Index: src/compiler/arm/instruction-selector-arm.cc |
diff --git a/src/compiler/arm/instruction-selector-arm.cc b/src/compiler/arm/instruction-selector-arm.cc |
index 17fc4fcb08ace1bc6cd530920a1c8d812177bfc8..04e90189ba9d700f9f1b9a5988f687e3be8ff06c 100644 |
--- a/src/compiler/arm/instruction-selector-arm.cc |
+++ b/src/compiler/arm/instruction-selector-arm.cc |
@@ -1110,23 +1110,10 @@ void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { |
} |
-void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) { |
+void InstructionSelector::EmitPrepareArguments(NodeVector* arguments, |
+ const CallDescriptor* descriptor, |
+ Node* node) { |
ArmOperandGenerator g(this); |
- const CallDescriptor* descriptor = OpParameter<const CallDescriptor*>(node); |
- |
- FrameStateDescriptor* frame_state_descriptor = nullptr; |
- if (descriptor->NeedsFrameState()) { |
- frame_state_descriptor = |
- GetFrameStateDescriptor(node->InputAt(descriptor->InputCount())); |
- } |
- |
- CallBuffer buffer(zone(), descriptor, frame_state_descriptor); |
- |
- // Compute InstructionOperands for inputs and outputs. |
- // TODO(turbofan): on ARM it's probably better to use the code object in a |
- // register if there are multiple uses of it. Improve constant pool and the |
- // heuristics in the register allocator for where to emit constants. |
- InitializeCallBuffer(node, &buffer, true, true); |
// Prepare for C function call. |
if (descriptor->IsCFunctionCall()) { |
@@ -1135,8 +1122,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); |
Emit(kArmPoke | MiscField::encode(slot), g.NoOutput(), |
g.UseRegister(input)); |
@@ -1144,49 +1131,12 @@ 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)) { |
// Skip any alignment holes in pushed nodes. |
if (input == nullptr) continue; |
Emit(kArmPush, g.NoOutput(), g.UseRegister(input)); |
} |
} |
- |
- // 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(); |
} |