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, |