Index: src/compiler/arm64/code-generator-arm64.cc |
diff --git a/src/compiler/arm64/code-generator-arm64.cc b/src/compiler/arm64/code-generator-arm64.cc |
index 54fe76c3d1762889a3a703f040764614417431ac..e9393ff13dc275035f55cfe79e6e40f9730bb676 100644 |
--- a/src/compiler/arm64/code-generator-arm64.cc |
+++ b/src/compiler/arm64/code-generator-arm64.cc |
@@ -293,7 +293,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode { |
: OMIT_REMEMBERED_SET; |
SaveFPRegsMode const save_fp_mode = |
frame()->DidAllocateDoubleRegisters() ? kSaveFPRegs : kDontSaveFPRegs; |
- if (!frame()->needs_frame()) { |
+ if (!frame_access_state()->access_frame_with_fp()) { |
// We need to save and restore lr if the frame was elided. |
__ Push(lr); |
} |
@@ -301,7 +301,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode { |
remembered_set_action, save_fp_mode); |
__ Add(scratch1_, object_, index_); |
__ CallStub(&stub); |
- if (!frame()->needs_frame()) { |
+ if (!frame_access_state()->access_frame_with_fp()) { |
__ Pop(lr); |
} |
} |
@@ -466,6 +466,15 @@ Condition FlagsConditionToCondition(FlagsCondition condition) { |
} \ |
} while (0) |
+void CodeGenerator::AssembleDeconstructFrame() { |
+ const CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
+ if (descriptor->IsCFunctionCall() || descriptor->UseNativeStack()) { |
+ __ Mov(csp, fp); |
+ } else { |
+ __ Mov(jssp, fp); |
+ } |
+ __ Pop(fp, lr); |
+} |
void CodeGenerator::AssembleDeconstructActivationRecord(int stack_param_delta) { |
int sp_slot_delta = TailCallFrameStackSlotDelta(stack_param_delta); |
@@ -482,7 +491,7 @@ void CodeGenerator::AssemblePrepareTailCall(int stack_param_delta) { |
__ Claim(-sp_slot_delta); |
frame_access_state()->IncreaseSPDelta(-sp_slot_delta); |
} |
- if (frame()->needs_frame()) { |
+ if (frame_access_state()->access_frame_with_fp()) { |
__ Ldr(lr, MemOperand(fp, StandardFrameConstants::kCallerPCOffset)); |
__ Ldr(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
} |
@@ -664,7 +673,7 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
__ mov(i.OutputRegister(), fp); |
break; |
case kArchParentFramePointer: |
- if (frame_access_state()->frame()->needs_frame()) { |
+ if (frame_access_state()->access_frame_with_fp()) { |
__ ldr(i.OutputRegister(), MemOperand(fp, 0)); |
} else { |
__ mov(i.OutputRegister(), fp); |
@@ -1407,6 +1416,7 @@ void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) { |
void CodeGenerator::AssembleArchJump(RpoNumber target) { |
+ AssembleDeconstructFrameBetweenBlocks(); |
if (!IsNextInAssemblyOrder(target)) __ B(GetLabel(target)); |
} |
@@ -1464,12 +1474,18 @@ void CodeGenerator::AssembleDeoptimizerCall( |
__ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
} |
+void CodeGenerator::SetupStackPointer() { |
+ if (linkage()->GetIncomingDescriptor()->UseNativeStack()) { |
+ __ SetStackPointer(csp); |
+ } else { |
+ __ SetStackPointer(jssp); |
+ } |
+} |
void CodeGenerator::AssemblePrologue() { |
CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
- frame()->AlignFrame(16); |
int stack_shrink_slots = frame()->GetSpillSlotCount(); |
- if (frame()->needs_frame()) { |
+ if (frame_access_state()->access_frame_with_fp()) { |
if (descriptor->IsJSFunctionCall()) { |
DCHECK(!descriptor->UseNativeStack()); |
__ SetStackPointer(jssp); |
@@ -1489,15 +1505,8 @@ void CodeGenerator::AssemblePrologue() { |
frame()->GetTotalFrameSlotCount()); |
} |
} |
- } else { |
- if (descriptor->UseNativeStack()) { |
- __ SetStackPointer(csp); |
- } else { |
- __ SetStackPointer(jssp); |
- } |
- frame()->SetElidedFrameSizeInSlots(0); |
} |
- frame_access_state()->SetFrameAccessToDefault(); |
+ |
if (info()->is_osr()) { |
// TurboFan OSR-compiled functions cannot be entered directly. |
__ Abort(kShouldNotDirectlyEnterOsrFunction); |
@@ -1558,22 +1567,16 @@ void CodeGenerator::AssembleReturn() { |
int pop_count = static_cast<int>(descriptor->StackParameterCount()); |
if (descriptor->IsCFunctionCall()) { |
- __ Mov(csp, fp); |
- __ Pop(fp, lr); |
- } 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(); |
__ B(&return_label_); |
return; |
} else { |
__ Bind(&return_label_); |
- if (descriptor->UseNativeStack()) { |
- __ Mov(csp, fp); |
- pop_count += (pop_count & 1); // align |
- } else { |
- __ Mov(jssp, fp); |
- } |
- __ Pop(fp, lr); |
+ AssembleDeconstructFrameWhenLeaving(); |
} |
} else if (descriptor->UseNativeStack()) { |
pop_count += (pop_count & 1); // align |