Index: src/compiler/x64/code-generator-x64.cc |
diff --git a/src/compiler/x64/code-generator-x64.cc b/src/compiler/x64/code-generator-x64.cc |
index fa7f50ea094dd0fa7de99181a7fa4e6a11f938d2..73a60899a67a7b738280b83c2a6071d96bf7125a 100644 |
--- a/src/compiler/x64/code-generator-x64.cc |
+++ b/src/compiler/x64/code-generator-x64.cc |
@@ -602,6 +602,10 @@ class OutOfLineRecordWrite final : public OutOfLineCode { |
} \ |
} while (false) |
+void CodeGenerator::AssembleDeconstructFrame() { |
+ __ movq(rsp, rbp); |
+ __ popq(rbp); |
+} |
void CodeGenerator::AssembleDeconstructActivationRecord(int stack_param_delta) { |
int sp_slot_delta = TailCallFrameStackSlotDelta(stack_param_delta); |
@@ -618,7 +622,7 @@ void CodeGenerator::AssemblePrepareTailCall(int stack_param_delta) { |
__ subq(rsp, Immediate(-sp_slot_delta * kPointerSize)); |
frame_access_state()->IncreaseSPDelta(-sp_slot_delta); |
} |
- if (frame()->needs_frame()) { |
+ if (frame_access_state()->access_frame_with_fp()) { |
__ movq(rbp, MemOperand(rbp, 0)); |
} |
frame_access_state()->SetFrameAccessToSP(); |
@@ -775,7 +779,7 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
__ movq(i.OutputRegister(), rbp); |
break; |
case kArchParentFramePointer: |
- if (frame_access_state()->frame()->needs_frame()) { |
+ if (frame_access_state()->access_frame_with_fp()) { |
__ movq(i.OutputRegister(), Operand(rbp, 0)); |
} else { |
__ movq(i.OutputRegister(), rbp); |
@@ -1799,6 +1803,7 @@ void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) { |
void CodeGenerator::AssembleArchJump(RpoNumber target) { |
+ AssembleDeconstructFrameBetweenBlocks(); |
if (!IsNextInAssemblyOrder(target)) __ jmp(GetLabel(target)); |
} |
@@ -1917,7 +1922,7 @@ static const int kQuadWordSize = 16; |
void CodeGenerator::AssemblePrologue() { |
CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
- if (frame()->needs_frame()) { |
+ if (frame_access_state()->access_frame_with_fp()) { |
if (descriptor->IsCFunctionCall()) { |
__ pushq(rbp); |
__ movq(rbp, rsp); |
@@ -1926,11 +1931,7 @@ void CodeGenerator::AssemblePrologue() { |
} else { |
__ StubPrologue(info()->GetOutputStackFrameType()); |
} |
- } else { |
- frame()->SetElidedFrameSizeInSlots(kPCOnStackSize / kPointerSize); |
} |
- frame_access_state()->SetFrameAccessToDefault(); |
- |
int stack_shrink_slots = frame()->GetSpillSlotCount(); |
if (info()->is_osr()) { |
// TurboFan OSR-compiled functions cannot be entered directly. |
@@ -2010,17 +2011,16 @@ void CodeGenerator::AssembleReturn() { |
} |
if (descriptor->IsCFunctionCall()) { |
- __ movq(rsp, rbp); // Move stack pointer back to frame pointer. |
- __ popq(rbp); // Pop caller's frame pointer. |
- } else if (frame()->needs_frame()) { |
+ AssembleDeconstructFrameWhenLeaving(); |
+ } else if (frame_access_state()->access_frame_with_fp()) { |
// Canonicalize JSFunction return sites for now. |
if (return_label_.is_bound()) { |
+ AssembleDeconstructFrameBetweenBlocks(); |
__ jmp(&return_label_); |
return; |
} else { |
__ bind(&return_label_); |
- __ movq(rsp, rbp); // Move stack pointer back to frame pointer. |
- __ popq(rbp); // Pop caller's frame pointer. |
+ AssembleDeconstructFrameWhenLeaving(); |
} |
} |
size_t pop_size = descriptor->StackParameterCount() * kPointerSize; |