| 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 2b7ff10a5ca306de7bc988301c70e387dbe52858..62a60c39a3ec908e133dddd87611e744d6a7964f 100644
|
| --- a/src/compiler/mips/code-generator-mips.cc
|
| +++ b/src/compiler/mips/code-generator-mips.cc
|
| @@ -448,19 +448,38 @@ 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;
|
| - }
|
| - if (stack_param_delta < 0) {
|
| - stack_pointer_delta += -stack_param_delta * kPointerSize;
|
| + int spill_slots = frame()->GetSpillSlotCount();
|
| + bool has_frame = descriptor->IsJSFunctionCall() || spill_slots > 0;
|
| + if (has_frame) {
|
| + if (stack_param_delta != 0) {
|
| + int total_discarded_slots = frame()->GetTotalFrameSlotCount();
|
| + // Leave the PC and saved frame pointer on the stack.
|
| + total_discarded_slots -=
|
| + StandardFrameConstants::kFixedFrameSizeFromFp / kPointerSize;
|
| + // Discard only slots that won't be used by new parameters.
|
| + total_discarded_slots -= stack_param_delta;
|
| + if (total_discarded_slots > 0) {
|
| + __ addiu(sp, sp, total_discarded_slots * kPointerSize);
|
| + }
|
| + } else {
|
| + __ mov(sp, fp);
|
| + }
|
| + __ Pop(ra, fp);
|
| }
|
| - if (stack_pointer_delta != 0) {
|
| - __ addiu(sp, sp, stack_pointer_delta);
|
| +}
|
| +
|
| +
|
| +void CodeGenerator::AssemblePrepareTailCall(int stack_param_delta) {
|
| + if (stack_param_delta > 0) {
|
| + int total_discarded_slots = frame()->GetTotalFrameSlotCount();
|
| + // Leave the PC and saved frame pointer on the stack.
|
| + total_discarded_slots -=
|
| + StandardFrameConstants::kFixedFrameSizeFromFp / kPointerSize;
|
| + // Discard only slots that won't be used by new parameters.
|
| + total_discarded_slots -= stack_param_delta;
|
| + if (total_discarded_slots < 0) {
|
| + __ Subu(sp, sp, Operand(-total_discarded_slots * kPointerSize));
|
| + }
|
| }
|
| }
|
|
|
| @@ -533,6 +552,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()) {
|
|
|