Index: src/compiler/mips/code-generator-mips.cc |
diff --git a/src/compiler/mips/code-generator-mips.cc b/src/compiler/mips/code-generator-mips.cc |
index 5aac134d44d2981668d88ad04aa348cdf6313a66..2ea084f8c4882fdfdc86f745f65849524fe2e802 100644 |
--- a/src/compiler/mips/code-generator-mips.cc |
+++ b/src/compiler/mips/code-generator-mips.cc |
@@ -454,20 +454,23 @@ FPUCondition FlagsConditionToConditionCmpFPU(bool& predicate, |
void CodeGenerator::AssembleDeconstructActivationRecord(int stack_param_delta) { |
- CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
- int stack_slots = frame()->GetSpillSlotCount(); |
- int stack_pointer_delta = 0; |
- if (descriptor->IsJSFunctionCall() || stack_slots > 0) { |
- __ mov(sp, fp); |
- __ lw(fp, MemOperand(sp, 0 * kPointerSize)); |
- __ lw(ra, MemOperand(sp, 1 * kPointerSize)); |
- stack_pointer_delta = 2 * kPointerSize; |
+ int sp_slot_delta = TailCallFrameStackSlotDelta(stack_param_delta); |
+ if (sp_slot_delta > 0) { |
+ __ addiu(sp, sp, sp_slot_delta * kPointerSize); |
} |
- if (stack_param_delta < 0) { |
- stack_pointer_delta += -stack_param_delta * kPointerSize; |
+ CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
+ int spill_slots = frame()->GetSpillSlotCount(); |
+ bool has_frame = descriptor->IsJSFunctionCall() || spill_slots > 0; |
+ if (has_frame) { |
+ __ Pop(ra, fp); |
} |
- if (stack_pointer_delta != 0) { |
- __ addiu(sp, sp, stack_pointer_delta); |
+} |
+ |
+ |
+void CodeGenerator::AssemblePrepareTailCall(int stack_param_delta) { |
+ int sp_slot_delta = TailCallFrameStackSlotDelta(stack_param_delta); |
+ if (sp_slot_delta < 0) { |
+ __ Subu(sp, sp, Operand(-sp_slot_delta * kPointerSize)); |
} |
} |
@@ -540,6 +543,9 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
__ PrepareCallCFunction(num_parameters, kScratchReg); |
break; |
} |
+ case kArchPrepareTailCall: |
+ AssemblePrepareTailCall(i.InputInt32(instr->InputCount() - 1)); |
+ break; |
case kArchCallCFunction: { |
int const num_parameters = MiscField::decode(instr->opcode()); |
if (instr->InputAt(0)->IsImmediate()) { |