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:
Junliang Yan 2021-01-08 11:05:02 -05:00 committed by Commit Bot
parent 740d94be0f
commit 2651820e68
2 changed files with 31 additions and 12 deletions

View File

@ -1358,6 +1358,15 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
public:
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:
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.
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
// Each relocation is encoded as a variable size value
static constexpr int kMaxRelocSize = RelocInfoWriter::kMaxSize;

View File

@ -92,8 +92,9 @@ inline MemOperand GetInstanceOperand() { return GetStackSlot(kInstanceOffset); }
} // namespace liftoff
int LiftoffAssembler::PrepareStackFrame() {
bailout(kUnsupportedArchitecture, "PrepareStackFrame");
return 0;
int offset = pc_offset();
lay(sp, MemOperand(sp));
return offset;
}
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::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::AbortCompilation() {}
void LiftoffAssembler::AbortCompilation() { AbortedCodeGeneration(); }
// static
constexpr int LiftoffAssembler::StaticStackFrameSize() {