Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(822)

Unified Diff: src/compiler/x87/instruction-selector-x87.cc

Issue 1411093006: [turbofan] Factor out platform-independent part of InstructionSelector::VisitCall. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/x64/instruction-selector-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/x87/instruction-selector-x87.cc
diff --git a/src/compiler/x87/instruction-selector-x87.cc b/src/compiler/x87/instruction-selector-x87.cc
index 24f5c3f5c8c742394e6bf0e2b5df9683d1248ac2..d6db9443b0f8bf8c49b50753ca1885396de43b0c 100644
--- a/src/compiler/x87/instruction-selector-x87.cc
+++ b/src/compiler/x87/instruction-selector-x87.cc
@@ -838,20 +838,10 @@ void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) {
}
-void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) {
+void InstructionSelector::EmitPrepareArguments(NodeVector* arguments,
+ const CallDescriptor* descriptor,
+ Node* node) {
X87OperandGenerator 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.
- InitializeCallBuffer(node, &buffer, true, true);
// Prepare for C function call.
if (descriptor->IsCFunctionCall()) {
@@ -862,8 +852,8 @@ void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) {
0, nullptr, 0, nullptr, temp_count, temps);
// 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 const slot = static_cast<int>(n);
InstructionOperand value = g.CanBeImmediate(input)
? g.UseImmediate(input)
@@ -873,7 +863,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): handle pushing double parameters.
if (input == nullptr) continue;
InstructionOperand value =
@@ -886,43 +876,6 @@ void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) {
Emit(kX87Push, 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();
}
« no previous file with comments | « src/compiler/x64/instruction-selector-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698