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

Unified Diff: test/cctest/interpreter/test-bytecode-generator.cc

Issue 1386133002: [Interpreter] Add bitwise operators (Or, Xor, And) to interpreter (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebased the patch 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/interpreter/interpreter.cc ('k') | test/cctest/interpreter/test-interpreter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/interpreter/test-bytecode-generator.cc
diff --git a/test/cctest/interpreter/test-bytecode-generator.cc b/test/cctest/interpreter/test-bytecode-generator.cc
index 424a12049b249f1e916a939be5dfed703b799a5f..ab85a76206a46fd60140e0f76970e2543e08322d 100644
--- a/test/cctest/interpreter/test-bytecode-generator.cc
+++ b/test/cctest/interpreter/test-bytecode-generator.cc
@@ -251,6 +251,104 @@ TEST(PrimitiveExpressions) {
B(Return) //
},
0},
+ {"var x = 0; return x - 3;",
+ 2 * kPointerSize,
+ 1,
+ 12,
+ {
+ B(LdaZero), //
+ B(Star), R(0), //
+ B(Ldar), R(0), // Easy to spot r1 not really needed here.
+ B(Star), R(1), // Dead store.
+ B(LdaSmi8), U8(3), //
+ B(Sub), R(1), //
+ B(Return) //
+ },
+ 0},
+ {"var x = 4; return x * 3;",
+ 2 * kPointerSize,
+ 1,
+ 13,
+ {
+ B(LdaSmi8), U8(4), //
+ B(Star), R(0), //
+ B(Ldar), R(0), // Easy to spot r1 not really needed here.
+ B(Star), R(1), // Dead store.
+ B(LdaSmi8), U8(3), //
+ B(Mul), R(1), //
+ B(Return) //
+ },
+ 0},
+ {"var x = 4; return x / 3;",
+ 2 * kPointerSize,
+ 1,
+ 13,
+ {
+ B(LdaSmi8), U8(4), //
+ B(Star), R(0), //
+ B(Ldar), R(0), // Easy to spot r1 not really needed here.
+ B(Star), R(1), // Dead store.
+ B(LdaSmi8), U8(3), //
+ B(Div), R(1), //
+ B(Return) //
+ },
+ 0},
+ {"var x = 4; return x % 3;",
+ 2 * kPointerSize,
+ 1,
+ 13,
+ {
+ B(LdaSmi8), U8(4), //
+ B(Star), R(0), //
+ B(Ldar), R(0), // Easy to spot r1 not really needed here.
+ B(Star), R(1), // Dead store.
+ B(LdaSmi8), U8(3), //
+ B(Mod), R(1), //
+ B(Return) //
+ },
+ 0},
+ {"var x = 1; return x | 2;",
+ 2 * kPointerSize,
+ 1,
+ 13,
+ {
+ B(LdaSmi8), U8(1), //
+ B(Star), R(0), //
+ B(Ldar), R(0), // Easy to spot r1 not really needed here.
+ B(Star), R(1), // Dead store.
+ B(LdaSmi8), U8(2), //
+ B(BitwiseOr), R(1), //
+ B(Return) //
+ },
+ 0},
+ {"var x = 1; return x ^ 2;",
+ 2 * kPointerSize,
+ 1,
+ 13,
+ {
+ B(LdaSmi8), U8(1), //
+ B(Star), R(0), //
+ B(Ldar), R(0), // Easy to spot r1 not really needed here.
+ B(Star), R(1), // Dead store.
+ B(LdaSmi8), U8(2), //
+ B(BitwiseXor), R(1), //
+ B(Return) //
+ },
+ 0},
+ {"var x = 1; return x & 2;",
+ 2 * kPointerSize,
+ 1,
+ 13,
+ {
+ B(LdaSmi8), U8(1), //
+ B(Star), R(0), //
+ B(Ldar), R(0), // Easy to spot r1 not really needed here.
+ B(Star), R(1), // Dead store.
+ B(LdaSmi8), U8(2), //
+ B(BitwiseAnd), R(1), //
+ B(Return) //
+ },
+ 0},
{"var x = 10; return x << 3;",
2 * kPointerSize,
1,
« no previous file with comments | « src/interpreter/interpreter.cc ('k') | test/cctest/interpreter/test-interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698