diff --git a/src/compiler/backend/arm/code-generator-arm.cc b/src/compiler/backend/arm/code-generator-arm.cc index 85960052a1..a1e7d8caea 100644 --- a/src/compiler/backend/arm/code-generator-arm.cc +++ b/src/compiler/backend/arm/code-generator-arm.cc @@ -3049,8 +3049,8 @@ void CodeGenerator::AssembleConstructFrame() { unwinding_info_writer_.MarkFrameConstructed(__ pc_offset()); } - int shrink_slots = frame()->GetTotalFrameSlotCount() - - call_descriptor->CalculateFixedFrameSize(); + int required_slots = frame()->GetTotalFrameSlotCount() - + call_descriptor->CalculateFixedFrameSize(); if (info()->is_osr()) { // TurboFan OSR-compiled functions cannot be entered directly. @@ -3062,16 +3062,16 @@ void CodeGenerator::AssembleConstructFrame() { // remaining stack slots. if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --"); osr_pc_offset_ = __ pc_offset(); - shrink_slots -= osr_helper()->UnoptimizedFrameSlots(); + required_slots -= osr_helper()->UnoptimizedFrameSlots(); ResetSpeculationPoison(); } const RegList saves = call_descriptor->CalleeSavedRegisters(); const RegList saves_fp = call_descriptor->CalleeSavedFPRegisters(); - if (shrink_slots > 0) { + if (required_slots > 0) { DCHECK(frame_access_state()->has_frame()); - if (info()->IsWasm() && shrink_slots > 128) { + if (info()->IsWasm() && required_slots > 128) { // 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 @@ -3081,14 +3081,14 @@ 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 ((shrink_slots * kSystemPointerSize) < (FLAG_stack_size * 1024)) { + if ((required_slots * kSystemPointerSize) < (FLAG_stack_size * 1024)) { UseScratchRegisterScope temps(tasm()); Register scratch = temps.Acquire(); __ ldr(scratch, FieldMemOperand( kWasmInstanceRegister, WasmInstanceObject::kRealStackLimitAddressOffset)); __ ldr(scratch, MemOperand(scratch)); - __ add(scratch, scratch, Operand(shrink_slots * kSystemPointerSize)); + __ add(scratch, scratch, Operand(required_slots * kSystemPointerSize)); __ cmp(sp, scratch); __ b(cs, &done); } @@ -3109,11 +3109,11 @@ void CodeGenerator::AssembleConstructFrame() { } // Skip callee-saved and return slots, which are pushed below. - shrink_slots -= base::bits::CountPopulation(saves); - shrink_slots -= frame()->GetReturnSlotCount(); - shrink_slots -= 2 * base::bits::CountPopulation(saves_fp); - if (shrink_slots > 0) { - __ sub(sp, sp, Operand(shrink_slots * kSystemPointerSize)); + required_slots -= base::bits::CountPopulation(saves); + required_slots -= frame()->GetReturnSlotCount(); + required_slots -= 2 * base::bits::CountPopulation(saves_fp); + if (required_slots > 0) { + __ sub(sp, sp, Operand(required_slots * kSystemPointerSize)); } } diff --git a/src/compiler/backend/arm64/code-generator-arm64.cc b/src/compiler/backend/arm64/code-generator-arm64.cc index 6a12799b90..6b5bf0cbf4 100644 --- a/src/compiler/backend/arm64/code-generator-arm64.cc +++ b/src/compiler/backend/arm64/code-generator-arm64.cc @@ -2396,8 +2396,8 @@ void CodeGenerator::AssembleConstructFrame() { // The frame has been previously padded in CodeGenerator::FinishFrame(). DCHECK_EQ(frame()->GetTotalFrameSlotCount() % 2, 0); - int shrink_slots = frame()->GetTotalFrameSlotCount() - - call_descriptor->CalculateFixedFrameSize(); + int required_slots = frame()->GetTotalFrameSlotCount() - + call_descriptor->CalculateFixedFrameSize(); CPURegList saves = CPURegList(CPURegister::kRegister, kXRegSizeInBits, call_descriptor->CalleeSavedRegisters()); @@ -2428,11 +2428,11 @@ void CodeGenerator::AssembleConstructFrame() { // to allocate the remaining stack slots. if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --"); osr_pc_offset_ = __ pc_offset(); - shrink_slots -= osr_helper()->UnoptimizedFrameSlots(); + required_slots -= osr_helper()->UnoptimizedFrameSlots(); ResetSpeculationPoison(); } - if (info()->IsWasm() && shrink_slots > 128) { + if (info()->IsWasm() && required_slots > 128) { // 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 @@ -2441,14 +2441,14 @@ 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 (shrink_slots * kSystemPointerSize < FLAG_stack_size * 1024) { + if (required_slots * kSystemPointerSize < FLAG_stack_size * 1024) { UseScratchRegisterScope scope(tasm()); Register scratch = scope.AcquireX(); __ Ldr(scratch, FieldMemOperand( kWasmInstanceRegister, WasmInstanceObject::kRealStackLimitAddressOffset)); __ Ldr(scratch, MemOperand(scratch)); - __ Add(scratch, scratch, shrink_slots * kSystemPointerSize); + __ Add(scratch, scratch, required_slots * kSystemPointerSize); __ Cmp(sp, scratch); __ B(hs, &done); } @@ -2479,9 +2479,9 @@ void CodeGenerator::AssembleConstructFrame() { } // Skip callee-saved slots, which are pushed below. - shrink_slots -= saves.Count(); - shrink_slots -= saves_fp.Count(); - shrink_slots -= returns; + required_slots -= saves.Count(); + required_slots -= saves_fp.Count(); + required_slots -= returns; // Build remainder of frame, including accounting for and filling-in // frame-specific header information, i.e. claiming the extra slot that @@ -2490,16 +2490,17 @@ void CodeGenerator::AssembleConstructFrame() { switch (call_descriptor->kind()) { case CallDescriptor::kCallJSFunction: if (call_descriptor->PushArgumentCount()) { - __ Claim(shrink_slots + 1); // Claim extra slot for argc. + __ Claim(required_slots + 1); // Claim extra slot for argc. __ Str(kJavaScriptCallArgCountRegister, MemOperand(fp, OptimizedBuiltinFrameConstants::kArgCOffset)); } else { - __ Claim(shrink_slots); + __ Claim(required_slots); } break; case CallDescriptor::kCallCodeObject: { UseScratchRegisterScope temps(tasm()); - __ Claim(shrink_slots + 1); // Claim extra slot for frame type marker. + __ Claim(required_slots + + 1); // Claim extra slot for frame type marker. Register scratch = temps.AcquireX(); __ Mov(scratch, StackFrame::TypeToMarker(info()->GetOutputStackFrameType())); @@ -2507,7 +2508,8 @@ void CodeGenerator::AssembleConstructFrame() { } break; case CallDescriptor::kCallWasmFunction: { UseScratchRegisterScope temps(tasm()); - __ Claim(shrink_slots + 2); // Claim extra slots for marker + instance. + __ Claim(required_slots + + 2); // Claim extra slots for marker + instance. Register scratch = temps.AcquireX(); __ Mov(scratch, StackFrame::TypeToMarker(info()->GetOutputStackFrameType())); @@ -2521,7 +2523,8 @@ void CodeGenerator::AssembleConstructFrame() { FieldMemOperand(kWasmInstanceRegister, Tuple2::kValue2Offset)); __ ldr(kWasmInstanceRegister, FieldMemOperand(kWasmInstanceRegister, Tuple2::kValue1Offset)); - __ Claim(shrink_slots + 2); // Claim extra slots for marker + instance. + __ Claim(required_slots + + 2); // Claim extra slots for marker + instance. Register scratch = temps.AcquireX(); __ Mov(scratch, StackFrame::TypeToMarker(info()->GetOutputStackFrameType())); @@ -2530,7 +2533,7 @@ void CodeGenerator::AssembleConstructFrame() { MemOperand(fp, WasmCompiledFrameConstants::kWasmInstanceOffset)); } break; case CallDescriptor::kCallAddress: - __ Claim(shrink_slots); + __ Claim(required_slots); break; default: UNREACHABLE(); diff --git a/src/compiler/backend/ia32/code-generator-ia32.cc b/src/compiler/backend/ia32/code-generator-ia32.cc index 2e30d8ab48..b5184c3245 100644 --- a/src/compiler/backend/ia32/code-generator-ia32.cc +++ b/src/compiler/backend/ia32/code-generator-ia32.cc @@ -4186,8 +4186,8 @@ void CodeGenerator::AssembleConstructFrame() { } } - int shrink_slots = frame()->GetTotalFrameSlotCount() - - call_descriptor->CalculateFixedFrameSize(); + int required_slots = frame()->GetTotalFrameSlotCount() - + call_descriptor->CalculateFixedFrameSize(); if (info()->is_osr()) { // TurboFan OSR-compiled functions cannot be entered directly. @@ -4199,13 +4199,13 @@ void CodeGenerator::AssembleConstructFrame() { // remaining stack slots. if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --"); osr_pc_offset_ = __ pc_offset(); - shrink_slots -= osr_helper()->UnoptimizedFrameSlots(); + required_slots -= osr_helper()->UnoptimizedFrameSlots(); } const RegList saves = call_descriptor->CalleeSavedRegisters(); - if (shrink_slots > 0) { + if (required_slots > 0) { DCHECK(frame_access_state()->has_frame()); - if (info()->IsWasm() && shrink_slots > 128) { + if (info()->IsWasm() && required_slots > 128) { // 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 @@ -4215,14 +4215,14 @@ 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 (shrink_slots * kSystemPointerSize < FLAG_stack_size * 1024) { + if (required_slots * kSystemPointerSize < FLAG_stack_size * 1024) { Register scratch = esi; __ push(scratch); __ mov(scratch, FieldOperand(kWasmInstanceRegister, WasmInstanceObject::kRealStackLimitAddressOffset)); __ mov(scratch, Operand(scratch, 0)); - __ add(scratch, Immediate(shrink_slots * kSystemPointerSize)); + __ add(scratch, Immediate(required_slots * kSystemPointerSize)); __ cmp(esp, scratch); __ pop(scratch); __ j(above_equal, &done); @@ -4239,10 +4239,10 @@ void CodeGenerator::AssembleConstructFrame() { } // Skip callee-saved and return slots, which are created below. - shrink_slots -= base::bits::CountPopulation(saves); - shrink_slots -= frame()->GetReturnSlotCount(); - if (shrink_slots > 0) { - __ sub(esp, Immediate(shrink_slots * kSystemPointerSize)); + required_slots -= base::bits::CountPopulation(saves); + required_slots -= frame()->GetReturnSlotCount(); + if (required_slots > 0) { + __ sub(esp, Immediate(required_slots * kSystemPointerSize)); } } diff --git a/src/compiler/backend/mips/code-generator-mips.cc b/src/compiler/backend/mips/code-generator-mips.cc index a18af5697e..dac6692fb8 100644 --- a/src/compiler/backend/mips/code-generator-mips.cc +++ b/src/compiler/backend/mips/code-generator-mips.cc @@ -3401,8 +3401,8 @@ void CodeGenerator::AssembleConstructFrame() { } } - int shrink_slots = frame()->GetTotalFrameSlotCount() - - call_descriptor->CalculateFixedFrameSize(); + int required_slots = frame()->GetTotalFrameSlotCount() - + call_descriptor->CalculateFixedFrameSize(); if (info()->is_osr()) { // TurboFan OSR-compiled functions cannot be entered directly. @@ -3414,7 +3414,7 @@ void CodeGenerator::AssembleConstructFrame() { // remaining stack slots. if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --"); osr_pc_offset_ = __ pc_offset(); - shrink_slots -= osr_helper()->UnoptimizedFrameSlots(); + required_slots -= osr_helper()->UnoptimizedFrameSlots(); ResetSpeculationPoison(); } @@ -3423,11 +3423,11 @@ void CodeGenerator::AssembleConstructFrame() { const int returns = frame()->GetReturnSlotCount(); // Skip callee-saved and return slots, which are pushed below. - shrink_slots -= base::bits::CountPopulation(saves); - shrink_slots -= 2 * base::bits::CountPopulation(saves_fpu); - shrink_slots -= returns; - if (shrink_slots > 0) { - __ Subu(sp, sp, Operand(shrink_slots * kSystemPointerSize)); + required_slots -= base::bits::CountPopulation(saves); + required_slots -= 2 * base::bits::CountPopulation(saves_fpu); + required_slots -= returns; + if (required_slots > 0) { + __ Subu(sp, sp, Operand(required_slots * kSystemPointerSize)); } // Save callee-saved FPU registers. diff --git a/src/compiler/backend/mips64/code-generator-mips64.cc b/src/compiler/backend/mips64/code-generator-mips64.cc index 95f42517e7..b989eab9d6 100644 --- a/src/compiler/backend/mips64/code-generator-mips64.cc +++ b/src/compiler/backend/mips64/code-generator-mips64.cc @@ -3560,8 +3560,8 @@ void CodeGenerator::AssembleConstructFrame() { } } - int shrink_slots = frame()->GetTotalFrameSlotCount() - - call_descriptor->CalculateFixedFrameSize(); + int required_slots = frame()->GetTotalFrameSlotCount() - + call_descriptor->CalculateFixedFrameSize(); if (info()->is_osr()) { // TurboFan OSR-compiled functions cannot be entered directly. @@ -3573,7 +3573,7 @@ void CodeGenerator::AssembleConstructFrame() { // remaining stack slots. if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --"); osr_pc_offset_ = __ pc_offset(); - shrink_slots -= osr_helper()->UnoptimizedFrameSlots(); + required_slots -= osr_helper()->UnoptimizedFrameSlots(); ResetSpeculationPoison(); } @@ -3582,11 +3582,11 @@ void CodeGenerator::AssembleConstructFrame() { const int returns = frame()->GetReturnSlotCount(); // Skip callee-saved and return slots, which are pushed below. - shrink_slots -= base::bits::CountPopulation(saves); - shrink_slots -= base::bits::CountPopulation(saves_fpu); - shrink_slots -= returns; - if (shrink_slots > 0) { - __ Dsubu(sp, sp, Operand(shrink_slots * kSystemPointerSize)); + required_slots -= base::bits::CountPopulation(saves); + required_slots -= base::bits::CountPopulation(saves_fpu); + required_slots -= returns; + if (required_slots > 0) { + __ Dsubu(sp, sp, Operand(required_slots * kSystemPointerSize)); } if (saves_fpu != 0) { diff --git a/src/compiler/backend/ppc/code-generator-ppc.cc b/src/compiler/backend/ppc/code-generator-ppc.cc index 4809e1ed49..23f853944e 100644 --- a/src/compiler/backend/ppc/code-generator-ppc.cc +++ b/src/compiler/backend/ppc/code-generator-ppc.cc @@ -2323,8 +2323,8 @@ void CodeGenerator::AssembleConstructFrame() { } } - int shrink_slots = frame()->GetTotalFrameSlotCount() - - call_descriptor->CalculateFixedFrameSize(); + int required_slots = frame()->GetTotalFrameSlotCount() - + call_descriptor->CalculateFixedFrameSize(); if (info()->is_osr()) { // TurboFan OSR-compiled functions cannot be entered directly. __ Abort(AbortReason::kShouldNotDirectlyEnterOsrFunction); @@ -2335,7 +2335,7 @@ void CodeGenerator::AssembleConstructFrame() { // remaining stack slots. if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --"); osr_pc_offset_ = __ pc_offset(); - shrink_slots -= osr_helper()->UnoptimizedFrameSlots(); + required_slots -= osr_helper()->UnoptimizedFrameSlots(); ResetSpeculationPoison(); } @@ -2345,8 +2345,8 @@ void CodeGenerator::AssembleConstructFrame() { ~kConstantPoolRegister.bit() : call_descriptor->CalleeSavedRegisters(); - if (shrink_slots > 0) { - if (info()->IsWasm() && shrink_slots > 128) { + if (required_slots > 0) { + if (info()->IsWasm() && required_slots > 128) { // 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 @@ -2356,14 +2356,14 @@ 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 ((shrink_slots * kSystemPointerSize) < (FLAG_stack_size * 1024)) { + if ((required_slots * kSystemPointerSize) < (FLAG_stack_size * 1024)) { Register scratch = ip; __ LoadP( scratch, FieldMemOperand(kWasmInstanceRegister, WasmInstanceObject::kRealStackLimitAddressOffset)); __ LoadP(scratch, MemOperand(scratch), r0); - __ Add(scratch, scratch, shrink_slots * kSystemPointerSize, r0); + __ Add(scratch, scratch, required_slots * kSystemPointerSize, r0); __ cmpl(sp, scratch); __ bge(&done); } @@ -2386,11 +2386,11 @@ void CodeGenerator::AssembleConstructFrame() { } // Skip callee-saved and return slots, which are pushed below. - shrink_slots -= base::bits::CountPopulation(saves); - shrink_slots -= frame()->GetReturnSlotCount(); - shrink_slots -= (kDoubleSize / kSystemPointerSize) * - base::bits::CountPopulation(saves_fp); - __ Add(sp, sp, -shrink_slots * kSystemPointerSize, r0); + required_slots -= base::bits::CountPopulation(saves); + required_slots -= frame()->GetReturnSlotCount(); + required_slots -= (kDoubleSize / kSystemPointerSize) * + base::bits::CountPopulation(saves_fp); + __ Add(sp, sp, -required_slots * kSystemPointerSize, r0); } // Save callee-saved Double registers. diff --git a/src/compiler/backend/s390/code-generator-s390.cc b/src/compiler/backend/s390/code-generator-s390.cc index b832124f1a..081030099b 100644 --- a/src/compiler/backend/s390/code-generator-s390.cc +++ b/src/compiler/backend/s390/code-generator-s390.cc @@ -3024,8 +3024,8 @@ void CodeGenerator::AssembleConstructFrame() { } } - int shrink_slots = frame()->GetTotalFrameSlotCount() - - call_descriptor->CalculateFixedFrameSize(); + int required_slots = frame()->GetTotalFrameSlotCount() - + call_descriptor->CalculateFixedFrameSize(); if (info()->is_osr()) { // TurboFan OSR-compiled functions cannot be entered directly. __ Abort(AbortReason::kShouldNotDirectlyEnterOsrFunction); @@ -3036,15 +3036,15 @@ void CodeGenerator::AssembleConstructFrame() { // remaining stack slots. if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --"); osr_pc_offset_ = __ pc_offset(); - shrink_slots -= osr_helper()->UnoptimizedFrameSlots(); + required_slots -= osr_helper()->UnoptimizedFrameSlots(); ResetSpeculationPoison(); } const RegList saves_fp = call_descriptor->CalleeSavedFPRegisters(); const RegList saves = call_descriptor->CalleeSavedRegisters(); - if (shrink_slots > 0) { - if (info()->IsWasm() && shrink_slots > 128) { + if (required_slots > 0) { + if (info()->IsWasm() && required_slots > 128) { // 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 @@ -3054,14 +3054,14 @@ 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 ((shrink_slots * kSystemPointerSize) < (FLAG_stack_size * 1024)) { + if ((required_slots * kSystemPointerSize) < (FLAG_stack_size * 1024)) { Register scratch = r1; __ LoadP( scratch, FieldMemOperand(kWasmInstanceRegister, WasmInstanceObject::kRealStackLimitAddressOffset)); __ LoadP(scratch, MemOperand(scratch)); - __ AddP(scratch, scratch, Operand(shrink_slots * kSystemPointerSize)); + __ AddP(scratch, scratch, Operand(required_slots * kSystemPointerSize)); __ CmpLogicalP(sp, scratch); __ bge(&done); } @@ -3082,11 +3082,11 @@ void CodeGenerator::AssembleConstructFrame() { } // Skip callee-saved and return slots, which are pushed below. - shrink_slots -= base::bits::CountPopulation(saves); - shrink_slots -= frame()->GetReturnSlotCount(); - shrink_slots -= (kDoubleSize / kSystemPointerSize) * - base::bits::CountPopulation(saves_fp); - __ lay(sp, MemOperand(sp, -shrink_slots * kSystemPointerSize)); + required_slots -= base::bits::CountPopulation(saves); + required_slots -= frame()->GetReturnSlotCount(); + required_slots -= (kDoubleSize / kSystemPointerSize) * + base::bits::CountPopulation(saves_fp); + __ lay(sp, MemOperand(sp, -required_slots * kSystemPointerSize)); } // Save callee-saved Double registers. diff --git a/src/compiler/backend/x64/code-generator-x64.cc b/src/compiler/backend/x64/code-generator-x64.cc index a041aa205a..3746958435 100644 --- a/src/compiler/backend/x64/code-generator-x64.cc +++ b/src/compiler/backend/x64/code-generator-x64.cc @@ -3678,8 +3678,8 @@ void CodeGenerator::AssembleConstructFrame() { unwinding_info_writer_.MarkFrameConstructed(pc_base); } - int shrink_slots = frame()->GetTotalFrameSlotCount() - - call_descriptor->CalculateFixedFrameSize(); + int required_slots = frame()->GetTotalFrameSlotCount() - + call_descriptor->CalculateFixedFrameSize(); if (info()->is_osr()) { // TurboFan OSR-compiled functions cannot be entered directly. @@ -3691,16 +3691,16 @@ void CodeGenerator::AssembleConstructFrame() { // remaining stack slots. if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --"); osr_pc_offset_ = __ pc_offset(); - shrink_slots -= static_cast(osr_helper()->UnoptimizedFrameSlots()); + required_slots -= static_cast(osr_helper()->UnoptimizedFrameSlots()); ResetSpeculationPoison(); } const RegList saves = call_descriptor->CalleeSavedRegisters(); const RegList saves_fp = call_descriptor->CalleeSavedFPRegisters(); - if (shrink_slots > 0) { + if (required_slots > 0) { DCHECK(frame_access_state()->has_frame()); - if (info()->IsWasm() && shrink_slots > 128) { + if (info()->IsWasm() && required_slots > 128) { // 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 @@ -3710,12 +3710,13 @@ 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 (shrink_slots * kSystemPointerSize < FLAG_stack_size * 1024) { + if (required_slots * kSystemPointerSize < FLAG_stack_size * 1024) { __ movq(kScratchRegister, FieldOperand(kWasmInstanceRegister, WasmInstanceObject::kRealStackLimitAddressOffset)); __ movq(kScratchRegister, Operand(kScratchRegister, 0)); - __ addq(kScratchRegister, Immediate(shrink_slots * kSystemPointerSize)); + __ addq(kScratchRegister, + Immediate(required_slots * kSystemPointerSize)); __ cmpq(rsp, kScratchRegister); __ j(above_equal, &done); } @@ -3732,12 +3733,12 @@ void CodeGenerator::AssembleConstructFrame() { } // Skip callee-saved and return slots, which are created below. - shrink_slots -= base::bits::CountPopulation(saves); - shrink_slots -= base::bits::CountPopulation(saves_fp) * - (kQuadWordSize / kSystemPointerSize); - shrink_slots -= frame()->GetReturnSlotCount(); - if (shrink_slots > 0) { - __ subq(rsp, Immediate(shrink_slots * kSystemPointerSize)); + required_slots -= base::bits::CountPopulation(saves); + required_slots -= base::bits::CountPopulation(saves_fp) * + (kQuadWordSize / kSystemPointerSize); + required_slots -= frame()->GetReturnSlotCount(); + if (required_slots > 0) { + __ subq(rsp, Immediate(required_slots * kSystemPointerSize)); } }