OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/bit-vector.h" | 5 #include "src/bit-vector.h" |
6 #include "src/compiler/control-equivalence.h" | 6 #include "src/compiler/control-equivalence.h" |
7 #include "src/compiler/graph-visualizer.h" | 7 #include "src/compiler/graph-visualizer.h" |
8 #include "src/compiler/node-properties.h" | 8 #include "src/compiler/node-properties.h" |
9 #include "src/zone-containers.h" | 9 #include "src/zone-containers.h" |
10 #include "test/unittests/compiler/graph-unittest.h" | 10 #include "test/unittests/compiler/graph-unittest.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 } | 63 } |
64 | 64 |
65 Node* IfTrue(Node* control) { | 65 Node* IfTrue(Node* control) { |
66 return Store(graph()->NewNode(common()->IfTrue(), control)); | 66 return Store(graph()->NewNode(common()->IfTrue(), control)); |
67 } | 67 } |
68 | 68 |
69 Node* IfFalse(Node* control) { | 69 Node* IfFalse(Node* control) { |
70 return Store(graph()->NewNode(common()->IfFalse(), control)); | 70 return Store(graph()->NewNode(common()->IfFalse(), control)); |
71 } | 71 } |
72 | 72 |
| 73 Node* Merge1(Node* control) { |
| 74 return Store(graph()->NewNode(common()->Merge(1), control)); |
| 75 } |
| 76 |
73 Node* Merge2(Node* control1, Node* control2) { | 77 Node* Merge2(Node* control1, Node* control2) { |
74 return Store(graph()->NewNode(common()->Merge(2), control1, control2)); | 78 return Store(graph()->NewNode(common()->Merge(2), control1, control2)); |
75 } | 79 } |
76 | 80 |
77 Node* Loop2(Node* control) { | 81 Node* Loop2(Node* control) { |
78 return Store(graph()->NewNode(common()->Loop(2), control, control)); | 82 return Store(graph()->NewNode(common()->Loop(2), control, control)); |
79 } | 83 } |
80 | 84 |
81 Node* End(Node* control) { | 85 Node* End(Node* control) { |
82 return Store(graph()->NewNode(common()->End(1), control)); | 86 return Store(graph()->NewNode(common()->End(1), control)); |
(...skipping 17 matching lines...) Expand all Loading... |
100 TEST_F(ControlEquivalenceTest, Empty1) { | 104 TEST_F(ControlEquivalenceTest, Empty1) { |
101 Node* start = graph()->start(); | 105 Node* start = graph()->start(); |
102 ComputeEquivalence(start); | 106 ComputeEquivalence(start); |
103 | 107 |
104 ASSERT_EQUIVALENCE(start); | 108 ASSERT_EQUIVALENCE(start); |
105 } | 109 } |
106 | 110 |
107 | 111 |
108 TEST_F(ControlEquivalenceTest, Empty2) { | 112 TEST_F(ControlEquivalenceTest, Empty2) { |
109 Node* start = graph()->start(); | 113 Node* start = graph()->start(); |
110 Node* end = End(start); | 114 Node* merge1 = Merge1(start); |
111 ComputeEquivalence(end); | 115 ComputeEquivalence(merge1); |
112 | 116 |
113 ASSERT_EQUIVALENCE(start, end); | 117 ASSERT_EQUIVALENCE(start, merge1); |
114 } | 118 } |
115 | 119 |
116 | 120 |
117 TEST_F(ControlEquivalenceTest, Diamond1) { | 121 TEST_F(ControlEquivalenceTest, Diamond1) { |
118 Node* start = graph()->start(); | 122 Node* start = graph()->start(); |
119 Node* b = Branch(start); | 123 Node* b = Branch(start); |
120 Node* t = IfTrue(b); | 124 Node* t = IfTrue(b); |
121 Node* f = IfFalse(b); | 125 Node* f = IfFalse(b); |
122 Node* m = Merge2(t, f); | 126 Node* m = Merge2(t, f); |
123 ComputeEquivalence(m); | 127 ComputeEquivalence(m); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 ASSERT_EQUIVALENCE(t2); | 250 ASSERT_EQUIVALENCE(t2); |
247 ASSERT_EQUIVALENCE(f2); | 251 ASSERT_EQUIVALENCE(f2); |
248 ASSERT_EQUIVALENCE(f3); | 252 ASSERT_EQUIVALENCE(f3); |
249 ASSERT_EQUIVALENCE(lp); | 253 ASSERT_EQUIVALENCE(lp); |
250 } | 254 } |
251 | 255 |
252 | 256 |
253 } // namespace compiler | 257 } // namespace compiler |
254 } // namespace internal | 258 } // namespace internal |
255 } // namespace v8 | 259 } // namespace v8 |
OLD | NEW |