Chromium Code Reviews| Index: src/compiler/arm/code-generator-arm.cc |
| diff --git a/src/compiler/arm/code-generator-arm.cc b/src/compiler/arm/code-generator-arm.cc |
| index 76e9050b441c423ab3476d6fe961f4e6580d18c2..835827383e593dc587da1757dc04fb61b86ed90c 100644 |
| --- a/src/compiler/arm/code-generator-arm.cc |
| +++ b/src/compiler/arm/code-generator-arm.cc |
| @@ -356,13 +356,42 @@ Condition FlagsConditionToCondition(FlagsCondition condition) { |
| void CodeGenerator::AssembleDeconstructActivationRecord(int stack_param_delta) { |
| CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
| - int stack_slots = frame()->GetSpillSlotCount(); |
| - if (descriptor->IsJSFunctionCall() || stack_slots > 0) { |
| - __ LeaveFrame(StackFrame::MANUAL); |
| + int spill_slots = frame()->GetSpillSlotCount(); |
| + bool has_frame = descriptor->IsJSFunctionCall() || spill_slots > 0; |
| + if (has_frame) { |
| + if (stack_param_delta != 0) { |
|
Jarin
2015/11/20 10:56:09
Is the special casing for the stack_parameter_delt
danno
2015/11/20 14:43:23
No, but the code is more compact. For simplicity I
|
| + 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) { |
| + __ add(sp, sp, Operand(total_discarded_slots * kPointerSize)); |
| + } |
| + } else { |
| + __ mov(sp, fp); |
| + } |
| + if (FLAG_enable_embedded_constant_pool) { |
| + __ ldm(ia_w, sp, pp.bit() | fp.bit() | lr.bit()); |
| + } else { |
| + __ ldm(ia_w, sp, fp.bit() | lr.bit()); |
| + } |
| } |
| - if (stack_param_delta < 0) { |
| - int offset = -stack_param_delta * kPointerSize; |
| - __ add(sp, sp, Operand(offset)); |
| +} |
| + |
| + |
| +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; |
|
Jarin
2015/11/20 10:56:09
The calculation of total_discarded_slots is repeat
danno
2015/11/20 14:43:23
Done.
|
| + if (total_discarded_slots < 0) { |
| + __ sub(sp, sp, Operand(-total_discarded_slots * kPointerSize)); |
| + } |
| } |
| } |
| @@ -442,6 +471,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()) { |