Chromium Code Reviews| Index: src/compiler/instruction-selector.cc |
| diff --git a/src/compiler/instruction-selector.cc b/src/compiler/instruction-selector.cc |
| index 4200d0d93784f493e4216f3f776fe31d9e3b1817..d86f12b7d28f3185c63a8bd2a5bf21a044ff7cca 100644 |
| --- a/src/compiler/instruction-selector.cc |
| +++ b/src/compiler/instruction-selector.cc |
| @@ -507,6 +507,40 @@ void InstructionSelector::InitializeCallBuffer(Node* call, CallBuffer* buffer, |
| } |
| DCHECK_EQ(input_count, buffer->instruction_args.size() + pushed_count - |
| buffer->frame_state_value_count()); |
| + if (call_tail && stack_param_delta != 0) { |
| + // For tail calls that change the size of their parameter list, move the |
| + // saved caller return address, parent frame pointer and parent constant |
| + // pool pointer to just above the parameters. |
| + |
| + // Return address |
| + LinkageLocation saved_return_location = |
| + LinkageLocation::ForSavedCallerReturnAddress(); |
| + InstructionOperand return_address = |
| + g.UseLocation(LinkageLocation::ConvertToTailCallerLocation( |
| + saved_return_location, stack_param_delta), |
| + saved_return_location, kMachPtr); |
|
Jarin
2015/11/20 10:56:09
It looks like the UseLocation method is only calle
danno
2015/11/20 14:43:24
Done.
|
| + buffer->instruction_args.push_back(return_address); |
| + |
| + // Parent frame pointer |
| + LinkageLocation saved_frame_location = |
| + LinkageLocation::ForSavedCallerFramePtr(); |
| + InstructionOperand saved_frame = |
| + g.UseLocation(LinkageLocation::ConvertToTailCallerLocation( |
| + saved_frame_location, stack_param_delta), |
| + saved_frame_location, kMachPtr); |
| + buffer->instruction_args.push_back(saved_frame); |
| + |
| + if (V8_EMBEDDED_CONSTANT_POOL) { |
| + // Constant pool pointer |
| + LinkageLocation saved_cp_location = |
| + LinkageLocation::ForSavedCallerConstantPool(); |
| + InstructionOperand saved_cp = |
| + g.UseLocation(LinkageLocation::ConvertToTailCallerLocation( |
| + saved_cp_location, stack_param_delta), |
| + saved_cp_location, kMachPtr); |
| + buffer->instruction_args.push_back(saved_cp); |
| + } |
| + } |
| } |
| @@ -1287,6 +1321,9 @@ void InstructionSelector::VisitTailCall(Node* node) { |
| buffer.instruction_args.push_back(g.TempImmediate(stack_param_delta)); |
| + Emit(kArchPrepareTailCall, g.NoOutput(), |
| + g.TempImmediate(stack_param_delta)); |
| + |
| // Emit the tailcall instruction. |
| Emit(opcode, 0, nullptr, buffer.instruction_args.size(), |
| &buffer.instruction_args.front()); |