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 23 matching lines...) Expand all Loading... |
34 } | 34 } |
35 ControlEquivalence equivalence(zone(), graph()); | 35 ControlEquivalence equivalence(zone(), graph()); |
36 equivalence.Run(node); | 36 equivalence.Run(node); |
37 classes_.resize(graph()->NodeCount()); | 37 classes_.resize(graph()->NodeCount()); |
38 for (Node* node : all_nodes_) { | 38 for (Node* node : all_nodes_) { |
39 classes_[node->id()] = equivalence.ClassOf(node); | 39 classes_[node->id()] = equivalence.ClassOf(node); |
40 } | 40 } |
41 } | 41 } |
42 | 42 |
43 bool IsEquivalenceClass(size_t length, Node** nodes) { | 43 bool IsEquivalenceClass(size_t length, Node** nodes) { |
44 BitVector in_class(graph()->NodeCount(), zone()); | 44 BitVector in_class(static_cast<int>(graph()->NodeCount()), zone()); |
45 size_t expected_class = classes_[nodes[0]->id()]; | 45 size_t expected_class = classes_[nodes[0]->id()]; |
46 for (size_t i = 0; i < length; ++i) { | 46 for (size_t i = 0; i < length; ++i) { |
47 in_class.Add(nodes[i]->id()); | 47 in_class.Add(nodes[i]->id()); |
48 } | 48 } |
49 for (Node* node : all_nodes_) { | 49 for (Node* node : all_nodes_) { |
50 if (in_class.Contains(node->id())) { | 50 if (in_class.Contains(node->id())) { |
51 if (classes_[node->id()] != expected_class) return false; | 51 if (classes_[node->id()] != expected_class) return false; |
52 } else { | 52 } else { |
53 if (classes_[node->id()] == expected_class) return false; | 53 if (classes_[node->id()] == expected_class) return false; |
54 } | 54 } |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 ASSERT_EQUIVALENCE(t2); | 246 ASSERT_EQUIVALENCE(t2); |
247 ASSERT_EQUIVALENCE(f2); | 247 ASSERT_EQUIVALENCE(f2); |
248 ASSERT_EQUIVALENCE(f3); | 248 ASSERT_EQUIVALENCE(f3); |
249 ASSERT_EQUIVALENCE(lp); | 249 ASSERT_EQUIVALENCE(lp); |
250 } | 250 } |
251 | 251 |
252 | 252 |
253 } // namespace compiler | 253 } // namespace compiler |
254 } // namespace internal | 254 } // namespace internal |
255 } // namespace v8 | 255 } // namespace v8 |
OLD | NEW |