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 663cfb08d049f9a0d9f48d4f19a8b07b293a3c6c..306c347f8a16cff03d2ffad3cffa470e7dd6f1e1 100644 |
--- a/src/compiler/arm/code-generator-arm.cc |
+++ b/src/compiler/arm/code-generator-arm.cc |
@@ -299,6 +299,19 @@ Condition FlagsConditionToCondition(FlagsCondition condition) { |
} while (0) |
+void CodeGenerator::AssembleDeconstructActivationRecord() { |
+ CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
+ int stack_slots = frame()->GetSpillSlotCount(); |
+ if (descriptor->IsJSFunctionCall() || stack_slots > 0) { |
+ __ LeaveFrame(StackFrame::MANUAL); |
+ int pop_count = descriptor->IsJSFunctionCall() |
+ ? static_cast<int>(descriptor->JSParameterCount()) |
+ : 0; |
+ __ Drop(pop_count); |
+ } |
+} |
+ |
+ |
// Assembles an instruction after register allocation, producing machine code. |
void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
ArmOperandConverter i(this, instr); |
@@ -318,6 +331,19 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
DCHECK_EQ(LeaveCC, i.OutputSBit()); |
break; |
} |
+ case kArchTailCallCodeObject: { |
+ AssembleDeconstructActivationRecord(); |
+ if (instr->InputAt(0)->IsImmediate()) { |
+ __ Jump(Handle<Code>::cast(i.InputHeapObject(0)), |
+ RelocInfo::CODE_TARGET); |
+ } else { |
+ __ add(ip, i.InputRegister(0), |
+ Operand(Code::kHeaderSize - kHeapObjectTag)); |
+ __ Jump(ip); |
+ } |
+ DCHECK_EQ(LeaveCC, i.OutputSBit()); |
+ break; |
+ } |
case kArchCallJSFunction: { |
EnsureSpaceForLazyDeopt(); |
Register func = i.InputRegister(0); |
@@ -333,6 +359,20 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
DCHECK_EQ(LeaveCC, i.OutputSBit()); |
break; |
} |
+ case kArchTailCallJSFunction: { |
+ Register func = i.InputRegister(0); |
+ if (FLAG_debug_code) { |
+ // Check the function's context matches the context argument. |
+ __ ldr(kScratchReg, FieldMemOperand(func, JSFunction::kContextOffset)); |
+ __ cmp(cp, kScratchReg); |
+ __ Assert(eq, kWrongFunctionContext); |
+ } |
+ AssembleDeconstructActivationRecord(); |
+ __ ldr(ip, FieldMemOperand(func, JSFunction::kCodeEntryOffset)); |
+ __ Jump(ip); |
+ DCHECK_EQ(LeaveCC, i.OutputSBit()); |
+ break; |
+ } |
case kArchJmp: |
AssembleArchJump(i.InputRpo(0)); |
DCHECK_EQ(LeaveCC, i.OutputSBit()); |