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

Side by Side Diff: test/unittests/compiler/control-equivalence-unittest.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 unified diff | Download patch
OLDNEW
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"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 namespace compiler { 14 namespace compiler {
15 15
16 #define ASSERT_EQUIVALENCE(...) \ 16 #define ASSERT_EQUIVALENCE(...) \
17 do { \ 17 do { \
18 Node* __n[] = {__VA_ARGS__}; \ 18 Node* __n[] = {__VA_ARGS__}; \
19 ASSERT_TRUE(IsEquivalenceClass(arraysize(__n), __n)); \ 19 ASSERT_TRUE(IsEquivalenceClass(arraysize(__n), __n)); \
20 } while (false) 20 } while (false)
21 21
22 class ControlEquivalenceTest : public GraphTest { 22 class ControlEquivalenceTest : public GraphTest {
23 public: 23 public:
24 ControlEquivalenceTest() : all_nodes_(zone()), classes_(zone()) { 24 ControlEquivalenceTest() : all_nodes_(zone()), classes_(zone()) {
25 Store(graph()->start()); 25 Store(graph()->start());
26 } 26 }
27 27
28 protected: 28 protected:
29 void ComputeEquivalence(Node* node) { 29 void ComputeEquivalence(Node* node) {
30 graph()->SetEnd(graph()->NewNode(common()->End(), node)); 30 graph()->SetEnd(graph()->NewNode(common()->End(1), node));
31 if (FLAG_trace_turbo) { 31 if (FLAG_trace_turbo) {
32 OFStream os(stdout); 32 OFStream os(stdout);
33 os << AsDOT(*graph()); 33 os << AsDOT(*graph());
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 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 Node* Merge2(Node* control1, Node* control2) { 73 Node* Merge2(Node* control1, Node* control2) {
74 return Store(graph()->NewNode(common()->Merge(2), control1, control2)); 74 return Store(graph()->NewNode(common()->Merge(2), control1, control2));
75 } 75 }
76 76
77 Node* Loop2(Node* control) { 77 Node* Loop2(Node* control) {
78 return Store(graph()->NewNode(common()->Loop(2), control, control)); 78 return Store(graph()->NewNode(common()->Loop(2), control, control));
79 } 79 }
80 80
81 Node* End(Node* control) { 81 Node* End(Node* control) {
82 return Store(graph()->NewNode(common()->End(), control)); 82 return Store(graph()->NewNode(common()->End(1), control));
83 } 83 }
84 84
85 private: 85 private:
86 Node* Store(Node* node) { 86 Node* Store(Node* node) {
87 all_nodes_.push_back(node); 87 all_nodes_.push_back(node);
88 return node; 88 return node;
89 } 89 }
90 90
91 ZoneVector<Node*> all_nodes_; 91 ZoneVector<Node*> all_nodes_;
92 ZoneVector<size_t> classes_; 92 ZoneVector<size_t> classes_;
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698