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

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

Issue 1116923002: [test] make instruction sequence test emit cfgs more like the scheduler (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
« no previous file with comments | « test/unittests/compiler/instruction-sequence-unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/compiler/move-optimizer.h" 5 #include "src/compiler/move-optimizer.h"
6 #include "test/unittests/compiler/instruction-sequence-unittest.h" 6 #include "test/unittests/compiler/instruction-sequence-unittest.h"
7 7
8 namespace v8 { 8 namespace v8 {
9 namespace internal { 9 namespace internal {
10 namespace compiler { 10 namespace compiler {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 EndBlock(Jump(2)); 129 EndBlock(Jump(2));
130 AddMove(LastInstruction(), Reg(0), Reg(1)); 130 AddMove(LastInstruction(), Reg(0), Reg(1));
131 131
132 StartBlock(); 132 StartBlock();
133 EndBlock(Jump(1)); 133 EndBlock(Jump(1));
134 AddMove(LastInstruction(), Reg(0), Reg(1)); 134 AddMove(LastInstruction(), Reg(0), Reg(1));
135 135
136 StartBlock(); 136 StartBlock();
137 EndBlock(Last()); 137 EndBlock(Last());
138 138
139 auto last = LastInstruction();
140
139 Optimize(); 141 Optimize();
140 142
141 auto move = LastInstruction()->parallel_moves()[0]; 143 auto move = last->parallel_moves()[0];
142 CHECK_EQ(1, NonRedundantSize(move)); 144 CHECK_EQ(1, NonRedundantSize(move));
143 CHECK(Contains(move, Reg(0), Reg(1))); 145 CHECK(Contains(move, Reg(0), Reg(1)));
144 } 146 }
145 147
146 148
147 TEST_F(MoveOptimizerTest, SimpleMergeCycle) { 149 TEST_F(MoveOptimizerTest, SimpleMergeCycle) {
148 StartBlock(); 150 StartBlock();
149 EndBlock(Branch(Imm(), 1, 2)); 151 EndBlock(Branch(Imm(), 1, 2));
150 152
151 StartBlock(); 153 StartBlock();
152 EndBlock(Jump(2)); 154 EndBlock(Jump(2));
153 auto gap_0 = LastInstruction(); 155 auto gap_0 = LastInstruction();
154 AddMove(gap_0, Reg(0), Reg(1)); 156 AddMove(gap_0, Reg(0), Reg(1));
155 AddMove(LastInstruction(), Reg(1), Reg(0)); 157 AddMove(LastInstruction(), Reg(1), Reg(0));
156 158
157 StartBlock(); 159 StartBlock();
158 EndBlock(Jump(1)); 160 EndBlock(Jump(1));
159 auto gap_1 = LastInstruction(); 161 auto gap_1 = LastInstruction();
160 AddMove(gap_1, Reg(0), Reg(1)); 162 AddMove(gap_1, Reg(0), Reg(1));
161 AddMove(gap_1, Reg(1), Reg(0)); 163 AddMove(gap_1, Reg(1), Reg(0));
162 164
163 StartBlock(); 165 StartBlock();
164 EndBlock(Last()); 166 EndBlock(Last());
165 167
168 auto last = LastInstruction();
169
166 Optimize(); 170 Optimize();
167 171
168 CHECK(gap_0->AreMovesRedundant()); 172 CHECK(gap_0->AreMovesRedundant());
169 CHECK(gap_1->AreMovesRedundant()); 173 CHECK(gap_1->AreMovesRedundant());
170 auto move = LastInstruction()->parallel_moves()[0]; 174 auto move = last->parallel_moves()[0];
171 CHECK_EQ(2, NonRedundantSize(move)); 175 CHECK_EQ(2, NonRedundantSize(move));
172 CHECK(Contains(move, Reg(0), Reg(1))); 176 CHECK(Contains(move, Reg(0), Reg(1)));
173 CHECK(Contains(move, Reg(1), Reg(0))); 177 CHECK(Contains(move, Reg(1), Reg(0)));
174 } 178 }
175 179
176 } // namespace compiler 180 } // namespace compiler
177 } // namespace internal 181 } // namespace internal
178 } // namespace v8 182 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/instruction-sequence-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698