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

Unified Diff: src/compiler/js-inlining.cc

Issue 1157023002: [turbofan] Change End to take a variable number of inputs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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/control-reducer.cc ('k') | src/compiler/node-properties.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-inlining.cc
diff --git a/src/compiler/js-inlining.cc b/src/compiler/js-inlining.cc
index 6449fab1bf4477f53637fad829c59abc4c36a377..a5e98464798689a1314ffde66ea6c33a99668ae7 100644
--- a/src/compiler/js-inlining.cc
+++ b/src/compiler/js-inlining.cc
@@ -165,50 +165,36 @@ Reduction JSInliner::InlineCall(Node* call, Node* start, Node* end) {
}
}
- // TODO(turbofan): This can be unified once End takes a variable number of
- // inputs.
- Node* value_output;
- Node* effect_output;
- Node* control_output;
-
- Node* final_merge = NodeProperties::GetControlInput(end);
- if (final_merge->opcode() == IrOpcode::kReturn) {
- value_output = NodeProperties::GetValueInput(final_merge, 0);
- effect_output = NodeProperties::GetEffectInput(final_merge, 0);
- control_output = NodeProperties::GetControlInput(final_merge, 0);
- } else {
- NodeVector values(local_zone_);
- NodeVector effects(local_zone_);
- NodeVector controls(local_zone_);
- DCHECK_EQ(IrOpcode::kMerge, final_merge->opcode());
- for (Node* const input : final_merge->inputs()) {
- switch (input->opcode()) {
- case IrOpcode::kReturn:
- values.push_back(NodeProperties::GetValueInput(input, 0));
- effects.push_back(NodeProperties::GetEffectInput(input));
- controls.push_back(NodeProperties::GetControlInput(input));
- break;
- default:
- // TODO(turbofan): Handle Throw, Terminate and Deoptimize here.
- UNREACHABLE();
- break;
- }
+ NodeVector values(local_zone_);
+ NodeVector effects(local_zone_);
+ NodeVector controls(local_zone_);
+ for (Node* const input : end->inputs()) {
+ switch (input->opcode()) {
+ case IrOpcode::kReturn:
+ values.push_back(NodeProperties::GetValueInput(input, 0));
+ effects.push_back(NodeProperties::GetEffectInput(input));
+ controls.push_back(NodeProperties::GetControlInput(input));
+ break;
+ default:
+ // TODO(turbofan): Handle Throw, Terminate and Deoptimize here.
+ UNREACHABLE();
+ break;
}
- DCHECK_NE(0u, values.size());
- DCHECK_EQ(values.size(), effects.size());
- DCHECK_EQ(values.size(), controls.size());
- int const input_count = static_cast<int>(controls.size());
- control_output = jsgraph_->graph()->NewNode(
- jsgraph_->common()->Merge(input_count), input_count, &controls.front());
- values.push_back(control_output);
- effects.push_back(control_output);
- value_output = jsgraph_->graph()->NewNode(
- jsgraph_->common()->Phi(kMachAnyTagged, input_count),
- static_cast<int>(values.size()), &values.front());
- effect_output = jsgraph_->graph()->NewNode(
- jsgraph_->common()->EffectPhi(input_count),
- static_cast<int>(effects.size()), &effects.front());
}
+ DCHECK_NE(0u, values.size());
+ DCHECK_EQ(values.size(), effects.size());
+ DCHECK_EQ(values.size(), controls.size());
+ int const input_count = static_cast<int>(controls.size());
+ Node* control_output = jsgraph_->graph()->NewNode(
+ jsgraph_->common()->Merge(input_count), input_count, &controls.front());
Michael Starzinger 2015/05/26 10:28:05 This will create a singleton Merge as well as sing
Benedikt Meurer 2015/05/26 10:29:31 Yes. My plan is to optimize this away later. For n
+ values.push_back(control_output);
+ effects.push_back(control_output);
+ Node* value_output = jsgraph_->graph()->NewNode(
+ jsgraph_->common()->Phi(kMachAnyTagged, input_count),
+ static_cast<int>(values.size()), &values.front());
+ Node* effect_output = jsgraph_->graph()->NewNode(
+ jsgraph_->common()->EffectPhi(input_count),
+ static_cast<int>(effects.size()), &effects.front());
ReplaceWithValue(call, value_output, effect_output, control_output);
« no previous file with comments | « src/compiler/control-reducer.cc ('k') | src/compiler/node-properties.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698