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

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

Issue 1503963002: [Interpreter] Adds wide variant of CreateLiterals. Adds CreateLiterals to BytecodeGraphBuilder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: renamed BuildLiteral to BuildCreateLiteral. Created 5 years 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 673766d698f1dffd07e5205c80555b2f088e27c4..b52b7534b66b0d3bd33bf569e5382e3d30fe2594 100644
--- a/test/cctest/interpreter/test-bytecode-generator.cc
+++ b/test/cctest/interpreter/test-bytecode-generator.cc
@@ -1604,12 +1604,11 @@ TEST(CallRuntime) {
"function f() { return %spread_iterable([1]) }\nf()",
2 * kPointerSize,
1,
- 16,
+ 15,
{
B(LdaUndefined), //
B(Star), R(0), //
- B(LdaConstant), U8(0), //
- B(CreateArrayLiteral), U8(0), U8(3), //
+ B(CreateArrayLiteral), U8(0), U8(0), U8(3), //
B(Star), R(1), //
B(CallJSRuntime), U16(Context::SPREAD_ITERABLE_INDEX), R(0), //
U8(1), //
@@ -2607,13 +2606,12 @@ TEST(Delete) {
{"var a = {x:13, y:14}; return delete a.x;",
1 * kPointerSize,
1,
- 12,
+ 11,
{
- B(LdaConstant), U8(0), //
- B(CreateObjectLiteral), U8(0), U8(deep_elements_flags), //
- B(Star), R(0), //
- B(LdaConstant), U8(1), //
- B(DeletePropertySloppy), R(0), //
+ B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
+ B(Star), R(0), //
+ B(LdaConstant), U8(1), //
+ B(DeletePropertySloppy), R(0), //
B(Return)
},
2,
@@ -2622,13 +2620,12 @@ TEST(Delete) {
{"'use strict'; var a = {x:13, y:14}; return delete a.x;",
1 * kPointerSize,
1,
- 12,
+ 11,
{
- B(LdaConstant), U8(0), //
- B(CreateObjectLiteral), U8(0), U8(deep_elements_flags), //
- B(Star), R(0), //
- B(LdaConstant), U8(1), //
- B(DeletePropertyStrict), R(0), //
+ B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
+ B(Star), R(0), //
+ B(LdaConstant), U8(1), //
+ B(DeletePropertyStrict), R(0), //
B(Return)
},
2,
@@ -2637,13 +2634,12 @@ TEST(Delete) {
{"var a = {1:13, 2:14}; return delete a[2];",
1 * kPointerSize,
1,
- 12,
+ 11,
{
- B(LdaConstant), U8(0), //
- B(CreateObjectLiteral), U8(0), U8(deep_elements_flags), //
- B(Star), R(0), //
- B(LdaSmi8), U8(2), //
- B(DeletePropertySloppy), R(0), //
+ B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
+ B(Star), R(0), //
+ B(LdaSmi8), U8(2), //
+ B(DeletePropertySloppy), R(0), //
B(Return)
},
1,
@@ -2665,19 +2661,18 @@ TEST(Delete) {
"return delete a[1];",
2 * kPointerSize,
1,
- 28,
+ 27,
{
- B(CallRuntime), U16(Runtime::kNewFunctionContext), //
- R(closure), U8(1), //
- B(PushContext), R(0), //
- B(LdaConstant), U8(0), //
- B(CreateObjectLiteral), U8(0), U8(deep_elements_flags), //
- B(StaContextSlot), R(0), U8(first_context_slot), //
- B(CreateClosure), U8(1), U8(0), //
- B(LdaContextSlot), R(0), U8(first_context_slot), //
- B(Star), R(1), //
- B(LdaSmi8), U8(1), //
- B(DeletePropertyStrict), R(1), //
+ B(CallRuntime), U16(Runtime::kNewFunctionContext), //
+ R(closure), U8(1), //
+ B(PushContext), R(0), //
+ B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
+ B(StaContextSlot), R(0), U8(first_context_slot), //
+ B(CreateClosure), U8(1), U8(0), //
+ B(LdaContextSlot), R(0), U8(first_context_slot), //
+ B(Star), R(1), //
+ B(LdaSmi8), U8(1), //
+ B(DeletePropertyStrict), R(1), //
B(Return)
},
2,
@@ -2855,32 +2850,29 @@ TEST(RegExpLiterals) {
{"return /ab+d/;",
0 * kPointerSize,
1,
- 6,
+ 5,
{
- B(LdaConstant), U8(0), //
- B(CreateRegExpLiteral), U8(0), U8(0), //
- B(Return), //
+ B(CreateRegExpLiteral), U8(0), U8(0), U8(0), //
+ B(Return), //
},
1,
{"ab+d"}},
{"return /(\\w+)\\s(\\w+)/i;",
0 * kPointerSize,
1,
- 6,
+ 5,
{
- B(LdaConstant), U8(0), //
- B(CreateRegExpLiteral), U8(0), U8(i_flags), //
- B(Return), //
+ B(CreateRegExpLiteral), U8(0), U8(0), U8(i_flags), //
+ B(Return), //
},
1,
{"(\\w+)\\s(\\w+)"}},
{"return /ab+d/.exec('abdd');",
3 * kPointerSize,
1,
- 23,
+ 22,
{
- B(LdaConstant), U8(0), //
- B(CreateRegExpLiteral), U8(0), U8(0), //
+ B(CreateRegExpLiteral), U8(0), U8(0), U8(0), //
B(Star), R(1), //
B(LoadICSloppy), R(1), U8(1), U8(vector->GetIndex(slot2)), //
B(Star), R(0), //
@@ -2901,6 +2893,38 @@ TEST(RegExpLiterals) {
}
+TEST(RegExpLiteralsWide) {
+ InitializedHandleScope handle_scope;
+ BytecodeGeneratorHelper helper;
+ Zone zone;
+
+ int wide_idx = 0;
+
+ ExpectedSnippet<InstanceType, 257> snippets[] = {
+ {"var a;" REPEAT_256(SPACE, "a = 1.23;") "return /ab+d/;",
+ 1 * kPointerSize,
+ 1,
+ 1031,
+ {
+ REPEAT_256(COMMA, //
+ B(LdaConstant), U8(wide_idx++), //
+ B(Star), R(0)), //
+ B(CreateRegExpLiteralWide), U16(256), U16(0), U8(0), //
+ B(Return) //
+ },
+ 257,
+ {REPEAT_256(COMMA, InstanceType::HEAP_NUMBER_TYPE),
+ InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}},
+ };
+
+ for (size_t i = 0; i < arraysize(snippets); i++) {
+ Handle<BytecodeArray> bytecode_array =
+ helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet);
+ CheckBytecodeArrayEqual(snippets[i], bytecode_array);
+ }
+}
+
+
TEST(ArrayLiterals) {
InitializedHandleScope handle_scope;
BytecodeGeneratorHelper helper;
@@ -2921,23 +2945,21 @@ TEST(ArrayLiterals) {
{"return [ 1, 2 ];",
0,
1,
- 6,
+ 5,
{
- B(LdaConstant), U8(0), //
- B(CreateArrayLiteral), U8(0), U8(simple_flags), //
- B(Return) //
+ B(CreateArrayLiteral), U8(0), U8(0), U8(simple_flags), //
+ B(Return) //
},
1,
{InstanceType::FIXED_ARRAY_TYPE}},
{"var a = 1; return [ a, a + 1 ];",
3 * kPointerSize,
1,
- 35,
+ 34,
{
B(LdaSmi8), U8(1), //
B(Star), R(0), //
- B(LdaConstant), U8(0), //
- B(CreateArrayLiteral), U8(0), U8(3), //
+ B(CreateArrayLiteral), U8(0), U8(0), U8(3), //
B(Star), R(2), //
B(LdaZero), //
B(Star), R(1), //
@@ -2956,28 +2978,25 @@ TEST(ArrayLiterals) {
{"return [ [ 1, 2 ], [ 3 ] ];",
0,
1,
- 6,
+ 5,
{
- B(LdaConstant), U8(0), //
- B(CreateArrayLiteral), U8(2), U8(deep_elements_flags), //
- B(Return) //
+ B(CreateArrayLiteral), U8(0), U8(2), U8(deep_elements_flags), //
+ B(Return) //
},
1,
{InstanceType::FIXED_ARRAY_TYPE}},
{"var a = 1; return [ [ a, 2 ], [ a + 2 ] ];",
5 * kPointerSize,
1,
- 67,
+ 64,
{
B(LdaSmi8), U8(1), //
B(Star), R(0), //
- B(LdaConstant), U8(0), //
- B(CreateArrayLiteral), U8(2), U8(deep_elements_flags), //
+ B(CreateArrayLiteral), U8(0), U8(2), U8(deep_elements_flags), //
B(Star), R(2), //
B(LdaZero), //
B(Star), R(1), //
- B(LdaConstant), U8(1), //
- B(CreateArrayLiteral), U8(0), U8(simple_flags), //
+ B(CreateArrayLiteral), U8(1), U8(0), U8(simple_flags), //
B(Star), R(4), //
B(LdaZero), //
B(Star), R(3), //
@@ -2987,8 +3006,7 @@ TEST(ArrayLiterals) {
B(KeyedStoreICSloppy), R(2), R(1), U8(vector->GetIndex(slot3)), //
B(LdaSmi8), U8(1), //
B(Star), R(1), //
- B(LdaConstant), U8(2), //
- B(CreateArrayLiteral), U8(1), U8(simple_flags), //
+ B(CreateArrayLiteral), U8(2), U8(1), U8(simple_flags), //
B(Star), R(4), //
B(LdaZero), //
B(Star), R(3), //
@@ -3013,6 +3031,40 @@ TEST(ArrayLiterals) {
}
+TEST(ArrayLiteralsWide) {
+ InitializedHandleScope handle_scope;
+ BytecodeGeneratorHelper helper;
+ Zone zone;
+
+ int wide_idx = 0;
+ int simple_flags =
+ ArrayLiteral::kDisableMementos | ArrayLiteral::kShallowElements;
+
+ ExpectedSnippet<InstanceType, 257> snippets[] = {
+ {"var a;" REPEAT_256(SPACE, "a = 1.23;") "return [ 1 , 2 ];",
+ 1 * kPointerSize,
+ 1,
+ 1031,
+ {
+ REPEAT_256(COMMA, //
+ B(LdaConstant), U8(wide_idx++), //
+ B(Star), R(0)), //
+ B(CreateArrayLiteralWide), U16(256), U16(0), U8(simple_flags), //
+ B(Return) //
+ },
+ 257,
+ {REPEAT_256(COMMA, InstanceType::HEAP_NUMBER_TYPE),
+ InstanceType::FIXED_ARRAY_TYPE}},
+ };
+
+ for (size_t i = 0; i < arraysize(snippets); i++) {
+ Handle<BytecodeArray> bytecode_array =
+ helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet);
+ CheckBytecodeArrayEqual(snippets[i], bytecode_array);
+ }
+}
+
+
TEST(ObjectLiterals) {
InitializedHandleScope handle_scope;
BytecodeGeneratorHelper helper;
@@ -3033,39 +3085,36 @@ TEST(ObjectLiterals) {
{"return { };",
0,
1,
- 6,
+ 5,
{
- B(LdaConstant), U8(0), //
- B(CreateObjectLiteral), U8(0), U8(simple_flags), //
- B(Return) //
+ B(CreateObjectLiteral), U8(0), U8(0), U8(simple_flags), //
+ B(Return) //
},
1,
{InstanceType::FIXED_ARRAY_TYPE}},
{"return { name: 'string', val: 9.2 };",
0,
1,
- 6,
+ 5,
{
- B(LdaConstant), U8(0), //
- B(CreateObjectLiteral), U8(0), U8(deep_elements_flags), //
- B(Return) //
+ B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
+ B(Return) //
},
1,
{InstanceType::FIXED_ARRAY_TYPE}},
{"var a = 1; return { name: 'string', val: a };",
2 * kPointerSize,
1,
- 20,
+ 19,
{
- B(LdaSmi8), U8(1), //
- B(Star), R(0), //
- B(LdaConstant), U8(0), //
- B(CreateObjectLiteral), U8(0), U8(deep_elements_flags), //
- B(Star), R(1), //
- B(Ldar), R(0), //
- B(StoreICSloppy), R(1), U8(1), U8(vector->GetIndex(slot1)), //
- B(Ldar), R(1), //
- B(Return), //
+ B(LdaSmi8), U8(1), //
+ B(Star), R(0), //
+ B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
+ B(Star), R(1), //
+ B(Ldar), R(0), //
+ B(StoreICSloppy), R(1), U8(1), U8(vector->GetIndex(slot1)), //
+ B(Ldar), R(1), //
+ B(Return), //
},
2,
{InstanceType::FIXED_ARRAY_TYPE,
@@ -3073,18 +3122,17 @@ TEST(ObjectLiterals) {
{"var a = 1; return { val: a, val: a + 1 };",
2 * kPointerSize,
1,
- 22,
+ 21,
{
- B(LdaSmi8), U8(1), //
- B(Star), R(0), //
- B(LdaConstant), U8(0), //
- B(CreateObjectLiteral), U8(0), U8(deep_elements_flags), //
- B(Star), R(1), //
- B(LdaSmi8), U8(1), //
- B(Add), R(0), //
- B(StoreICSloppy), R(1), U8(1), U8(vector->GetIndex(slot1)), //
- B(Ldar), R(1), //
- B(Return), //
+ B(LdaSmi8), U8(1), //
+ B(Star), R(0), //
+ B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
+ B(Star), R(1), //
+ B(LdaSmi8), U8(1), //
+ B(Add), R(0), //
+ B(StoreICSloppy), R(1), U8(1), U8(vector->GetIndex(slot1)), //
+ B(Ldar), R(1), //
+ B(Return), //
},
2,
{InstanceType::FIXED_ARRAY_TYPE,
@@ -3092,15 +3140,14 @@ TEST(ObjectLiterals) {
{"return { func: function() { } };",
1 * kPointerSize,
1,
- 17,
+ 16,
{
- B(LdaConstant), U8(0), //
- B(CreateObjectLiteral), U8(0), U8(deep_elements_flags), //
- B(Star), R(0), //
- B(CreateClosure), U8(2), U8(0), //
- B(StoreICSloppy), R(0), U8(1), U8(vector->GetIndex(slot1)), //
- B(Ldar), R(0), //
- B(Return), //
+ B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
+ B(Star), R(0), //
+ B(CreateClosure), U8(2), U8(0), //
+ B(StoreICSloppy), R(0), U8(1), U8(vector->GetIndex(slot1)), //
+ B(Ldar), R(0), //
+ B(Return), //
},
3,
{InstanceType::FIXED_ARRAY_TYPE,
@@ -3109,15 +3156,14 @@ TEST(ObjectLiterals) {
{"return { func(a) { return a; } };",
1 * kPointerSize,
1,
- 17,
+ 16,
{
- B(LdaConstant), U8(0), //
- B(CreateObjectLiteral), U8(0), U8(deep_elements_flags), //
- B(Star), R(0), //
- B(CreateClosure), U8(2), U8(0), //
- B(StoreICSloppy), R(0), U8(1), U8(vector->GetIndex(slot1)), //
- B(Ldar), R(0), //
- B(Return), //
+ B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
+ B(Star), R(0), //
+ B(CreateClosure), U8(2), U8(0), //
+ B(StoreICSloppy), R(0), U8(1), U8(vector->GetIndex(slot1)), //
+ B(Ldar), R(0), //
+ B(Return), //
},
3,
{InstanceType::FIXED_ARRAY_TYPE,
@@ -3126,10 +3172,9 @@ TEST(ObjectLiterals) {
{"return { get a() { return 2; } };",
5 * kPointerSize,
1,
- 30,
+ 29,
{
- B(LdaConstant), U8(0), //
- B(CreateObjectLiteral), U8(0), U8(deep_elements_flags), //
+ B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
B(Star), R(0), //
B(LdaConstant), U8(1), //
B(Star), R(1), //
@@ -3151,10 +3196,9 @@ TEST(ObjectLiterals) {
{"return { get a() { return this.x; }, set a(val) { this.x = val } };",
5 * kPointerSize,
1,
- 32,
+ 31,
{
- B(LdaConstant), U8(0), //
- B(CreateObjectLiteral), U8(0), U8(deep_elements_flags), //
+ B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
B(Star), R(0), //
B(LdaConstant), U8(1), //
B(Star), R(1), //
@@ -3177,10 +3221,9 @@ TEST(ObjectLiterals) {
{"return { set b(val) { this.y = val } };",
5 * kPointerSize,
1,
- 30,
+ 29,
{
- B(LdaConstant), U8(0), //
- B(CreateObjectLiteral), U8(0), U8(deep_elements_flags), //
+ B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
B(Star), R(0), //
B(LdaConstant), U8(1), //
B(Star), R(1), //
@@ -3202,32 +3245,30 @@ TEST(ObjectLiterals) {
{"var a = 1; return { 1: a };",
5 * kPointerSize,
1,
- 30,
+ 29,
{
- B(LdaSmi8), U8(1), //
- B(Star), R(0), //
- B(LdaConstant), U8(0), //
- B(CreateObjectLiteral), U8(0), U8(deep_elements_flags), //
- B(Star), R(1), //
- B(LdaSmi8), U8(1), //
- B(Star), R(2), //
- B(Ldar), R(0), //
- B(Star), R(3), //
- B(LdaZero), //
- B(Star), R(4), //
- B(CallRuntime), U16(Runtime::kSetProperty), R(1), U8(4), //
- B(Ldar), R(1), //
- B(Return), //
+ B(LdaSmi8), U8(1), //
+ B(Star), R(0), //
+ B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
+ B(Star), R(1), //
+ B(LdaSmi8), U8(1), //
+ B(Star), R(2), //
+ B(Ldar), R(0), //
+ B(Star), R(3), //
+ B(LdaZero), //
+ B(Star), R(4), //
+ B(CallRuntime), U16(Runtime::kSetProperty), R(1), U8(4), //
+ B(Ldar), R(1), //
+ B(Return), //
},
1,
{InstanceType::FIXED_ARRAY_TYPE}},
{"return { __proto__: null }",
2 * kPointerSize,
1,
- 18,
+ 17,
{
- B(LdaConstant), U8(0), //
- B(CreateObjectLiteral), U8(0), U8(simple_flags), //
+ B(CreateObjectLiteral), U8(0), U8(0), U8(simple_flags), //
B(Star), R(0), //
B(LdaNull), B(Star), R(1), //
B(CallRuntime), U16(Runtime::kInternalSetPrototype), R(0), U8(2), //
@@ -3239,12 +3280,11 @@ TEST(ObjectLiterals) {
{"var a = 'test'; return { [a]: 1 }",
5 * kPointerSize,
1,
- 31,
+ 30,
{
B(LdaConstant), U8(0), //
B(Star), R(0), //
- B(LdaConstant), U8(1), //
- B(CreateObjectLiteral), U8(0), U8(simple_flags), //
+ B(CreateObjectLiteral), U8(1), U8(0), U8(simple_flags), //
B(Star), R(1), //
B(Ldar), R(0), //
B(ToName), //
@@ -3264,12 +3304,11 @@ TEST(ObjectLiterals) {
{"var a = 'test'; return { val: a, [a]: 1 }",
5 * kPointerSize,
1,
- 37,
+ 36,
{
B(LdaConstant), U8(0), //
B(Star), R(0), //
- B(LdaConstant), U8(1), //
- B(CreateObjectLiteral), U8(0), U8(deep_elements_flags), //
+ B(CreateObjectLiteral), U8(1), U8(0), U8(deep_elements_flags), //
B(Star), R(1), //
B(Ldar), R(0), //
B(StoreICSloppy), R(1), U8(2), U8(vector->GetIndex(slot1)), //
@@ -3292,12 +3331,11 @@ TEST(ObjectLiterals) {
{"var a = 'test'; return { [a]: 1, __proto__: {} }",
5 * kPointerSize,
1,
- 43,
+ 41,
{
B(LdaConstant), U8(0), //
B(Star), R(0), //
- B(LdaConstant), U8(1), //
- B(CreateObjectLiteral), U8(1), U8(simple_flags), //
+ B(CreateObjectLiteral), U8(1), U8(1), U8(simple_flags), //
B(Star), R(1), //
B(Ldar), R(0), //
B(ToName), //
@@ -3308,8 +3346,7 @@ TEST(ObjectLiterals) {
B(Star), R(4), //
B(CallRuntime), U16(Runtime::kDefineDataPropertyUnchecked), R(1), //
U8(4), //
- B(LdaConstant), U8(1), //
- B(CreateObjectLiteral), U8(0), U8(13), //
+ B(CreateObjectLiteral), U8(1), U8(0), U8(13), //
B(Star), R(2), //
B(CallRuntime), U16(Runtime::kInternalSetPrototype), R(1), U8(2), //
B(Ldar), R(1), //
@@ -3321,12 +3358,11 @@ TEST(ObjectLiterals) {
{"var n = 'name'; return { [n]: 'val', get a() { }, set a(b) {} };",
5 * kPointerSize,
1,
- 65,
+ 64,
{
B(LdaConstant), U8(0), //
B(Star), R(0), //
- B(LdaConstant), U8(1), //
- B(CreateObjectLiteral), U8(0), U8(simple_flags), //
+ B(CreateObjectLiteral), U8(1), U8(0), U8(simple_flags), //
B(Star), R(1), //
B(Ldar), R(0), //
B(ToName), //
@@ -3373,6 +3409,42 @@ TEST(ObjectLiterals) {
}
+TEST(ObjectLiteralsWide) {
+ InitializedHandleScope handle_scope;
+ BytecodeGeneratorHelper helper;
+ Zone zone;
+
+ int deep_elements_flags =
+ ObjectLiteral::kFastElements | ObjectLiteral::kDisableMementos;
+ int wide_idx = 0;
+
+ ExpectedSnippet<InstanceType, 257> snippets[] = {
+ {"var a;" REPEAT_256(SPACE,
+ "a = 1.23;") "return { name: 'string', val: 9.2 };",
+ 1 * kPointerSize,
+ 1,
+ 1031,
+ {
+ REPEAT_256(COMMA, //
+ B(LdaConstant), U8(wide_idx++), //
+ B(Star), R(0)), //
+ B(CreateObjectLiteralWide), U16(256), U16(0), //
+ U8(deep_elements_flags), //
+ B(Return) //
+ },
+ 257,
+ {REPEAT_256(COMMA, InstanceType::HEAP_NUMBER_TYPE),
+ InstanceType::FIXED_ARRAY_TYPE}},
+ };
+
+ for (size_t i = 0; i < arraysize(snippets); i++) {
+ Handle<BytecodeArray> bytecode_array =
+ helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet);
+ CheckBytecodeArrayEqual(snippets[i], bytecode_array);
+ }
+}
+
+
TEST(TopLevelObjectLiterals) {
InitializedHandleScope handle_scope;
BytecodeGeneratorHelper helper;
@@ -3384,7 +3456,7 @@ TEST(TopLevelObjectLiterals) {
{"var a = { func: function() { } };",
5 * kPointerSize,
1,
- 49,
+ 48,
{
B(LdaConstant), U8(0), //
B(Star), R(1), //
@@ -3395,8 +3467,7 @@ TEST(TopLevelObjectLiterals) {
B(Star), R(1), //
B(LdaZero), //
B(Star), R(2), //
- B(LdaConstant), U8(2), //
- B(CreateObjectLiteral), U8(0), U8(has_function_flags), //
+ B(CreateObjectLiteral), U8(2), U8(0), U8(has_function_flags), //
B(Star), R(4), //
B(CreateClosure), U8(4), U8(1), //
B(StoreICSloppy), R(4), U8(3), U8(5), //
@@ -3963,18 +4034,17 @@ TEST(CountOperators) {
{"var a = { val: 1 }; return a.val++;",
2 * kPointerSize,
1,
- 22,
+ 21,
{
- B(LdaConstant), U8(0), //
- B(CreateObjectLiteral), U8(0), U8(object_literal_flags), //
- B(Star), R(0), //
- B(LoadICSloppy), R(0), U8(1), U8(vector->GetIndex(slot1)), //
- B(ToNumber), //
- B(Star), R(1), //
- B(Inc), //
- B(StoreICSloppy), R(0), U8(1), U8(vector->GetIndex(slot2)), //
- B(Ldar), R(1), //
- B(Return), //
+ B(CreateObjectLiteral), U8(0), U8(0), U8(object_literal_flags), //
+ B(Star), R(0), //
+ B(LoadICSloppy), R(0), U8(1), U8(vector->GetIndex(slot1)), //
+ B(ToNumber), //
+ B(Star), R(1), //
+ B(Inc), //
+ B(StoreICSloppy), R(0), U8(1), U8(vector->GetIndex(slot2)), //
+ B(Ldar), R(1), //
+ B(Return), //
},
2,
{InstanceType::FIXED_ARRAY_TYPE,
@@ -3982,16 +4052,15 @@ TEST(CountOperators) {
{"var a = { val: 1 }; return --a.val;",
1 * kPointerSize,
1,
- 18,
+ 17,
{
- B(LdaConstant), U8(0), //
- B(CreateObjectLiteral), U8(0), U8(object_literal_flags), //
- B(Star), R(0), //
- B(LoadICSloppy), R(0), U8(1), U8(vector->GetIndex(slot1)), //
- B(ToNumber), //
- B(Dec), //
- B(StoreICSloppy), R(0), U8(1), U8(vector->GetIndex(slot2)), //
- B(Return), //
+ B(CreateObjectLiteral), U8(0), U8(0), U8(object_literal_flags), //
+ B(Star), R(0), //
+ B(LoadICSloppy), R(0), U8(1), U8(vector->GetIndex(slot1)), //
+ B(ToNumber), //
+ B(Dec), //
+ B(StoreICSloppy), R(0), U8(1), U8(vector->GetIndex(slot2)), //
+ B(Return), //
},
2,
{InstanceType::FIXED_ARRAY_TYPE,
@@ -3999,12 +4068,11 @@ TEST(CountOperators) {
{"var name = 'var'; var a = { val: 1 }; return a[name]--;",
4 * kPointerSize,
1,
- 29,
+ 28,
{
B(LdaConstant), U8(0), //
B(Star), R(0), //
- B(LdaConstant), U8(1), //
- B(CreateObjectLiteral), U8(0), U8(object_literal_flags), //
+ B(CreateObjectLiteral), U8(1), U8(0), U8(object_literal_flags), //
B(Star), R(1), //
B(Ldar), R(0), //
B(Star), R(2), //
@@ -4022,12 +4090,11 @@ TEST(CountOperators) {
{"var name = 'var'; var a = { val: 1 }; return ++a[name];",
3 * kPointerSize,
1,
- 25,
+ 24,
{
B(LdaConstant), U8(0), //
B(Star), R(0), //
- B(LdaConstant), U8(1), //
- B(CreateObjectLiteral), U8(0), U8(object_literal_flags), //
+ B(CreateObjectLiteral), U8(1), U8(0), U8(object_literal_flags), //
B(Star), R(1), //
B(Ldar), R(0), //
B(Star), R(2), //
@@ -4085,12 +4152,11 @@ TEST(CountOperators) {
{"var idx = 1; var a = [1, 2]; return a[idx++] = 2;",
3 * kPointerSize,
1,
- 26,
+ 25,
{
B(LdaSmi8), U8(1), //
B(Star), R(0), //
- B(LdaConstant), U8(0), //
- B(CreateArrayLiteral), U8(0), U8(array_literal_flags), //
+ B(CreateArrayLiteral), U8(0), U8(0), U8(array_literal_flags), //
B(Star), R(1), //
B(Ldar), R(0), //
B(ToNumber), //
@@ -4241,18 +4307,17 @@ TEST(CompoundExpressions) {
{"var a = { val: 2 }; a.name *= 2;",
2 * kPointerSize,
1,
- 23,
+ 22,
{
- B(LdaConstant), U8(0), //
- B(CreateObjectLiteral), U8(0), U8(object_literal_flags), //
- B(Star), R(0), //
- B(LoadICSloppy), R(0), U8(1), U8(vector->GetIndex(slot1)), //
- B(Star), R(1), //
- B(LdaSmi8), U8(2), //
- B(Mul), R(1), //
- B(StoreICSloppy), R(0), U8(1), U8(vector->GetIndex(slot2)), //
- B(LdaUndefined), //
- B(Return), //
+ B(CreateObjectLiteral), U8(0), U8(0), U8(object_literal_flags), //
+ B(Star), R(0), //
+ B(LoadICSloppy), R(0), U8(1), U8(vector->GetIndex(slot1)), //
+ B(Star), R(1), //
+ B(LdaSmi8), U8(2), //
+ B(Mul), R(1), //
+ B(StoreICSloppy), R(0), U8(1), U8(vector->GetIndex(slot2)), //
+ B(LdaUndefined), //
+ B(Return), //
},
2,
{InstanceType::FIXED_ARRAY_TYPE,
@@ -4260,10 +4325,9 @@ TEST(CompoundExpressions) {
{"var a = { 1: 2 }; a[1] ^= 2;",
3 * kPointerSize,
1,
- 26,
+ 25,
{
- B(LdaConstant), U8(0), //
- B(CreateObjectLiteral), U8(0), U8(object_literal_flags), //
+ B(CreateObjectLiteral), U8(0), U8(0), U8(object_literal_flags), //
B(Star), R(0), //
B(LdaSmi8), U8(1), //
B(Star), R(1), //
@@ -4557,12 +4621,11 @@ TEST(ForIn) {
"for (var p in [1,2,3]) { x += p; }",
5 * kPointerSize,
1,
- 53,
+ 52,
{
B(LdaZero), //
B(Star), R(1), //
- B(LdaConstant), U8(0), //
- B(CreateArrayLiteral), U8(0), U8(simple_flags), //
+ B(CreateArrayLiteral), U8(0), U8(0), U8(simple_flags), //
B(JumpIfUndefined), U8(43), //
B(JumpIfNull), U8(41), //
B(ToObject), //
@@ -4596,13 +4659,11 @@ TEST(ForIn) {
"}",
4 * kPointerSize,
1,
- 83,
+ 81,
{
- B(LdaConstant), U8(0), //
- B(CreateObjectLiteral), U8(0), U8(deep_elements_flags), //
+ B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
B(Star), R(0), //
- B(LdaConstant), U8(1), //
- B(CreateArrayLiteral), U8(1), U8(simple_flags), //
+ B(CreateArrayLiteral), U8(1), U8(1), U8(simple_flags), //
B(JumpIfUndefined), U8(69), //
B(JumpIfNull), U8(67), //
B(ToObject), //
@@ -4644,13 +4705,11 @@ TEST(ForIn) {
"for (x[0] in [1,2,3]) { return x[3]; }",
5 * kPointerSize,
1,
- 66,
+ 64,
{
- B(LdaConstant), U8(0), //
- B(CreateArrayLiteral), U8(0), U8(simple_flags), //
+ B(CreateArrayLiteral), U8(0), U8(0), U8(simple_flags), //
B(Star), R(0), //
- B(LdaConstant), U8(1), //
- B(CreateArrayLiteral), U8(1), U8(simple_flags), //
+ B(CreateArrayLiteral), U8(1), U8(1), U8(simple_flags), //
B(JumpIfUndefined), U8(52), //
B(JumpIfNull), U8(50), //
B(ToObject), //
« no previous file with comments | « test/cctest/compiler/test-run-bytecode-graph-builder.cc ('k') | test/unittests/interpreter/bytecode-array-builder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698