s390x: [liftoff] implement stack frame handling
Change-Id: I68ef1a97ac857106e014d561be3d7e845ec9fbdc Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2618280 Reviewed-by: Milad Fa <mfarazma@redhat.com> Commit-Queue: Junliang Yan <junyan@redhat.com> Cr-Commit-Position: refs/heads/master@{#71983}
This commit is contained in:
parent
740d94be0f
commit
2651820e68
@ -1358,6 +1358,15 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
|
|||||||
public:
|
public:
|
||||||
byte* buffer_pos() const { return buffer_start_; }
|
byte* buffer_pos() const { return buffer_start_; }
|
||||||
|
|
||||||
|
|
||||||
|
// Code generation
|
||||||
|
// The relocation writer's position is at least kGap bytes below the end of
|
||||||
|
// the generated instructions. This is so that multi-instruction sequences do
|
||||||
|
// not have to check for overflow. The same is true for writes of large
|
||||||
|
// relocation info entries.
|
||||||
|
static constexpr int kGap = 32;
|
||||||
|
STATIC_ASSERT(AssemblerBase::kMinimalBufferSize >= 2 * kGap);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int buffer_space() const { return reloc_info_writer.pos() - pc_; }
|
int buffer_space() const { return reloc_info_writer.pos() - pc_; }
|
||||||
|
|
||||||
@ -1375,14 +1384,6 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
|
|||||||
// Avoid overflows for displacements etc.
|
// Avoid overflows for displacements etc.
|
||||||
static const int kMaximalBufferSize = 512 * MB;
|
static const int kMaximalBufferSize = 512 * MB;
|
||||||
|
|
||||||
// Code generation
|
|
||||||
// The relocation writer's position is at least kGap bytes below the end of
|
|
||||||
// the generated instructions. This is so that multi-instruction sequences do
|
|
||||||
// not have to check for overflow. The same is true for writes of large
|
|
||||||
// relocation info entries.
|
|
||||||
static constexpr int kGap = 32;
|
|
||||||
STATIC_ASSERT(AssemblerBase::kMinimalBufferSize >= 2 * kGap);
|
|
||||||
|
|
||||||
// Relocation info generation
|
// Relocation info generation
|
||||||
// Each relocation is encoded as a variable size value
|
// Each relocation is encoded as a variable size value
|
||||||
static constexpr int kMaxRelocSize = RelocInfoWriter::kMaxSize;
|
static constexpr int kMaxRelocSize = RelocInfoWriter::kMaxSize;
|
||||||
|
@ -92,8 +92,9 @@ inline MemOperand GetInstanceOperand() { return GetStackSlot(kInstanceOffset); }
|
|||||||
} // namespace liftoff
|
} // namespace liftoff
|
||||||
|
|
||||||
int LiftoffAssembler::PrepareStackFrame() {
|
int LiftoffAssembler::PrepareStackFrame() {
|
||||||
bailout(kUnsupportedArchitecture, "PrepareStackFrame");
|
int offset = pc_offset();
|
||||||
return 0;
|
lay(sp, MemOperand(sp));
|
||||||
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LiftoffAssembler::PrepareTailCall(int num_callee_stack_params,
|
void LiftoffAssembler::PrepareTailCall(int num_callee_stack_params,
|
||||||
@ -104,12 +105,29 @@ void LiftoffAssembler::PrepareTailCall(int num_callee_stack_params,
|
|||||||
void LiftoffAssembler::AlignFrameSize() {}
|
void LiftoffAssembler::AlignFrameSize() {}
|
||||||
|
|
||||||
void LiftoffAssembler::PatchPrepareStackFrame(int offset) {
|
void LiftoffAssembler::PatchPrepareStackFrame(int offset) {
|
||||||
bailout(kUnsupportedArchitecture, "PatchPrepareStackFrame");
|
int frame_size = GetTotalFrameSize() - kSystemPointerSize;
|
||||||
|
|
||||||
|
constexpr int LayInstrSize = 6;
|
||||||
|
|
||||||
|
#ifdef USE_SIMULATOR
|
||||||
|
// When using the simulator, deal with Liftoff which allocates the stack
|
||||||
|
// before checking it.
|
||||||
|
// TODO(arm): Remove this when the stack check mechanism will be updated.
|
||||||
|
if (frame_size > KB / 2) {
|
||||||
|
bailout(kOtherReason,
|
||||||
|
"Stack limited to 512 bytes to avoid a bug in StackCheck");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
Assembler patching_assembler(
|
||||||
|
AssemblerOptions{},
|
||||||
|
ExternalAssemblerBuffer(buffer_start_ + offset, LayInstrSize + kGap));
|
||||||
|
patching_assembler.lay(sp, MemOperand(sp, -frame_size));
|
||||||
}
|
}
|
||||||
|
|
||||||
void LiftoffAssembler::FinishCode() {}
|
void LiftoffAssembler::FinishCode() {}
|
||||||
|
|
||||||
void LiftoffAssembler::AbortCompilation() {}
|
void LiftoffAssembler::AbortCompilation() { AbortedCodeGeneration(); }
|
||||||
|
|
||||||
// static
|
// static
|
||||||
constexpr int LiftoffAssembler::StaticStackFrameSize() {
|
constexpr int LiftoffAssembler::StaticStackFrameSize() {
|
||||||
|
Loading…
Reference in New Issue
Block a user