| Index: src/compiler/arm64/code-generator-arm64.cc
|
| diff --git a/src/compiler/arm64/code-generator-arm64.cc b/src/compiler/arm64/code-generator-arm64.cc
|
| index 51106c2a3c9f80b5408bfa304e6b66fc516825e3..dc045af64b4775f6765e1f13644ecf8167e8da8c 100644
|
| --- a/src/compiler/arm64/code-generator-arm64.cc
|
| +++ b/src/compiler/arm64/code-generator-arm64.cc
|
| @@ -343,6 +343,20 @@ Condition FlagsConditionToCondition(FlagsCondition condition) {
|
| } while (0)
|
|
|
|
|
| +void CodeGenerator::AssembleDeconstructActivationRecord() {
|
| + CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
|
| + int stack_slots = frame()->GetSpillSlotCount();
|
| + if (descriptor->IsJSFunctionCall() || stack_slots > 0) {
|
| + __ Mov(jssp, fp);
|
| + __ Pop(fp, lr);
|
| + 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) {
|
| Arm64OperandConverter i(this, instr);
|
| @@ -361,6 +375,18 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
|
| RecordCallPosition(instr);
|
| break;
|
| }
|
| + case kArchTailCallCodeObject: {
|
| + AssembleDeconstructActivationRecord();
|
| + if (instr->InputAt(0)->IsImmediate()) {
|
| + __ Jump(Handle<Code>::cast(i.InputHeapObject(0)),
|
| + RelocInfo::CODE_TARGET);
|
| + } else {
|
| + Register target = i.InputRegister(0);
|
| + __ Add(target, target, Code::kHeaderSize - kHeapObjectTag);
|
| + __ Jump(target);
|
| + }
|
| + break;
|
| + }
|
| case kArchCallJSFunction: {
|
| EnsureSpaceForLazyDeopt();
|
| Register func = i.InputRegister(0);
|
| @@ -377,6 +403,21 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
|
| RecordCallPosition(instr);
|
| break;
|
| }
|
| + case kArchTailCallJSFunction: {
|
| + Register func = i.InputRegister(0);
|
| + if (FLAG_debug_code) {
|
| + // Check the function's context matches the context argument.
|
| + UseScratchRegisterScope scope(masm());
|
| + Register temp = scope.AcquireX();
|
| + __ Ldr(temp, FieldMemOperand(func, JSFunction::kContextOffset));
|
| + __ cmp(cp, temp);
|
| + __ Assert(eq, kWrongFunctionContext);
|
| + }
|
| + AssembleDeconstructActivationRecord();
|
| + __ Ldr(x10, FieldMemOperand(func, JSFunction::kCodeEntryOffset));
|
| + __ Jump(x10);
|
| + break;
|
| + }
|
| case kArchJmp:
|
| AssembleArchJump(i.InputRpo(0));
|
| break;
|
|
|