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 c07a21f8638314fa16bbd93c5eada9e8530036b7..54f85dbe5e118789e9ed687fc46364812b82b49f 100644 |
--- a/src/compiler/x64/code-generator-x64.cc |
+++ b/src/compiler/x64/code-generator-x64.cc |
@@ -602,6 +602,12 @@ class OutOfLineRecordWrite final : public OutOfLineCode { |
} \ |
} while (false) |
+void CodeGenerator::AssembleDeconstructFrame() { |
+ __ movq(rsp, rbp); |
+ __ popq(rbp); |
+} |
+ |
+void CodeGenerator::SetupStackPointer() {} |
void CodeGenerator::AssembleDeconstructActivationRecord(int stack_param_delta) { |
int sp_slot_delta = TailCallFrameStackSlotDelta(stack_param_delta); |
@@ -618,7 +624,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()->has_frame()) { |
__ movq(rbp, MemOperand(rbp, 0)); |
} |
frame_access_state()->SetFrameAccessToSP(); |
@@ -775,7 +781,7 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
__ movq(i.OutputRegister(), rbp); |
break; |
case kArchParentFramePointer: |
- if (frame_access_state()->frame()->needs_frame()) { |
+ if (frame_access_state()->has_frame()) { |
__ movq(i.OutputRegister(), Operand(rbp, 0)); |
} else { |
__ movq(i.OutputRegister(), rbp); |
@@ -1754,6 +1760,7 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
// Assembles branches after this instruction. |
void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) { |
+ AssembleDeconstructFrameIfNeeded(); |
X64OperandConverter i(this, instr); |
Label::Distance flabel_distance = |
branch->fallthru ? Label::kNear : Label::kFar; |
@@ -1811,6 +1818,7 @@ void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) { |
void CodeGenerator::AssembleArchJump(RpoNumber target) { |
+ AssembleDeconstructFrameIfNeeded(); |
if (!IsNextInAssemblyOrder(target)) __ jmp(GetLabel(target)); |
} |
@@ -1929,7 +1937,7 @@ static const int kQuadWordSize = 16; |
void CodeGenerator::AssemblePrologue() { |
CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
- if (frame()->needs_frame()) { |
+ if (frame_access_state()->has_frame()) { |
if (descriptor->IsCFunctionCall()) { |
__ pushq(rbp); |
__ movq(rbp, rsp); |
@@ -1938,11 +1946,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. |
@@ -2022,18 +2026,9 @@ 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()) { |
- // Canonicalize JSFunction return sites for now. |
- if (return_label_.is_bound()) { |
- __ 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. |
- } |
+ AssembleDeconstructFrameIfNeeded(); |
+ } else if (frame_access_state()->has_frame()) { |
+ if (AssembleDeconstructFrameUsingReturnLabel()) return; |
} |
size_t pop_size = descriptor->StackParameterCount() * kPointerSize; |
// Might need rcx for scratch if pop_size is too big. |