Commit 5404eaf1 authored by Liu Yu's avatar Liu Yu Committed by V8 LUCI CQ

[mips][liftoff] Push the instance as part of frame construction

Port 593fbb69

Bug: v8:12017
Change-Id: I0776820d0ab51950028da347d9d7d08acfb30386
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3058652
Auto-Submit: Liu yu <liuyu@loongson.cn>
Reviewed-by: 's avatarZhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Cr-Commit-Position: refs/heads/master@{#75955}
parent 472e40b3
...@@ -4844,6 +4844,9 @@ void TurboAssembler::EnterFrame(StackFrame::Type type) { ...@@ -4844,6 +4844,9 @@ void TurboAssembler::EnterFrame(StackFrame::Type type) {
li(kScratchReg, Operand(StackFrame::TypeToMarker(type))); li(kScratchReg, Operand(StackFrame::TypeToMarker(type)));
Push(kScratchReg); Push(kScratchReg);
} }
#if V8_ENABLE_WEBASSEMBLY
if (type == StackFrame::WASM) Push(kWasmInstanceRegister);
#endif // V8_ENABLE_WEBASSEMBLY
} }
void TurboAssembler::LeaveFrame(StackFrame::Type type) { void TurboAssembler::LeaveFrame(StackFrame::Type type) {
......
...@@ -5373,6 +5373,9 @@ void TurboAssembler::EnterFrame(StackFrame::Type type) { ...@@ -5373,6 +5373,9 @@ void TurboAssembler::EnterFrame(StackFrame::Type type) {
li(kScratchReg, Operand(StackFrame::TypeToMarker(type))); li(kScratchReg, Operand(StackFrame::TypeToMarker(type)));
Push(kScratchReg); Push(kScratchReg);
} }
#if V8_ENABLE_WEBASSEMBLY
if (type == StackFrame::WASM) Push(kWasmInstanceRegister);
#endif // V8_ENABLE_WEBASSEMBLY
} }
void TurboAssembler::LeaveFrame(StackFrame::Type type) { void TurboAssembler::LeaveFrame(StackFrame::Type type) {
......
...@@ -344,10 +344,10 @@ void LiftoffAssembler::AlignFrameSize() {} ...@@ -344,10 +344,10 @@ void LiftoffAssembler::AlignFrameSize() {}
void LiftoffAssembler::PatchPrepareStackFrame( void LiftoffAssembler::PatchPrepareStackFrame(
int offset, SafepointTableBuilder* safepoint_table_builder) { int offset, SafepointTableBuilder* safepoint_table_builder) {
// The frame_size includes the frame marker. The frame marker has already been // The frame_size includes the frame marker and the instance slot. Both are
// pushed on the stack though, so we don't need to allocate memory for it // pushed as part of frame construction, so we don't need to allocate memory
// anymore. // for them anymore.
int frame_size = GetTotalFrameSize() - kSystemPointerSize; int frame_size = GetTotalFrameSize() - 2 * kSystemPointerSize;
// We can't run out of space, just pass anything big enough to not cause the // We can't run out of space, just pass anything big enough to not cause the
// assembler to try to grow the buffer. // assembler to try to grow the buffer.
...@@ -395,9 +395,6 @@ void LiftoffAssembler::PatchPrepareStackFrame( ...@@ -395,9 +395,6 @@ void LiftoffAssembler::PatchPrepareStackFrame(
Branch(&continuation, uge, sp, Operand(stack_limit)); Branch(&continuation, uge, sp, Operand(stack_limit));
} }
// The instance has not been written to the frame yet (because no frame space
// has been allocated), but the runtime call expects it. Hence push it now.
Push(kWasmInstanceRegister);
Call(wasm::WasmCode::kWasmStackOverflow, RelocInfo::WASM_STUB_CALL); Call(wasm::WasmCode::kWasmStackOverflow, RelocInfo::WASM_STUB_CALL);
// The call will not return; just define an empty safepoint. // The call will not return; just define an empty safepoint.
safepoint_table_builder->DefineSafepoint(this); safepoint_table_builder->DefineSafepoint(this);
......
...@@ -331,10 +331,10 @@ void LiftoffAssembler::AlignFrameSize() {} ...@@ -331,10 +331,10 @@ void LiftoffAssembler::AlignFrameSize() {}
void LiftoffAssembler::PatchPrepareStackFrame( void LiftoffAssembler::PatchPrepareStackFrame(
int offset, SafepointTableBuilder* safepoint_table_builder) { int offset, SafepointTableBuilder* safepoint_table_builder) {
// The frame_size includes the frame marker. The frame marker has already been // The frame_size includes the frame marker and the instance slot. Both are
// pushed on the stack though, so we don't need to allocate memory for it // pushed as part of frame construction, so we don't need to allocate memory
// anymore. // for them anymore.
int frame_size = GetTotalFrameSize() - kSystemPointerSize; int frame_size = GetTotalFrameSize() - 2 * kSystemPointerSize;
// We can't run out of space, just pass anything big enough to not cause the // We can't run out of space, just pass anything big enough to not cause the
// assembler to try to grow the buffer. // assembler to try to grow the buffer.
...@@ -382,9 +382,6 @@ void LiftoffAssembler::PatchPrepareStackFrame( ...@@ -382,9 +382,6 @@ void LiftoffAssembler::PatchPrepareStackFrame(
Branch(&continuation, uge, sp, Operand(stack_limit)); Branch(&continuation, uge, sp, Operand(stack_limit));
} }
// The instance has not been written to the frame yet (because no frame space
// has been allocated), but the runtime call expects it. Hence push it now.
Push(kWasmInstanceRegister);
Call(wasm::WasmCode::kWasmStackOverflow, RelocInfo::WASM_STUB_CALL); Call(wasm::WasmCode::kWasmStackOverflow, RelocInfo::WASM_STUB_CALL);
// The call will not return; just define an empty safepoint. // The call will not return; just define an empty safepoint.
safepoint_table_builder->DefineSafepoint(this); safepoint_table_builder->DefineSafepoint(this);
......
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