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

Side by Side Diff: src/compiler/control-flow-optimizer.cc

Issue 935033004: Introduce and test NodeProperties::CollectControlProjections. (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 unified diff | Download patch
« no previous file with comments | « no previous file | src/compiler/node-properties.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/control-flow-optimizer.h" 5 #include "src/compiler/control-flow-optimizer.h"
6 6
7 #include "src/compiler/js-graph.h" 7 #include "src/compiler/js-graph.h"
8 #include "src/compiler/node-matchers.h" 8 #include "src/compiler/node-matchers.h"
9 #include "src/compiler/node-properties.h" 9 #include "src/compiler/node-properties.h"
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 Int32BinopMatcher m(cond); 61 Int32BinopMatcher m(cond);
62 Node* index = m.left().node(); 62 Node* index = m.left().node();
63 if (!m.right().HasValue()) return VisitNode(node); 63 if (!m.right().HasValue()) return VisitNode(node);
64 int32_t value = m.right().Value(); 64 int32_t value = m.right().Value();
65 ZoneSet<int32_t> values(zone()); 65 ZoneSet<int32_t> values(zone());
66 values.insert(value); 66 values.insert(value);
67 67
68 Node* if_false; 68 Node* if_false;
69 Node* if_true; 69 Node* if_true;
70 while (true) { 70 while (true) {
71 // TODO(turbofan): use NodeProperties::CollectSuccessorProjections() here 71 Node* control_projections[2];
72 // once available. 72 NodeProperties::CollectControlProjections(branch, control_projections, 2);
73 auto it = branch->uses().begin(); 73 if_true = control_projections[0];
74 DCHECK(it != branch->uses().end()); 74 if_false = control_projections[1];
75 if_true = *it++;
76 DCHECK(it != branch->uses().end());
77 if_false = *it++;
78 DCHECK(it == branch->uses().end());
79 if (if_true->opcode() != IrOpcode::kIfTrue) std::swap(if_true, if_false);
80 DCHECK_EQ(IrOpcode::kIfTrue, if_true->opcode()); 75 DCHECK_EQ(IrOpcode::kIfTrue, if_true->opcode());
81 DCHECK_EQ(IrOpcode::kIfFalse, if_false->opcode()); 76 DCHECK_EQ(IrOpcode::kIfFalse, if_false->opcode());
82 77
83 it = if_false->uses().begin(); 78 auto it = if_false->uses().begin();
84 if (it == if_false->uses().end()) break; 79 if (it == if_false->uses().end()) break;
85 Node* branch1 = *it++; 80 Node* branch1 = *it++;
86 if (branch1->opcode() != IrOpcode::kBranch) break; 81 if (branch1->opcode() != IrOpcode::kBranch) break;
87 if (it != if_false->uses().end()) break; 82 if (it != if_false->uses().end()) break;
88 Node* cond1 = branch1->InputAt(0); 83 Node* cond1 = branch1->InputAt(0);
89 if (cond1->opcode() != IrOpcode::kWord32Equal) break; 84 if (cond1->opcode() != IrOpcode::kWord32Equal) break;
90 Int32BinopMatcher m1(cond1); 85 Int32BinopMatcher m1(cond1);
91 if (m1.left().node() != index) break; 86 if (m1.left().node() != index) break;
92 if (!m1.right().HasValue()) break; 87 if (!m1.right().HasValue()) break;
93 int32_t value1 = m1.right().Value(); 88 int32_t value1 = m1.right().Value();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 Graph* ControlFlowOptimizer::graph() const { return jsgraph()->graph(); } 133 Graph* ControlFlowOptimizer::graph() const { return jsgraph()->graph(); }
139 134
140 135
141 MachineOperatorBuilder* ControlFlowOptimizer::machine() const { 136 MachineOperatorBuilder* ControlFlowOptimizer::machine() const {
142 return jsgraph()->machine(); 137 return jsgraph()->machine();
143 } 138 }
144 139
145 } // namespace compiler 140 } // namespace compiler
146 } // namespace internal 141 } // namespace internal
147 } // namespace v8 142 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/node-properties.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698