| Index: src/compiler/x64/code-generator-x64.cc
|
| diff --git a/src/compiler/x64/code-generator-x64.cc b/src/compiler/x64/code-generator-x64.cc
|
| index 9241d8355f7079691a01d1dc18e3994f93b2ae94..0f1e959adc7efd0cdacf20c38255032cdfa3cae0 100644
|
| --- a/src/compiler/x64/code-generator-x64.cc
|
| +++ b/src/compiler/x64/code-generator-x64.cc
|
| @@ -527,6 +527,23 @@ class OutOfLineTruncateDoubleToI final : public OutOfLineCode {
|
| } while (false)
|
|
|
|
|
| +void CodeGenerator::AssembleDeconstructActivationRecord() {
|
| + CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
|
| + int stack_slots = frame()->GetSpillSlotCount();
|
| + if (descriptor->IsJSFunctionCall() || stack_slots > 0) {
|
| + __ movq(rsp, rbp);
|
| + __ popq(rbp);
|
| + int32_t bytes_to_pop =
|
| + descriptor->IsJSFunctionCall()
|
| + ? static_cast<int32_t>(descriptor->JSParameterCount() *
|
| + kPointerSize)
|
| + : 0;
|
| + __ popq(Operand(rsp, bytes_to_pop));
|
| + __ addq(rsp, Immediate(bytes_to_pop));
|
| + }
|
| +}
|
| +
|
| +
|
| // Assembles an instruction after register allocation, producing machine code.
|
| void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
|
| X64OperandConverter i(this, instr);
|
| @@ -545,6 +562,18 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
|
| RecordCallPosition(instr);
|
| break;
|
| }
|
| + case kArchTailCallCodeObject: {
|
| + AssembleDeconstructActivationRecord();
|
| + if (HasImmediateInput(instr, 0)) {
|
| + Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0));
|
| + __ jmp(code, RelocInfo::CODE_TARGET);
|
| + } else {
|
| + Register reg = i.InputRegister(0);
|
| + int entry = Code::kHeaderSize - kHeapObjectTag;
|
| + __ jmp(Operand(reg, entry));
|
| + }
|
| + break;
|
| + }
|
| case kArchCallJSFunction: {
|
| EnsureSpaceForLazyDeopt();
|
| Register func = i.InputRegister(0);
|
| @@ -557,6 +586,17 @@ 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.
|
| + __ cmpp(rsi, FieldOperand(func, JSFunction::kContextOffset));
|
| + __ Assert(equal, kWrongFunctionContext);
|
| + }
|
| + AssembleDeconstructActivationRecord();
|
| + __ jmp(FieldOperand(func, JSFunction::kCodeEntryOffset));
|
| + break;
|
| + }
|
| case kArchJmp:
|
| AssembleArchJump(i.InputRpo(0));
|
| break;
|
|
|