Chromium Code Reviews| Index: src/compiler/x64/instruction-selector-x64.cc |
| diff --git a/src/compiler/x64/instruction-selector-x64.cc b/src/compiler/x64/instruction-selector-x64.cc |
| index fa63138f2799841c5af49c2ac93a7493541881cb..40ac86e7a9b9b64bb4a519efd46bb813cd90aeae 100644 |
| --- a/src/compiler/x64/instruction-selector-x64.cc |
| +++ b/src/compiler/x64/instruction-selector-x64.cc |
| @@ -1201,6 +1201,51 @@ void InstructionSelector::VisitTailCall(Node* node) { |
| } |
| +void InstructionSelector::VisitCallVarArgs(Node* node) { |
| + X64OperandGenerator g(this); |
| + const CallDescriptor* descriptor = OpParameter<const CallDescriptor*>(node); |
| + const int descriptor_input_count = static_cast<int>(descriptor->InputCount()); |
| + |
| + FrameStateDescriptor* frame_state_descriptor = nullptr; |
| + if (descriptor->NeedsFrameState()) { |
| + frame_state_descriptor = |
| + GetFrameStateDescriptor(node->InputAt(descriptor_input_count + 2)); |
| + } |
| + |
| + CallBuffer buffer(zone(), descriptor, frame_state_descriptor); |
| + |
| + // Compute InstructionOperands for inputs and outputs. |
| + InitializeCallBuffer(node, &buffer, true, true); |
| + |
| + // Push the arguments onto the stack. |
| + Node* args_start = node->InputAt(descriptor_input_count); |
| + Node* args_end = node->InputAt(descriptor_input_count + 1); |
| + Emit(kX64PushMultiple, g.NoOutput(), g.UseRegister(args_start), |
|
Benedikt Meurer
2015/09/07 05:14:30
Mhm, I have mixed feelings with this, but on the o
|
| + g.UseRegister(args_end)); |
| + |
| + // Select the appropriate opcode based on the call type. |
| + CallDescriptor::Flags flags = descriptor->flags(); |
| + InstructionCode opcode; |
| + switch (descriptor->kind()) { |
| + case CallDescriptor::kCallCodeObject: |
| + opcode = kArchCallCodeObject | MiscField::encode(flags); |
| + break; |
| + case CallDescriptor::kCallJSFunction: |
| + opcode = kArchCallJSFunction | MiscField::encode(flags); |
| + break; |
| + default: |
| + UNREACHABLE(); |
| + return; |
| + } |
| + |
| + // Emit the call instruction. |
| + size_t const output_count = buffer.outputs.size(); |
| + auto* outputs = output_count ? &buffer.outputs.front() : nullptr; |
| + Emit(opcode, output_count, outputs, buffer.instruction_args.size(), |
| + &buffer.instruction_args.front())->MarkAsCall(); |
| +} |
| + |
| + |
| namespace { |
| // Shared routine for multiple compare operations. |