Commit 821e02d8 authored by Liu Yu's avatar Liu Yu Committed by V8 LUCI CQ

[mips][wasm] Use a consistent limit for large frames

Port f7de8c80

Bug: v8:12017
Change-Id: I5099254936e2402d4dcf19a52c8ca8726d07f621
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3070384
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@{#76106}
parent ec7b99d5
...@@ -4139,7 +4139,7 @@ void CodeGenerator::AssembleConstructFrame() { ...@@ -4139,7 +4139,7 @@ void CodeGenerator::AssembleConstructFrame() {
if (required_slots > 0) { if (required_slots > 0) {
DCHECK(frame_access_state()->has_frame()); DCHECK(frame_access_state()->has_frame());
#if V8_ENABLE_WEBASSEMBLY #if V8_ENABLE_WEBASSEMBLY
if (info()->IsWasm() && required_slots > 128) { if (info()->IsWasm() && required_slots * kSystemPointerSize > 4 * KB) {
// For WebAssembly functions with big frames we have to do the stack // For WebAssembly functions with big frames we have to do the stack
// overflow check before we construct the frame. Otherwise we may not // overflow check before we construct the frame. Otherwise we may not
// have enough space on the stack to call the runtime for the stack // have enough space on the stack to call the runtime for the stack
...@@ -4149,7 +4149,7 @@ void CodeGenerator::AssembleConstructFrame() { ...@@ -4149,7 +4149,7 @@ void CodeGenerator::AssembleConstructFrame() {
// If the frame is bigger than the stack, we throw the stack overflow // If the frame is bigger than the stack, we throw the stack overflow
// exception unconditionally. Thereby we can avoid the integer overflow // exception unconditionally. Thereby we can avoid the integer overflow
// check in the condition code. // check in the condition code.
if ((required_slots * kSystemPointerSize) < (FLAG_stack_size * 1024)) { if (required_slots * kSystemPointerSize < FLAG_stack_size * KB) {
__ Lw( __ Lw(
kScratchReg, kScratchReg,
FieldMemOperand(kWasmInstanceRegister, FieldMemOperand(kWasmInstanceRegister,
...@@ -4161,12 +4161,11 @@ void CodeGenerator::AssembleConstructFrame() { ...@@ -4161,12 +4161,11 @@ void CodeGenerator::AssembleConstructFrame() {
} }
__ Call(wasm::WasmCode::kWasmStackOverflow, RelocInfo::WASM_STUB_CALL); __ Call(wasm::WasmCode::kWasmStackOverflow, RelocInfo::WASM_STUB_CALL);
// We come from WebAssembly, there are no references for the GC. // The call does not return, hence we can ignore any references and just
// define an empty safepoint.
ReferenceMap* reference_map = zone()->New<ReferenceMap>(zone()); ReferenceMap* reference_map = zone()->New<ReferenceMap>(zone());
RecordSafepoint(reference_map); RecordSafepoint(reference_map);
if (FLAG_debug_code) { if (FLAG_debug_code) __ stop();
__ stop();
}
__ bind(&done); __ bind(&done);
} }
......
...@@ -4349,7 +4349,7 @@ void CodeGenerator::AssembleConstructFrame() { ...@@ -4349,7 +4349,7 @@ void CodeGenerator::AssembleConstructFrame() {
if (required_slots > 0) { if (required_slots > 0) {
DCHECK(frame_access_state()->has_frame()); DCHECK(frame_access_state()->has_frame());
#if V8_ENABLE_WEBASSEMBLY #if V8_ENABLE_WEBASSEMBLY
if (info()->IsWasm() && required_slots > 128) { if (info()->IsWasm() && required_slots * kSystemPointerSize > 4 * KB) {
// For WebAssembly functions with big frames we have to do the stack // For WebAssembly functions with big frames we have to do the stack
// overflow check before we construct the frame. Otherwise we may not // overflow check before we construct the frame. Otherwise we may not
// have enough space on the stack to call the runtime for the stack // have enough space on the stack to call the runtime for the stack
...@@ -4359,7 +4359,7 @@ void CodeGenerator::AssembleConstructFrame() { ...@@ -4359,7 +4359,7 @@ void CodeGenerator::AssembleConstructFrame() {
// If the frame is bigger than the stack, we throw the stack overflow // If the frame is bigger than the stack, we throw the stack overflow
// exception unconditionally. Thereby we can avoid the integer overflow // exception unconditionally. Thereby we can avoid the integer overflow
// check in the condition code. // check in the condition code.
if ((required_slots * kSystemPointerSize) < (FLAG_stack_size * 1024)) { if (required_slots * kSystemPointerSize < FLAG_stack_size * KB) {
__ Ld( __ Ld(
kScratchReg, kScratchReg,
FieldMemOperand(kWasmInstanceRegister, FieldMemOperand(kWasmInstanceRegister,
...@@ -4371,12 +4371,11 @@ void CodeGenerator::AssembleConstructFrame() { ...@@ -4371,12 +4371,11 @@ void CodeGenerator::AssembleConstructFrame() {
} }
__ Call(wasm::WasmCode::kWasmStackOverflow, RelocInfo::WASM_STUB_CALL); __ Call(wasm::WasmCode::kWasmStackOverflow, RelocInfo::WASM_STUB_CALL);
// We come from WebAssembly, there are no references for the GC. // The call does not return, hence we can ignore any references and just
// define an empty safepoint.
ReferenceMap* reference_map = zone()->New<ReferenceMap>(zone()); ReferenceMap* reference_map = zone()->New<ReferenceMap>(zone());
RecordSafepoint(reference_map); RecordSafepoint(reference_map);
if (FLAG_debug_code) { if (FLAG_debug_code) __ stop();
__ stop();
}
__ bind(&done); __ bind(&done);
} }
......
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