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

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

Issue 1392933002: [Interpreter] Reduce temporary register usage in generated bytecode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove dead code. 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
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 a5cb12aceab8db2947e25f8178c25c7f934d9001..5fc2a6926073dfac5c21376c49bb7d5070fc7d57 100644
--- a/test/cctest/interpreter/test-bytecode-generator.cc
+++ b/test/cctest/interpreter/test-bytecode-generator.cc
@@ -75,6 +75,8 @@ class BytecodeGeneratorHelper {
#define B(x) static_cast<uint8_t>(Bytecode::k##x)
#define U8(x) static_cast<uint8_t>((x) & 0xff)
#define R(x) static_cast<uint8_t>(-(x) & 0xff)
+#define A(x, n) R(helper.kLastParamIndex - (n) + 1 + (x))
+#define THIS(n) A(0, n)
#define _ static_cast<uint8_t>(0x5a)
#if defined(V8_TARGET_LITTLE_ENDIAN)
#define U16(x) static_cast<uint8_t>((x) & 0xff), \
@@ -128,7 +130,7 @@ static void CheckConstant(InstanceType expected, Object* actual) {
template <typename T>
-static void CheckBytecodeArrayEqual(struct ExpectedSnippet<T> expected,
+static void CheckBytecodeArrayEqual(const ExpectedSnippet<T>& expected,
Handle<BytecodeArray> actual,
bool has_unknown = false) {
CHECK_EQ(actual->frame_size(), expected.frame_size);
@@ -229,158 +231,135 @@ TEST(PrimitiveExpressions) {
InitializedHandleScope handle_scope;
BytecodeGeneratorHelper helper;
- ExpectedSnippet<int> snippets[] = {
- {"var x = 0; return x;",
- kPointerSize,
- 1,
- 6,
- {B(LdaZero), //
- B(Star), R(0), //
- B(Ldar), R(0), //
- 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(Add), R(1), //
- 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,
- 13,
- {B(LdaSmi8), U8(10), //
- 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(ShiftLeft), R(1), //
- B(Return)},
- 0},
- {"var x = 10; return x >> 3;",
- 2 * kPointerSize,
- 1,
- 13,
- {B(LdaSmi8), U8(10), //
- 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(ShiftRight), R(1), //
- B(Return)},
- 0},
- {"var x = 10; return x >>> 3;",
- 2 * kPointerSize,
- 1,
- 13,
- {B(LdaSmi8), U8(10), //
- 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(ShiftRightLogical), R(1), //
- B(Return)},
- 0},
- {"var x = 0; return (x, 3);",
- 1 * kPointerSize,
- 1,
- 8,
- {B(LdaZero), //
- B(Star), R(0), //
- B(Ldar), R(0), //
- B(LdaSmi8), U8(3), //
- B(Return)},
- 0}};
+ ExpectedSnippet<int> snippets[] = {{"var x = 0; return x;",
+ kPointerSize,
+ 1,
+ 6,
+ {B(LdaZero), //
+ B(Star), R(0), //
+ B(Ldar), R(0), //
+ B(Return)},
+ 0},
+ {"var x = 0; return x + 3;",
+ kPointerSize,
+ 1,
+ 8,
+ {B(LdaZero), //
+ B(Star), R(0), //
+ B(LdaSmi8), U8(3), //
+ B(Add), R(0), //
+ B(Return)},
+ 0},
+ {"var x = 0; return x - 3;",
+ kPointerSize,
+ 1,
+ 8,
+ {B(LdaZero), //
+ B(Star), R(0), //
+ B(LdaSmi8), U8(3), //
+ B(Sub), R(0), //
+ B(Return)},
+ 0},
+ {"var x = 4; return x * 3;",
+ kPointerSize,
+ 1,
+ 9,
+ {B(LdaSmi8), U8(4), //
+ B(Star), R(0), //
+ B(LdaSmi8), U8(3), //
+ B(Mul), R(0), //
+ B(Return)},
+ 0},
+ {"var x = 4; return x / 3;",
+ kPointerSize,
+ 1,
+ 9,
+ {B(LdaSmi8), U8(4), //
+ B(Star), R(0), //
+ B(LdaSmi8), U8(3), //
+ B(Div), R(0), //
+ B(Return)},
+ 0},
+ {"var x = 4; return x % 3;",
+ kPointerSize,
+ 1,
+ 9,
+ {B(LdaSmi8), U8(4), //
+ B(Star), R(0), //
+ B(LdaSmi8), U8(3), //
+ B(Mod), R(0), //
+ B(Return)},
+ 0},
+ {"var x = 1; return x | 2;",
+ kPointerSize,
+ 1,
+ 9,
+ {B(LdaSmi8), U8(1), //
+ B(Star), R(0), //
+ B(LdaSmi8), U8(2), //
+ B(BitwiseOr), R(0), //
+ B(Return)},
+ 0},
+ {"var x = 1; return x ^ 2;",
+ kPointerSize,
+ 1,
+ 9,
+ {B(LdaSmi8), U8(1), //
+ B(Star), R(0), //
+ B(LdaSmi8), U8(2), //
+ B(BitwiseXor), R(0), //
+ B(Return)},
+ 0},
+ {"var x = 1; return x & 2;",
+ kPointerSize,
+ 1,
+ 9,
+ {B(LdaSmi8), U8(1), //
+ B(Star), R(0), //
+ B(LdaSmi8), U8(2), //
+ B(BitwiseAnd), R(0), //
+ B(Return)},
+ 0},
+ {"var x = 10; return x << 3;",
+ kPointerSize,
+ 1,
+ 9,
+ {B(LdaSmi8), U8(10), //
+ B(Star), R(0), //
+ B(LdaSmi8), U8(3), //
+ B(ShiftLeft), R(0), //
+ B(Return)},
+ 0},
+ {"var x = 10; return x >> 3;",
+ kPointerSize,
+ 1,
+ 9,
+ {B(LdaSmi8), U8(10), //
+ B(Star), R(0), //
+ B(LdaSmi8), U8(3), //
+ B(ShiftRight), R(0), //
+ B(Return)},
+ 0},
+ {"var x = 10; return x >>> 3;",
+ kPointerSize,
+ 1,
+ 9,
+ {B(LdaSmi8), U8(10), //
+ B(Star), R(0), //
+ B(LdaSmi8), U8(3), //
+ B(ShiftRightLogical), R(0), //
+ B(Return)},
+ 0},
+ {"var x = 0; return (x, 3);",
+ kPointerSize,
+ 1,
+ 8,
+ {B(LdaZero), //
+ B(Star), R(0), //
+ B(Ldar), R(0), //
+ B(LdaSmi8), U8(3), //
+ B(Return)},
+ 0}};
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -507,27 +486,51 @@ TEST(Parameters) {
ExpectedSnippet<int> snippets[] = {
{"function f() { return this; }",
- 0, 1, 3, {B(Ldar), R(helper.kLastParamIndex), B(Return)}, 0},
+ 0,
+ 1,
+ 3,
+ {B(Ldar), THIS(1), B(Return)},
+ 0},
{"function f(arg1) { return arg1; }",
- 0, 2, 3, {B(Ldar), R(helper.kLastParamIndex), B(Return)}, 0},
+ 0,
+ 2,
+ 3,
+ {B(Ldar), A(1, 2), B(Return)},
+ 0},
{"function f(arg1) { return this; }",
- 0, 2, 3, {B(Ldar), R(helper.kLastParamIndex - 1), B(Return)}, 0},
+ 0,
+ 2,
+ 3,
+ {B(Ldar), THIS(2), B(Return)},
+ 0},
{"function f(arg1, arg2, arg3, arg4, arg5, arg6, arg7) { return arg4; }",
- 0, 8, 3, {B(Ldar), R(helper.kLastParamIndex - 3), B(Return)}, 0},
+ 0,
+ 8,
+ 3,
+ {B(Ldar), A(4, 8), B(Return)},
+ 0},
{"function f(arg1, arg2, arg3, arg4, arg5, arg6, arg7) { return this; }",
- 0, 8, 3, {B(Ldar), R(helper.kLastParamIndex - 7), B(Return)}, 0},
+ 0,
+ 8,
+ 3,
+ {B(Ldar), THIS(8), B(Return)},
+ 0},
{"function f(arg1) { arg1 = 1; }",
- 0, 2, 6,
- {B(LdaSmi8), U8(1), //
- B(Star), R(helper.kLastParamIndex), //
- B(LdaUndefined), //
+ 0,
+ 2,
+ 6,
+ {B(LdaSmi8), U8(1), //
+ B(Star), A(1, 2), //
+ B(LdaUndefined), //
B(Return)},
0},
{"function f(arg1, arg2, arg3, arg4) { arg2 = 1; }",
- 0, 5, 6,
- {B(LdaSmi8), U8(1), //
- B(Star), R(helper.kLastParamIndex - 2), //
- B(LdaUndefined), //
+ 0,
+ 5,
+ 6,
+ {B(LdaSmi8), U8(1), //
+ B(Star), A(2, 5), //
+ B(LdaUndefined), //
B(Return)},
0},
};
@@ -697,104 +700,88 @@ TEST(PropertyLoads) {
ExpectedSnippet<const char*> snippets[] = {
{"function f(a) { return a.name; }\nf({name : \"test\"})",
- 1 * kPointerSize,
+ 0,
2,
- 10,
+ 6,
{
- B(Ldar), R(helper.kLastParamIndex), //
- B(Star), R(0), //
- B(LdaConstant), U8(0), //
- B(LoadICSloppy), R(0), U8(vector->GetIndex(slot1)), //
- B(Return) //
+ B(LdaConstant), U8(0), //
+ B(LoadICSloppy), A(1, 2), U8(vector->GetIndex(slot1)), //
+ B(Return), //
},
1,
{"name"}},
{"function f(a) { return a[\"key\"]; }\nf({key : \"test\"})",
- 1 * kPointerSize,
+ 0,
2,
- 10,
+ 6,
{
- B(Ldar), R(helper.kLastParamIndex), //
- B(Star), R(0), //
- B(LdaConstant), U8(0), //
- B(LoadICSloppy), R(0), U8(vector->GetIndex(slot1)), //
- B(Return) //
+ B(LdaConstant), U8(0), //
+ B(LoadICSloppy), A(1, 2), U8(vector->GetIndex(slot1)), //
+ B(Return) //
},
1,
{"key"}},
{"function f(a) { return a[100]; }\nf({100 : \"test\"})",
- 1 * kPointerSize,
+ 0,
2,
- 10,
+ 6,
{
- B(Ldar), R(helper.kLastParamIndex), //
- B(Star), R(0), //
- B(LdaSmi8), U8(100), //
- B(KeyedLoadICSloppy), R(0), U8(vector->GetIndex(slot1)), //
- B(Return) //
+ B(LdaSmi8), U8(100), //
+ B(KeyedLoadICSloppy), A(1, 2), U8(vector->GetIndex(slot1)), //
+ B(Return) //
},
0},
{"function f(a, b) { return a[b]; }\nf({arg : \"test\"}, \"arg\")",
- 1 * kPointerSize,
+ 0,
3,
- 10,
+ 6,
{
- B(Ldar), R(helper.kLastParamIndex - 1), //
- B(Star), R(0), //
- B(Ldar), R(helper.kLastParamIndex), //
- B(KeyedLoadICSloppy), R(0), U8(vector->GetIndex(slot1)), //
- B(Return) //
+ B(Ldar), A(1, 2), //
+ B(KeyedLoadICSloppy), A(1, 3), U8(vector->GetIndex(slot1)), //
+ B(Return) //
},
0},
{"function f(a) { var b = a.name; return a[-124]; }\n"
"f({\"-124\" : \"test\", name : 123 })",
- 2 * kPointerSize,
+ kPointerSize,
2,
- 21,
+ 13,
{
- B(Ldar), R(helper.kLastParamIndex), //
- B(Star), R(1), //
- B(LdaConstant), U8(0), //
- B(LoadICSloppy), R(1), U8(vector->GetIndex(slot1)), //
- B(Star), R(0), //
- B(Ldar), R(helper.kLastParamIndex), //
- B(Star), R(1), //
- B(LdaSmi8), U8(-124), //
- B(KeyedLoadICSloppy), R(1), U8(vector->GetIndex(slot2)), //
- B(Return) //
+ B(LdaConstant), U8(0), //
+ B(LoadICSloppy), A(1, 2), U8(vector->GetIndex(slot1)), //
+ B(Star), R(0), //
+ B(LdaSmi8), U8(-124), //
+ B(KeyedLoadICSloppy), A(1, 2), U8(vector->GetIndex(slot2)), //
+ B(Return), //
},
1,
{"name"}},
{"function f(a) { \"use strict\"; return a.name; }\nf({name : \"test\"})",
- 1 * kPointerSize,
+ 0,
2,
- 12,
+ 8,
{
// TODO(rmcilroy) Avoid unnecessary LdaConstant for "use strict"
// expression, or any other unused literal expression.
- B(LdaConstant), U8(0), //
- B(Ldar), R(helper.kLastParamIndex), //
- B(Star), R(0), //
- B(LdaConstant), U8(1), //
- B(LoadICStrict), R(0), U8(vector->GetIndex(slot1)), //
- B(Return) //
+ B(LdaConstant), U8(0), //
+ B(LdaConstant), U8(1), //
+ B(LoadICStrict), A(1, 2), U8(vector->GetIndex(slot1)), //
+ B(Return), //
},
2,
{"use strict", "name"}},
{"function f(a, b) { \"use strict\"; return a[b]; }\n"
"f({arg : \"test\"}, \"arg\")",
- 1 * kPointerSize,
+ 0,
3,
- 12,
+ 8,
{
// TODO(rmcilroy) Avoid unnecessary LdaConstant for "use strict"
// expression, or any other unused literal expression.
- B(LdaConstant), U8(0), //
- B(Ldar), R(helper.kLastParamIndex - 1), //
- B(Star), R(0), //
- B(Ldar), R(helper.kLastParamIndex), //
- B(KeyedLoadICStrict), R(0), U8(vector->GetIndex(slot1)), //
- B(Return) //
+ B(LdaConstant), U8(0), //
+ B(Ldar), A(2, 3), //
+ B(KeyedLoadICStrict), A(1, 3), U8(vector->GetIndex(slot1)), //
+ B(Return), //
},
1,
{"use strict"}}};
@@ -820,126 +807,109 @@ TEST(PropertyStores) {
ExpectedSnippet<const char*> snippets[] = {
{"function f(a) { a.name = \"val\"; }\nf({name : \"test\"})",
- 2 * kPointerSize,
+ kPointerSize,
2,
- 16,
+ 12,
{
- B(Ldar), R(helper.kLastParamIndex), //
- B(Star), R(0), //
- B(LdaConstant), U8(0), //
- B(Star), R(1), //
- B(LdaConstant), U8(1), //
- B(StoreICSloppy), R(0), R(1), U8(vector->GetIndex(slot1)), //
- B(LdaUndefined), //
- B(Return) //
+ B(LdaConstant), U8(0), //
+ B(Star), R(0), //
+ B(LdaConstant), U8(1), //
+ B(StoreICSloppy), A(1, 2), R(0), U8(vector->GetIndex(slot1)), //
+ B(LdaUndefined), //
+ B(Return), //
},
2,
{"name", "val"}},
{"function f(a) { a[\"key\"] = \"val\"; }\nf({key : \"test\"})",
- 2 * kPointerSize,
+ kPointerSize,
2,
- 16,
+ 12,
{
- B(Ldar), R(helper.kLastParamIndex), //
- B(Star), R(0), //
- B(LdaConstant), U8(0), //
- B(Star), R(1), //
- B(LdaConstant), U8(1), //
- B(StoreICSloppy), R(0), R(1), U8(vector->GetIndex(slot1)), //
- B(LdaUndefined), //
- B(Return) //
+ B(LdaConstant), U8(0), //
+ B(Star), R(0), //
+ B(LdaConstant), U8(1), //
+ B(StoreICSloppy), A(1, 2), R(0), U8(vector->GetIndex(slot1)), //
+ B(LdaUndefined), //
+ B(Return), //
},
2,
{"key", "val"}},
{"function f(a) { a[100] = \"val\"; }\nf({100 : \"test\"})",
- 2 * kPointerSize,
+ kPointerSize,
2,
- 16,
+ 12,
{
- B(Ldar), R(helper.kLastParamIndex), //
- B(Star), R(0), //
- B(LdaSmi8), U8(100), //
- B(Star), R(1), //
- B(LdaConstant), U8(0), //
- B(KeyedStoreICSloppy), R(0), R(1), U8(vector->GetIndex(slot1)), //
- B(LdaUndefined), //
- B(Return) //
+ B(LdaSmi8), U8(100), //
+ B(Star), R(0), //
+ B(LdaConstant), U8(0), //
+ B(KeyedStoreICSloppy), A(1, 2), R(0), //
+ U8(vector->GetIndex(slot1)), //
rmcilroy 2015/10/19 12:56:23 nit - indent operands (and below) - I can't find a
oth 2015/10/20 15:28:53 Done.
+ B(LdaUndefined), //
+ B(Return), //
},
1,
{"val"}},
{"function f(a, b) { a[b] = \"val\"; }\nf({arg : \"test\"}, \"arg\")",
- 2 * kPointerSize,
+ 0,
3,
- 16,
+ 8,
{
- B(Ldar), R(helper.kLastParamIndex - 1), //
- B(Star), R(0), //
- B(Ldar), R(helper.kLastParamIndex), //
- B(Star), R(1), //
- B(LdaConstant), U8(0), //
- B(KeyedStoreICSloppy), R(0), R(1), U8(vector->GetIndex(slot1)), //
- B(LdaUndefined), //
- B(Return) //
+ B(LdaConstant), U8(0), //
+ B(KeyedStoreICSloppy), A(1, 3), A(2, 3), //
+ U8(vector->GetIndex(slot1)), //
+ B(LdaUndefined), //
+ B(Return), //
},
1,
{"val"}},
{"function f(a) { a.name = a[-124]; }\n"
"f({\"-124\" : \"test\", name : 123 })",
- 3 * kPointerSize,
+ kPointerSize,
2,
- 23,
+ 15,
{
- B(Ldar), R(helper.kLastParamIndex), //
- B(Star), R(0), //
- B(LdaConstant), U8(0), //
- B(Star), R(1), //
- B(Ldar), R(helper.kLastParamIndex), //
- B(Star), R(2), //
- B(LdaSmi8), U8(-124), //
- B(KeyedLoadICSloppy), R(2), U8(vector->GetIndex(slot1)), //
- B(StoreICSloppy), R(0), R(1), U8(vector->GetIndex(slot2)), //
- B(LdaUndefined), //
- B(Return) //
+ B(LdaConstant), U8(0), //
+ B(Star), R(0), //
+ B(LdaSmi8), U8(-124), //
+ B(KeyedLoadICSloppy), A(1, 2), U8(vector->GetIndex(slot1)), //
+ B(StoreICSloppy), A(1, 2), R(0), U8(vector->GetIndex(slot2)), //
+ B(LdaUndefined), //
+ B(Return), //
},
1,
{"name"}},
{"function f(a) { \"use strict\"; a.name = \"val\"; }\n"
"f({name : \"test\"})",
- 2 * kPointerSize,
+ kPointerSize,
2,
- 18,
+ 14,
{
// TODO(rmcilroy) Avoid unnecessary LdaConstant for "use strict"
// expression, or any other unused literal expression.
- B(LdaConstant), U8(0), //
- B(Ldar), R(helper.kLastParamIndex), //
- B(Star), R(0), //
- B(LdaConstant), U8(1), //
- B(Star), R(1), //
- B(LdaConstant), U8(2), //
- B(StoreICStrict), R(0), R(1), U8(vector->GetIndex(slot1)), //
- B(LdaUndefined), //
- B(Return) //
+ B(LdaConstant), U8(0), //
+ B(LdaConstant), U8(1), //
+ B(Star), R(0), //
+ B(LdaConstant), U8(2), //
+ B(StoreICStrict), A(1, 2), R(0), U8(vector->GetIndex(slot1)), //
+ B(LdaUndefined), //
+ B(Return), //
},
3,
{"use strict", "name", "val"}},
{"function f(a, b) { \"use strict\"; a[b] = \"val\"; }\n"
"f({arg : \"test\"}, \"arg\")",
- 2 * kPointerSize,
+ 0,
3,
- 18,
+ 10,
{
// TODO(rmcilroy) Avoid unnecessary LdaConstant for "use strict"
// expression, or any other unused literal expression.
- B(LdaConstant), U8(0), //
- B(Ldar), R(helper.kLastParamIndex - 1), //
- B(Star), R(0), //
- B(Ldar), R(helper.kLastParamIndex), //
- B(Star), R(1), //
- B(LdaConstant), U8(1), //
- B(KeyedStoreICStrict), R(0), R(1), U8(vector->GetIndex(slot1)), //
- B(LdaUndefined), //
- B(Return) //
+ B(LdaConstant), U8(0), //
+ B(LdaConstant), U8(1), //
+ B(KeyedStoreICStrict), A(1, 3), A(2, 3), //
+ U8(vector->GetIndex(slot1)), //
+ B(LdaUndefined), //
+ B(Return), //
},
2,
{"use strict", "val"}}};
@@ -973,13 +943,13 @@ TEST(PropertyCall) {
2,
16,
{
- B(Ldar), R(helper.kLastParamIndex), //
+ B(Ldar), A(1, 2), //
B(Star), R(1), //
B(LdaConstant), U8(0), //
B(LoadICSloppy), R(1), U8(vector->GetIndex(slot2)), //
B(Star), R(0), //
B(Call), R(0), R(1), U8(0), //
- B(Return) //
+ B(Return), //
},
1,
{"func"}},
@@ -988,14 +958,14 @@ TEST(PropertyCall) {
4,
24,
{
- B(Ldar), R(helper.kLastParamIndex - 2), //
+ B(Ldar), A(1, 4), //
B(Star), R(1), //
B(LdaConstant), U8(0), //
B(LoadICSloppy), R(1), U8(vector->GetIndex(slot2)), //
B(Star), R(0), //
- B(Ldar), R(helper.kLastParamIndex - 1), //
+ B(Ldar), A(2, 4), //
B(Star), R(2), //
- B(Ldar), R(helper.kLastParamIndex), //
+ B(Ldar), A(3, 4), //
B(Star), R(3), //
B(Call), R(0), R(1), U8(2), //
B(Return) //
@@ -1005,19 +975,17 @@ TEST(PropertyCall) {
{"function f(a, b) { return a.func(b + b, b); }\nf(" FUNC_ARG ", 1)",
4 * kPointerSize,
3,
- 30,
+ 26,
{
- B(Ldar), R(helper.kLastParamIndex - 1), //
+ B(Ldar), A(1, 3), //
B(Star), R(1), //
B(LdaConstant), U8(0), //
B(LoadICSloppy), R(1), U8(vector->GetIndex(slot2)), //
B(Star), R(0), //
- B(Ldar), R(helper.kLastParamIndex), //
- B(Star), R(3), //
- B(Ldar), R(helper.kLastParamIndex), //
- B(Add), R(3), //
+ B(Ldar), A(2, 3), //
+ B(Add), A(2, 3), //
B(Star), R(2), //
- B(Ldar), R(helper.kLastParamIndex), //
+ B(Ldar), A(2, 3), //
B(Star), R(3), //
B(Call), R(0), R(1), U8(2), //
B(Return), //
@@ -1294,7 +1262,7 @@ TEST(CallRuntime) {
2,
10,
{
- B(Ldar), R(helper.kLastParamIndex), //
+ B(Ldar), A(1, 2), //
B(Star), R(0), //
B(CallRuntime), U16(Runtime::kIsArray), R(0), U8(1), //
B(Return) //
@@ -1381,39 +1349,35 @@ TEST(IfConditions) {
{unused, unused, unused, unused, unused, unused}},
{"function f(a) { if (a <= 0) { return 200; } else { return -200; } }"
"f(99);",
- kPointerSize,
+ 0,
2,
- 19,
- {B(Ldar), R(helper.kLastParamIndex), //
- B(Star), R(0), //
- B(LdaZero), //
- B(TestLessThanOrEqual), R(0), //
- B(JumpIfFalse), U8(7), //
- B(LdaConstant), U8(0), //
- B(Return), //
- B(Jump), U8(5), //
- B(LdaConstant), U8(1), //
- B(Return), //
- B(LdaUndefined), //
- B(Return)}, //
+ 15,
+ {B(LdaZero), //
+ B(TestLessThanOrEqual), A(1, 2), //
+ B(JumpIfFalse), U8(7), //
+ B(LdaConstant), U8(0), //
+ B(Return), //
+ B(Jump), U8(5), //
+ B(LdaConstant), U8(1), //
+ B(Return), //
+ B(LdaUndefined), //
+ B(Return)}, //
2,
{helper.factory()->NewNumberFromInt(200),
helper.factory()->NewNumberFromInt(-200), unused, unused, unused,
unused}},
{"function f(a, b) { if (a in b) { return 200; } }"
"f('prop', { prop: 'yes'});",
- kPointerSize,
+ 0,
3,
- 15,
- {B(Ldar), R(helper.kLastParamIndex - 1), //
- B(Star), R(0), //
- B(Ldar), R(helper.kLastParamIndex), //
- B(TestIn), R(0), //
- B(JumpIfFalse), U8(5), //
- B(LdaConstant), U8(0), //
- B(Return), //
- B(LdaUndefined), //
- B(Return)}, //
+ 11,
+ {B(Ldar), A(2, 3), //
+ B(TestIn), A(1, 3), //
+ B(JumpIfFalse), U8(5), //
+ B(LdaConstant), U8(0), //
+ B(Return), //
+ B(LdaUndefined), //
+ B(Return)}, //
1,
{helper.factory()->NewNumberFromInt(200), unused, unused, unused, unused,
unused}},
@@ -1422,34 +1386,34 @@ TEST(IfConditions) {
X X X X X X X X X X X X X X X X X X X X X X X X
#undef X
" return 200; } else { return -200; } } f(0.001)",
- 3 * kPointerSize,
+ 2 * kPointerSize,
2,
- 218,
- {B(LdaZero), //
- B(Star), R(0), //
- B(LdaZero), //
- B(Star), R(1), //
- B(Ldar), R(0), //
- B(Star), R(2), //
- B(LdaConstant), U8(0), //
- B(TestEqualStrict), R(2), //
- B(JumpIfFalseConstant), U8(2), //
-#define X B(Ldar), R(0), B(Star), R(1), B(Ldar), R(1), B(Star), R(0),
- X X X X X X X X X X X X X X X X X X X X X X X X
+ 214,
+ {
+#define X B(Ldar), R(0), B(Star), R(1), B(Ldar), R(1), B(Star), R(0)
+ B(LdaZero), //
+ B(Star), R(0), //
+ B(LdaZero), //
+ B(Star), R(1), //
+ B(LdaConstant), U8(0), //
+ B(TestEqualStrict), R(0), //
+ B(JumpIfFalseConstant), U8(2), //
+ X, X, X, X, X, X, X, X, X, X, //
+ X, X, X, X, X, X, X, X, X, X, //
+ X, X, X, X, //
+ B(LdaConstant), U8(1), //
+ B(Return), //
+ B(Jump), U8(5), //
+ B(LdaConstant), U8(3), //
+ B(Return), //
+ B(LdaUndefined), //
+ B(Return)}, //
#undef X
- B(LdaConstant), U8(1), //
- B(Return), //
- B(Jump), U8(5), //
- B(LdaConstant), U8(3), //
- B(Return), //
- B(LdaUndefined), //
- B(Return)}, //
4,
{helper.factory()->NewHeapNumber(0.01),
helper.factory()->NewNumberFromInt(200),
helper.factory()->NewNumberFromInt(199),
- helper.factory()->NewNumberFromInt(-200),
- unused, unused}},
+ helper.factory()->NewNumberFromInt(-200), unused, unused}},
{"function f(a, b) {\n"
" if (a == b) { return 1; }\n"
" if (a === b) { return 1; }\n"
@@ -1459,22 +1423,18 @@ TEST(IfConditions) {
" if (a >= b) { return 1; }\n"
" if (a in b) { return 1; }\n"
" if (a instanceof b) { return 1; }\n"
- " /* if (a != b) { return 1; } */" // TODO(oth) Ast visitor yields
- " /* if (a !== b) { return 1; } */" // UNARY NOT, rather than !=/!==.
" return 0;\n"
"} f(1, 1);",
- kPointerSize,
+ 0,
3,
- 106,
+ 74,
{
#define IF_CONDITION_RETURN(condition) \
- B(Ldar), R(helper.kLastParamIndex - 1), \
- B(Star), R(0), \
- B(Ldar), R(helper.kLastParamIndex), \
- B(condition), R(0), \
- B(JumpIfFalse), U8(5), \
- B(LdaSmi8), U8(1), \
- B(Return),
+ B(Ldar), A(2, 3), \
+ B(condition), A(1, 3), \
+ B(JumpIfFalse), U8(5), \
+ B(LdaSmi8), U8(1), \
+ B(Return),
IF_CONDITION_RETURN(TestEqual) //
IF_CONDITION_RETURN(TestEqualStrict) //
IF_CONDITION_RETURN(TestLessThan) //
@@ -1483,9 +1443,9 @@ TEST(IfConditions) {
IF_CONDITION_RETURN(TestGreaterThanOrEqual) //
IF_CONDITION_RETURN(TestIn) //
IF_CONDITION_RETURN(TestInstanceOf) //
+ B(LdaZero), //
+ B(Return)}, //
#undef IF_CONDITION_RETURN
- B(LdaZero), //
- B(Return)}, //
0,
{unused, unused, unused, unused, unused, unused}},
};
@@ -1508,31 +1468,29 @@ TEST(DeclareGlobals) {
1,
45,
{
- B(Ldar), R(Register::function_closure().index()), //
- B(Star), R(2), //
- B(LdaConstant), U8(0), //
- B(Star), R(3), //
- B(CallRuntime), U16(Runtime::kNewScriptContext), R(2), U8(2), //
- B(PushContext), R(1), //
- B(LdaConstant), U8(1), //
- B(Star), R(2), //
- B(LdaZero), //
- B(Star), R(3), //
- B(CallRuntime), U16(Runtime::kDeclareGlobals), R(2), U8(2), //
- B(LdaConstant), U8(2), //
- B(Star), R(2), //
- B(LdaZero), //
- B(Star), R(3), //
- B(LdaSmi8), U8(1), //
- B(Star), R(4), //
- B(CallRuntime), U16(Runtime::kInitializeVarGlobal), R(2), //
- U8(3), //
- B(LdaUndefined), //
- B(Return) //
+ B(Ldar), R(Register::function_closure().index()), //
+ B(Star), R(2), //
+ B(LdaConstant), U8(0), //
+ B(Star), R(3), //
+ B(CallRuntime), U16(Runtime::kNewScriptContext), R(2), U8(2), //
+ B(PushContext), R(1), //
+ B(LdaConstant), U8(1), //
+ B(Star), R(2), //
+ B(LdaZero), //
+ B(Star), R(3), //
+ B(CallRuntime), U16(Runtime::kDeclareGlobals), R(2), U8(2), //
+ B(LdaConstant), U8(2), //
+ B(Star), R(2), //
+ B(LdaZero), //
+ B(Star), R(3), //
+ B(LdaSmi8), U8(1), //
+ B(Star), R(4), //
+ B(CallRuntime), U16(Runtime::kInitializeVarGlobal), R(2), U8(3), //
+ B(LdaUndefined), //
+ B(Return), //
},
3,
- {InstanceType::FIXED_ARRAY_TYPE,
- InstanceType::FIXED_ARRAY_TYPE,
+ {InstanceType::FIXED_ARRAY_TYPE, InstanceType::FIXED_ARRAY_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}},
{"function f() {}",
3 * kPointerSize,
@@ -1578,7 +1536,7 @@ TEST(DeclareGlobals) {
B(LdaSmi8), U8(1), //
B(Star), R(4), //
B(CallRuntime), U16(Runtime::kInitializeVarGlobal), R(2), //
- U8(3), //
+ U8(3), //
B(LdaSmi8), U8(2), //
B(StaGlobalSloppy), _, //
B(Star), R(0), //
@@ -1586,8 +1544,7 @@ TEST(DeclareGlobals) {
B(Return) //
},
3,
- {InstanceType::FIXED_ARRAY_TYPE,
- InstanceType::FIXED_ARRAY_TYPE,
+ {InstanceType::FIXED_ARRAY_TYPE, InstanceType::FIXED_ARRAY_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}},
{"function f() {}\nf();",
4 * kPointerSize,
@@ -1634,34 +1591,28 @@ TEST(BasicLoops) {
{"var x = 0;"
"var y = 1;"
"while (x < 10) {"
- " y = y * 10;"
+ " y = y * 12;"
" x = x + 1;"
"}"
"return y;",
- 3 * kPointerSize,
+ 2 * kPointerSize,
1,
- 42,
+ 30,
{
B(LdaZero), //
B(Star), R(0), //
B(LdaSmi8), U8(1), //
B(Star), R(1), //
- B(Jump), U8(22), //
- B(Ldar), R(1), //
- B(Star), R(2), //
- B(LdaSmi8), U8(10), //
- B(Mul), R(2), //
+ B(Jump), U8(14), //
+ B(LdaSmi8), U8(12), //
+ B(Mul), R(1), //
B(Star), R(1), //
- B(Ldar), R(0), //
- B(Star), R(2), //
B(LdaSmi8), U8(1), //
- B(Add), R(2), //
+ B(Add), R(0), //
B(Star), R(0), //
- B(Ldar), R(0), //
- B(Star), R(2), //
B(LdaSmi8), U8(10), //
- B(TestLessThan), R(2), //
- B(JumpIfTrue), U8(-28), //
+ B(TestLessThan), R(0), //
+ B(JumpIfTrue), U8(-16), //
B(Ldar), R(1), //
B(Return), //
},
@@ -1676,52 +1627,40 @@ TEST(BasicLoops) {
" i = i + 1;"
"}"
"return i;",
- 2 * kPointerSize,
+ 1 * kPointerSize,
1,
- 80,
+ 56,
{
B(LdaZero), //
B(Star), R(0), //
- B(Jump), U8(71), //
- B(Ldar), R(0), //
- B(Star), R(1), //
+ B(Jump), U8(47), //
B(LdaZero), //
- B(TestLessThan), R(1), //
+ B(TestLessThan), R(0), //
B(JumpIfFalse), U8(4), //
- B(Jump), U8(60), //
- B(Ldar), R(0), //
- B(Star), R(1), //
+ B(Jump), U8(40), //
B(LdaSmi8), U8(3), //
- B(TestEqual), R(1), //
+ B(TestEqual), R(0), //
B(JumpIfFalse), U8(4), //
- B(Jump), U8(51), //
- B(Ldar), R(0), //
- B(Star), R(1), //
+ B(Jump), U8(35), //
B(LdaSmi8), U8(4), //
- B(TestEqual), R(1), //
+ B(TestEqual), R(0), //
B(JumpIfFalse), U8(4), //
- B(Jump), U8(39), //
- B(Ldar), R(0), //
- B(Star), R(1), //
+ B(Jump), U8(27), //
B(LdaSmi8), U8(10), //
- B(TestEqual), R(1), //
+ B(TestEqual), R(0), //
B(JumpIfFalse), U8(4), //
- B(Jump), U8(24), //
- B(Ldar), R(0), //
- B(Star), R(1), //
+ B(Jump), U8(16), //
B(LdaSmi8), U8(5), //
- B(TestEqual), R(1), //
+ B(TestEqual), R(0), //
B(JumpIfFalse), U8(4), //
- B(Jump), U8(15), //
- B(Ldar), R(0), //
- B(Star), R(1), //
+ B(Jump), U8(11), //
B(LdaSmi8), U8(1), //
- B(Add), R(1), //
+ B(Add), R(0), //
B(Star), R(0), //
B(LdaTrue), //
- B(JumpIfTrue), U8(-70), //
+ B(JumpIfTrue), U8(-46), //
B(Ldar), R(0), //
- B(Return) //
+ B(Return), //
},
0},
{"var x = 0; var y = 1;"
@@ -1732,43 +1671,33 @@ TEST(BasicLoops) {
" x = x + 1;"
"} while (x < 10);"
"return y;",
- 3 * kPointerSize,
+ 2 * kPointerSize,
1,
- 64,
+ 44,
{
B(LdaZero), //
B(Star), R(0), //
B(LdaSmi8), U8(1), //
B(Star), R(1), //
- B(Ldar), R(1), //
- B(Star), R(2), //
B(LdaSmi8), U8(10), //
- B(Mul), R(2), //
+ B(Mul), R(1), //
B(Star), R(1), //
- B(Ldar), R(0), //
- B(Star), R(2), //
B(LdaSmi8), U8(5), //
- B(TestEqual), R(2), //
+ B(TestEqual), R(0), //
B(JumpIfFalse), U8(4), //
- B(Jump), U8(34), //
- B(Ldar), R(0), //
- B(Star), R(2), //
+ B(Jump), U8(22), //
B(LdaSmi8), U8(6), //
- B(TestEqual), R(2), //
+ B(TestEqual), R(0), //
B(JumpIfFalse), U8(4), //
- B(Jump), U8(12), //
- B(Ldar), R(0), //
- B(Star), R(2), //
+ B(Jump), U8(8), //
B(LdaSmi8), U8(1), //
- B(Add), R(2), //
+ B(Add), R(0), //
B(Star), R(0), //
- B(Ldar), R(0), //
- B(Star), R(2), //
B(LdaSmi8), U8(10), //
- B(TestLessThan), R(2), //
- B(JumpIfTrue), U8(-52), //
+ B(TestLessThan), R(0), //
+ B(JumpIfTrue), U8(-32), //
B(Ldar), R(1), //
- B(Return) //
+ B(Return), //
},
0},
{"var x = 0; "
@@ -1776,24 +1705,20 @@ TEST(BasicLoops) {
" if (x == 1) break;"
" x = x + 1;"
"}",
- 2 * kPointerSize,
+ 1 * kPointerSize,
1,
- 29,
+ 21,
{
B(LdaZero), //
B(Star), R(0), //
- B(Ldar), R(0), //
- B(Star), R(1), //
B(LdaSmi8), U8(1), //
- B(TestEqual), R(1), //
+ B(TestEqual), R(0), //
B(JumpIfFalse), U8(4), //
- B(Jump), U8(14), //
- B(Ldar), R(0), //
- B(Star), R(1), //
+ B(Jump), U8(10), //
B(LdaSmi8), U8(1), //
- B(Add), R(1), //
+ B(Add), R(0), //
B(Star), R(0), //
- B(Jump), U8(-22), //
+ B(Jump), U8(-14), //
B(LdaUndefined), //
B(Return), //
},
@@ -1803,31 +1728,25 @@ TEST(BasicLoops) {
" u = u + 1;"
" continue;"
"}",
- 3 * kPointerSize,
+ 2 * kPointerSize,
1,
- 42,
+ 30,
{
B(LdaZero), //
B(Star), R(0), //
B(LdaZero), //
B(Star), R(1), //
- B(Jump), U8(24), //
- B(Ldar), R(0), //
- B(Star), R(2), //
+ B(Jump), U8(16), //
B(LdaSmi8), U8(1), //
- B(Add), R(2), //
+ B(Add), R(0), //
B(Star), R(0), //
B(Jump), U8(2), //
- B(Ldar), R(1), //
- B(Star), R(2), //
B(LdaSmi8), U8(1), //
- B(Add), R(2), //
+ B(Add), R(1), //
B(Star), R(1), //
- B(Ldar), R(1), //
- B(Star), R(2), //
B(LdaSmi8), U8(100), //
- B(TestLessThan), R(2), //
- B(JumpIfTrue), U8(-30), //
+ B(TestLessThan), R(1), //
+ B(JumpIfTrue), U8(-18), //
B(LdaUndefined), //
B(Return), //
},
@@ -1842,38 +1761,30 @@ TEST(BasicLoops) {
" break;"
"}"
"return i;",
- 2 * kPointerSize,
+ 1 * kPointerSize,
1,
- 57,
+ 41,
{
B(LdaZero), //
B(Star), R(0), //
- B(Jump), U8(48), //
- B(Jump), U8(24), //
- B(Ldar), R(0), //
- B(Star), R(1), //
+ B(Jump), U8(32), //
+ B(Jump), U8(16), //
B(LdaSmi8), U8(2), //
- B(TestEqual), R(1), //
+ B(TestEqual), R(0), //
B(JumpIfFalse), U8(4), //
- B(Jump), U8(22), //
- B(Ldar), R(0), //
- B(Star), R(1), //
+ B(Jump), U8(14), //
B(LdaSmi8), U8(1), //
- B(Add), R(1), //
+ B(Add), R(0), //
B(Star), R(0), //
- B(Ldar), R(0), //
- B(Star), R(1), //
B(LdaSmi8), U8(3), //
- B(TestLessThan), R(1), //
- B(JumpIfTrue), U8(-30), //
- B(Ldar), R(0), //
- B(Star), R(1), //
+ B(TestLessThan), R(0), //
+ B(JumpIfTrue), U8(-18), //
B(LdaSmi8), U8(1), //
- B(Add), R(1), //
+ B(Add), R(0), //
B(Star), R(0), //
B(Jump), U8(5), //
B(LdaTrue), //
- B(JumpIfTrue), U8(-47), //
+ B(JumpIfTrue), U8(-31), //
B(Ldar), R(0), //
B(Return), //
},
@@ -1898,24 +1809,20 @@ TEST(UnaryOperators) {
" x = x + 10;"
"}"
"return x;",
- 2 * kPointerSize,
+ kPointerSize,
1,
- 29,
+ 21,
{
B(LdaZero), //
B(Star), R(0), //
- B(Jump), U8(12), //
- B(Ldar), R(0), //
- B(Star), R(1), //
+ B(Jump), U8(8), //
B(LdaSmi8), U8(10), //
- B(Add), R(1), //
+ B(Add), R(0), //
B(Star), R(0), //
- B(Ldar), R(0), //
- B(Star), R(1), //
B(LdaSmi8), U8(10), //
- B(TestEqual), R(1), //
+ B(TestEqual), R(0), //
B(LogicalNot), //
- B(JumpIfTrue), U8(-19), //
+ B(JumpIfTrue), U8(-11), //
B(Ldar), R(0), //
B(Return), //
},
@@ -1925,36 +1832,32 @@ TEST(UnaryOperators) {
" x = !x;"
"} while(x == false);"
"return x;",
- 2 * kPointerSize,
+ kPointerSize,
1,
- 20,
+ 16,
{
- B(LdaFalse), //
- B(Star), R(0), //
- B(Ldar), R(0), //
- B(LogicalNot), //
- B(Star), R(0), //
- B(Ldar), R(0), //
- B(Star), R(1), //
- B(LdaFalse), //
- B(TestEqual), R(1), //
- B(JumpIfTrue), U8(-12), //
- B(Ldar), R(0), //
- B(Return), //
+ B(LdaFalse), //
+ B(Star), R(0), //
+ B(Ldar), R(0), //
+ B(LogicalNot), //
+ B(Star), R(0), //
+ B(LdaFalse), //
+ B(TestEqual), R(0), //
+ B(JumpIfTrue), U8(-8), //
+ B(Ldar), R(0), //
+ B(Return), //
},
0},
{"var x = 101;"
"return void(x * 3);",
- 2 * kPointerSize,
+ kPointerSize,
1,
- 14,
+ 10,
{
B(LdaSmi8), U8(101), //
B(Star), R(0), //
- B(Ldar), R(0), //
- B(Star), R(1), //
B(LdaSmi8), U8(3), //
- B(Mul), R(1), //
+ B(Mul), R(0), //
B(LdaUndefined), //
B(Return), //
},
@@ -1962,16 +1865,14 @@ TEST(UnaryOperators) {
{"var x = 1234;"
"var y = void (x * x - 1);"
"return y;",
- 4 * kPointerSize,
+ 3 * kPointerSize,
1,
- 24,
+ 20,
{
B(LdaConstant), U8(0), //
B(Star), R(0), //
B(Ldar), R(0), //
- B(Star), R(3), //
- B(Ldar), R(0), //
- B(Mul), R(3), //
+ B(Mul), R(0), //
B(Star), R(2), //
B(LdaSmi8), U8(1), //
B(Sub), R(2), //
@@ -1984,14 +1885,14 @@ TEST(UnaryOperators) {
{1234}},
{"var x = 13;"
"return typeof(x);",
- 1 * kPointerSize,
+ kPointerSize,
1,
8,
{
B(LdaSmi8), U8(13), //
B(Star), R(0), //
- B(Ldar), R(0), //
- B(TypeOf), //
+ B(Ldar), R(0), // TODO(oth): Ldar R(X) following Star R(X)
+ B(TypeOf), // could be culled in bytecode array builder.
rmcilroy 2015/10/19 12:56:23 nit - move comment up one line (on Star and Ldar)
oth 2015/10/20 15:28:53 Done.
B(Return), //
},
0},
@@ -2161,9 +2062,9 @@ TEST(ArrayLiterals) {
1,
{InstanceType::FIXED_ARRAY_TYPE}},
{"var a = 1; return [ a, a + 1 ];",
- 4 * kPointerSize,
+ 3 * kPointerSize,
1,
- 39,
+ 35,
{
B(LdaSmi8), U8(1), //
B(Star), R(0), //
@@ -2176,13 +2077,11 @@ TEST(ArrayLiterals) {
B(KeyedStoreICSloppy), R(2), R(1), U8(vector->GetIndex(slot1)), //
B(LdaSmi8), U8(1), //
B(Star), R(1), //
- B(Ldar), R(0), //
- B(Star), R(3), //
B(LdaSmi8), U8(1), //
- B(Add), R(3), //
+ B(Add), R(0), //
B(KeyedStoreICSloppy), R(2), R(1), U8(vector->GetIndex(slot1)), //
B(Ldar), R(2), //
- B(Return) //
+ B(Return), //
},
1,
{InstanceType::FIXED_ARRAY_TYPE}},
@@ -2198,9 +2097,9 @@ TEST(ArrayLiterals) {
1,
{InstanceType::FIXED_ARRAY_TYPE}},
{"var a = 1; return [ [ a, 2 ], [ a + 2 ] ];",
- 6 * kPointerSize,
+ 5 * kPointerSize,
1,
- 71,
+ 67,
{
B(LdaSmi8), U8(1), //
B(Star), R(0), //
@@ -2225,10 +2124,8 @@ TEST(ArrayLiterals) {
B(Star), R(4), //
B(LdaZero), //
B(Star), R(3), //
- B(Ldar), R(0), //
- B(Star), R(5), //
B(LdaSmi8), U8(2), //
- B(Add), R(5), //
+ B(Add), R(0), //
B(KeyedStoreICSloppy), R(4), R(3), U8(vector->GetIndex(slot2)), //
B(Ldar), R(4), //
B(KeyedStoreICSloppy), R(2), R(1), U8(vector->GetIndex(slot3)), //
@@ -2301,9 +2198,9 @@ TEST(ObjectLiterals) {
{InstanceType::FIXED_ARRAY_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}},
{"var a = 1; return { val: a, val: a + 1 };",
- 4 * kPointerSize,
+ 3 * kPointerSize,
1,
- 32,
+ 28,
{
B(LdaSmi8), U8(1), //
B(Star), R(0), //
@@ -2313,10 +2210,8 @@ TEST(ObjectLiterals) {
B(Ldar), R(0), //
B(LdaConstant), U8(1), //
B(Star), R(2), //
- B(Ldar), R(0), //
- B(Star), R(3), //
B(LdaSmi8), U8(1), //
- B(Add), R(3), //
+ B(Add), R(0), //
B(StoreICSloppy), R(1), R(2), U8(3), //
B(Ldar), R(1), //
B(Return), //
@@ -2382,7 +2277,7 @@ TEST(ObjectLiterals) {
B(LdaZero), //
B(Star), R(4), //
B(CallRuntime), U16(Runtime::kDefineAccessorPropertyUnchecked), //
- R(0), U8(5), //
+ R(0), U8(5), //
B(Ldar), R(0), //
B(Return), //
},
@@ -2409,7 +2304,7 @@ TEST(ObjectLiterals) {
B(LdaZero), //
B(Star), R(4), //
B(CallRuntime), U16(Runtime::kDefineAccessorPropertyUnchecked), //
- R(0), U8(5), //
+ R(0), U8(5), //
B(Ldar), R(0), //
B(Return), //
},
@@ -2436,7 +2331,7 @@ TEST(ObjectLiterals) {
B(LdaZero), //
B(Star), R(4), //
B(CallRuntime), U16(Runtime::kDefineAccessorPropertyUnchecked), //
- R(0), U8(5), //
+ R(0), U8(5), //
B(Ldar), R(0), //
B(Return), //
},
@@ -2499,7 +2394,7 @@ TEST(ObjectLiterals) {
B(LdaZero), //
B(Star), R(4), //
B(CallRuntime), U16(Runtime::kDefineDataPropertyUnchecked), R(1), //
- U8(4), //
+ U8(4), //
B(Ldar), R(1), //
B(Return), //
},
@@ -2528,7 +2423,7 @@ TEST(ObjectLiterals) {
B(LdaZero), //
B(Star), R(4), //
B(CallRuntime), U16(Runtime::kDefineDataPropertyUnchecked), R(1), //
- U8(4), //
+ U8(4), //
B(Ldar), R(1), //
B(Return), //
},
@@ -2554,7 +2449,7 @@ TEST(ObjectLiterals) {
B(LdaZero), //
B(Star), R(4), //
B(CallRuntime), U16(Runtime::kDefineDataPropertyUnchecked), R(1), //
- U8(4), //
+ U8(4), //
B(LdaConstant), U8(1), //
B(CreateObjectLiteral), U8(0), U8(13), //
B(Star), R(2), //
@@ -2583,7 +2478,7 @@ TEST(ObjectLiterals) {
B(LdaZero), //
B(Star), R(4), //
B(CallRuntime), U16(Runtime::kDefineDataPropertyUnchecked), R(1), //
- U8(4), //
+ U8(4), //
B(LdaConstant), U8(3), //
B(ToName), //
B(Star), R(2), //
@@ -2593,7 +2488,7 @@ TEST(ObjectLiterals) {
B(LdaZero), //
B(Star), R(4), //
B(CallRuntime), U16(Runtime::kDefineGetterPropertyUnchecked), //
- R(1), U8(4), //
+ R(1), U8(4), //
B(LdaConstant), U8(3), //
B(ToName), //
B(Star), R(2), //
@@ -2603,7 +2498,7 @@ TEST(ObjectLiterals) {
B(LdaZero), //
B(Star), R(4), //
B(CallRuntime), U16(Runtime::kDefineSetterPropertyUnchecked), //
- R(1), U8(4), //
+ R(1), U8(4), //
B(Ldar), R(1), //
B(Return), //
},
@@ -2665,11 +2560,10 @@ TEST(TopLevelObjectLiterals) {
B(Star), R(4), //
B(CallRuntime), U16(Runtime::kInitializeVarGlobal), R(2), U8(3), //
B(LdaUndefined), //
- B(Return), //
+ B(Return),
},
6,
- {InstanceType::FIXED_ARRAY_TYPE,
- InstanceType::FIXED_ARRAY_TYPE,
+ {InstanceType::FIXED_ARRAY_TYPE, InstanceType::FIXED_ARRAY_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::FIXED_ARRAY_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
@@ -2691,7 +2585,7 @@ TEST(TryCatch) {
// TODO(rmcilroy): modify tests when we have real try catch support.
ExpectedSnippet<int> snippets[] = {
{"try { return 1; } catch(e) { return 2; }",
- 1 * kPointerSize,
+ kPointerSize,
1,
5,
{
@@ -2718,7 +2612,7 @@ TEST(TryFinally) {
// TODO(rmcilroy): modify tests when we have real try finally support.
ExpectedSnippet<int> snippets[] = {
{"var a = 1; try { a = 2; } finally { a = 3; }",
- 1 * kPointerSize,
+ kPointerSize,
1,
14,
{

Powered by Google App Engine
This is Rietveld 408576698