[wasm] Use a consistent limit for large frames
For large frames we are executing a special stack check that checks the remaining stack space before allocating the new frame. Different platforms used different limits for the frame size so far. Liftoff already uses 4KB everywhere, hence use the same limit also for TurboFan. Drive-by: Remove an outdated and misleading comment, and other minor simplification. R=ahaas@chromium.org Bug: v8:12017 Change-Id: I6548b2293ec255349bf4e08c26fd05b7e0df0497 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3063501 Reviewed-by: Andreas Haas <ahaas@chromium.org> Reviewed-by: Georg Neis <neis@chromium.org> Commit-Queue: Clemens Backes <clemensb@chromium.org> Cr-Commit-Position: refs/heads/master@{#76034}
This commit is contained in:
parent
a876146449
commit
f7de8c8062
@ -3814,7 +3814,7 @@ void CodeGenerator::AssembleConstructFrame() {
|
||||
if (required_slots > 0) {
|
||||
DCHECK(frame_access_state()->has_frame());
|
||||
#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
|
||||
// overflow check before we construct the frame. Otherwise we may not
|
||||
// have enough space on the stack to call the runtime for the stack
|
||||
@ -3824,7 +3824,7 @@ void CodeGenerator::AssembleConstructFrame() {
|
||||
// If the frame is bigger than the stack, we throw the stack overflow
|
||||
// exception unconditionally. Thereby we can avoid the integer overflow
|
||||
// check in the condition code.
|
||||
if ((required_slots * kSystemPointerSize) < (FLAG_stack_size * 1024)) {
|
||||
if (required_slots * kSystemPointerSize < FLAG_stack_size * KB) {
|
||||
UseScratchRegisterScope temps(tasm());
|
||||
Register scratch = temps.Acquire();
|
||||
__ ldr(scratch, FieldMemOperand(
|
||||
@ -3837,12 +3837,11 @@ void CodeGenerator::AssembleConstructFrame() {
|
||||
}
|
||||
|
||||
__ 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());
|
||||
RecordSafepoint(reference_map);
|
||||
if (FLAG_debug_code) {
|
||||
__ stop();
|
||||
}
|
||||
if (FLAG_debug_code) __ stop();
|
||||
|
||||
__ bind(&done);
|
||||
}
|
||||
|
@ -3139,7 +3139,7 @@ void CodeGenerator::AssembleConstructFrame() {
|
||||
}
|
||||
|
||||
#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
|
||||
// overflow check before we construct the frame. Otherwise we may not
|
||||
// have enough space on the stack to call the runtime for the stack
|
||||
@ -3148,7 +3148,7 @@ void CodeGenerator::AssembleConstructFrame() {
|
||||
// If the frame is bigger than the stack, we throw the stack overflow
|
||||
// exception unconditionally. Thereby we can avoid the integer overflow
|
||||
// check in the condition code.
|
||||
if (required_slots * kSystemPointerSize < FLAG_stack_size * 1024) {
|
||||
if (required_slots * kSystemPointerSize < FLAG_stack_size * KB) {
|
||||
UseScratchRegisterScope scope(tasm());
|
||||
Register scratch = scope.AcquireX();
|
||||
__ Ldr(scratch, FieldMemOperand(
|
||||
@ -3170,12 +3170,11 @@ void CodeGenerator::AssembleConstructFrame() {
|
||||
}
|
||||
|
||||
__ 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());
|
||||
RecordSafepoint(reference_map);
|
||||
if (FLAG_debug_code) {
|
||||
__ Brk(0);
|
||||
}
|
||||
if (FLAG_debug_code) __ Brk(0);
|
||||
__ Bind(&done);
|
||||
}
|
||||
#endif // V8_ENABLE_WEBASSEMBLY
|
||||
|
@ -4537,7 +4537,7 @@ void CodeGenerator::AssembleConstructFrame() {
|
||||
if (required_slots > 0) {
|
||||
DCHECK(frame_access_state()->has_frame());
|
||||
#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
|
||||
// overflow check before we construct the frame. Otherwise we may not
|
||||
// have enough space on the stack to call the runtime for the stack
|
||||
@ -4547,7 +4547,7 @@ void CodeGenerator::AssembleConstructFrame() {
|
||||
// If the frame is bigger than the stack, we throw the stack overflow
|
||||
// exception unconditionally. Thereby we can avoid the integer overflow
|
||||
// check in the condition code.
|
||||
if (required_slots * kSystemPointerSize < FLAG_stack_size * 1024) {
|
||||
if (required_slots * kSystemPointerSize < FLAG_stack_size * KB) {
|
||||
Register scratch = esi;
|
||||
__ push(scratch);
|
||||
__ mov(scratch,
|
||||
@ -4562,6 +4562,8 @@ void CodeGenerator::AssembleConstructFrame() {
|
||||
|
||||
__ wasm_call(wasm::WasmCode::kWasmStackOverflow,
|
||||
RelocInfo::WASM_STUB_CALL);
|
||||
// The call does not return, hence we can ignore any references and just
|
||||
// define an empty safepoint.
|
||||
ReferenceMap* reference_map = zone()->New<ReferenceMap>(zone());
|
||||
RecordSafepoint(reference_map);
|
||||
__ AssertUnreachable(AbortReason::kUnexpectedReturnFromWasmTrap);
|
||||
|
@ -4732,7 +4732,7 @@ void CodeGenerator::AssembleConstructFrame() {
|
||||
if (required_slots > 0) {
|
||||
DCHECK(frame_access_state()->has_frame());
|
||||
#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
|
||||
// overflow check before we construct the frame. Otherwise we may not
|
||||
// have enough space on the stack to call the runtime for the stack
|
||||
@ -4742,7 +4742,7 @@ void CodeGenerator::AssembleConstructFrame() {
|
||||
// If the frame is bigger than the stack, we throw the stack overflow
|
||||
// exception unconditionally. Thereby we can avoid the integer overflow
|
||||
// check in the condition code.
|
||||
if (required_slots * kSystemPointerSize < FLAG_stack_size * 1024) {
|
||||
if (required_slots * kSystemPointerSize < FLAG_stack_size * KB) {
|
||||
__ movq(kScratchRegister,
|
||||
FieldOperand(kWasmInstanceRegister,
|
||||
WasmInstanceObject::kRealStackLimitAddressOffset));
|
||||
@ -4755,6 +4755,8 @@ void CodeGenerator::AssembleConstructFrame() {
|
||||
|
||||
__ near_call(wasm::WasmCode::kWasmStackOverflow,
|
||||
RelocInfo::WASM_STUB_CALL);
|
||||
// The call does not return, hence we can ignore any references and just
|
||||
// define an empty safepoint.
|
||||
ReferenceMap* reference_map = zone()->New<ReferenceMap>(zone());
|
||||
RecordSafepoint(reference_map);
|
||||
__ AssertUnreachable(AbortReason::kUnexpectedReturnFromWasmTrap);
|
||||
|
Loading…
Reference in New Issue
Block a user