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

Unified Diff: src/compiler/control-flow-optimizer.cc

Issue 971223002: [turbofan] Fix ControlFlowOptimizer to also handle non-control nodes in the control chain. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | test/unittests/compiler/control-flow-optimizer-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/control-flow-optimizer.cc
diff --git a/src/compiler/control-flow-optimizer.cc b/src/compiler/control-flow-optimizer.cc
index de47589af6462a0bfc5b4f2094273795271e29db..b3a1a8bf58e403b76671d42571a79f35c23d50fb 100644
--- a/src/compiler/control-flow-optimizer.cc
+++ b/src/compiler/control-flow-optimizer.cc
@@ -46,8 +46,10 @@ void ControlFlowOptimizer::Enqueue(Node* node) {
void ControlFlowOptimizer::VisitNode(Node* node) {
- for (Node* use : node->uses()) {
- if (NodeProperties::IsControl(use)) Enqueue(use);
+ for (Edge edge : node->use_edges()) {
+ if (NodeProperties::IsControlEdge(edge)) {
+ Enqueue(edge.from());
+ }
}
}
@@ -258,20 +260,18 @@ bool ControlFlowOptimizer::TryBuildSwitch(Node* node) {
DCHECK_EQ(IrOpcode::kIfFalse, if_false->opcode());
if (branch == node) {
DCHECK_EQ(1u, values.size());
- Enqueue(if_true);
- Enqueue(if_false);
- } else {
- DCHECK_LT(1u, values.size());
- node->set_op(common()->Switch(values.size() + 1));
- node->ReplaceInput(0, index);
- if_true->set_op(common()->IfValue(value));
- if_true->ReplaceInput(0, node);
- Enqueue(if_true);
- if_false->set_op(common()->IfDefault());
- if_false->ReplaceInput(0, node);
- Enqueue(if_false);
- branch->RemoveAllInputs();
+ return false;
}
+ DCHECK_LT(1u, values.size());
+ node->set_op(common()->Switch(values.size() + 1));
+ node->ReplaceInput(0, index);
+ if_true->set_op(common()->IfValue(value));
+ if_true->ReplaceInput(0, node);
+ Enqueue(if_true);
+ if_false->set_op(common()->IfDefault());
+ if_false->ReplaceInput(0, node);
+ Enqueue(if_false);
+ branch->RemoveAllInputs();
return true;
}
« no previous file with comments | « no previous file | test/unittests/compiler/control-flow-optimizer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698