Index: src/compiler/mips64/code-generator-mips64.cc |
diff --git a/src/compiler/mips64/code-generator-mips64.cc b/src/compiler/mips64/code-generator-mips64.cc |
index 225b99d092029e9f4622e75fc90ab4276ab3ba93..f06c9dafc678bf34b113855bb678d84025cbe7be 100644 |
--- a/src/compiler/mips64/code-generator-mips64.cc |
+++ b/src/compiler/mips64/code-generator-mips64.cc |
@@ -224,7 +224,8 @@ class OutOfLineRecordWrite final : public OutOfLineCode { |
value_(value), |
scratch0_(scratch0), |
scratch1_(scratch1), |
- mode_(mode) {} |
+ mode_(mode), |
+ must_save_lr_(gen->frame_access_state()->has_frame()) {} |
void Generate() final { |
if (mode_ > RecordWriteMode::kValueIsPointer) { |
@@ -238,7 +239,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode { |
: OMIT_REMEMBERED_SET; |
SaveFPRegsMode const save_fp_mode = |
frame()->DidAllocateDoubleRegisters() ? kSaveFPRegs : kDontSaveFPRegs; |
- if (!frame()->needs_frame()) { |
+ if (must_save_lr_) { |
// We need to save and restore ra if the frame was elided. |
__ Push(ra); |
} |
@@ -246,7 +247,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode { |
remembered_set_action, save_fp_mode); |
__ Daddu(scratch1_, object_, index_); |
__ CallStub(&stub); |
- if (!frame()->needs_frame()) { |
+ if (must_save_lr_) { |
__ Pop(ra); |
} |
} |
@@ -258,6 +259,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode { |
Register const scratch0_; |
Register const scratch1_; |
RecordWriteMode const mode_; |
+ bool must_save_lr_; |
}; |
@@ -482,6 +484,13 @@ FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate, |
__ bind(&done); \ |
} |
+void CodeGenerator::AssembleDeconstructFrame() { |
+ __ mov(sp, fp); |
+ __ Pop(ra, fp); |
+} |
+ |
+void CodeGenerator::SetupStackPointer() {} |
+ |
void CodeGenerator::AssembleDeconstructActivationRecord(int stack_param_delta) { |
int sp_slot_delta = TailCallFrameStackSlotDelta(stack_param_delta); |
if (sp_slot_delta > 0) { |
@@ -497,7 +506,7 @@ void CodeGenerator::AssemblePrepareTailCall(int stack_param_delta) { |
__ Dsubu(sp, sp, Operand(-sp_slot_delta * kPointerSize)); |
frame_access_state()->IncreaseSPDelta(-sp_slot_delta); |
} |
- if (frame()->needs_frame()) { |
+ if (frame_access_state()->has_frame()) { |
__ ld(ra, MemOperand(fp, StandardFrameConstants::kCallerPCOffset)); |
__ ld(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
} |
@@ -655,7 +664,7 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
__ mov(i.OutputRegister(), fp); |
break; |
case kArchParentFramePointer: |
- if (frame_access_state()->frame()->needs_frame()) { |
+ if (frame_access_state()->has_frame()) { |
__ ld(i.OutputRegister(), MemOperand(fp, 0)); |
} else { |
__ mov(i.OutputRegister(), fp); |
@@ -1585,6 +1594,7 @@ static bool convertCondition(FlagsCondition condition, Condition& cc) { |
// Assembles branches after an instruction. |
void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) { |
+ AssembleDeconstructFrameIfNeeded(); |
MipsOperandConverter i(this, instr); |
Label* tlabel = branch->true_label; |
Label* flabel = branch->false_label; |
@@ -1669,6 +1679,7 @@ void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) { |
void CodeGenerator::AssembleArchJump(RpoNumber target) { |
+ AssembleDeconstructFrameIfNeeded(); |
if (!IsNextInAssemblyOrder(target)) __ Branch(GetLabel(target)); |
} |
@@ -1870,7 +1881,7 @@ void CodeGenerator::AssembleDeoptimizerCall( |
void CodeGenerator::AssemblePrologue() { |
CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
- if (frame()->needs_frame()) { |
+ if (frame_access_state()->has_frame()) { |
if (descriptor->IsCFunctionCall()) { |
__ Push(ra, fp); |
__ mov(fp, sp); |
@@ -1879,10 +1890,7 @@ void CodeGenerator::AssemblePrologue() { |
} else { |
__ StubPrologue(info()->GetOutputStackFrameType()); |
} |
- } else { |
- frame()->SetElidedFrameSizeInSlots(0); |
} |
- frame_access_state()->SetFrameAccessToDefault(); |
int stack_shrink_slots = frame()->GetSpillSlotCount(); |
if (info()->is_osr()) { |
@@ -1941,18 +1949,9 @@ void CodeGenerator::AssembleReturn() { |
} |
if (descriptor->IsCFunctionCall()) { |
- __ mov(sp, fp); |
- __ Pop(ra, fp); |
- } else if (frame()->needs_frame()) { |
- // Canonicalize JSFunction return sites for now. |
- if (return_label_.is_bound()) { |
- __ Branch(&return_label_); |
- return; |
- } else { |
- __ bind(&return_label_); |
- __ mov(sp, fp); |
- __ Pop(ra, fp); |
- } |
+ AssembleDeconstructFrameIfNeeded(); |
+ } else if (frame_access_state()->has_frame()) { |
+ if (AssembleDeconstructFrameUsingReturnLabel()) return; |
} |
int pop_count = static_cast<int>(descriptor->StackParameterCount()); |
if (pop_count != 0) { |