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

Unified Diff: test/unittests/interpreter/bytecode-peephole-optimizer-unittest.cc

Issue 2161563002: Revert of [interpeter] Move to table based peephole optimizer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/interpreter/bytecode_expectations/LetVariable.golden ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/interpreter/bytecode-peephole-optimizer-unittest.cc
diff --git a/test/unittests/interpreter/bytecode-peephole-optimizer-unittest.cc b/test/unittests/interpreter/bytecode-peephole-optimizer-unittest.cc
index c3548252a7ff25c7832612787254161d4f162f05..168e0a732294f72182cffc104807a5268447de5e 100644
--- a/test/unittests/interpreter/bytecode-peephole-optimizer-unittest.cc
+++ b/test/unittests/interpreter/bytecode-peephole-optimizer-unittest.cc
@@ -134,10 +134,12 @@
TEST_F(BytecodePeepholeOptimizerTest, KeepJumpIfToBooleanTrue) {
BytecodeNode first(Bytecode::kLdaNull);
BytecodeNode second(Bytecode::kJumpIfToBooleanTrue, 3);
- BytecodeLabel label;
- optimizer()->Write(&first);
- CHECK_EQ(write_count(), 0);
- optimizer()->WriteJump(&second, &label);
+ optimizer()->Write(&first);
+ CHECK_EQ(write_count(), 0);
+ optimizer()->Write(&second);
+ CHECK_EQ(write_count(), 1);
+ CHECK_EQ(last_written(), first);
+ Flush();
CHECK_EQ(write_count(), 2);
CHECK_EQ(last_written(), second);
}
@@ -145,12 +147,15 @@
TEST_F(BytecodePeepholeOptimizerTest, ElideJumpIfToBooleanTrue) {
BytecodeNode first(Bytecode::kLdaTrue);
BytecodeNode second(Bytecode::kJumpIfToBooleanTrue, 3);
- BytecodeLabel label;
- optimizer()->Write(&first);
- CHECK_EQ(write_count(), 0);
- optimizer()->WriteJump(&second, &label);
- CHECK_EQ(write_count(), 2);
- CHECK_EQ(last_written(), second);
+ optimizer()->Write(&first);
+ CHECK_EQ(write_count(), 0);
+ optimizer()->Write(&second);
+ CHECK_EQ(write_count(), 1);
+ CHECK_EQ(last_written(), first);
+ Flush();
+ CHECK_EQ(write_count(), 2);
+ CHECK_EQ(last_written().bytecode(), Bytecode::kJumpIfTrue);
+ CHECK_EQ(last_written().operand(0), second.operand(0));
}
TEST_F(BytecodePeepholeOptimizerTest, KeepToBooleanLogicalNot) {
@@ -199,11 +204,12 @@
BytecodeNode first(Bytecode::kStar, Register(0).ToOperand());
BytecodeNode second(Bytecode::kLdar, Register(0).ToOperand());
optimizer()->Write(&first);
- optimizer()->Write(&second);
- CHECK_EQ(write_count(), 0);
- Flush();
- CHECK_EQ(write_count(), 1);
- CHECK_EQ(last_written(), first);
+ CHECK_EQ(write_count(), 0);
+ optimizer()->Write(&second);
+ CHECK_EQ(write_count(), 1);
+ CHECK_EQ(last_written(), first);
+ Flush();
+ CHECK_EQ(write_count(), 1);
}
TEST_F(BytecodePeepholeOptimizerTest, StarRxLdarRxStatement) {
@@ -256,10 +262,11 @@
BytecodeNode first(Bytecode::kToName);
BytecodeNode second(Bytecode::kToName);
optimizer()->Write(&first);
- optimizer()->Write(&second);
- CHECK_EQ(write_count(), 0);
- Flush();
- CHECK_EQ(last_written(), first);
+ CHECK_EQ(write_count(), 0);
+ optimizer()->Write(&second);
+ CHECK_EQ(write_count(), 1);
+ CHECK_EQ(last_written(), first);
+ Flush();
CHECK_EQ(write_count(), 1);
}
@@ -267,11 +274,12 @@
BytecodeNode first(Bytecode::kTypeOf);
BytecodeNode second(Bytecode::kToName);
optimizer()->Write(&first);
- optimizer()->Write(&second);
- CHECK_EQ(write_count(), 0);
- Flush();
- CHECK_EQ(write_count(), 1);
- CHECK_EQ(last_written(), first);
+ CHECK_EQ(write_count(), 0);
+ optimizer()->Write(&second);
+ CHECK_EQ(write_count(), 1);
+ CHECK_EQ(last_written(), first);
+ Flush();
+ CHECK_EQ(write_count(), 1);
}
TEST_F(BytecodePeepholeOptimizerTest, LdaConstantStringToName) {
@@ -281,11 +289,12 @@
BytecodeNode first(Bytecode::kLdaConstant, static_cast<uint32_t>(index));
BytecodeNode second(Bytecode::kToName);
optimizer()->Write(&first);
- optimizer()->Write(&second);
- CHECK_EQ(write_count(), 0);
- Flush();
- CHECK_EQ(write_count(), 1);
- CHECK_EQ(last_written(), first);
+ CHECK_EQ(write_count(), 0);
+ optimizer()->Write(&second);
+ CHECK_EQ(write_count(), 1);
+ CHECK_EQ(last_written(), first);
+ Flush();
+ CHECK_EQ(write_count(), 1);
}
TEST_F(BytecodePeepholeOptimizerTest, LdaConstantNumberToName) {
« no previous file with comments | « test/cctest/interpreter/bytecode_expectations/LetVariable.golden ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698