Commit 007aec55 authored by Junliang Yan's avatar Junliang Yan Committed by V8 LUCI CQ

ppc: [liftoff] implement PrepareStackFrame

Change-Id: Iffed72ddf703ea868a959c15f65547c34f976200
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3077060Reviewed-by: 's avatarMilad Fa <mfarazma@redhat.com>
Commit-Queue: Junliang Yan <junyan@redhat.com>
Cr-Commit-Position: refs/heads/master@{#76140}
parent dcc6bd76
......@@ -99,8 +99,9 @@ inline constexpr bool UseSignedOp(LiftoffCondition liftoff_cond) {
} // namespace liftoff
int LiftoffAssembler::PrepareStackFrame() {
bailout(kUnsupportedArchitecture, "PrepareStackFrame");
return 0;
int offset = pc_offset();
addi(sp, sp, Operand::Zero());
return offset;
}
void LiftoffAssembler::PrepareTailCall(int num_callee_stack_params,
......@@ -112,7 +113,26 @@ void LiftoffAssembler::AlignFrameSize() {}
void LiftoffAssembler::PatchPrepareStackFrame(int offset,
SafepointTableBuilder*) {
bailout(kUnsupportedArchitecture, "PatchPrepareStackFrame");
int frame_size = GetTotalFrameSize() - 2 * kSystemPointerSize;
#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
if (!is_int16(-frame_size)) {
bailout(kOtherReason, "PPC subi overflow");
return;
}
Assembler patching_assembler(
AssemblerOptions{},
ExternalAssemblerBuffer(buffer_start_ + offset, kInstrSize + kGap));
patching_assembler.addi(sp, sp, Operand(-frame_size));
}
void LiftoffAssembler::FinishCode() { EmitConstantPool(); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment