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

Side by Side Diff: test/unittests/compiler/control-flow-optimizer-unittest.cc

Issue 1513543003: [turbofan] Make MachineType a pair of enums. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Moar rebase Created 5 years 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 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 #include "src/compiler/js-operator.h" 6 #include "src/compiler/js-operator.h"
7 #include "src/compiler/machine-operator.h" 7 #include "src/compiler/machine-operator.h"
8 #include "test/unittests/compiler/graph-unittest.h" 8 #include "test/unittests/compiler/graph-unittest.h"
9 #include "test/unittests/compiler/node-test-utils.h" 9 #include "test/unittests/compiler/node-test-utils.h"
10 #include "testing/gmock-support.h" 10 #include "testing/gmock-support.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 99
100 TEST_F(ControlFlowOptimizerTest, CloneBranch) { 100 TEST_F(ControlFlowOptimizerTest, CloneBranch) {
101 Node* cond0 = Parameter(0); 101 Node* cond0 = Parameter(0);
102 Node* cond1 = Parameter(1); 102 Node* cond1 = Parameter(1);
103 Node* cond2 = Parameter(2); 103 Node* cond2 = Parameter(2);
104 Node* branch0 = graph()->NewNode(common()->Branch(), cond0, start()); 104 Node* branch0 = graph()->NewNode(common()->Branch(), cond0, start());
105 Node* control1 = graph()->NewNode(common()->IfTrue(), branch0); 105 Node* control1 = graph()->NewNode(common()->IfTrue(), branch0);
106 Node* control2 = graph()->NewNode(common()->IfFalse(), branch0); 106 Node* control2 = graph()->NewNode(common()->IfFalse(), branch0);
107 Node* merge0 = graph()->NewNode(common()->Merge(2), control1, control2); 107 Node* merge0 = graph()->NewNode(common()->Merge(2), control1, control2);
108 Node* phi0 = 108 Node* phi0 = graph()->NewNode(common()->Phi(MachineRepresentation::kBit, 2),
109 graph()->NewNode(common()->Phi(kRepBit, 2), cond1, cond2, merge0); 109 cond1, cond2, merge0);
110 Node* branch = graph()->NewNode(common()->Branch(), phi0, merge0); 110 Node* branch = graph()->NewNode(common()->Branch(), phi0, merge0);
111 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); 111 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
112 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); 112 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
113 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false); 113 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
114 graph()->SetEnd(graph()->NewNode(common()->End(1), merge)); 114 graph()->SetEnd(graph()->NewNode(common()->End(1), merge));
115 Optimize(); 115 Optimize();
116 Capture<Node*> branch1_capture, branch2_capture; 116 Capture<Node*> branch1_capture, branch2_capture;
117 EXPECT_THAT( 117 EXPECT_THAT(
118 end(), 118 end(),
119 IsEnd(IsMerge(IsMerge(IsIfTrue(CaptureEq(&branch1_capture)), 119 IsEnd(IsMerge(IsMerge(IsIfTrue(CaptureEq(&branch1_capture)),
120 IsIfTrue(CaptureEq(&branch2_capture))), 120 IsIfTrue(CaptureEq(&branch2_capture))),
121 IsMerge(IsIfFalse(AllOf(CaptureEq(&branch1_capture), 121 IsMerge(IsIfFalse(AllOf(CaptureEq(&branch1_capture),
122 IsBranch(cond1, control1))), 122 IsBranch(cond1, control1))),
123 IsIfFalse(AllOf(CaptureEq(&branch2_capture), 123 IsIfFalse(AllOf(CaptureEq(&branch2_capture),
124 IsBranch(cond2, control2))))))); 124 IsBranch(cond2, control2)))))));
125 } 125 }
126 126
127 } // namespace compiler 127 } // namespace compiler
128 } // namespace internal 128 } // namespace internal
129 } // namespace v8 129 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/common-operator-unittest.cc ('k') | test/unittests/compiler/dead-code-elimination-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698