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

Unified 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, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/move-optimizer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/compiler/move-optimizer-unittest.cc
diff --git a/test/unittests/compiler/move-optimizer-unittest.cc b/test/unittests/compiler/move-optimizer-unittest.cc
index 9a31d2f770753d3bc17f318431cfb2b09df83b05..66eb9abc4f802b17e70df84c1dbf97b58f3f6244 100644
--- a/test/unittests/compiler/move-optimizer-unittest.cc
+++ b/test/unittests/compiler/move-optimizer-unittest.cc
@@ -207,6 +207,45 @@ TEST_F(MoveOptimizerTest, SimpleMergeCycle) {
CHECK(Contains(move, Reg(1), Reg(0)));
}
+
+TEST_F(MoveOptimizerTest, GapsCanMoveOverInstruction) {
+ StartBlock();
+ int const_index = 1;
+ DefineConstant(const_index);
+ Instruction* ctant_def = LastInstruction();
+ AddMove(ctant_def, Reg(1), Reg(0));
+
+ Instruction* last = EmitNop();
+ AddMove(last, Const(const_index), Reg(0));
+ AddMove(last, Reg(0), Reg(1));
+ EndBlock(Last());
+ Optimize();
+
+ ParallelMove* inst1_start =
+ ctant_def->GetParallelMove(Instruction::GapPosition::START);
+ ParallelMove* inst1_end =
+ ctant_def->GetParallelMove(Instruction::GapPosition::END);
+ ParallelMove* last_start =
+ last->GetParallelMove(Instruction::GapPosition::START);
+ 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
+ CHECK(inst1_end == nullptr || inst1_end->size() == 0);
+ CHECK(last_start->size() == 2);
+ int redundants = 0;
+ int assignment = 0;
+ for (MoveOperands* move : *last_start) {
+ if (move->IsRedundant()) {
+ ++redundants;
+ } else {
+ ++assignment;
+ CHECK(move->destination().IsRegister());
+ CHECK(move->source().IsConstant());
+ }
+ }
+ CHECK_EQ(1, redundants);
+ CHECK_EQ(1, assignment);
+}
+
+
} // namespace compiler
} // namespace internal
} // namespace v8
« 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