| Index: src/compiler/mips64/code-generator-mips64.cc
|
| diff --git a/src/compiler/mips64/code-generator-mips64.cc b/src/compiler/mips64/code-generator-mips64.cc
|
| index b2b267053dd94f443073866cc692d628d7609dd8..63c795708463ecc8ce6a0c58f784d884424dbdd9 100644
|
| --- a/src/compiler/mips64/code-generator-mips64.cc
|
| +++ b/src/compiler/mips64/code-generator-mips64.cc
|
| @@ -394,6 +394,20 @@ FPUCondition FlagsConditionToConditionCmpD(bool& predicate,
|
| } while (0)
|
|
|
|
|
| +void CodeGenerator::AssembleDeconstructActivationRecord() {
|
| + CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
|
| + int stack_slots = frame()->GetSpillSlotCount();
|
| + if (descriptor->IsJSFunctionCall() || stack_slots > 0) {
|
| + __ mov(sp, fp);
|
| + __ Pop(ra, fp);
|
| + 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) {
|
| MipsOperandConverter i(this, instr);
|
| @@ -412,6 +426,17 @@ 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 {
|
| + __ daddiu(at, i.InputRegister(0), Code::kHeaderSize - kHeapObjectTag);
|
| + __ Jump(at);
|
| + }
|
| + break;
|
| + }
|
| case kArchCallJSFunction: {
|
| EnsureSpaceForLazyDeopt();
|
| Register func = i.InputRegister(0);
|
| @@ -426,6 +451,19 @@ 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.
|
| + __ ld(kScratchReg, FieldMemOperand(func, JSFunction::kContextOffset));
|
| + __ Assert(eq, kWrongFunctionContext, cp, Operand(kScratchReg));
|
| + }
|
| +
|
| + AssembleDeconstructActivationRecord();
|
| + __ ld(at, FieldMemOperand(func, JSFunction::kCodeEntryOffset));
|
| + __ Jump(at);
|
| + break;
|
| + }
|
| case kArchJmp:
|
| AssembleArchJump(i.InputRpo(0));
|
| break;
|
|
|