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 c43b1829a599fe644a0beea78238f62f2019c03f..7597df4928823dd31f6aabb66d01ef01f9b13f9f 100644 |
--- a/src/compiler/x64/instruction-selector-x64.cc |
+++ b/src/compiler/x64/instruction-selector-x64.cc |
@@ -1072,20 +1072,10 @@ void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { |
} |
-void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) { |
+void InstructionSelector::EmitPrepareArguments(NodeVector* arguments, |
+ const CallDescriptor* descriptor, |
+ Node* node) { |
X64OperandGenerator g(this); |
- const CallDescriptor* descriptor = OpParameter<const CallDescriptor*>(node); |
- |
- FrameStateDescriptor* frame_state_descriptor = nullptr; |
- if (descriptor->NeedsFrameState()) { |
- frame_state_descriptor = GetFrameStateDescriptor( |
- node->InputAt(static_cast<int>(descriptor->InputCount()))); |
- } |
- |
- CallBuffer buffer(zone(), descriptor, frame_state_descriptor); |
- |
- // Compute InstructionOperands for inputs and outputs. |
- InitializeCallBuffer(node, &buffer, true, true); |
// Prepare for C function call. |
if (descriptor->IsCFunctionCall()) { |
@@ -1094,8 +1084,8 @@ void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) { |
0, nullptr, 0, nullptr); |
// Poke any stack arguments. |
- for (size_t n = 0; n < buffer.pushed_nodes.size(); ++n) { |
- if (Node* input = buffer.pushed_nodes[n]) { |
+ for (size_t n = 0; n < arguments->size(); ++n) { |
+ if (Node* input = (*arguments)[n]) { |
int slot = static_cast<int>(n); |
InstructionOperand value = g.CanBeImmediate(input) |
? g.UseImmediate(input) |
@@ -1105,7 +1095,7 @@ void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) { |
} |
} else { |
// Push any stack arguments. |
- for (Node* input : base::Reversed(buffer.pushed_nodes)) { |
+ for (Node* input : base::Reversed(*arguments)) { |
// TODO(titzer): X64Push cannot handle stack->stack double moves |
// because there is no way to encode fixed double slots. |
InstructionOperand value = |
@@ -1118,43 +1108,6 @@ void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) { |
Emit(kX64Push, g.NoOutput(), value); |
} |
} |
- |
- // Pass label of exception handler block. |
- CallDescriptor::Flags flags = descriptor->flags(); |
- if (handler) { |
- DCHECK_EQ(IrOpcode::kIfException, handler->front()->opcode()); |
- IfExceptionHint hint = OpParameter<IfExceptionHint>(handler->front()); |
- if (hint == IfExceptionHint::kLocallyCaught) { |
- flags |= CallDescriptor::kHasLocalCatchHandler; |
- } |
- flags |= CallDescriptor::kHasExceptionHandler; |
- buffer.instruction_args.push_back(g.Label(handler)); |
- } |
- |
- // Select the appropriate opcode based on the call type. |
- InstructionCode opcode = kArchNop; |
- switch (descriptor->kind()) { |
- case CallDescriptor::kCallAddress: |
- opcode = |
- kArchCallCFunction | |
- MiscField::encode(static_cast<int>(descriptor->CParameterCount())); |
- break; |
- case CallDescriptor::kCallCodeObject: |
- opcode = kArchCallCodeObject | MiscField::encode(flags); |
- break; |
- case CallDescriptor::kCallJSFunction: |
- opcode = kArchCallJSFunction | MiscField::encode(flags); |
- break; |
- case CallDescriptor::kLazyBailout: |
- opcode = kArchLazyBailout | MiscField::encode(flags); |
- break; |
- } |
- |
- // 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(); |
} |