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

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

Issue 2139593002: [turbofan] Move TryCloneBranch in the EffectControlLinearizer pass. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update. Created 4 years, 5 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 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 Optimize(); 89 Optimize();
90 Capture<Node*> switch_capture; 90 Capture<Node*> switch_capture;
91 EXPECT_THAT( 91 EXPECT_THAT(
92 end(), 92 end(),
93 IsEnd(IsMerge(IsIfValue(0, CaptureEq(&switch_capture)), 93 IsEnd(IsMerge(IsIfValue(0, CaptureEq(&switch_capture)),
94 IsIfValue(1, CaptureEq(&switch_capture)), 94 IsIfValue(1, CaptureEq(&switch_capture)),
95 IsIfDefault(AllOf(CaptureEq(&switch_capture), 95 IsIfDefault(AllOf(CaptureEq(&switch_capture),
96 IsSwitch(index, IsIfSuccess(index))))))); 96 IsSwitch(index, IsIfSuccess(index)))))));
97 } 97 }
98 98
99
100 TEST_F(ControlFlowOptimizerTest, CloneBranch) {
101 Node* cond0 = Parameter(0);
102 Node* cond1 = Parameter(1);
103 Node* cond2 = Parameter(2);
104 Node* branch0 = graph()->NewNode(common()->Branch(), cond0, start());
105 Node* control1 = graph()->NewNode(common()->IfTrue(), branch0);
106 Node* control2 = graph()->NewNode(common()->IfFalse(), branch0);
107 Node* merge0 = graph()->NewNode(common()->Merge(2), control1, control2);
108 Node* phi0 = graph()->NewNode(common()->Phi(MachineRepresentation::kBit, 2),
109 cond1, cond2, merge0);
110 Node* branch = graph()->NewNode(common()->Branch(), phi0, merge0);
111 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
112 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
113 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false);
114 graph()->SetEnd(graph()->NewNode(common()->End(1), merge));
115 Optimize();
116 Capture<Node*> branch1_capture, branch2_capture;
117 EXPECT_THAT(
118 end(),
119 IsEnd(IsMerge(IsMerge(IsIfTrue(CaptureEq(&branch1_capture)),
120 IsIfTrue(CaptureEq(&branch2_capture))),
121 IsMerge(IsIfFalse(AllOf(CaptureEq(&branch1_capture),
122 IsBranch(cond1, control1))),
123 IsIfFalse(AllOf(CaptureEq(&branch2_capture),
124 IsBranch(cond2, control2)))))));
125 }
126
127 } // namespace compiler 99 } // namespace compiler
128 } // namespace internal 100 } // namespace internal
129 } // namespace v8 101 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/effect-control-linearizer.cc ('k') | test/unittests/compiler/effect-control-linearizer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698