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

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

Issue 1422333003: [turbofan] optimize redundant moves around splinter sites (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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 | « src/compiler/move-optimizer.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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 Optimize(); 200 Optimize();
201 201
202 CHECK(gap_0->AreMovesRedundant()); 202 CHECK(gap_0->AreMovesRedundant());
203 CHECK(gap_1->AreMovesRedundant()); 203 CHECK(gap_1->AreMovesRedundant());
204 auto move = last->parallel_moves()[0]; 204 auto move = last->parallel_moves()[0];
205 CHECK_EQ(2, NonRedundantSize(move)); 205 CHECK_EQ(2, NonRedundantSize(move));
206 CHECK(Contains(move, Reg(0), Reg(1))); 206 CHECK(Contains(move, Reg(0), Reg(1)));
207 CHECK(Contains(move, Reg(1), Reg(0))); 207 CHECK(Contains(move, Reg(1), Reg(0)));
208 } 208 }
209 209
210
211 TEST_F(MoveOptimizerTest, GapsCanMoveOverInstruction) {
212 StartBlock();
213 int const_index = 1;
214 DefineConstant(const_index);
215 Instruction* ctant_def = LastInstruction();
216 AddMove(ctant_def, Reg(1), Reg(0));
217
218 Instruction* last = EmitNop();
219 AddMove(last, Const(const_index), Reg(0));
220 AddMove(last, Reg(0), Reg(1));
221 EndBlock(Last());
222 Optimize();
223
224 ParallelMove* inst1_start =
225 ctant_def->GetParallelMove(Instruction::GapPosition::START);
226 ParallelMove* inst1_end =
227 ctant_def->GetParallelMove(Instruction::GapPosition::END);
228 ParallelMove* last_start =
229 last->GetParallelMove(Instruction::GapPosition::START);
230 CHECK(inst1_start == nullptr || inst1_start->size() == 0);
Jarin 2015/10/29 14:53:14 Nit: In unit tests, we should always use EXPECT (o
231 CHECK(inst1_end == nullptr || inst1_end->size() == 0);
232 CHECK(last_start->size() == 2);
233 int redundants = 0;
234 int assignment = 0;
235 for (MoveOperands* move : *last_start) {
236 if (move->IsRedundant()) {
237 ++redundants;
238 } else {
239 ++assignment;
240 CHECK(move->destination().IsRegister());
241 CHECK(move->source().IsConstant());
242 }
243 }
244 CHECK_EQ(1, redundants);
245 CHECK_EQ(1, assignment);
246 }
247
248
210 } // namespace compiler 249 } // namespace compiler
211 } // namespace internal 250 } // namespace internal
212 } // namespace v8 251 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/move-optimizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698