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

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

Issue 1665853002: [Interpreter] Add explicit StackCheck bytecodes on function entry and back branches. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix unittests. Created 4 years, 10 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/cctest.status ('k') | test/mjsunit/mjsunit.status » ('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 7a62265a79492cd2943762c0915b958edc21c13c..e69a5ba06d654d6ca6a46780affd2fa878a329a2 100644
--- a/test/cctest/interpreter/test-bytecode-generator.cc
+++ b/test/cctest/interpreter/test-bytecode-generator.cc
@@ -274,18 +274,110 @@ TEST(PrimitiveReturnStatements) {
InitializedHandleScope handle_scope;
BytecodeGeneratorHelper helper;
+ // clang-format off
ExpectedSnippet<int> snippets[] = {
- {"", 0, 1, 2, {B(LdaUndefined), B(Return)}, 0},
- {"return;", 0, 1, 2, {B(LdaUndefined), B(Return)}, 0},
- {"return null;", 0, 1, 2, {B(LdaNull), B(Return)}, 0},
- {"return true;", 0, 1, 2, {B(LdaTrue), B(Return)}, 0},
- {"return false;", 0, 1, 2, {B(LdaFalse), B(Return)}, 0},
- {"return 0;", 0, 1, 2, {B(LdaZero), B(Return)}, 0},
- {"return +1;", 0, 1, 3, {B(LdaSmi8), U8(1), B(Return)}, 0},
- {"return -1;", 0, 1, 3, {B(LdaSmi8), U8(-1), B(Return)}, 0},
- {"return +127;", 0, 1, 3, {B(LdaSmi8), U8(127), B(Return)}, 0},
- {"return -128;", 0, 1, 3, {B(LdaSmi8), U8(-128), B(Return)}, 0},
+ {"",
+ 0,
+ 1,
+ 3,
+ {
+ B(StackCheck), //
+ B(LdaUndefined), //
+ B(Return) //
+ },
+ 0},
+ {"return;",
+ 0,
+ 1,
+ 3,
+ {
+ B(StackCheck), //
+ B(LdaUndefined), //
+ B(Return) //
+ },
+ 0},
+ {"return null;",
+ 0,
+ 1,
+ 3,
+ {
+ B(StackCheck), //
+ B(LdaNull), //
+ B(Return) //
+ },
+ 0},
+ {"return true;",
+ 0,
+ 1,
+ 3,
+ {
+ B(StackCheck), //
+ B(LdaTrue), //
+ B(Return) //
+ },
+ 0},
+ {"return false;",
+ 0,
+ 1,
+ 3,
+ {
+ B(StackCheck), //
+ B(LdaFalse), //
+ B(Return) //
+ },
+ 0},
+ {"return 0;",
+ 0,
+ 1,
+ 3,
+ {
+ B(StackCheck), //
+ B(LdaZero), //
+ B(Return) //
+ },
+ 0},
+ {"return +1;",
+ 0,
+ 1,
+ 4,
+ {
+ B(StackCheck), //
+ B(LdaSmi8), U8(1), //
+ B(Return) //
+ },
+ 0},
+ {"return -1;",
+ 0,
+ 1,
+ 4,
+ {
+ B(StackCheck), //
+ B(LdaSmi8), U8(-1), //
+ B(Return) //
+ },
+ 0},
+ {"return +127;",
+ 0,
+ 1,
+ 4,
+ {
+ B(StackCheck), //
+ B(LdaSmi8), U8(127), //
+ B(Return) //
+ },
+ 0},
+ {"return -128;",
+ 0,
+ 1,
+ 4,
+ {
+ B(StackCheck), //
+ B(LdaSmi8), U8(-128), //
+ B(Return) //
+ },
+ 0},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -299,20 +391,23 @@ TEST(PrimitiveExpressions) {
InitializedHandleScope handle_scope;
BytecodeGeneratorHelper helper;
+ // clang-format off
ExpectedSnippet<int> snippets[] = {
{"var x = 0; return x;",
kPointerSize,
1,
- 4,
- {B(LdaZero), //
+ 5,
+ {B(StackCheck), //
+ B(LdaZero), //
B(Star), R(0), //
B(Return)},
0},
{"var x = 0; return x + 3;",
2 * kPointerSize,
1,
- 10,
- {B(LdaZero), //
+ 11,
+ {B(StackCheck), //
+ B(LdaZero), //
B(Star), R(0), //
B(Star), R(1), //
B(LdaSmi8), U8(3), //
@@ -322,8 +417,9 @@ TEST(PrimitiveExpressions) {
{"var x = 0; return x - 3;",
2 * kPointerSize,
1,
- 10,
- {B(LdaZero), //
+ 11,
+ {B(StackCheck), //
+ B(LdaZero), //
B(Star), R(0), //
B(Star), R(1), //
B(LdaSmi8), U8(3), //
@@ -333,8 +429,9 @@ TEST(PrimitiveExpressions) {
{"var x = 4; return x * 3;",
2 * kPointerSize,
1,
- 11,
- {B(LdaSmi8), U8(4), //
+ 12,
+ {B(StackCheck), //
+ B(LdaSmi8), U8(4), //
B(Star), R(0), //
B(Star), R(1), //
B(LdaSmi8), U8(3), //
@@ -344,8 +441,9 @@ TEST(PrimitiveExpressions) {
{"var x = 4; return x / 3;",
2 * kPointerSize,
1,
- 11,
- {B(LdaSmi8), U8(4), //
+ 12,
+ {B(StackCheck), //
+ B(LdaSmi8), U8(4), //
B(Star), R(0), //
B(Star), R(1), //
B(LdaSmi8), U8(3), //
@@ -355,8 +453,9 @@ TEST(PrimitiveExpressions) {
{"var x = 4; return x % 3;",
2 * kPointerSize,
1,
- 11,
- {B(LdaSmi8), U8(4), //
+ 12,
+ {B(StackCheck), //
+ B(LdaSmi8), U8(4), //
B(Star), R(0), //
B(Star), R(1), //
B(LdaSmi8), U8(3), //
@@ -366,8 +465,9 @@ TEST(PrimitiveExpressions) {
{"var x = 1; return x | 2;",
2 * kPointerSize,
1,
- 11,
- {B(LdaSmi8), U8(1), //
+ 12,
+ {B(StackCheck), //
+ B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(Star), R(1), //
B(LdaSmi8), U8(2), //
@@ -377,8 +477,9 @@ TEST(PrimitiveExpressions) {
{"var x = 1; return x ^ 2;",
2 * kPointerSize,
1,
- 11,
- {B(LdaSmi8), U8(1), //
+ 12,
+ {B(StackCheck), //
+ B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(Star), R(1), //
B(LdaSmi8), U8(2), //
@@ -388,8 +489,9 @@ TEST(PrimitiveExpressions) {
{"var x = 1; return x & 2;",
2 * kPointerSize,
1,
- 11,
- {B(LdaSmi8), U8(1), //
+ 12,
+ {B(StackCheck), //
+ B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(Star), R(1), //
B(LdaSmi8), U8(2), //
@@ -399,8 +501,9 @@ TEST(PrimitiveExpressions) {
{"var x = 10; return x << 3;",
2 * kPointerSize,
1,
- 11,
- {B(LdaSmi8), U8(10), //
+ 12,
+ {B(StackCheck), //
+ B(LdaSmi8), U8(10), //
B(Star), R(0), //
B(Star), R(1), //
B(LdaSmi8), U8(3), //
@@ -410,8 +513,9 @@ TEST(PrimitiveExpressions) {
{"var x = 10; return x >> 3;",
2 * kPointerSize,
1,
- 11,
- {B(LdaSmi8), U8(10), //
+ 12,
+ {B(StackCheck), //
+ B(LdaSmi8), U8(10), //
B(Star), R(0), //
B(Star), R(1), //
B(LdaSmi8), U8(3), //
@@ -421,8 +525,9 @@ TEST(PrimitiveExpressions) {
{"var x = 10; return x >>> 3;",
2 * kPointerSize,
1,
- 11,
- {B(LdaSmi8), U8(10), //
+ 12,
+ {B(StackCheck), //
+ B(LdaSmi8), U8(10), //
B(Star), R(0), //
B(Star), R(1), //
B(LdaSmi8), U8(3), //
@@ -432,12 +537,15 @@ TEST(PrimitiveExpressions) {
{"var x = 0; return (x, 3);",
1 * kPointerSize,
1,
- 6,
- {B(LdaZero), //
+ 7,
+ {B(StackCheck), //
+ B(LdaZero), //
B(Star), R(0), //
B(LdaSmi8), U8(3), //
B(Return)},
- 0}};
+ 0},
+ };
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -451,12 +559,14 @@ TEST(LogicalExpressions) {
InitializedHandleScope handle_scope;
BytecodeGeneratorHelper helper;
+ // clang-format off
ExpectedSnippet<int> snippets[] = {
{"var x = 0; return x || 3;",
1 * kPointerSize,
1,
- 8,
- {B(LdaZero), //
+ 9,
+ {B(StackCheck), //
+ B(LdaZero), //
B(Star), R(0), //
B(JumpIfToBooleanTrue), U8(4), //
B(LdaSmi8), U8(3), //
@@ -465,8 +575,9 @@ TEST(LogicalExpressions) {
{"var x = 0; return (x == 1) || 3;",
2 * kPointerSize,
1,
- 14,
- {B(LdaZero), //
+ 15,
+ {B(StackCheck), //
+ B(LdaZero), //
B(Star), R(0), //
B(Star), R(1), //
B(LdaSmi8), U8(1), //
@@ -478,8 +589,9 @@ TEST(LogicalExpressions) {
{"var x = 0; return x && 3;",
1 * kPointerSize,
1,
- 8,
- {B(LdaZero), //
+ 9,
+ {B(StackCheck), //
+ B(LdaZero), //
B(Star), R(0), //
B(JumpIfToBooleanFalse), U8(4), //
B(LdaSmi8), U8(3), //
@@ -488,8 +600,9 @@ TEST(LogicalExpressions) {
{"var x = 0; return (x == 0) && 3;",
2 * kPointerSize,
1,
- 13,
- {B(LdaZero), //
+ 14,
+ {B(StackCheck), //
+ B(LdaZero), //
B(Star), R(0), //
B(Star), R(1), //
B(LdaZero), //
@@ -501,8 +614,9 @@ TEST(LogicalExpressions) {
{"var x = 0; return x || (1, 2, 3);",
1 * kPointerSize,
1,
- 8,
- {B(LdaZero), //
+ 9,
+ {B(StackCheck), //
+ B(LdaZero), //
B(Star), R(0), //
B(JumpIfToBooleanTrue), U8(4), //
B(LdaSmi8), U8(3), //
@@ -511,8 +625,9 @@ TEST(LogicalExpressions) {
{"var a = 2, b = 3, c = 4; return a || (a, b, a, b, c = 5, 3);",
3 * kPointerSize,
1,
- 31,
- {B(LdaSmi8), U8(2), //
+ 32,
+ {B(StackCheck), //
+ B(LdaSmi8), U8(2), //
B(Star), R(0), //
B(LdaSmi8), U8(3), //
B(Star), R(1), //
@@ -534,8 +649,9 @@ TEST(LogicalExpressions) {
"3);",
3 * kPointerSize,
1,
- 275,
- {B(LdaSmi8), U8(1), //
+ 276,
+ {B(StackCheck), //
+ B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(LdaSmi8), U8(2), //
B(Star), R(1), //
@@ -557,8 +673,9 @@ TEST(LogicalExpressions) {
"3);",
3 * kPointerSize,
1,
- 274,
- {B(LdaZero), //
+ 275,
+ {B(StackCheck), //
+ B(LdaZero), //
B(Star), R(0), //
B(LdaSmi8), U8(2), //
B(Star), R(1), //
@@ -580,8 +697,9 @@ TEST(LogicalExpressions) {
"3);",
4 * kPointerSize,
1,
- 281,
- {B(LdaSmi8), U8(1), //
+ 282,
+ {B(StackCheck), //
+ B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(LdaSmi8), U8(2), //
B(Star), R(1), //
@@ -606,8 +724,9 @@ TEST(LogicalExpressions) {
"3);",
4 * kPointerSize,
1,
- 280,
- {B(LdaZero), //
+ 281,
+ {B(StackCheck), //
+ B(LdaZero), //
B(Star), R(0), //
B(LdaSmi8), U8(2), //
B(Star), R(1), //
@@ -630,22 +749,25 @@ TEST(LogicalExpressions) {
{"return 0 && 3;",
0 * kPointerSize,
1,
- 2,
- {B(LdaZero), //
+ 3,
+ {B(StackCheck), //
+ B(LdaZero), //
B(Return)},
0},
{"return 1 || 3;",
0 * kPointerSize,
1,
- 3,
- {B(LdaSmi8), U8(1), //
+ 4,
+ {B(StackCheck), //
+ B(LdaSmi8), U8(1), //
B(Return)},
0},
{"var x = 1; return x && 3 || 0, 1;",
1 * kPointerSize,
1,
- 14,
- {B(LdaSmi8), U8(1), //
+ 15,
+ {B(StackCheck), //
+ B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(JumpIfToBooleanFalse), U8(4), //
B(LdaSmi8), U8(3), //
@@ -653,7 +775,9 @@ TEST(LogicalExpressions) {
B(LdaZero), //
B(LdaSmi8), U8(1), //
B(Return)},
- 0}};
+ 0}
+ };
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -667,42 +791,54 @@ TEST(Parameters) {
InitializedHandleScope handle_scope;
BytecodeGeneratorHelper helper;
+ // clang-format off
ExpectedSnippet<int> snippets[] = {
{"function f() { return this; }",
0,
1,
- 3,
- {B(Ldar), THIS(1), B(Return)},
+ 4,
+ {B(StackCheck), //
+ B(Ldar), THIS(1), //
+ B(Return)},
0},
{"function f(arg1) { return arg1; }",
0,
2,
- 3,
- {B(Ldar), A(1, 2), B(Return)},
+ 4,
+ {B(StackCheck), //
+ B(Ldar), A(1, 2), //
+ B(Return)},
0},
{"function f(arg1) { return this; }",
0,
2,
- 3,
- {B(Ldar), THIS(2), B(Return)},
+ 4,
+ {B(StackCheck), //
+ B(Ldar), THIS(2), //
+ B(Return)},
0},
{"function f(arg1, arg2, arg3, arg4, arg5, arg6, arg7) { return arg4; }",
0,
8,
- 3,
- {B(Ldar), A(4, 8), B(Return)},
+ 4,
+ {B(StackCheck), //
+ B(Ldar), A(4, 8), //
+ B(Return)},
0},
{"function f(arg1, arg2, arg3, arg4, arg5, arg6, arg7) { return this; }",
0,
8,
- 3,
- {B(Ldar), THIS(8), B(Return)},
+ 4,
+ {B(StackCheck), //
+ B(Ldar), THIS(8), //
+ B(Return)},
0},
{"function f(arg1) { arg1 = 1; }",
0,
2,
- 6,
- {B(LdaSmi8), U8(1), //
+ 7,
+ {B(StackCheck), //
+ B(LdaSmi8), U8(1), //
B(Star), A(1, 2), //
B(LdaUndefined), //
B(Return)},
@@ -710,13 +846,15 @@ TEST(Parameters) {
{"function f(arg1, arg2, arg3, arg4) { arg2 = 1; }",
0,
5,
- 6,
- {B(LdaSmi8), U8(1), //
+ 7,
+ {B(StackCheck), //
+ B(LdaSmi8), U8(1), //
B(Star), A(2, 5), //
B(LdaUndefined), //
B(Return)},
0},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -730,12 +868,14 @@ TEST(IntegerConstants) {
InitializedHandleScope handle_scope;
BytecodeGeneratorHelper helper;
+ // clang-format off
ExpectedSnippet<int> snippets[] = {
{"return 12345678;",
0,
1,
- 3,
+ 4,
{
+ B(StackCheck), //
B(LdaConstant), U8(0), //
B(Return) //
},
@@ -744,8 +884,9 @@ TEST(IntegerConstants) {
{"var a = 1234; return 5678;",
1 * kPointerSize,
1,
- 7,
+ 8,
{
+ B(StackCheck), //
B(LdaConstant), U8(0), //
B(Star), R(0), //
B(LdaConstant), U8(1), //
@@ -756,15 +897,18 @@ TEST(IntegerConstants) {
{"var a = 1234; return 1234;",
1 * kPointerSize,
1,
- 7,
+ 8,
{
+ B(StackCheck), //
B(LdaConstant), U8(0), //
B(Star), R(0), //
B(LdaConstant), U8(0), //
B(Return) //
},
1,
- {1234}}};
+ {1234}}
+ };
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -780,12 +924,14 @@ TEST(HeapNumberConstants) {
int wide_idx = 0;
+ // clang-format off
ExpectedSnippet<double, 257> snippets[] = {
{"return 1.2;",
0,
1,
- 3,
+ 4,
{
+ B(StackCheck), //
B(LdaConstant), U8(0), //
B(Return) //
},
@@ -794,8 +940,9 @@ TEST(HeapNumberConstants) {
{"var a = 1.2; return 2.6;",
1 * kPointerSize,
1,
- 7,
+ 8,
{
+ B(StackCheck), //
B(LdaConstant), U8(0), //
B(Star), R(0), //
B(LdaConstant), U8(1), //
@@ -806,8 +953,9 @@ TEST(HeapNumberConstants) {
{"var a = 3.14; return 3.14;",
1 * kPointerSize,
1,
- 7,
+ 8,
{
+ B(StackCheck), //
B(LdaConstant), U8(0), //
B(Star), R(0), //
B(LdaConstant), U8(1), //
@@ -820,8 +968,9 @@ TEST(HeapNumberConstants) {
" a = 3.14;",
1 * kPointerSize,
1,
- 1031,
+ 1032,
{
+ B(StackCheck), //
REPEAT_256(COMMA, //
B(LdaConstant), U8(wide_idx++), //
B(Star), R(0)), //
@@ -834,6 +983,8 @@ TEST(HeapNumberConstants) {
{REPEAT_256(COMMA, 1.414),
3.14}}
};
+ // clang-format on
+
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet);
@@ -846,12 +997,14 @@ TEST(StringConstants) {
InitializedHandleScope handle_scope;
BytecodeGeneratorHelper helper;
+ // clang-format off
ExpectedSnippet<const char*> snippets[] = {
{"return \"This is a string\";",
0,
1,
- 3,
+ 4,
{
+ B(StackCheck), //
B(LdaConstant), U8(0), //
B(Return) //
},
@@ -860,8 +1013,9 @@ TEST(StringConstants) {
{"var a = \"First string\"; return \"Second string\";",
1 * kPointerSize,
1,
- 7,
+ 8,
{
+ B(StackCheck), //
B(LdaConstant), U8(0), //
B(Star), R(0), //
B(LdaConstant), U8(1), //
@@ -872,15 +1026,18 @@ TEST(StringConstants) {
{"var a = \"Same string\"; return \"Same string\";",
1 * kPointerSize,
1,
- 7,
+ 8,
{
+ B(StackCheck), //
B(LdaConstant), U8(0), //
B(Star), R(0), //
B(LdaConstant), U8(0), //
B(Return) //
},
1,
- {"Same string"}}};
+ {"Same string"}}
+ };
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -908,12 +1065,14 @@ TEST(PropertyLoads) {
int wide_idx_3 = vector->GetIndex(slot1) - 2;
int wide_idx_4 = vector->GetIndex(slot1) - 2;
+ // clang-format off
ExpectedSnippet<const char*> snippets[] = {
{"function f(a) { return a.name; }\nf({name : \"test\"})",
1 * kPointerSize,
2,
- 9,
+ 10,
{
+ B(StackCheck), //
B(Ldar), A(1, 2), //
B(Star), R(0), //
B(LoadICSloppy), R(0), U8(0), U8(vector->GetIndex(slot1)), //
@@ -924,8 +1083,9 @@ TEST(PropertyLoads) {
{"function f(a) { return a[\"key\"]; }\nf({key : \"test\"})",
1 * kPointerSize,
2,
- 9,
+ 10,
{
+ B(StackCheck), //
B(Ldar), A(1, 2), //
B(Star), R(0), //
B(LoadICSloppy), R(0), U8(0), U8(vector->GetIndex(slot1)), //
@@ -936,8 +1096,9 @@ TEST(PropertyLoads) {
{"function f(a) { return a[100]; }\nf({100 : \"test\"})",
1 * kPointerSize,
2,
- 10,
+ 11,
{
+ B(StackCheck), //
B(Ldar), A(1, 2), //
B(Star), R(0), //
B(LdaSmi8), U8(100), //
@@ -948,8 +1109,9 @@ TEST(PropertyLoads) {
{"function f(a, b) { return a[b]; }\nf({arg : \"test\"}, \"arg\")",
1 * kPointerSize,
3,
- 10,
+ 11,
{
+ B(StackCheck), //
B(Ldar), A(1, 3), //
B(Star), R(0), //
B(Ldar), A(1, 2), //
@@ -961,8 +1123,9 @@ TEST(PropertyLoads) {
"f({\"-124\" : \"test\", name : 123 })",
2 * kPointerSize,
2,
- 20,
+ 21,
{
+ B(StackCheck), //
B(Ldar), A(1, 2), //
B(Star), R(1), //
B(LoadICSloppy), R(1), U8(0), U8(vector->GetIndex(slot1)), //
@@ -978,8 +1141,9 @@ TEST(PropertyLoads) {
{"function f(a) { \"use strict\"; return a.name; }\nf({name : \"test\"})",
1 * kPointerSize,
2,
- 9,
+ 10,
{
+ B(StackCheck), //
B(Ldar), A(1, 2), //
B(Star), R(0), //
B(LoadICStrict), R(0), U8(0), U8(vector->GetIndex(slot1)), //
@@ -991,8 +1155,9 @@ TEST(PropertyLoads) {
"f({arg : \"test\"}, \"arg\")",
1 * kPointerSize,
3,
- 10,
+ 11,
{
+ B(StackCheck), //
B(Ldar), A(1, 3), //
B(Star), R(0), //
B(Ldar), A(2, 3), //
@@ -1008,8 +1173,9 @@ TEST(PropertyLoads) {
"f({name : \"test\"})\n",
2 * kPointerSize,
2,
- 1291,
+ 1292,
{
+ B(StackCheck), //
B(Ldar), A(1, 2), //
B(Star), R(1), //
B(LoadICSloppy), R(1), U8(0), U8(wide_idx_1 += 2), //
@@ -1035,8 +1201,9 @@ TEST(PropertyLoads) {
"f({name : \"test\"})\n",
2 * kPointerSize,
2,
- 1291,
+ 1292,
{
+ B(StackCheck), //
B(Ldar), A(1, 2), //
B(Star), R(1), //
B(LoadICStrict), R(1), U8(0), U8((wide_idx_2 += 2)), //
@@ -1062,8 +1229,9 @@ TEST(PropertyLoads) {
"f({name : \"test\"}, \"name\")\n",
2 * kPointerSize,
3,
- 1419,
+ 1420,
{
+ B(StackCheck), //
B(Ldar), A(1, 3), //
B(Star), R(1), //
B(Ldar), A(2, 3), //
@@ -1089,8 +1257,9 @@ TEST(PropertyLoads) {
"f({name : \"test\"}, \"name\")\n",
2 * kPointerSize,
3,
- 1419,
+ 1420,
{
+ B(StackCheck), //
B(Ldar), A(1, 3), //
B(Star), R(1), //
B(Ldar), A(2, 3), //
@@ -1109,6 +1278,8 @@ TEST(PropertyLoads) {
B(Return), //
}},
};
+ // clang-format on
+
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
helper.MakeBytecode(snippets[i].code_snippet, helper.kFunctionName);
@@ -1135,12 +1306,14 @@ TEST(PropertyStores) {
int wide_idx_3 = vector->GetIndex(slot1) - 2;
int wide_idx_4 = vector->GetIndex(slot1) - 2;
+ // clang-format off
ExpectedSnippet<const char*> snippets[] = {
{"function f(a) { a.name = \"val\"; }\nf({name : \"test\"})",
kPointerSize,
2,
- 12,
+ 13,
{
+ B(StackCheck), //
B(Ldar), A(1, 2), //
B(Star), R(0), //
B(LdaConstant), U8(0), //
@@ -1153,8 +1326,9 @@ TEST(PropertyStores) {
{"function f(a) { a[\"key\"] = \"val\"; }\nf({key : \"test\"})",
kPointerSize,
2,
- 12,
+ 13,
{
+ B(StackCheck), //
B(Ldar), A(1, 2), //
B(Star), R(0), //
B(LdaConstant), U8(0), //
@@ -1167,8 +1341,9 @@ TEST(PropertyStores) {
{"function f(a) { a[100] = \"val\"; }\nf({100 : \"test\"})",
2 * kPointerSize,
2,
- 16,
+ 17,
{
+ B(StackCheck), //
B(Ldar), A(1, 2), //
B(Star), R(0), //
B(LdaSmi8), U8(100), //
@@ -1184,8 +1359,9 @@ TEST(PropertyStores) {
{"function f(a, b) { a[b] = \"val\"; }\nf({arg : \"test\"}, \"arg\")",
2 * kPointerSize,
3,
- 16,
+ 17,
{
+ B(StackCheck), //
B(Ldar), A(1, 3), //
B(Star), R(0), //
B(Ldar), A(2, 3), //
@@ -1202,8 +1378,9 @@ TEST(PropertyStores) {
"f({\"-124\" : \"test\", name : 123 })",
2 * kPointerSize,
2,
- 19,
+ 20,
{
+ B(StackCheck), //
B(Ldar), A(1, 2), //
B(Star), R(0), //
B(Ldar), A(1, 2), //
@@ -1220,8 +1397,9 @@ TEST(PropertyStores) {
"f({name : \"test\"})",
kPointerSize,
2,
- 12,
+ 13,
{
+ B(StackCheck), //
B(Ldar), A(1, 2), //
B(Star), R(0), //
B(LdaConstant), U8(0), //
@@ -1235,8 +1413,9 @@ TEST(PropertyStores) {
"f({arg : \"test\"}, \"arg\")",
2 * kPointerSize,
3,
- 16,
+ 17,
{
+ B(StackCheck), //
B(Ldar), A(1, 3), //
B(Star), R(0), //
B(Ldar), A(2, 3), //
@@ -1255,8 +1434,9 @@ TEST(PropertyStores) {
"f({name : \"test\"})\n",
kPointerSize,
2,
- 1294,
+ 1295,
{
+ B(StackCheck), //
B(Ldar), A(1, 2), //
B(Star), R(0), //
B(LdaSmi8), U8(1), //
@@ -1284,8 +1464,9 @@ TEST(PropertyStores) {
"f({name : \"test\"})\n",
kPointerSize,
2,
- 1294,
+ 1295,
{
+ B(StackCheck), //
B(Ldar), A(1, 2), //
B(Star), R(0), //
B(LdaSmi8), U8(1), //
@@ -1312,8 +1493,9 @@ TEST(PropertyStores) {
"f({name : \"test\"})\n",
2 * kPointerSize,
3,
- 1809,
+ 1810,
{
+ B(StackCheck), //
B(Ldar), A(1, 3), //
B(Star), R(0), //
B(Ldar), A(2, 3), //
@@ -1345,8 +1527,9 @@ TEST(PropertyStores) {
"f({name : \"test\"})\n",
2 * kPointerSize,
3,
- 1809,
+ 1810,
{
+ B(StackCheck), //
B(Ldar), A(1, 3), //
B(Star), R(0), //
B(Ldar), A(2, 3), //
@@ -1369,7 +1552,10 @@ TEST(PropertyStores) {
B(KeyedStoreICStrictWide), R(0), R(1), U16(wide_idx_4 + 2), //
B(LdaUndefined), //
B(Return), //
- }}};
+ }}
+ };
+ // clang-format on
+
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
helper.MakeBytecode(snippets[i].code_snippet, helper.kFunctionName);
@@ -1396,12 +1582,14 @@ TEST(PropertyCall) {
// These are a hack used by the CallWide test below.
int wide_idx = vector->GetIndex(slot1) - 2;
+ // clang-format off
ExpectedSnippet<const char*> snippets[] = {
{"function f(a) { return a.func(); }\nf(" FUNC_ARG ")",
2 * kPointerSize,
2,
- 16,
+ 17,
{
+ B(StackCheck), //
B(Ldar), A(1, 2), //
B(Star), R(1), //
B(LoadICSloppy), R(1), U8(0), U8(vector->GetIndex(slot2)), //
@@ -1414,8 +1602,9 @@ TEST(PropertyCall) {
{"function f(a, b, c) { return a.func(b, c); }\nf(" FUNC_ARG ", 1, 2)",
4 * kPointerSize,
4,
- 24,
+ 25,
{
+ B(StackCheck), //
B(Ldar), A(1, 4), //
B(Star), R(1), //
B(LoadICSloppy), R(1), U8(0), U8(vector->GetIndex(slot2)), //
@@ -1432,8 +1621,9 @@ TEST(PropertyCall) {
{"function f(a, b) { return a.func(b + b, b); }\nf(" FUNC_ARG ", 1)",
4 * kPointerSize,
3,
- 30,
+ 31,
{
+ B(StackCheck), //
B(Ldar), A(1, 3), //
B(Star), R(1), //
B(LoadICSloppy), R(1), U8(0), U8(vector->GetIndex(slot2)), //
@@ -1455,8 +1645,9 @@ TEST(PropertyCall) {
SPACE, " a.func;\n") " return a.func(); }\nf(" FUNC_ARG ")",
2 * kPointerSize,
2,
- 1046,
+ 1047,
{
+ B(StackCheck), //
B(Ldar), A(1, 2), //
B(Star), R(0), //
B(LoadICSloppy), R(0), U8(0), U8(wide_idx += 2), //
@@ -1474,6 +1665,8 @@ TEST(PropertyCall) {
1,
{"func"}},
};
+ // clang-format on
+
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
helper.MakeBytecode(snippets[i].code_snippet, helper.kFunctionName);
@@ -1497,12 +1690,14 @@ TEST(LoadGlobal) {
int wide_idx_1 = vector->GetIndex(slot) - 2;
int wide_idx_2 = vector->GetIndex(slot) - 2;
+ // clang-format off
ExpectedSnippet<const char*> snippets[] = {
{"var a = 1;\nfunction f() { return a; }\nf()",
0,
1,
- 4,
+ 5,
{
+ B(StackCheck), //
B(LdaGlobalSloppy), U8(0), U8(vector->GetIndex(slot)), //
B(Return) //
},
@@ -1511,8 +1706,9 @@ TEST(LoadGlobal) {
{"function t() { }\nfunction f() { return t; }\nf()",
0,
1,
- 4,
+ 5,
{
+ B(StackCheck), //
B(LdaGlobalSloppy), U8(0), U8(vector->GetIndex(slot)), //
B(Return) //
},
@@ -1521,8 +1717,9 @@ TEST(LoadGlobal) {
{"'use strict'; var a = 1;\nfunction f() { return a; }\nf()",
0,
1,
- 4,
+ 5,
{
+ B(StackCheck), //
B(LdaGlobalStrict), U8(0), U8(vector->GetIndex(slot)), //
B(Return) //
},
@@ -1531,8 +1728,9 @@ TEST(LoadGlobal) {
{"a = 1;\nfunction f() { return a; }\nf()",
0,
1,
- 4,
+ 5,
{
+ B(StackCheck), //
B(LdaGlobalSloppy), U8(0), U8(vector->GetIndex(slot)), //
B(Return) //
},
@@ -1546,8 +1744,9 @@ TEST(LoadGlobal) {
"}\nf({name: 1});",
kPointerSize,
2,
- 1030,
+ 1031,
{
+ B(StackCheck), //
B(Ldar), A(1, 2), //
B(Star), R(0), //
B(LoadICSloppy), R(0), U8(0), U8(wide_idx_1 += 2), //
@@ -1569,8 +1768,9 @@ TEST(LoadGlobal) {
"}\nf({name: 1});",
kPointerSize,
2,
- 1030,
+ 1031,
{
+ B(StackCheck), //
B(Ldar), A(1, 2), //
B(Star), R(0), //
B(LoadICStrict), R(0), U8(0), U8(wide_idx_2 += 2), //
@@ -1584,6 +1784,7 @@ TEST(LoadGlobal) {
2,
{"name", "a"}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -1608,12 +1809,14 @@ TEST(StoreGlobal) {
int wide_idx_1 = vector->GetIndex(slot) - 2;
int wide_idx_2 = vector->GetIndex(slot) - 2;
+ // clang-format off
ExpectedSnippet<const char*> snippets[] = {
{"var a = 1;\nfunction f() { a = 2; }\nf()",
0,
1,
- 7,
+ 8,
{
+ B(StackCheck), //
B(LdaSmi8), U8(2), //
B(StaGlobalSloppy), U8(0), U8(vector->GetIndex(slot)), //
B(LdaUndefined), //
@@ -1624,8 +1827,9 @@ TEST(StoreGlobal) {
{"var a = \"test\"; function f(b) { a = b; }\nf(\"global\")",
0,
2,
- 7,
+ 8,
{
+ B(StackCheck), //
B(Ldar), R(helper.kLastParamIndex), //
B(StaGlobalSloppy), U8(0), U8(vector->GetIndex(slot)), //
B(LdaUndefined), //
@@ -1636,8 +1840,9 @@ TEST(StoreGlobal) {
{"'use strict'; var a = 1;\nfunction f() { a = 2; }\nf()",
0,
1,
- 7,
+ 8,
{
+ B(StackCheck), //
B(LdaSmi8), U8(2), //
B(StaGlobalStrict), U8(0), U8(vector->GetIndex(slot)), //
B(LdaUndefined), //
@@ -1648,8 +1853,9 @@ TEST(StoreGlobal) {
{"a = 1;\nfunction f() { a = 2; }\nf()",
0,
1,
- 7,
+ 8,
{
+ B(StackCheck), //
B(LdaSmi8), U8(2), //
B(StaGlobalSloppy), U8(0), U8(vector->GetIndex(slot)), //
B(LdaUndefined), //
@@ -1665,8 +1871,9 @@ TEST(StoreGlobal) {
"f({name: 1});",
kPointerSize,
2,
- 1033,
+ 1034,
{
+ B(StackCheck), //
B(Ldar), A(1, 2), //
B(Star), R(0), //
B(LoadICSloppy), R(0), U8(0), U8(wide_idx_1 += 2), //
@@ -1690,8 +1897,9 @@ TEST(StoreGlobal) {
"f({name: 1});",
kPointerSize,
2,
- 1033,
+ 1034,
{
+ B(StackCheck), //
B(Ldar), A(1, 2), //
B(Star), R(0), //
B(LoadICStrict), R(0), U8(0), U8(wide_idx_2 += 2), //
@@ -1707,6 +1915,7 @@ TEST(StoreGlobal) {
2,
{"name", "a"}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -1728,12 +1937,14 @@ TEST(CallGlobal) {
Handle<i::TypeFeedbackVector> vector =
i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec);
+ // clang-format off
ExpectedSnippet<const char*> snippets[] = {
{"function t() { }\nfunction f() { return t(); }\nf()",
2 * kPointerSize,
1,
- 14,
+ 15,
{
+ B(StackCheck), //
B(LdaUndefined), //
B(Star), R(1), //
B(LdaGlobalSloppy), U8(0), U8(vector->GetIndex(slot2)), //
@@ -1746,8 +1957,9 @@ TEST(CallGlobal) {
{"function t(a, b, c) { }\nfunction f() { return t(1, 2, 3); }\nf()",
5 * kPointerSize,
1,
- 26,
+ 27,
{
+ B(StackCheck), //
B(LdaUndefined), //
B(Star), R(1), //
B(LdaGlobalSloppy), U8(0), U8(vector->GetIndex(slot2)), //
@@ -1764,6 +1976,7 @@ TEST(CallGlobal) {
1,
{"t"}},
};
+ // clang-format on
size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]);
for (size_t i = 0; i < num_snippets; i++) {
@@ -1778,13 +1991,15 @@ TEST(CallRuntime) {
InitializedHandleScope handle_scope;
BytecodeGeneratorHelper helper;
+ // clang-format off
ExpectedSnippet<InstanceType> snippets[] = {
{
"function f() { %TheHole() }\nf()",
0,
1,
- 7,
+ 8,
{
+ B(StackCheck), //
B(CallRuntime), U16(Runtime::kTheHole), R(0), U8(0), //
B(LdaUndefined), //
B(Return) //
@@ -1794,8 +2009,9 @@ TEST(CallRuntime) {
"function f(a) { return %IsArray(a) }\nf(undefined)",
1 * kPointerSize,
2,
- 10,
+ 11,
{
+ B(StackCheck), //
B(Ldar), A(1, 2), //
B(Star), R(0), //
B(CallRuntime), U16(Runtime::kIsArray), R(0), U8(1), //
@@ -1806,8 +2022,9 @@ TEST(CallRuntime) {
"function f() { return %Add(1, 2) }\nf()",
2 * kPointerSize,
1,
- 14,
+ 15,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(LdaSmi8), U8(2), //
@@ -1820,20 +2037,22 @@ TEST(CallRuntime) {
"function f() { return %spread_iterable([1]) }\nf()",
2 * kPointerSize,
1,
- 15,
+ 16,
{
+ B(StackCheck), //
B(LdaUndefined), //
B(Star), R(0), //
B(CreateArrayLiteral), U8(0), U8(0), U8(3), //
B(Star), R(1), //
B(CallJSRuntime), U16(Context::SPREAD_ITERABLE_INDEX), R(0), //
- U8(2), //
+ /* */ U8(2), //
B(Return), //
},
1,
{InstanceType::FIXED_ARRAY_TYPE},
},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -1849,12 +2068,14 @@ TEST(IfConditions) {
Handle<Object> unused = helper.factory()->undefined_value();
+ // clang-format off
ExpectedSnippet<Handle<Object>> snippets[] = {
{"function f() { if (0) { return 1; } else { return -1; } } f()",
0,
1,
- 3,
+ 4,
{
+ B(StackCheck), //
B(LdaSmi8), U8(-1), //
B(Return), //
},
@@ -1863,8 +2084,9 @@ TEST(IfConditions) {
{"function f() { if ('lucky') { return 1; } else { return -1; } } f();",
0,
1,
- 3,
+ 4,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Return), //
},
@@ -1873,8 +2095,9 @@ TEST(IfConditions) {
{"function f() { if (false) { return 1; } else { return -1; } } f();",
0,
1,
- 3,
+ 4,
{
+ B(StackCheck), //
B(LdaSmi8), U8(-1), //
B(Return), //
},
@@ -1883,8 +2106,9 @@ TEST(IfConditions) {
{"function f() { if (false) { return 1; } } f();",
0,
1,
- 2,
+ 3,
{
+ B(StackCheck), //
B(LdaUndefined), //
B(Return), //
},
@@ -1893,8 +2117,9 @@ TEST(IfConditions) {
{"function f() { var a = 1; if (a) { a += 1; } else { return 2; } } f();",
2 * kPointerSize,
1,
- 23,
+ 24,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(JumpIfToBooleanFalse), U8(14), //
@@ -1915,8 +2140,9 @@ TEST(IfConditions) {
"f(99);",
kPointerSize,
2,
- 17,
+ 18,
{
+ B(StackCheck), //
B(Ldar), A(1, 2), //
B(Star), R(0), //
B(LdaZero), //
@@ -1937,8 +2163,9 @@ TEST(IfConditions) {
"f('prop', { prop: 'yes'});",
kPointerSize,
3,
- 15,
+ 16,
{
+ B(StackCheck), //
B(Ldar), A(1, 3), //
B(Star), R(0), //
B(Ldar), A(2, 3), //
@@ -1957,8 +2184,9 @@ TEST(IfConditions) {
" return 200; } else { return -200; } } f(0.001)",
3 * kPointerSize,
2,
- 282,
+ 283,
{
+ B(StackCheck), //
B(LdaZero), //
B(Star), R(0), //
B(LdaZero), //
@@ -1988,8 +2216,9 @@ TEST(IfConditions) {
" return 200; } else { return -200; } } f()",
2 * kPointerSize,
1,
- 276,
+ 277,
{
+ B(StackCheck), //
B(LdaZero), //
B(Star), R(0), //
B(LdaZero), //
@@ -2024,7 +2253,7 @@ TEST(IfConditions) {
"} f(1, 1);",
kPointerSize,
3,
- 106,
+ 107,
{
#define IF_CONDITION_RETURN(condition) \
B(Ldar), A(1, 3), \
@@ -2034,6 +2263,7 @@ TEST(IfConditions) {
B(JumpIfFalse), U8(5), \
B(LdaSmi8), U8(1), \
B(Return),
+ B(StackCheck), //
IF_CONDITION_RETURN(TestEqual) //
IF_CONDITION_RETURN(TestEqualStrict) //
IF_CONDITION_RETURN(TestLessThan) //
@@ -2057,8 +2287,9 @@ TEST(IfConditions) {
"f();",
1 * kPointerSize,
1,
- 13,
+ 14,
{
+ B(StackCheck), //
B(LdaZero), //
B(Star), R(0), //
B(JumpIfToBooleanFalse), U8(5), //
@@ -2070,7 +2301,9 @@ TEST(IfConditions) {
B(Return)
},
0,
- {unused, unused, unused, unused, unused, unused}}};
+ {unused, unused, unused, unused, unused, unused}}
+ };
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -2101,17 +2334,19 @@ TEST(DeclareGlobals) {
Handle<i::TypeFeedbackVector> load_vector =
i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec_loads);
+ // clang-format off
ExpectedSnippet<InstanceType> snippets[] = {
{"var a = 1;",
4 * kPointerSize,
1,
- 30,
+ 31,
{
B(LdaConstant), U8(0), //
B(Star), R(1), //
B(LdaZero), //
B(Star), R(2), //
B(CallRuntime), U16(Runtime::kDeclareGlobals), R(1), U8(2), //
+ B(StackCheck), //
B(LdaConstant), U8(1), //
B(Star), R(1), //
B(LdaZero), //
@@ -2128,13 +2363,14 @@ TEST(DeclareGlobals) {
{"function f() {}",
2 * kPointerSize,
1,
- 14,
+ 15,
{
B(LdaConstant), U8(0), //
B(Star), R(0), //
B(LdaZero), //
B(Star), R(1), //
B(CallRuntime), U16(Runtime::kDeclareGlobals), R(0), U8(2), //
+ B(StackCheck), //
B(LdaUndefined), //
B(Return) //
},
@@ -2143,13 +2379,14 @@ TEST(DeclareGlobals) {
{"var a = 1;\na=2;",
4 * kPointerSize,
1,
- 36,
+ 37,
{
B(LdaConstant), U8(0), //
B(Star), R(1), //
B(LdaZero), //
B(Star), R(2), //
B(CallRuntime), U16(Runtime::kDeclareGlobals), R(1), U8(2), //
+ B(StackCheck), //
B(LdaConstant), U8(1), //
B(Star), R(1), //
B(LdaZero), //
@@ -2159,7 +2396,7 @@ TEST(DeclareGlobals) {
B(CallRuntime), U16(Runtime::kInitializeVarGlobal), R(1), U8(3), //
B(LdaSmi8), U8(2), //
B(StaGlobalSloppy), U8(1), //
- U8(store_vector->GetIndex(store_slot_2)), //
+ /* */ U8(store_vector->GetIndex(store_slot_2)), //
B(Star), R(0), //
B(Return) //
},
@@ -2169,20 +2406,21 @@ TEST(DeclareGlobals) {
{"function f() {}\nf();",
3 * kPointerSize,
1,
- 28,
+ 29,
{
B(LdaConstant), U8(0), //
B(Star), R(1), //
B(LdaZero), //
B(Star), R(2), //
B(CallRuntime), U16(Runtime::kDeclareGlobals), R(1), U8(2), //
+ B(StackCheck), //
B(LdaUndefined), //
B(Star), R(2), //
B(LdaGlobalSloppy), U8(1), //
- U8(load_vector->GetIndex(load_slot_1)), //
+ /* */ U8(load_vector->GetIndex(load_slot_1)), //
B(Star), R(1), //
B(Call), R(1), R(2), U8(1), //
- U8(load_vector->GetIndex(call_slot_1)), //
+ /* */ U8(load_vector->GetIndex(call_slot_1)), //
B(Star), R(0), //
B(Return) //
},
@@ -2190,6 +2428,7 @@ TEST(DeclareGlobals) {
{InstanceType::FIXED_ARRAY_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -2206,6 +2445,7 @@ TEST(BreakableBlocks) {
int closure = Register::function_closure().index();
int context = Register::current_context().index();
+ // clang-format off
ExpectedSnippet<InstanceType> snippets[] = {
{"var x = 0;\n"
"label: {\n"
@@ -2216,8 +2456,9 @@ TEST(BreakableBlocks) {
"return x;",
2 * kPointerSize,
1,
- 16,
+ 17,
{
+ B(StackCheck), //
B(LdaZero), //
B(Star), R(0), //
B(Star), R(1), //
@@ -2240,8 +2481,9 @@ TEST(BreakableBlocks) {
"return sum;",
5 * kPointerSize,
1,
- 72,
+ 75,
{
+ B(StackCheck), //
B(LdaZero), //
B(Star), R(0), //
B(LdaZero), //
@@ -2250,14 +2492,16 @@ TEST(BreakableBlocks) {
B(Star), R(3), //
B(LdaSmi8), U8(10), //
B(TestLessThan), R(3), //
- B(JumpIfFalse), U8(55), //
+ B(JumpIfFalse), U8(57), //
+ B(StackCheck), //
B(LdaZero), //
B(Star), R(2), //
B(Ldar), R(2), //
B(Star), R(3), //
B(LdaSmi8), U8(3), //
B(TestLessThan), R(3), //
- B(JumpIfFalse), U8(34), //
+ B(JumpIfFalse), U8(35), //
+ B(StackCheck), //
B(Ldar), R(0), //
B(ToNumber), //
B(Inc), //
@@ -2275,12 +2519,12 @@ TEST(BreakableBlocks) {
B(ToNumber), //
B(Inc), //
B(Star), R(2), //
- B(Jump), U8(-40), //
+ B(Jump), U8(-41), //
B(Ldar), R(1), //
B(ToNumber), //
B(Inc), //
B(Star), R(1), //
- B(Jump), U8(-61), //
+ B(Jump), U8(-63), //
B(Ldar), R(0), //
B(Return), //
}},
@@ -2291,8 +2535,9 @@ TEST(BreakableBlocks) {
"}\n",
5 * kPointerSize,
1,
- 39,
+ 40,
{
+ B(StackCheck), //
B(LdaConstant), U8(0), //
B(Star), R(3), //
B(Ldar), R(closure), //
@@ -2327,13 +2572,14 @@ TEST(BreakableBlocks) {
"x = 4;",
6 * kPointerSize,
1,
- 72,
+ 73,
{
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), //
- U8(1), //
+ /* */ U8(1), //
B(PushContext), R(2), //
B(LdaTheHole), //
B(StaContextSlot), R(context), U8(4), //
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(StaContextSlot), R(context), U8(4), //
B(LdaConstant), U8(0), //
@@ -2366,6 +2612,7 @@ TEST(BreakableBlocks) {
{InstanceType::FIXED_ARRAY_TYPE,
InstanceType::SHARED_FUNCTION_INFO_TYPE}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -2382,14 +2629,16 @@ TEST(BasicLoops) {
int closure = Register::function_closure().index();
int context = Register::current_context().index();
+ // clang-format off
ExpectedSnippet<InstanceType> snippets[] = {
{"var x = 0;\n"
"while (false) { x = 99; break; continue; }\n"
"return x;",
1 * kPointerSize,
1,
- 4,
+ 5,
{
+ B(StackCheck), //
B(LdaZero), //
B(Star), R(0), //
B(Return) //
@@ -2401,8 +2650,9 @@ TEST(BasicLoops) {
"return x;",
1 * kPointerSize,
1,
- 4,
+ 5,
{
+ B(StackCheck), //
B(LdaZero), //
B(Star), R(0), //
B(Return), //
@@ -2419,8 +2669,9 @@ TEST(BasicLoops) {
"return y;",
3 * kPointerSize,
1,
- 64,
+ 66,
{
+ B(StackCheck), //
B(LdaZero), //
B(Star), R(0), //
B(LdaSmi8), U8(1), //
@@ -2429,7 +2680,8 @@ TEST(BasicLoops) {
B(Star), R(2), //
B(LdaSmi8), U8(10), //
B(TestLessThan), R(2), //
- B(JumpIfFalse), U8(46), //
+ B(JumpIfFalse), U8(47), //
+ B(StackCheck), //
B(Ldar), R(1), //
B(Star), R(2), //
B(LdaSmi8), U8(12), //
@@ -2444,14 +2696,14 @@ TEST(BasicLoops) {
B(LdaSmi8), U8(3), //
B(TestEqual), R(2), //
B(JumpIfFalse), U8(4), //
- B(Jump), U8(-38), //
+ B(Jump), U8(-39), //
B(Ldar), R(0), //
B(Star), R(2), //
B(LdaSmi8), U8(4), //
B(TestEqual), R(2), //
B(JumpIfFalse), U8(4), //
B(Jump), U8(4), //
- B(Jump), U8(-52), //
+ B(Jump), U8(-53), //
B(Ldar), R(1), //
B(Return), //
},
@@ -2468,16 +2720,18 @@ TEST(BasicLoops) {
"return i;",
2 * kPointerSize,
1,
- 77,
+ 79,
{
+ B(StackCheck), //
B(LdaZero), //
B(Star), R(0), //
+ B(StackCheck), //
B(Ldar), R(0), //
B(Star), R(1), //
B(LdaZero), //
B(TestLessThan), R(1), //
B(JumpIfFalse), U8(4), //
- B(Jump), U8(-9), //
+ B(Jump), U8(-10), //
B(Ldar), R(0), //
B(Star), R(1), //
B(LdaSmi8), U8(3), //
@@ -2495,7 +2749,7 @@ TEST(BasicLoops) {
B(LdaSmi8), U8(10), //
B(TestEqual), R(1), //
B(JumpIfFalse), U8(4), //
- B(Jump), U8(-45), //
+ B(Jump), U8(-46), //
B(Ldar), R(0), //
B(Star), R(1), //
B(LdaSmi8), U8(5), //
@@ -2507,7 +2761,7 @@ TEST(BasicLoops) {
B(LdaSmi8), U8(1), //
B(Add), R(1), //
B(Star), R(0), //
- B(Jump), U8(-69), //
+ B(Jump), U8(-70), //
B(Ldar), R(0), //
B(Return), //
},
@@ -2524,15 +2778,18 @@ TEST(BasicLoops) {
"return i;",
2 * kPointerSize,
1,
- 54,
+ 57,
{
+ B(StackCheck), //
B(LdaZero), //
B(Star), R(0), //
+ B(StackCheck), //
B(Ldar), R(0), //
B(Star), R(1), //
B(LdaSmi8), U8(3), //
B(TestLessThan), R(1), //
- B(JumpIfFalse), U8(26), //
+ B(JumpIfFalse), U8(27), //
+ B(StackCheck), //
B(Ldar), R(0), //
B(Star), R(1), //
B(LdaSmi8), U8(2), //
@@ -2544,14 +2801,14 @@ TEST(BasicLoops) {
B(LdaSmi8), U8(1), //
B(Add), R(1), //
B(Star), R(0), //
- B(Jump), U8(-32), //
+ B(Jump), U8(-33), //
B(Ldar), R(0), //
B(Star), R(1), //
B(LdaSmi8), U8(1), //
B(Add), R(1), //
B(Star), R(0), //
B(Jump), U8(4), //
- B(Jump), U8(-46), //
+ B(Jump), U8(-48), //
B(Ldar), R(0), //
B(Return), //
},
@@ -2565,14 +2822,16 @@ TEST(BasicLoops) {
"return y;",
3 * kPointerSize,
1,
- 37,
+ 39,
{
+ B(StackCheck), //
B(LdaSmi8), U8(10), //
B(Star), R(0), //
B(LdaSmi8), U8(1), //
B(Star), R(1), //
B(Ldar), R(0), //
- B(JumpIfToBooleanFalse), U8(24), //
+ B(JumpIfToBooleanFalse), U8(25), //
+ B(StackCheck), //
B(Ldar), R(1), //
B(Star), R(2), //
B(LdaSmi8), U8(12), //
@@ -2583,7 +2842,7 @@ TEST(BasicLoops) {
B(LdaSmi8), U8(1), //
B(Sub), R(2), //
B(Star), R(0), //
- B(Jump), U8(-24), //
+ B(Jump), U8(-25), //
B(Ldar), R(1), //
B(Return), //
},
@@ -2598,12 +2857,14 @@ TEST(BasicLoops) {
"return y;",
3 * kPointerSize,
1,
- 64,
+ 66,
{
+ B(StackCheck), //
B(LdaZero), //
B(Star), R(0), //
B(LdaSmi8), U8(1), //
B(Star), R(1), //
+ B(StackCheck), //
B(Ldar), R(1), //
B(Star), R(2), //
B(LdaSmi8), U8(10), //
@@ -2630,7 +2891,7 @@ TEST(BasicLoops) {
B(Star), R(2), //
B(LdaSmi8), U8(10), //
B(TestLessThan), R(2), //
- B(JumpIfTrue), U8(-52), //
+ B(JumpIfTrue), U8(-53), //
B(Ldar), R(1), //
B(Return), //
},
@@ -2644,12 +2905,14 @@ TEST(BasicLoops) {
"return y;",
3 * kPointerSize,
1,
- 35,
+ 37,
{
+ B(StackCheck), //
B(LdaSmi8), U8(10), //
B(Star), R(0), //
B(LdaSmi8), U8(1), //
B(Star), R(1), //
+ B(StackCheck), //
B(Ldar), R(1), //
B(Star), R(2), //
B(LdaSmi8), U8(12), //
@@ -2661,7 +2924,7 @@ TEST(BasicLoops) {
B(Sub), R(2), //
B(Star), R(0), //
B(Ldar), R(0), //
- B(JumpIfToBooleanTrue), U8(-22), //
+ B(JumpIfToBooleanTrue), U8(-23), //
B(Ldar), R(1), //
B(Return), //
},
@@ -2676,12 +2939,14 @@ TEST(BasicLoops) {
"return y;",
3 * kPointerSize,
1,
- 52,
+ 54,
{
+ B(StackCheck), //
B(LdaZero), //
B(Star), R(0), //
B(LdaSmi8), U8(1), //
B(Star), R(1), //
+ B(StackCheck), //
B(Ldar), R(1), //
B(Star), R(2), //
B(LdaSmi8), U8(10), //
@@ -2717,12 +2982,14 @@ TEST(BasicLoops) {
"return y;",
3 * kPointerSize,
1,
- 54,
+ 56,
{
+ B(StackCheck), //
B(LdaZero), //
B(Star), R(0), //
B(LdaSmi8), U8(1), //
B(Star), R(1), //
+ B(StackCheck), //
B(Ldar), R(1), //
B(Star), R(2), //
B(LdaSmi8), U8(10), //
@@ -2743,8 +3010,8 @@ TEST(BasicLoops) {
B(LdaSmi8), U8(6), //
B(TestEqual), R(2), //
B(JumpIfFalse), U8(4), //
- B(Jump), U8(-40), //
- B(Jump), U8(-42), //
+ B(Jump), U8(-41), //
+ B(Jump), U8(-43), //
B(Ldar), R(1), //
B(Return), //
},
@@ -2757,10 +3024,12 @@ TEST(BasicLoops) {
"}",
2 * kPointerSize,
1,
- 41,
+ 43,
{
+ B(StackCheck), //
B(LdaZero), //
B(Star), R(0), //
+ B(StackCheck), //
B(Ldar), R(0), //
B(Star), R(1), //
B(LdaSmi8), U8(1), //
@@ -2772,13 +3041,13 @@ TEST(BasicLoops) {
B(LdaSmi8), U8(2), //
B(TestEqual), R(1), //
B(JumpIfFalse), U8(4), //
- B(Jump), U8(-22), //
+ B(Jump), U8(-23), //
B(Ldar), R(0), //
B(Star), R(1), //
B(LdaSmi8), U8(1), //
B(Add), R(1), //
B(Star), R(0), //
- B(Jump), U8(-34), //
+ B(Jump), U8(-35), //
B(LdaUndefined), //
B(Return), //
},
@@ -2790,10 +3059,12 @@ TEST(BasicLoops) {
"}",
2 * kPointerSize,
1,
- 41,
+ 43,
{
+ B(StackCheck), //
B(LdaZero), //
B(Star), R(0), //
+ B(StackCheck), //
B(Ldar), R(0), //
B(Star), R(1), //
B(LdaSmi8), U8(1), //
@@ -2805,13 +3076,13 @@ TEST(BasicLoops) {
B(LdaSmi8), U8(2), //
B(TestEqual), R(1), //
B(JumpIfFalse), U8(4), //
- B(Jump), U8(-22), //
+ B(Jump), U8(-23), //
B(Ldar), R(0), //
B(Star), R(1), //
B(LdaSmi8), U8(1), //
B(Add), R(1), //
B(Star), R(0), //
- B(Jump), U8(-34), //
+ B(Jump), U8(-35), //
B(LdaUndefined), //
B(Return), //
},
@@ -2823,10 +3094,12 @@ TEST(BasicLoops) {
"}",
2 * kPointerSize,
1,
- 41,
+ 43,
{
+ B(StackCheck), //
B(LdaZero), //
B(Star), R(0), //
+ B(StackCheck), //
B(Ldar), R(0), //
B(Star), R(1), //
B(LdaSmi8), U8(1), //
@@ -2844,7 +3117,7 @@ TEST(BasicLoops) {
B(LdaSmi8), U8(1), //
B(Add), R(1), //
B(Star), R(0), //
- B(Jump), U8(-34), //
+ B(Jump), U8(-35), //
B(LdaUndefined), //
B(Return), //
},
@@ -2855,10 +3128,12 @@ TEST(BasicLoops) {
"}",
2 * kPointerSize,
1,
- 41,
+ 43,
{
+ B(StackCheck), //
B(LdaZero), //
B(Star), R(0), //
+ B(StackCheck), //
B(Ldar), R(0), //
B(Star), R(1), //
B(LdaSmi8), U8(1), //
@@ -2876,7 +3151,7 @@ TEST(BasicLoops) {
B(LdaSmi8), U8(1), //
B(Add), R(1), //
B(Star), R(0), //
- B(Jump), U8(-34), //
+ B(Jump), U8(-35), //
B(LdaUndefined), //
B(Return), //
},
@@ -2888,8 +3163,9 @@ TEST(BasicLoops) {
"}",
3 * kPointerSize,
1,
- 42,
+ 44,
{
+ B(StackCheck), //
B(LdaZero), //
B(Star), R(0), //
B(LdaZero), //
@@ -2898,7 +3174,8 @@ TEST(BasicLoops) {
B(Star), R(2), //
B(LdaSmi8), U8(100), //
B(TestLessThan), R(2), //
- B(JumpIfFalse), U8(26), //
+ B(JumpIfFalse), U8(27), //
+ B(StackCheck), //
B(Ldar), R(0), //
B(Star), R(2), //
B(LdaSmi8), U8(1), //
@@ -2910,7 +3187,7 @@ TEST(BasicLoops) {
B(LdaSmi8), U8(1), //
B(Add), R(2), //
B(Star), R(1), //
- B(Jump), U8(-32), //
+ B(Jump), U8(-33), //
B(LdaUndefined), //
B(Return), //
},
@@ -2922,14 +3199,16 @@ TEST(BasicLoops) {
"return y;",
3 * kPointerSize,
1,
- 33,
+ 35,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(LdaSmi8), U8(10), //
B(Star), R(1), //
B(Ldar), R(1), //
- B(JumpIfToBooleanFalse), U8(20), //
+ B(JumpIfToBooleanFalse), U8(21), //
+ B(StackCheck), //
B(Ldar), R(0), //
B(Star), R(2), //
B(LdaSmi8), U8(12), //
@@ -2939,7 +3218,7 @@ TEST(BasicLoops) {
B(ToNumber), //
B(Dec), //
B(Star), R(1), //
- B(Jump), U8(-20), //
+ B(Jump), U8(-21), //
B(Ldar), R(0), //
B(Return), //
},
@@ -2951,8 +3230,9 @@ TEST(BasicLoops) {
"return x;",
2 * kPointerSize,
1,
- 9,
+ 10,
{
+ B(StackCheck), //
B(LdaZero), //
B(Star), R(0), //
B(LdaZero), //
@@ -2969,12 +3249,14 @@ TEST(BasicLoops) {
"return x;",
3 * kPointerSize,
1,
- 37,
+ 39,
{
+ B(StackCheck), //
B(LdaZero), //
B(Star), R(0), //
B(LdaZero), //
B(Star), R(1), //
+ B(StackCheck), //
B(Ldar), R(0), //
B(Star), R(2), //
B(LdaSmi8), U8(1), //
@@ -2989,7 +3271,7 @@ TEST(BasicLoops) {
B(ToNumber), //
B(Inc), //
B(Star), R(1), //
- B(Jump), U8(-26), //
+ B(Jump), U8(-27), //
B(Ldar), R(0), //
B(Return), //
},
@@ -3005,12 +3287,14 @@ TEST(BasicLoops) {
"}\n",
6 * kPointerSize,
1,
- 65,
+ 67,
{
+ B(StackCheck), //
B(LdaZero), //
B(Star), R(1), //
B(Ldar), R(1), //
- B(JumpIfToBooleanFalse), U8(58), //
+ B(JumpIfToBooleanFalse), U8(59), //
+ B(StackCheck), //
B(LdaConstant), U8(0), //
B(Star), R(4), //
B(Ldar), R(closure), //
@@ -3028,14 +3312,14 @@ TEST(BasicLoops) {
B(LdaContextSlot), R(context), U8(4), //
B(JumpIfToBooleanFalse), U8(6), //
B(PopContext), R(3), //
- B(Jump), U8(-44), //
+ B(Jump), U8(-45), //
B(LdaContextSlot), R(context), U8(4), //
B(ToNumber), //
B(Star), R(4), //
B(Inc), //
B(StaContextSlot), R(context), U8(4), //
B(PopContext), R(3), //
- B(Jump), U8(-58), //
+ B(Jump), U8(-59), //
B(LdaUndefined), //
B(Return), //
},
@@ -3043,6 +3327,7 @@ TEST(BasicLoops) {
{InstanceType::FIXED_ARRAY_TYPE,
InstanceType::SHARED_FUNCTION_INFO_TYPE}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -3057,6 +3342,7 @@ TEST(JumpsRequiringConstantWideOperands) {
BytecodeGeneratorHelper helper;
int constant_count = 0;
+ // clang-format off
ExpectedSnippet<Handle<Object>, 316> snippets[] = {
{
REPEAT_256(SPACE, "var x = 0.1;")
@@ -3070,8 +3356,9 @@ TEST(JumpsRequiringConstantWideOperands) {
"return 3;",
kPointerSize * 3,
1,
- 1359,
+ 1361,
{
+ B(StackCheck), //
#define L(c) B(LdaConstant), U8(c), B(Star), R(0)
REPEAT_256(COMMA, L(constant_count++)),
#undef L
@@ -3087,6 +3374,7 @@ TEST(JumpsRequiringConstantWideOperands) {
B(LdaSmi8), U8(3), //
B(TestLessThan), R(2), //
B(JumpIfFalseConstantWide), U16(313), //
+ B(StackCheck), //
B(Ldar), R(1), //
B(Star), R(2), //
B(LdaSmi8), U8(1), //
@@ -3104,7 +3392,7 @@ TEST(JumpsRequiringConstantWideOperands) {
B(Star), R(2), //
B(Inc), //
B(Star), R(1), //
- B(Jump), U8(-47), //
+ B(Jump), U8(-48), //
B(LdaSmi8), U8(3), //
B(Return) //
},
@@ -3117,9 +3405,11 @@ TEST(JumpsRequiringConstantWideOperands) {
REPEAT_8(COMMA, S(0.4)),
#undef S
#define N(x) CcTest::i_isolate()->factory()->NewNumberFromInt(x)
- N(6), N(41), N(13), N(17)
+ N(6), N(42), N(13), N(17)
#undef N
- }}};
+ }}
+ };
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -3133,6 +3423,7 @@ TEST(UnaryOperators) {
InitializedHandleScope handle_scope;
BytecodeGeneratorHelper helper;
+ // clang-format off
ExpectedSnippet<int> snippets[] = {
{"var x = 0;"
"while (x != 10) {"
@@ -3141,8 +3432,9 @@ TEST(UnaryOperators) {
"return x;",
2 * kPointerSize,
1,
- 29,
+ 31,
{
+ B(StackCheck), //
B(LdaZero), //
B(Star), R(0), //
B(Ldar), R(0), //
@@ -3150,13 +3442,14 @@ TEST(UnaryOperators) {
B(LdaSmi8), U8(10), //
B(TestEqual), R(1), //
B(LogicalNot), //
- B(JumpIfFalse), U8(14), //
+ B(JumpIfFalse), U8(15), //
+ B(StackCheck), //
B(Ldar), R(0), //
B(Star), R(1), //
B(LdaSmi8), U8(10), //
B(Add), R(1), //
B(Star), R(0), //
- B(Jump), U8(-21), //
+ B(Jump), U8(-22), //
B(Ldar), R(0), //
B(Return), //
},
@@ -3168,28 +3461,31 @@ TEST(UnaryOperators) {
"return x;",
2 * kPointerSize,
1,
- 20,
+ 22,
{
- 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(StackCheck), //
+ B(LdaFalse), //
+ B(Star), R(0), //
+ B(StackCheck), //
+ 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(-13), //
+ B(Ldar), R(0), //
+ B(Return), //
},
0},
{"var x = 101;"
"return void(x * 3);",
2 * kPointerSize,
1,
- 12,
+ 13,
{
+ B(StackCheck), //
B(LdaSmi8), U8(101), //
B(Star), R(0), //
B(Star), R(1), //
@@ -3204,8 +3500,9 @@ TEST(UnaryOperators) {
"return y;",
4 * kPointerSize,
1,
- 20,
+ 21,
{
+ B(StackCheck), //
B(LdaConstant), U8(0), //
B(Star), R(0), //
B(Star), R(2), //
@@ -3224,8 +3521,9 @@ TEST(UnaryOperators) {
"return ~x;",
2 * kPointerSize,
1,
- 11,
+ 12,
{
+ B(StackCheck), //
B(LdaSmi8), U8(13), //
B(Star), R(0), //
B(Star), R(1), //
@@ -3238,8 +3536,9 @@ TEST(UnaryOperators) {
"return +x;",
2 * kPointerSize,
1,
- 11,
+ 12,
{
+ B(StackCheck), //
B(LdaSmi8), U8(13), //
B(Star), R(0), //
B(Star), R(1), //
@@ -3252,8 +3551,9 @@ TEST(UnaryOperators) {
"return -x;",
2 * kPointerSize,
1,
- 11,
+ 12,
{
+ B(StackCheck), //
B(LdaSmi8), U8(13), //
B(Star), R(0), //
B(Star), R(1), //
@@ -3261,7 +3561,9 @@ TEST(UnaryOperators) {
B(Mul), R(1), //
B(Return), //
},
- 0}};
+ 0}
+ };
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -3282,6 +3584,7 @@ TEST(Typeof) {
Handle<i::TypeFeedbackVector> vector =
i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec);
+ // clang-format off
ExpectedSnippet<const char*> snippets[] = {
{"function f() {\n"
" var x = 13;\n"
@@ -3289,8 +3592,9 @@ TEST(Typeof) {
"}; f();",
kPointerSize,
1,
- 6,
+ 7,
{
+ B(StackCheck), //
B(LdaSmi8), U8(13), //
B(Star), R(0), //
B(TypeOf), //
@@ -3302,10 +3606,11 @@ TEST(Typeof) {
"}; f();",
0,
1,
- 5,
+ 6,
{
+ B(StackCheck), //
B(LdaGlobalInsideTypeofSloppy), U8(0), //
- U8(vector->GetIndex(slot)), //
+ /* */ U8(vector->GetIndex(slot)), //
B(TypeOf), //
B(Return), //
},
@@ -3318,16 +3623,18 @@ TEST(Typeof) {
"}; f();",
0,
1,
- 5,
+ 6,
{
+ B(StackCheck), //
B(LdaGlobalInsideTypeofStrict), U8(0), //
- U8(vector->GetIndex(slot)), //
+ /* */ U8(vector->GetIndex(slot)), //
B(TypeOf), //
B(Return), //
},
1,
{"x"}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -3347,12 +3654,15 @@ TEST(Delete) {
int context = Register::current_context().index();
int first_context_slot = Context::MIN_CONTEXT_SLOTS;
+ // clang-format off
ExpectedSnippet<InstanceType> snippets[] = {
{"var a = {x:13, y:14}; return delete a.x;",
2 * kPointerSize,
1,
- 15,
- {B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
+ 16,
+ {
+ B(StackCheck), //
+ B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
B(Star), R(1), //
B(Star), R(0), //
B(Star), R(1), //
@@ -3365,8 +3675,9 @@ TEST(Delete) {
{"'use strict'; var a = {x:13, y:14}; return delete a.x;",
2 * kPointerSize,
1,
- 15,
- {B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
+ 16,
+ {B(StackCheck), //
+ B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
B(Star), R(1), //
B(Star), R(0), //
B(Star), R(1), //
@@ -3379,8 +3690,9 @@ TEST(Delete) {
{"var a = {1:13, 2:14}; return delete a[2];",
2 * kPointerSize,
1,
- 15,
- {B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
+ 16,
+ {B(StackCheck), //
+ B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
B(Star), R(1), //
B(Star), R(0), //
B(Star), R(1), //
@@ -3392,8 +3704,9 @@ TEST(Delete) {
{"var a = 10; return delete a;",
1 * kPointerSize,
1,
- 6,
- {B(LdaSmi8), U8(10), //
+ 7,
+ {B(StackCheck), //
+ B(LdaSmi8), U8(10), //
B(Star), R(0), //
B(LdaFalse), //
B(Return)},
@@ -3404,10 +3717,11 @@ TEST(Delete) {
"return delete a[1];",
2 * kPointerSize,
1,
- 29,
+ 30,
{B(CallRuntime), U16(Runtime::kNewFunctionContext), //
- R(closure), U8(1), //
+ /* */ R(closure), U8(1), //
B(PushContext), R(0), //
+ B(StackCheck), //
B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
B(Star), R(1), //
B(StaContextSlot), R(context), U8(first_context_slot), //
@@ -3423,11 +3737,13 @@ TEST(Delete) {
{"return delete 'test';",
0 * kPointerSize,
1,
- 2,
- {B(LdaTrue), //
+ 3,
+ {B(StackCheck), //
+ B(LdaTrue), //
B(Return)},
0},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -3451,12 +3767,14 @@ TEST(GlobalDelete) {
Handle<i::TypeFeedbackVector> vector =
i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec);
+ // clang-format off
ExpectedSnippet<InstanceType> snippets[] = {
{"var a = {x:13, y:14};\n function f() { return delete a.x; };\n f();",
1 * kPointerSize,
1,
- 10,
- {B(LdaGlobalSloppy), U8(0), U8(vector->GetIndex(slot)), //
+ 11,
+ {B(StackCheck), //
+ B(LdaGlobalSloppy), U8(0), U8(vector->GetIndex(slot)), //
B(Star), R(0), //
B(LdaConstant), U8(1), //
B(DeletePropertySloppy), R(0), //
@@ -3468,8 +3786,9 @@ TEST(GlobalDelete) {
"function f() {'use strict'; return delete a[1];};\n f();",
1 * kPointerSize,
1,
- 10,
- {B(LdaGlobalStrict), U8(0), U8(vector->GetIndex(slot)), //
+ 11,
+ {B(StackCheck), //
+ B(LdaGlobalStrict), U8(0), U8(vector->GetIndex(slot)), //
B(Star), R(0), //
B(LdaSmi8), U8(1), //
B(DeletePropertyStrict), R(0), //
@@ -3479,8 +3798,9 @@ TEST(GlobalDelete) {
{"var a = {x:13, y:14};\n function f() { return delete a; };\n f();",
2 * kPointerSize,
1,
- 15,
- {B(LdaContextSlot), R(context), U8(native_context_index), //
+ 16,
+ {B(StackCheck), //
+ B(LdaContextSlot), R(context), U8(native_context_index), //
B(Star), R(0), //
B(LdaContextSlot), R(0), U8(global_context_index), //
B(Star), R(1), //
@@ -3492,8 +3812,9 @@ TEST(GlobalDelete) {
{"b = 30;\n function f() { return delete b; };\n f();",
2 * kPointerSize,
1,
- 15,
- {B(LdaContextSlot), R(context), U8(native_context_index), //
+ 16,
+ {B(StackCheck), //
+ B(LdaContextSlot), R(context), U8(native_context_index), //
B(Star), R(0), //
B(LdaContextSlot), R(0), U8(global_context_index), //
B(Star), R(1), //
@@ -3501,7 +3822,9 @@ TEST(GlobalDelete) {
B(DeletePropertySloppy), R(1), //
B(Return)},
1,
- {InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}};
+ {InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}
+ };
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -3522,12 +3845,14 @@ TEST(FunctionLiterals) {
Handle<i::TypeFeedbackVector> vector =
i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec);
+ // clang-format off
ExpectedSnippet<InstanceType> snippets[] = {
{"return function(){ }",
0,
1,
- 4,
+ 5,
{
+ B(StackCheck), //
B(CreateClosure), U8(0), U8(0), //
B(Return) //
},
@@ -3536,8 +3861,9 @@ TEST(FunctionLiterals) {
{"return (function(){ })()",
2 * kPointerSize,
1,
- 14,
+ 15,
{
+ B(StackCheck), //
B(LdaUndefined), //
B(Star), R(1), //
B(CreateClosure), U8(0), U8(0), //
@@ -3550,8 +3876,9 @@ TEST(FunctionLiterals) {
{"return (function(x){ return x; })(1)",
3 * kPointerSize,
1,
- 18,
+ 19,
{
+ B(StackCheck), //
B(LdaUndefined), //
B(Star), R(1), //
B(CreateClosure), U8(0), U8(0), //
@@ -3564,6 +3891,7 @@ TEST(FunctionLiterals) {
1,
{InstanceType::SHARED_FUNCTION_INFO_TYPE}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -3586,12 +3914,14 @@ TEST(RegExpLiterals) {
Handle<i::TypeFeedbackVector> vector =
i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec);
+ // clang-format off
ExpectedSnippet<const char*> snippets[] = {
{"return /ab+d/;",
0 * kPointerSize,
1,
- 5,
+ 6,
{
+ B(StackCheck), //
B(CreateRegExpLiteral), U8(0), U8(0), U8(0), //
B(Return), //
},
@@ -3600,8 +3930,9 @@ TEST(RegExpLiterals) {
{"return /(\\w+)\\s(\\w+)/i;",
0 * kPointerSize,
1,
- 5,
+ 6,
{
+ B(StackCheck), //
B(CreateRegExpLiteral), U8(0), U8(0), U8(i_flags), //
B(Return), //
},
@@ -3610,8 +3941,9 @@ TEST(RegExpLiterals) {
{"return /ab+d/.exec('abdd');",
3 * kPointerSize,
1,
- 22,
+ 23,
{
+ B(StackCheck), //
B(CreateRegExpLiteral), U8(0), U8(0), U8(0), //
B(Star), R(1), //
B(LoadICSloppy), R(1), U8(1), U8(vector->GetIndex(slot2)), //
@@ -3624,6 +3956,7 @@ TEST(RegExpLiterals) {
3,
{"ab+d", "exec", "abdd"}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -3640,12 +3973,14 @@ TEST(RegExpLiteralsWide) {
int wide_idx = 0;
+ // clang-format off
ExpectedSnippet<InstanceType, 257> snippets[] = {
{"var a;" REPEAT_256(SPACE, "a = 1.23;") "return /ab+d/;",
1 * kPointerSize,
1,
- 1031,
+ 1032,
{
+ B(StackCheck), //
REPEAT_256(COMMA, //
B(LdaConstant), U8(wide_idx++), //
B(Star), R(0)), //
@@ -3656,6 +3991,7 @@ TEST(RegExpLiteralsWide) {
{REPEAT_256(COMMA, InstanceType::HEAP_NUMBER_TYPE),
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -3681,12 +4017,14 @@ TEST(ArrayLiterals) {
int simple_flags =
ArrayLiteral::kDisableMementos | ArrayLiteral::kShallowElements;
int deep_elements_flags = ArrayLiteral::kDisableMementos;
+ // clang-format off
ExpectedSnippet<InstanceType> snippets[] = {
{"return [ 1, 2 ];",
0,
1,
- 5,
+ 6,
{
+ B(StackCheck), //
B(CreateArrayLiteral), U8(0), U8(0), U8(simple_flags), //
B(Return) //
},
@@ -3695,8 +4033,9 @@ TEST(ArrayLiterals) {
{"var a = 1; return [ a, a + 1 ];",
4 * kPointerSize,
1,
- 38,
+ 39,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(CreateArrayLiteral), U8(0), U8(0), U8(3), //
@@ -3720,8 +4059,9 @@ TEST(ArrayLiterals) {
{"return [ [ 1, 2 ], [ 3 ] ];",
0,
1,
- 5,
+ 6,
{
+ B(StackCheck), //
B(CreateArrayLiteral), U8(0), U8(2), U8(deep_elements_flags), //
B(Return) //
},
@@ -3730,8 +4070,9 @@ TEST(ArrayLiterals) {
{"var a = 1; return [ [ a, 2 ], [ a + 2 ] ];",
6 * kPointerSize,
1,
- 68,
+ 69,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(CreateArrayLiteral), U8(0), U8(2), U8(deep_elements_flags), //
@@ -3766,6 +4107,7 @@ TEST(ArrayLiterals) {
{InstanceType::FIXED_ARRAY_TYPE, InstanceType::FIXED_ARRAY_TYPE,
InstanceType::FIXED_ARRAY_TYPE}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -3784,12 +4126,14 @@ TEST(ArrayLiteralsWide) {
int simple_flags =
ArrayLiteral::kDisableMementos | ArrayLiteral::kShallowElements;
+ // clang-format off
ExpectedSnippet<InstanceType, 257> snippets[] = {
{"var a;" REPEAT_256(SPACE, "a = 1.23;") "return [ 1 , 2 ];",
1 * kPointerSize,
1,
- 1031,
+ 1032,
{
+ B(StackCheck), //
REPEAT_256(COMMA, //
B(LdaConstant), U8(wide_idx++), //
B(Star), R(0)), //
@@ -3800,6 +4144,7 @@ TEST(ArrayLiteralsWide) {
{REPEAT_256(COMMA, InstanceType::HEAP_NUMBER_TYPE),
InstanceType::FIXED_ARRAY_TYPE}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -3825,12 +4170,14 @@ TEST(ObjectLiterals) {
ObjectLiteral::kDisableMementos;
int deep_elements_flags =
ObjectLiteral::kFastElements | ObjectLiteral::kDisableMementos;
+ // clang-format off
ExpectedSnippet<InstanceType> snippets[] = {
{"return { };",
kPointerSize,
1,
- 7,
+ 8,
{
+ B(StackCheck), //
B(CreateObjectLiteral), U8(0), U8(0), U8(simple_flags), //
B(Star), R(0), //
B(Return) //
@@ -3840,8 +4187,9 @@ TEST(ObjectLiterals) {
{"return { name: 'string', val: 9.2 };",
kPointerSize,
1,
- 7,
+ 8,
{
+ B(StackCheck), //
B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
B(Star), R(0), //
B(Return) //
@@ -3851,8 +4199,9 @@ TEST(ObjectLiterals) {
{"var a = 1; return { name: 'string', val: a };",
2 * kPointerSize,
1,
- 19,
+ 20,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
@@ -3868,8 +4217,9 @@ TEST(ObjectLiterals) {
{"var a = 1; return { val: a, val: a + 1 };",
3 * kPointerSize,
1,
- 25,
+ 26,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
@@ -3888,8 +4238,9 @@ TEST(ObjectLiterals) {
{"return { func: function() { } };",
1 * kPointerSize,
1,
- 16,
+ 17,
{
+ B(StackCheck), //
B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
B(Star), R(0), //
B(CreateClosure), U8(1), U8(0), //
@@ -3903,8 +4254,9 @@ TEST(ObjectLiterals) {
{"return { func(a) { return a; } };",
1 * kPointerSize,
1,
- 16,
+ 17,
{
+ B(StackCheck), //
B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
B(Star), R(0), //
B(CreateClosure), U8(1), U8(0), //
@@ -3918,8 +4270,9 @@ TEST(ObjectLiterals) {
{"return { get a() { return 2; } };",
6 * kPointerSize,
1,
- 32,
+ 33,
{
+ B(StackCheck), //
B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
B(Star), R(0), //
B(Mov), R(0), R(1), //
@@ -3932,7 +4285,7 @@ TEST(ObjectLiterals) {
B(LdaZero), //
B(Star), R(5), //
B(CallRuntime), U16(Runtime::kDefineAccessorPropertyUnchecked), //
- R(1), U8(5), //
+ /* */ R(1), U8(5), //
B(Ldar), R(0), //
B(Return), //
},
@@ -3943,8 +4296,9 @@ TEST(ObjectLiterals) {
{"return { get a() { return this.x; }, set a(val) { this.x = val } };",
6 * kPointerSize,
1,
- 34,
+ 35,
{
+ B(StackCheck), //
B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
B(Star), R(0), //
B(Mov), R(0), R(1), //
@@ -3957,7 +4311,7 @@ TEST(ObjectLiterals) {
B(LdaZero), //
B(Star), R(5), //
B(CallRuntime), U16(Runtime::kDefineAccessorPropertyUnchecked), //
- R(1), U8(5), //
+ /* */ R(1), U8(5), //
B(Ldar), R(0), //
B(Return), //
},
@@ -3969,8 +4323,9 @@ TEST(ObjectLiterals) {
{"return { set b(val) { this.y = val } };",
6 * kPointerSize,
1,
- 32,
+ 33,
{
+ B(StackCheck), //
B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
B(Star), R(0), //
B(Mov), R(0), R(1), //
@@ -3983,7 +4338,7 @@ TEST(ObjectLiterals) {
B(LdaZero), //
B(Star), R(5), //
B(CallRuntime), U16(Runtime::kDefineAccessorPropertyUnchecked), //
- R(1), U8(5), //
+ /* */ R(1), U8(5), //
B(Ldar), R(0), //
B(Return), //
},
@@ -3994,8 +4349,9 @@ TEST(ObjectLiterals) {
{"var a = 1; return { 1: a };",
6 * kPointerSize,
1,
- 32,
+ 33,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
@@ -4016,8 +4372,9 @@ TEST(ObjectLiterals) {
{"return { __proto__: null }",
3 * kPointerSize,
1,
- 20,
+ 21,
{
+ B(StackCheck), //
B(CreateObjectLiteral), U8(0), U8(0), U8(simple_flags), //
B(Star), R(0), //
B(Mov), R(0), R(1), //
@@ -4031,8 +4388,9 @@ TEST(ObjectLiterals) {
{"var a = 'test'; return { [a]: 1 }",
6 * kPointerSize,
1,
- 33,
+ 34,
{
+ B(StackCheck), //
B(LdaConstant), U8(0), //
B(Star), R(0), //
B(CreateObjectLiteral), U8(1), U8(0), U8(simple_flags), //
@@ -4046,7 +4404,7 @@ TEST(ObjectLiterals) {
B(LdaZero), //
B(Star), R(5), //
B(CallRuntime), U16(Runtime::kDefineDataPropertyUnchecked), R(2), //
- U8(4), //
+ /* */ U8(4), //
B(Ldar), R(1), //
B(Return), //
},
@@ -4056,8 +4414,9 @@ TEST(ObjectLiterals) {
{"var a = 'test'; return { val: a, [a]: 1 }",
6 * kPointerSize,
1,
- 39,
+ 40,
{
+ B(StackCheck), //
B(LdaConstant), U8(0), //
B(Star), R(0), //
B(CreateObjectLiteral), U8(1), U8(0), U8(deep_elements_flags), //
@@ -4073,7 +4432,7 @@ TEST(ObjectLiterals) {
B(LdaZero), //
B(Star), R(5), //
B(CallRuntime), U16(Runtime::kDefineDataPropertyUnchecked), R(2), //
- U8(4), //
+ /* */ U8(4), //
B(Ldar), R(1), //
B(Return), //
},
@@ -4084,8 +4443,9 @@ TEST(ObjectLiterals) {
{"var a = 'test'; return { [a]: 1, __proto__: {} }",
6 * kPointerSize,
1,
- 49,
+ 50,
{
+ B(StackCheck), //
B(LdaConstant), U8(0), //
B(Star), R(0), //
B(CreateObjectLiteral), U8(1), U8(1), U8(simple_flags), //
@@ -4099,7 +4459,7 @@ TEST(ObjectLiterals) {
B(LdaZero), //
B(Star), R(5), //
B(CallRuntime), U16(Runtime::kDefineDataPropertyUnchecked), R(2), //
- U8(4), //
+ /* */ U8(4), //
B(Mov), R(1), R(2), //
B(CreateObjectLiteral), U8(1), U8(0), U8(13), //
B(Star), R(4), //
@@ -4114,8 +4474,9 @@ TEST(ObjectLiterals) {
{"var n = 'name'; return { [n]: 'val', get a() { }, set a(b) {} };",
6 * kPointerSize,
1,
- 73,
+ 74,
{
+ B(StackCheck), //
B(LdaConstant), U8(0), //
B(Star), R(0), //
B(CreateObjectLiteral), U8(1), U8(0), U8(simple_flags), //
@@ -4129,7 +4490,7 @@ TEST(ObjectLiterals) {
B(LdaZero), //
B(Star), R(5), //
B(CallRuntime), U16(Runtime::kDefineDataPropertyUnchecked), R(2), //
- U8(4), //
+ /* */ U8(4), //
B(Mov), R(1), R(2), //
B(LdaConstant), U8(3), //
B(Star), R(3), //
@@ -4138,7 +4499,7 @@ TEST(ObjectLiterals) {
B(LdaZero), //
B(Star), R(5), //
B(CallRuntime), U16(Runtime::kDefineGetterPropertyUnchecked), //
- R(2), U8(4), //
+ /* */ R(2), U8(4), //
B(Mov), R(1), R(2), //
B(LdaConstant), U8(3), //
B(Star), R(3), //
@@ -4147,7 +4508,7 @@ TEST(ObjectLiterals) {
B(LdaZero), //
B(Star), R(5), //
B(CallRuntime), U16(Runtime::kDefineSetterPropertyUnchecked), //
- R(2), U8(4), //
+ /* */ R(2), U8(4), //
B(Ldar), R(1), //
B(Return), //
},
@@ -4159,6 +4520,7 @@ TEST(ObjectLiterals) {
InstanceType::SHARED_FUNCTION_INFO_TYPE,
InstanceType::SHARED_FUNCTION_INFO_TYPE}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -4177,26 +4539,28 @@ TEST(ObjectLiteralsWide) {
ObjectLiteral::kFastElements | ObjectLiteral::kDisableMementos;
int wide_idx = 0;
+ // clang-format off
ExpectedSnippet<InstanceType, 257> snippets[] = {
{"var a;" REPEAT_256(SPACE,
"a = 1.23;") "return { name: 'string', val: 9.2 };",
2 * kPointerSize,
1,
- 1033,
+ 1034,
{
- REPEAT_256(COMMA, //
- B(LdaConstant), U8(wide_idx++), //
- B(Star), R(0)), //
- B(CreateObjectLiteralWide),
- U16(256), U16(0), //
- U8(deep_elements_flags), //
- B(Star), R(1), //
- B(Return) //
+ B(StackCheck), //
+ REPEAT_256(COMMA, //
+ B(LdaConstant), U8(wide_idx++), //
+ B(Star), R(0)), //
+ B(CreateObjectLiteralWide), U16(256), U16(0), //
+ /* */ U8(deep_elements_flags), //
+ B(Star), R(1), //
+ B(Return) //
},
257,
{REPEAT_256(COMMA, InstanceType::HEAP_NUMBER_TYPE),
InstanceType::FIXED_ARRAY_TYPE}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -4213,17 +4577,19 @@ TEST(TopLevelObjectLiterals) {
int has_function_flags = ObjectLiteral::kFastElements |
ObjectLiteral::kHasFunction |
ObjectLiteral::kDisableMementos;
+ // clang-format off
ExpectedSnippet<InstanceType> snippets[] = {
{"var a = { func: function() { } };",
5 * kPointerSize,
1,
- 48,
+ 49,
{
B(LdaConstant), U8(0), //
B(Star), R(1), //
B(LdaZero), //
B(Star), R(2), //
B(CallRuntime), U16(Runtime::kDeclareGlobals), R(1), U8(2), //
+ B(StackCheck), //
B(LdaConstant), U8(1), //
B(Star), R(1), //
B(LdaZero), //
@@ -4246,6 +4612,7 @@ TEST(TopLevelObjectLiterals) {
InstanceType::SHARED_FUNCTION_INFO_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -4261,12 +4628,14 @@ TEST(TryCatch) {
int closure = Register::function_closure().index();
+ // clang-format off
ExpectedSnippet<const char*> snippets[] = {
{"try { return 1; } catch(e) { return 2; }",
5 * kPointerSize,
1,
- 36,
+ 37,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Return), //
B(Star), R(3), //
@@ -4284,18 +4653,19 @@ TEST(TryCatch) {
B(PopContext), R(0), //
B(Return), //
// TODO(mstarzinger): Potential optimization, elide next bytes.
- B(LdaUndefined), //
- B(Return), //
+ B(LdaUndefined), //
+ B(Return), //
},
1,
{"e"},
1,
- {{0, 3, 3}}},
+ {{1, 4, 4}}},
{"var a; try { a = 1 } catch(e1) {}; try { a = 2 } catch(e2) { a = 3 }",
6 * kPointerSize,
1,
- 74,
+ 75,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(Jump), U8(30), //
@@ -4334,8 +4704,9 @@ TEST(TryCatch) {
2,
{"e1", "e2"},
2,
- {{0, 4, 6}, {34, 38, 40}}},
+ {{1, 5, 7}, {35, 39, 41}}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -4351,12 +4722,14 @@ TEST(TryFinally) {
int closure = Register::function_closure().index();
+ // clang-format off
ExpectedSnippet<const char*> snippets[] = {
{"var a = 1; try { a = 2; } finally { a = 3; }",
4 * kPointerSize,
1,
- 47,
+ 48,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(LdaSmi8), U8(2), //
@@ -4386,12 +4759,13 @@ TEST(TryFinally) {
0,
{},
1,
- {{4, 8, 14}}},
+ {{5, 9, 15}}},
{"var a = 1; try { a = 2; } catch(e) { a = 20 } finally { a = 3; }",
9 * kPointerSize,
1,
- 81,
+ 82,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(LdaSmi8), U8(2), //
@@ -4436,14 +4810,15 @@ TEST(TryFinally) {
1,
{"e"},
2,
- {{4, 42, 48}, {4, 8, 10}}},
+ {{5, 43, 49}, {5, 9, 11}}},
{"var a; try {"
" try { a = 1 } catch(e) { a = 2 }"
"} catch(e) { a = 20 } finally { a = 3; }",
10 * kPointerSize,
1,
- 111,
+ 112,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(Jump), U8(34), //
@@ -4501,8 +4876,9 @@ TEST(TryFinally) {
1,
{"e"},
3,
- {{0, 72, 78}, {0, 38, 40}, {0, 4, 6}}},
+ {{1, 73, 79}, {1, 39, 41}, {1, 5, 7}}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -4516,12 +4892,14 @@ TEST(Throw) {
InitializedHandleScope handle_scope;
BytecodeGeneratorHelper helper;
+ // clang-format off
ExpectedSnippet<const char*> snippets[] = {
{"throw 1;",
0,
1,
- 3,
+ 4,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Throw), //
},
@@ -4529,8 +4907,9 @@ TEST(Throw) {
{"throw 'Error';",
0,
1,
- 3,
+ 4,
{
+ B(StackCheck), //
B(LdaConstant), U8(0), //
B(Throw), //
},
@@ -4539,8 +4918,9 @@ TEST(Throw) {
{"var a = 1; if (a) { throw 'Error'; };",
1 * kPointerSize,
1,
- 11,
+ 12,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(JumpIfToBooleanFalse), U8(5), //
@@ -4552,6 +4932,7 @@ TEST(Throw) {
1,
{"Error"}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -4574,14 +4955,16 @@ TEST(CallNew) {
Handle<i::TypeFeedbackVector> vector =
i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec);
+ // clang-format off
ExpectedSnippet<InstanceType> snippets[] = {
{"function bar() { this.value = 0; }\n"
"function f() { return new bar(); }\n"
"f()",
1 * kPointerSize,
1,
- 10,
+ 11,
{
+ B(StackCheck), //
B(LdaGlobalSloppy), U8(0), U8(vector->GetIndex(slot2)), //
B(Star), R(0), //
B(New), R(0), R(0), U8(0), //
@@ -4594,8 +4977,9 @@ TEST(CallNew) {
"f()",
2 * kPointerSize,
1,
- 14,
+ 15,
{
+ B(StackCheck), //
B(LdaGlobalSloppy), U8(0), U8(vector->GetIndex(slot2)), //
B(Star), R(0), //
B(LdaSmi8), U8(3), //
@@ -4615,8 +4999,9 @@ TEST(CallNew) {
"f()",
4 * kPointerSize,
1,
- 22,
+ 23,
{
+ B(StackCheck), //
B(LdaGlobalSloppy), U8(0), U8(vector->GetIndex(slot2)), //
B(Star), R(0), //
B(LdaSmi8), U8(3), //
@@ -4631,6 +5016,7 @@ TEST(CallNew) {
1,
{InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -4662,15 +5048,17 @@ TEST(ContextVariables) {
STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS + 3 + 249 == 256);
int wide_slot = first_context_slot + 3;
+ // clang-format off
ExpectedSnippet<InstanceType> snippets[] = {
{"var a; return function() { a = 1; };",
1 * kPointerSize,
1,
- 11,
+ 12,
{
B(CallRuntime), U16(Runtime::kNewFunctionContext), //
- R(closure), U8(1), //
+ /* */ R(closure), U8(1), //
B(PushContext), R(0), //
+ B(StackCheck), //
B(CreateClosure), U8(0), U8(0), //
B(Return), //
},
@@ -4679,11 +5067,12 @@ TEST(ContextVariables) {
{"var a = 1; return function() { a = 2; };",
1 * kPointerSize,
1,
- 16,
+ 17,
{
B(CallRuntime), U16(Runtime::kNewFunctionContext), //
- R(closure), U8(1), //
+ /* */ R(closure), U8(1), //
B(PushContext), R(0), //
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(StaContextSlot), R(context), U8(first_context_slot), //
B(CreateClosure), U8(0), U8(0), //
@@ -4694,11 +5083,12 @@ TEST(ContextVariables) {
{"var a = 1; var b = 2; return function() { a = 2; b = 3 };",
1 * kPointerSize,
1,
- 21,
+ 22,
{
B(CallRuntime), U16(Runtime::kNewFunctionContext), //
- R(closure), U8(1), //
+ /* */ R(closure), U8(1), //
B(PushContext), R(0), //
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(StaContextSlot), R(context), U8(first_context_slot), //
B(LdaSmi8), U8(2), //
@@ -4711,11 +5101,12 @@ TEST(ContextVariables) {
{"var a; (function() { a = 2; })(); return a;",
3 * kPointerSize,
1,
- 24,
+ 25,
{
B(CallRuntime), U16(Runtime::kNewFunctionContext), //
- R(closure), U8(1), //
+ /* */ R(closure), U8(1), //
B(PushContext), R(0), //
+ B(StackCheck), //
B(LdaUndefined), //
B(Star), R(2), //
B(CreateClosure), U8(0), U8(0), //
@@ -4729,13 +5120,14 @@ TEST(ContextVariables) {
{"'use strict'; let a = 1; { let b = 2; return function() { a + b; }; }",
4 * kPointerSize,
1,
- 46,
+ 47,
{
B(CallRuntime), U16(Runtime::kNewFunctionContext), //
- R(closure), U8(1), //
+ /* */ R(closure), U8(1), //
B(PushContext), R(0), //
B(LdaTheHole), //
B(StaContextSlot), R(context), U8(first_context_slot), //
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(StaContextSlot), R(context), U8(first_context_slot), //
B(LdaConstant), U8(0), //
@@ -4762,10 +5154,10 @@ TEST(ContextVariables) {
"return b",
3 * kPointerSize,
1,
- 1041,
+ 1042,
{
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), //
- U8(1), //
+ /* */ U8(1), //
B(PushContext), R(0), //
B(Ldar), THIS(1), //
B(StaContextSlot), R(context), U8(first_context_slot), //
@@ -4773,6 +5165,7 @@ TEST(ContextVariables) {
B(StaContextSlot), R(context), U8(first_context_slot + 1), //
B(Ldar), R(new_target), //
B(StaContextSlot), R(context), U8(first_context_slot + 2), //
+ B(StackCheck), //
REPEAT_249(COMMA, //
B(LdaZero), //
B(StaContextSlot), R(context), U8(wide_slot++)), //
@@ -4789,6 +5182,7 @@ TEST(ContextVariables) {
1,
{InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -4806,17 +5200,19 @@ TEST(ContextParameters) {
int context = Register::current_context().index();
int first_context_slot = Context::MIN_CONTEXT_SLOTS;
+ // clang-format off
ExpectedSnippet<InstanceType> snippets[] = {
{"function f(arg1) { return function() { arg1 = 2; }; }",
1 * kPointerSize,
2,
- 16,
+ 17,
{
B(CallRuntime), U16(Runtime::kNewFunctionContext), //
- R(closure), U8(1), //
+ /* */ R(closure), U8(1), //
B(PushContext), R(0), //
B(Ldar), R(helper.kLastParamIndex), //
B(StaContextSlot), R(context), U8(first_context_slot), //
+ B(StackCheck), //
B(CreateClosure), U8(0), U8(0), //
B(Return), //
},
@@ -4825,13 +5221,14 @@ TEST(ContextParameters) {
{"function f(arg1) { var a = function() { arg1 = 2; }; return arg1; }",
2 * kPointerSize,
2,
- 21,
+ 22,
{
B(CallRuntime), U16(Runtime::kNewFunctionContext), //
- R(closure), U8(1), //
+ /* */ R(closure), U8(1), //
B(PushContext), R(1), //
B(Ldar), R(helper.kLastParamIndex), //
B(StaContextSlot), R(context), U8(first_context_slot), //
+ B(StackCheck), //
B(CreateClosure), U8(0), U8(0), //
B(Star), R(0), //
B(LdaContextSlot), R(context), U8(first_context_slot), //
@@ -4842,15 +5239,16 @@ TEST(ContextParameters) {
{"function f(a1, a2, a3, a4) { return function() { a1 = a3; }; }",
1 * kPointerSize,
5,
- 21,
+ 22,
{
B(CallRuntime), U16(Runtime::kNewFunctionContext), //
- R(closure), U8(1), //
+ /* */ R(closure), U8(1), //
B(PushContext), R(0), //
B(Ldar), R(helper.kLastParamIndex - 3), //
B(StaContextSlot), R(context), U8(first_context_slot + 1), //
B(Ldar), R(helper.kLastParamIndex -1), //
B(StaContextSlot), R(context), U8(first_context_slot), //
+ B(StackCheck), //
B(CreateClosure), U8(0), U8(0), //
B(Return), //
},
@@ -4859,11 +5257,12 @@ TEST(ContextParameters) {
{"function f() { var self = this; return function() { self = 2; }; }",
1 * kPointerSize,
1,
- 16,
+ 17,
{
B(CallRuntime), U16(Runtime::kNewFunctionContext), //
- R(closure), U8(1), //
+ /* */ R(closure), U8(1), //
B(PushContext), R(0), //
+ B(StackCheck), //
B(Ldar), R(helper.kLastParamIndex), //
B(StaContextSlot), R(context), U8(first_context_slot), //
B(CreateClosure), U8(0), U8(0), //
@@ -4872,6 +5271,7 @@ TEST(ContextParameters) {
1,
{InstanceType::SHARED_FUNCTION_INFO_TYPE}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -4888,6 +5288,7 @@ TEST(OuterContextVariables) {
int context = Register::current_context().index();
int first_context_slot = Context::MIN_CONTEXT_SLOTS;
+ // clang-format off
ExpectedSnippet<InstanceType> snippets[] = {
{"function Outer() {"
" var outerVar = 1;"
@@ -4899,8 +5300,9 @@ TEST(OuterContextVariables) {
"var f = new Outer().getInnerFunc();",
2 * kPointerSize,
1,
- 20,
+ 21,
{
+ B(StackCheck), //
B(Ldar), R(context), //
B(Star), R(0), //
B(LdaContextSlot), R(0), U8(Context::PREVIOUS_INDEX), //
@@ -4921,8 +5323,9 @@ TEST(OuterContextVariables) {
"var f = new Outer().getInnerFunc();",
2 * kPointerSize,
1,
- 21,
+ 22,
{
+ B(StackCheck), //
B(LdaContextSlot), R(context), U8(first_context_slot), //
B(Star), R(0), //
B(Ldar), R(context), //
@@ -4935,6 +5338,7 @@ TEST(OuterContextVariables) {
B(Return), //
}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -4969,12 +5373,14 @@ TEST(CountOperators) {
int array_literal_flags =
ArrayLiteral::kDisableMementos | ArrayLiteral::kShallowElements;
+ // clang-format off
ExpectedSnippet<InstanceType> snippets[] = {
{"var a = 1; return ++a;",
1 * kPointerSize,
1,
- 9,
+ 10,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(ToNumber), //
@@ -4985,8 +5391,9 @@ TEST(CountOperators) {
{"var a = 1; return a++;",
2 * kPointerSize,
1,
- 13,
+ 14,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(ToNumber), //
@@ -4999,8 +5406,9 @@ TEST(CountOperators) {
{"var a = 1; return --a;",
1 * kPointerSize,
1,
- 9,
+ 10,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(ToNumber), //
@@ -5011,8 +5419,9 @@ TEST(CountOperators) {
{"var a = 1; return a--;",
2 * kPointerSize,
1,
- 13,
+ 14,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(ToNumber), //
@@ -5025,8 +5434,9 @@ TEST(CountOperators) {
{"var a = { val: 1 }; return a.val++;",
3 * kPointerSize,
1,
- 25,
+ 26,
{
+ B(StackCheck), //
B(CreateObjectLiteral), U8(0), U8(0), U8(object_literal_flags), //
B(Star), R(1), //
B(Star), R(0), //
@@ -5045,8 +5455,9 @@ TEST(CountOperators) {
{"var a = { val: 1 }; return --a.val;",
2 * kPointerSize,
1,
- 21,
+ 22,
{
+ B(StackCheck), //
B(CreateObjectLiteral), U8(0), U8(0), U8(object_literal_flags), //
B(Star), R(1), //
B(Star), R(0), //
@@ -5063,8 +5474,9 @@ TEST(CountOperators) {
{"var name = 'var'; var a = { val: 1 }; return a[name]--;",
5 * kPointerSize,
1,
- 32,
+ 33,
{
+ B(StackCheck), //
B(LdaConstant), U8(0), //
B(Star), R(0), //
B(CreateObjectLiteral), U8(1), U8(0), U8(object_literal_flags), //
@@ -5087,8 +5499,9 @@ TEST(CountOperators) {
{"var name = 'var'; var a = { val: 1 }; return ++a[name];",
4 * kPointerSize,
1,
- 28,
+ 29,
{
+ B(StackCheck), //
B(LdaConstant), U8(0), //
B(Star), R(0), //
B(CreateObjectLiteral), U8(1), U8(0), U8(object_literal_flags), //
@@ -5109,11 +5522,12 @@ TEST(CountOperators) {
{"var a = 1; var b = function() { return a }; return ++a;",
2 * kPointerSize,
1,
- 26,
+ 27,
{
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), //
- U8(1), //
+ /* */ U8(1), //
B(PushContext), R(1), //
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(StaContextSlot), R(context), U8(first_context_slot), //
B(CreateClosure), U8(0), U8(0), //
@@ -5129,11 +5543,12 @@ TEST(CountOperators) {
{"var a = 1; var b = function() { return a }; return a--;",
3 * kPointerSize,
1,
- 30,
+ 31,
{
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), //
- U8(1), //
+ /* */ U8(1), //
B(PushContext), R(1), //
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(StaContextSlot), R(context), U8(first_context_slot), //
B(CreateClosure), U8(0), U8(0), //
@@ -5151,26 +5566,28 @@ TEST(CountOperators) {
{"var idx = 1; var a = [1, 2]; return a[idx++] = 2;",
4 * kPointerSize,
1,
- 27,
+ 28,
{
- B(LdaSmi8), U8(1), //
- B(Star), R(0), //
- B(CreateArrayLiteral), U8(0), U8(0), U8(array_literal_flags), //
- B(Star), R(1), //
- B(Star), R(2), //
- B(Ldar), R(0), //
- B(ToNumber), //
- B(Star), R(3), //
- B(Inc), //
- B(Star), R(0), //
- B(LdaSmi8), U8(2), //
- B(KeyedStoreICSloppy), R(2), R(3), //
- U8(store_vector->GetIndex(store_slot)), //
- B(Return), //
+ B(StackCheck), //
+ B(LdaSmi8), U8(1), //
+ B(Star), R(0), //
+ B(CreateArrayLiteral), U8(0), U8(0), U8(array_literal_flags), //
+ B(Star), R(1), //
+ B(Star), R(2), //
+ B(Ldar), R(0), //
+ B(ToNumber), //
+ B(Star), R(3), //
+ B(Inc), //
+ B(Star), R(0), //
+ B(LdaSmi8), U8(2), //
+ B(KeyedStoreICSloppy), R(2), R(3), //
+ /* */ U8(store_vector->GetIndex(store_slot)), //
+ B(Return), //
},
1,
{InstanceType::FIXED_ARRAY_TYPE}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -5192,12 +5609,14 @@ TEST(GlobalCountOperators) {
Handle<i::TypeFeedbackVector> vector =
i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec);
+ // clang-format off
ExpectedSnippet<const char*> snippets[] = {
{"var global = 1;\nfunction f() { return ++global; }\nf()",
0,
1,
- 9,
+ 10,
{
+ B(StackCheck), //
B(LdaGlobalSloppy), U8(0), U8(vector->GetIndex(slot1)), //
B(ToNumber), //
B(Inc), //
@@ -5209,8 +5628,9 @@ TEST(GlobalCountOperators) {
{"var global = 1;\nfunction f() { return global--; }\nf()",
1 * kPointerSize,
1,
- 13,
+ 14,
{
+ B(StackCheck), //
B(LdaGlobalSloppy), U8(0), U8(vector->GetIndex(slot1)), //
B(ToNumber), //
B(Star), R(0), //
@@ -5225,8 +5645,9 @@ TEST(GlobalCountOperators) {
"f()",
0,
1,
- 9,
+ 10,
{
+ B(StackCheck), //
B(LdaGlobalStrict), U8(0), U8(vector->GetIndex(slot1)), //
B(ToNumber), //
B(Dec), //
@@ -5238,8 +5659,9 @@ TEST(GlobalCountOperators) {
{"unallocated = 1;\nfunction f() { return unallocated++; }\nf()",
1 * kPointerSize,
1,
- 13,
+ 14,
{
+ B(StackCheck), //
B(LdaGlobalSloppy), U8(0), U8(vector->GetIndex(slot1)), //
B(ToNumber), //
B(Star), R(0), //
@@ -5251,6 +5673,7 @@ TEST(GlobalCountOperators) {
1,
{"unallocated"}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -5278,12 +5701,15 @@ TEST(CompoundExpressions) {
int object_literal_flags =
ObjectLiteral::kFastElements | ObjectLiteral::kDisableMementos;
+
+ // clang-format off
ExpectedSnippet<InstanceType> snippets[] = {
{"var a = 1; a += 2;",
2 * kPointerSize,
1,
- 14,
+ 15,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(Star), R(1), //
@@ -5296,8 +5722,9 @@ TEST(CompoundExpressions) {
{"var a = 1; a /= 2;",
2 * kPointerSize,
1,
- 14,
+ 15,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(Star), R(1), //
@@ -5310,8 +5737,9 @@ TEST(CompoundExpressions) {
{"var a = { val: 2 }; a.name *= 2;",
3 * kPointerSize,
1,
- 26,
+ 27,
{
+ B(StackCheck), //
B(CreateObjectLiteral), U8(0), U8(0), U8(object_literal_flags), //
B(Star), R(1), //
B(Star), R(0), //
@@ -5330,8 +5758,9 @@ TEST(CompoundExpressions) {
{"var a = { 1: 2 }; a[1] ^= 2;",
4 * kPointerSize,
1,
- 29,
+ 30,
{
+ B(StackCheck), //
B(CreateObjectLiteral), U8(0), U8(0), U8(object_literal_flags), //
B(Star), R(1), //
B(Star), R(0), //
@@ -5351,11 +5780,12 @@ TEST(CompoundExpressions) {
{"var a = 1; (function f() { return a; }); a |= 24;",
2 * kPointerSize,
1,
- 29,
+ 30,
{
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), //
- U8(1), //
+ /* */ U8(1), //
B(PushContext), R(0), //
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(StaContextSlot), R(context), U8(first_context_slot), //
B(CreateClosure), U8(0), U8(0), //
@@ -5370,6 +5800,7 @@ TEST(CompoundExpressions) {
1,
{InstanceType::SHARED_FUNCTION_INFO_TYPE}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -5391,12 +5822,14 @@ TEST(GlobalCompoundExpressions) {
Handle<i::TypeFeedbackVector> vector =
i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec);
+ // clang-format off
ExpectedSnippet<const char*> snippets[] = {
{"var global = 1;\nfunction f() { return global &= 1; }\nf()",
1 * kPointerSize,
1,
- 13,
+ 14,
{
+ B(StackCheck), //
B(LdaGlobalSloppy), U8(0), U8(vector->GetIndex(slot1)), //
B(Star), R(0), //
B(LdaSmi8), U8(1), //
@@ -5409,8 +5842,9 @@ TEST(GlobalCompoundExpressions) {
{"unallocated = 1;\nfunction f() { return unallocated += 1; }\nf()",
1 * kPointerSize,
1,
- 13,
+ 14,
{
+ B(StackCheck), //
B(LdaGlobalSloppy), U8(0), U8(vector->GetIndex(slot1)), //
B(Star), R(0), //
B(LdaSmi8), U8(1), //
@@ -5421,6 +5855,7 @@ TEST(GlobalCompoundExpressions) {
1,
{"unallocated"}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -5445,23 +5880,28 @@ TEST(CreateArguments) {
Handle<i::TypeFeedbackVector> vector =
i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec);
+ // clang-format off
ExpectedSnippet<const char*> snippets[] = {
{"function f() { return arguments; }",
1 * kPointerSize,
1,
- 4,
+ 7,
{
B(CreateMappedArguments), //
B(Star), R(0), //
+ B(StackCheck), //
+ B(Ldar), R(0), //
B(Return), //
}},
{"function f() { return arguments[0]; }",
2 * kPointerSize,
1,
- 10,
+ 13,
{
B(CreateMappedArguments), //
B(Star), R(0), //
+ B(StackCheck), //
+ B(Ldar), R(0), //
B(Star), R(1), //
B(LdaZero), //
B(KeyedLoadICSloppy), R(1), U8(vector->GetIndex(slot)), //
@@ -5470,24 +5910,28 @@ TEST(CreateArguments) {
{"function f() { 'use strict'; return arguments; }",
1 * kPointerSize,
1,
- 4,
+ 7,
{
B(CreateUnmappedArguments), //
B(Star), R(0), //
+ B(StackCheck), //
+ B(Ldar), R(0), //
B(Return), //
}},
{"function f(a) { return arguments[0]; }",
3 * kPointerSize,
2,
- 22,
+ 25,
{
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), //
- U8(1), //
+ /* */ U8(1), //
B(PushContext), R(1), //
B(Ldar), R(BytecodeGeneratorHelper::kLastParamIndex), //
B(StaContextSlot), R(context), U8(first_context_slot), //
B(CreateMappedArguments), //
B(Star), R(0), //
+ B(StackCheck), //
+ B(Ldar), R(0), //
B(Star), R(2), //
B(LdaZero), //
B(KeyedLoadICSloppy), R(2), U8(vector->GetIndex(slot)), //
@@ -5496,10 +5940,10 @@ TEST(CreateArguments) {
{"function f(a, b, c) { return arguments; }",
2 * kPointerSize,
4,
- 26,
+ 29,
{
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), //
- U8(1), //
+ /* */ U8(1), //
B(PushContext), R(1), //
B(Ldar), R(BytecodeGeneratorHelper::kLastParamIndex - 2), //
B(StaContextSlot), R(context), U8(first_context_slot + 2), //
@@ -5509,18 +5953,23 @@ TEST(CreateArguments) {
B(StaContextSlot), R(context), U8(first_context_slot), //
B(CreateMappedArguments), //
B(Star), R(0), //
+ B(StackCheck), //
+ B(Ldar), R(0), //
B(Return), //
}},
{"function f(a, b, c) { 'use strict'; return arguments; }",
1 * kPointerSize,
4,
- 4,
+ 7,
{
B(CreateUnmappedArguments), //
B(Star), R(0), //
+ B(StackCheck), //
+ B(Ldar), R(0), //
B(Return), //
}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -5541,14 +5990,17 @@ TEST(CreateRestArguments) {
Handle<i::TypeFeedbackVector> vector =
i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec);
+ // clang-format off
ExpectedSnippet<int> snippets[] = {
{"function f(...restArgs) { return restArgs; }",
1 * kPointerSize,
2,
- 5,
+ 8,
{
B(CreateRestArguments), U8(0), //
B(Star), R(0), //
+ B(StackCheck), //
+ B(Ldar), R(0), //
B(Return), //
},
1,
@@ -5556,12 +6008,13 @@ TEST(CreateRestArguments) {
{"function f(a, ...restArgs) { return restArgs; }",
2 * kPointerSize,
3,
- 14,
+ 15,
{
B(CreateRestArguments), U8(0), //
B(Star), R(0), //
B(LdaTheHole), //
B(Star), R(1), //
+ B(StackCheck), //
B(Ldar), A(1, 3), //
B(Star), R(1), //
B(Ldar), R(0), //
@@ -5572,12 +6025,13 @@ TEST(CreateRestArguments) {
{"function f(a, ...restArgs) { return restArgs[0]; }",
3 * kPointerSize,
3,
- 20,
+ 21,
{
B(CreateRestArguments), U8(0), //
B(Star), R(0), //
B(LdaTheHole), //
B(Star), R(1), //
+ B(StackCheck), //
B(Ldar), A(1, 3), //
B(Star), R(1), //
B(Ldar), R(0), //
@@ -5591,7 +6045,7 @@ TEST(CreateRestArguments) {
{"function f(a, ...restArgs) { return restArgs[0] + arguments[0]; }",
5 * kPointerSize,
3,
- 35,
+ 36,
{
B(CreateUnmappedArguments), //
B(Star), R(0), //
@@ -5599,6 +6053,7 @@ TEST(CreateRestArguments) {
B(Star), R(1), //
B(LdaTheHole), //
B(Star), R(2), //
+ B(StackCheck), //
B(Ldar), A(1, 3), //
B(Star), R(2), //
B(Ldar), R(1), //
@@ -5616,6 +6071,7 @@ TEST(CreateRestArguments) {
1,
{1}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -5631,6 +6087,7 @@ TEST(IllegalRedeclaration) {
CHECK_GE(MessageTemplate::kVarRedeclaration, 128);
// Must adapt bytecode if this changes.
+ // clang-format off
ExpectedSnippet<Handle<Object>, 2> snippets[] = {
{"const a = 1; { var a = 2; }",
3 * kPointerSize,
@@ -5648,6 +6105,7 @@ TEST(IllegalRedeclaration) {
{helper.factory()->NewNumberFromInt(MessageTemplate::kVarRedeclaration),
helper.factory()->NewStringFromAsciiChecked("a")}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -5675,51 +6133,67 @@ TEST(ForIn) {
Handle<i::TypeFeedbackVector> vector =
i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec);
+ // clang-format off
ExpectedSnippet<InstanceType> snippets[] = {
{"for (var p in null) {}",
2 * kPointerSize,
1,
- 2,
- {B(LdaUndefined), B(Return)},
+ 3,
+ {
+ B(StackCheck), //
+ B(LdaUndefined), //
+ B(Return) //
+ },
0},
{"for (var p in undefined) {}",
2 * kPointerSize,
1,
- 2,
- {B(LdaUndefined), B(Return)},
+ 3,
+ {
+ B(StackCheck), //
+ B(LdaUndefined), //
+ B(Return) //
+ },
0},
{"for (var p in undefined) {}",
2 * kPointerSize,
1,
- 2,
- {B(LdaUndefined), B(Return)},
+ 3,
+ {
+ B(StackCheck), //
+ B(LdaUndefined), //
+ B(Return) //
+ },
0},
{"var x = 'potatoes';\n"
"for (var p in x) { return p; }",
8 * kPointerSize,
1,
- 42,
+ 46,
{
+ B(StackCheck), //
B(LdaConstant), U8(0), //
B(Star), R(1), //
- B(JumpIfUndefined), U8(36), //
- B(JumpIfNull), U8(34), //
+ B(JumpIfUndefined), U8(39), //
+ B(JumpIfNull), U8(37), //
B(ToObject), //
- B(JumpIfNull), U8(31), //
+ B(JumpIfNull), U8(34), //
B(Star), R(3), //
B(ForInPrepare), R(4), //
B(LdaZero), //
B(Star), R(7), //
B(ForInDone), R(7), R(6), //
- B(JumpIfTrue), U8(19), //
+ B(JumpIfTrue), U8(22), //
B(ForInNext), R(3), R(7), R(4), //
- B(JumpIfUndefined), U8(7), //
+ B(JumpIfUndefined), U8(10), //
B(Star), R(0), //
+ B(StackCheck), //
+ B(Ldar), R(0), //
B(Star), R(2), //
B(Return), //
B(ForInStep), R(7), //
B(Star), R(7), //
- B(Jump), U8(-20), //
+ B(Jump), U8(-23), //
B(LdaUndefined), //
B(Return), //
},
@@ -5729,24 +6203,27 @@ TEST(ForIn) {
"for (var p in [1,2,3]) { x += p; }",
9 * kPointerSize,
1,
- 54,
+ 58,
{
+ B(StackCheck), //
B(LdaZero), //
B(Star), R(1), //
B(CreateArrayLiteral), U8(0), U8(0), U8(3), //
- B(JumpIfUndefined), U8(45), //
- B(JumpIfNull), U8(43), //
+ B(JumpIfUndefined), U8(48), //
+ B(JumpIfNull), U8(46), //
B(ToObject), //
- B(JumpIfNull), U8(40), //
+ B(JumpIfNull), U8(43), //
B(Star), R(3), //
B(ForInPrepare), R(4), //
B(LdaZero), //
B(Star), R(7), //
B(ForInDone), R(7), R(6), //
- B(JumpIfTrue), U8(28), //
+ B(JumpIfTrue), U8(31), //
B(ForInNext), R(3), R(7), R(4), //
- B(JumpIfUndefined), U8(16), //
+ B(JumpIfUndefined), U8(19), //
B(Star), R(0), //
+ B(StackCheck), //
+ B(Ldar), R(0), //
B(Star), R(2), //
B(Ldar), R(1), //
B(Star), R(8), //
@@ -5755,7 +6232,7 @@ TEST(ForIn) {
B(Star), R(1), //
B(ForInStep), R(7), //
B(Star), R(7), //
- B(Jump), U8(-29), //
+ B(Jump), U8(-32), //
B(LdaUndefined), //
B(Return), //
},
@@ -5768,29 +6245,31 @@ TEST(ForIn) {
"}",
8 * kPointerSize,
1,
- 93,
+ 95,
{
+ B(StackCheck), //
B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
B(Star), R(1), //
B(Star), R(0), //
B(CreateArrayLiteral), U8(1), U8(1), U8(simple_flags), //
- B(JumpIfUndefined), U8(79), //
- B(JumpIfNull), U8(77), //
+ B(JumpIfUndefined), U8(80), //
+ B(JumpIfNull), U8(78), //
B(ToObject), //
- B(JumpIfNull), U8(74), //
+ B(JumpIfNull), U8(75), //
B(Star), R(1), //
B(ForInPrepare), R(2), //
B(LdaZero), //
B(Star), R(5), //
B(ForInDone), R(5), R(4), //
- B(JumpIfTrue), U8(62), //
+ B(JumpIfTrue), U8(63), //
B(ForInNext), R(1), R(5), R(2), //
- B(JumpIfUndefined), U8(50), //
+ B(JumpIfUndefined), U8(51), //
B(Star), R(6), //
B(Ldar), R(0), //
B(Star), R(7), //
B(Ldar), R(6), //
B(StoreICSloppy), R(7), U8(2), U8(vector->GetIndex(slot4)), //
+ B(StackCheck), //
B(Ldar), R(0), //
B(Star), R(6), //
B(LoadICSloppy), R(6), U8(2), U8(vector->GetIndex(slot2)), //
@@ -5809,7 +6288,7 @@ TEST(ForIn) {
B(Jump), U8(8), //
B(ForInStep), R(5), //
B(Star), R(5), //
- B(Jump), U8(-63), //
+ B(Jump), U8(-64), //
B(LdaUndefined), //
B(Return), //
},
@@ -5820,23 +6299,24 @@ TEST(ForIn) {
"for (x[0] in [1,2,3]) { return x[3]; }",
9 * kPointerSize,
1,
- 68,
+ 70,
{
+ B(StackCheck), //
B(CreateArrayLiteral), U8(0), U8(0), U8(simple_flags), //
B(Star), R(0), //
B(CreateArrayLiteral), U8(1), U8(1), U8(simple_flags), //
- B(JumpIfUndefined), U8(56), //
- B(JumpIfNull), U8(54), //
+ B(JumpIfUndefined), U8(57), //
+ B(JumpIfNull), U8(55), //
B(ToObject), //
- B(JumpIfNull), U8(51), //
+ B(JumpIfNull), U8(52), //
B(Star), R(1), //
B(ForInPrepare), R(2), //
B(LdaZero), //
B(Star), R(5), //
B(ForInDone), R(5), R(4), //
- B(JumpIfTrue), U8(39), //
+ B(JumpIfTrue), U8(40), //
B(ForInNext), R(1), R(5), R(2), //
- B(JumpIfUndefined), U8(27), //
+ B(JumpIfUndefined), U8(28), //
B(Star), R(6), //
B(Ldar), R(0), //
B(Star), R(7), //
@@ -5844,6 +6324,7 @@ TEST(ForIn) {
B(Star), R(8), //
B(Ldar), R(6), //
B(KeyedStoreICSloppy), R(7), R(8), U8(vector->GetIndex(slot3)), //
+ B(StackCheck), //
B(Ldar), R(0), //
B(Star), R(6), //
B(LdaSmi8), U8(3), //
@@ -5851,13 +6332,14 @@ TEST(ForIn) {
B(Return), //
B(ForInStep), R(5), //
B(Star), R(5), //
- B(Jump), U8(-40), //
+ B(Jump), U8(-41), //
B(LdaUndefined), //
B(Return), //
},
2,
{InstanceType::FIXED_ARRAY_TYPE, InstanceType::FIXED_ARRAY_TYPE}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -5889,12 +6371,14 @@ TEST(ForOf) {
Handle<i::TypeFeedbackVector> vector =
i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec);
+ // clang-format off
ExpectedSnippet<InstanceType, 8> snippets[] = {
{"for (var p of [0, 1, 2]) {}",
7 * kPointerSize,
1,
- 82,
+ 86,
{
+ B(StackCheck), //
B(CreateArrayLiteral), U8(0), U8(0), U8(array_literal_flags), //
B(Star), R(5), //
B(LdaConstant), U8(1), //
@@ -5915,17 +6399,19 @@ TEST(ForOf) {
B(Ldar), R(2), //
B(Star), R(4), //
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), //
- R(4), U8(1), //
+ /* */ R(4), U8(1), //
B(Ldar), R(2), //
B(Star), R(4), //
B(LoadICSloppy), R(4), U8(3), U8(vector->GetIndex(slot5)), //
- B(JumpIfToBooleanTrue), U8(16), //
+ B(JumpIfToBooleanTrue), U8(19), //
B(Ldar), R(2), //
B(Star), R(4), //
B(LoadICSloppy), R(4), U8(4), U8(vector->GetIndex(slot6)), //
B(Star), R(0), //
+ B(StackCheck), //
+ B(Ldar), R(0), //
B(Star), R(3), //
- B(Jump), U8(-58), //
+ B(Jump), U8(-61), //
B(LdaUndefined), //
B(Return), //
},
@@ -5938,8 +6424,9 @@ TEST(ForOf) {
"for (var p of x) { return p; }",
8 * kPointerSize,
1,
- 81,
+ 85,
{
+ B(StackCheck), //
B(LdaConstant), U8(0), //
B(Star), R(3), //
B(Star), R(6), //
@@ -5961,15 +6448,17 @@ TEST(ForOf) {
B(Ldar), R(2), //
B(Star), R(5), //
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), //
- R(5), U8(1), //
+ /* */ R(5), U8(1), //
B(Ldar), R(2), //
B(Star), R(5), //
B(LoadICSloppy), R(5), U8(3), U8(vector->GetIndex(slot5)), //
- B(JumpIfToBooleanTrue), U8(15), //
+ B(JumpIfToBooleanTrue), U8(18), //
B(Ldar), R(2), //
B(Star), R(5), //
B(LoadICSloppy), R(5), U8(4), U8(vector->GetIndex(slot6)), //
B(Star), R(0), //
+ B(StackCheck), //
+ B(Ldar), R(0), //
B(Star), R(4), //
B(Return), //
B(LdaUndefined), //
@@ -5987,8 +6476,9 @@ TEST(ForOf) {
"}",
7 * kPointerSize,
1,
- 104,
+ 108,
{
+ B(StackCheck), //
B(CreateArrayLiteral), U8(0), U8(0), U8(array_literal_flags), //
B(Star), R(5), //
B(LdaConstant), U8(1), //
@@ -6009,28 +6499,30 @@ TEST(ForOf) {
B(Ldar), R(2), //
B(Star), R(4), //
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), //
- R(4), U8(1), //
+ /* */ R(4), U8(1), //
B(Ldar), R(2), //
B(Star), R(4), //
B(LoadICSloppy), R(4), U8(3), U8(vector->GetIndex(slot5)), //
- B(JumpIfToBooleanTrue), U8(38), //
+ B(JumpIfToBooleanTrue), U8(41), //
B(Ldar), R(2), //
B(Star), R(4), //
B(LoadICSloppy), R(4), U8(4), U8(vector->GetIndex(slot6)), //
B(Star), R(0), //
+ B(StackCheck), //
+ B(Ldar), R(0), //
B(Star), R(3), //
B(Star), R(4), //
B(LdaSmi8), U8(10), //
B(TestEqual), R(4), //
B(JumpIfFalse), U8(4), //
- B(Jump), U8(-66), //
+ B(Jump), U8(-69), //
B(Ldar), R(3), //
B(Star), R(4), //
B(LdaSmi8), U8(20), //
B(TestEqual), R(4), //
B(JumpIfFalse), U8(4), //
B(Jump), U8(4), //
- B(Jump), U8(-80), //
+ B(Jump), U8(-83), //
B(LdaUndefined), //
B(Return), //
},
@@ -6043,8 +6535,9 @@ TEST(ForOf) {
"for (x['a'] of [1,2,3]) { return x['a']; }",
6 * kPointerSize,
1,
- 101,
+ 103,
{
+ B(StackCheck), //
B(CreateObjectLiteral), U8(0), U8(0), U8(object_literal_flags), //
B(Star), R(3), //
B(Star), R(2), //
@@ -6068,17 +6561,18 @@ TEST(ForOf) {
B(Ldar), R(1), //
B(Star), R(3), //
B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), //
- R(3), U8(1), //
+ /* */ R(3), U8(1), //
B(Ldar), R(1), //
B(Star), R(3), //
B(LoadICSloppy), R(3), U8(4), U8(vector->GetIndex(slot5)), //
- B(JumpIfToBooleanTrue), U8(27), //
+ B(JumpIfToBooleanTrue), U8(28), //
B(Ldar), R(2), //
B(Star), R(3), //
B(Ldar), R(1), //
B(Star), R(4), //
B(LoadICSloppy), R(4), U8(5), U8(vector->GetIndex(slot6)), //
B(StoreICSloppy), R(3), U8(6), U8(vector->GetIndex(slot7)), //
+ B(StackCheck), //
B(Ldar), R(2), //
B(Star), R(3), //
B(LoadICSloppy), R(3), U8(6), U8(vector->GetIndex(slot8)), //
@@ -6095,6 +6589,7 @@ TEST(ForOf) {
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -6108,12 +6603,14 @@ TEST(Conditional) {
InitializedHandleScope handle_scope;
BytecodeGeneratorHelper helper;
+ // clang-format off
ExpectedSnippet<int> snippets[] = {
{"return 1 ? 2 : 3;",
0,
1,
- 11,
+ 12,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(JumpIfToBooleanFalse), U8(6), //
B(LdaSmi8), U8(2), //
@@ -6124,8 +6621,9 @@ TEST(Conditional) {
{"return 1 ? 2 ? 3 : 4 : 5;",
0,
1,
- 19,
+ 20,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(JumpIfToBooleanFalse), U8(14), //
B(LdaSmi8), U8(2), //
@@ -6138,6 +6636,7 @@ TEST(Conditional) {
B(Return), //
}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -6151,6 +6650,7 @@ TEST(Switch) {
InitializedHandleScope handle_scope;
BytecodeGeneratorHelper helper;
+ // clang-format off
ExpectedSnippet<int> snippets[] = {
{"var a = 1;\n"
"switch(a) {\n"
@@ -6159,8 +6659,9 @@ TEST(Switch) {
"}\n",
3 * kPointerSize,
1,
- 30,
+ 31,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(1), // The tag variable is allocated as a
B(Star), R(0), // local by the parser, hence the store
@@ -6186,8 +6687,9 @@ TEST(Switch) {
"}\n",
3 * kPointerSize,
1,
- 36,
+ 37,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(1), //
B(Star), R(0), //
@@ -6215,8 +6717,9 @@ TEST(Switch) {
"}\n",
3 * kPointerSize,
1,
- 34,
+ 35,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(1), //
B(Star), R(0), //
@@ -6244,8 +6747,9 @@ TEST(Switch) {
"}\n",
3 * kPointerSize,
1,
- 34,
+ 35,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(1), //
B(Star), R(0), //
@@ -6273,8 +6777,9 @@ TEST(Switch) {
"}\n",
3 * kPointerSize,
1,
- 43,
+ 44,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(1), //
B(TypeOf), //
@@ -6306,8 +6811,9 @@ TEST(Switch) {
"}\n",
3 * kPointerSize,
1,
- 31,
+ 32,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(1), //
B(Star), R(0), //
@@ -6334,8 +6840,9 @@ TEST(Switch) {
"}\n",
3 * kPointerSize,
1,
- 288,
+ 289,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(1), //
B(Star), R(0), //
@@ -6370,8 +6877,9 @@ TEST(Switch) {
"}\n",
5 * kPointerSize,
1,
- 60,
+ 61,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(2), //
B(Star), R(0), //
@@ -6405,6 +6913,7 @@ TEST(Switch) {
B(Return), //
}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -6420,12 +6929,14 @@ TEST(BasicBlockToBoolean) {
// Check that we generate JumpIfToBoolean if they are at the start of basic
// blocks.
+ // clang-format off
ExpectedSnippet<int> snippets[] = {
{"var a = 1; if (a || a < 0) { return 1; }",
2 * kPointerSize,
1,
- 20,
+ 21,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(JumpIfToBooleanTrue), U8(9), //
@@ -6442,8 +6953,9 @@ TEST(BasicBlockToBoolean) {
{"var a = 1; if (a && a < 0) { return 1; }",
2 * kPointerSize,
1,
- 20,
+ 21,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(JumpIfToBooleanFalse), U8(9), //
@@ -6460,8 +6972,9 @@ TEST(BasicBlockToBoolean) {
{"var a = 1; a = (a || a < 0) ? 2 : 3;",
2 * kPointerSize,
1,
- 25,
+ 26,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(JumpIfToBooleanTrue), U8(9), //
@@ -6478,6 +6991,7 @@ TEST(BasicBlockToBoolean) {
B(Return), //
}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -6491,20 +7005,23 @@ TEST(DeadCodeRemoval) {
InitializedHandleScope handle_scope;
BytecodeGeneratorHelper helper;
+ // clang-format off
ExpectedSnippet<int> snippets[] = {
{"return; var a = 1; a();",
1 * kPointerSize,
1,
- 2,
+ 3,
{
+ B(StackCheck), //
B(LdaUndefined), //
B(Return), //
}},
{"if (false) { return; }; var a = 1;",
1 * kPointerSize,
1,
- 6,
+ 7,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(LdaUndefined), //
@@ -6513,16 +7030,18 @@ TEST(DeadCodeRemoval) {
{"if (true) { return 1; } else { return 2; };",
0,
1,
- 3,
+ 4,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Return), //
}},
{"var a = 1; if (a) { return 1; }; return 2;",
1 * kPointerSize,
1,
- 12,
+ 13,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(JumpIfToBooleanFalse), U8(5), //
@@ -6532,6 +7051,7 @@ TEST(DeadCodeRemoval) {
B(Return), //
}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -6547,14 +7067,16 @@ TEST(ThisFunction) {
int closure = Register::function_closure().index();
+ // clang-format off
ExpectedSnippet<int> snippets[] = {
{"var f;\n f = function f() { }",
1 * kPointerSize,
1,
- 9,
+ 10,
{
B(LdaTheHole), //
B(Star), R(0), //
+ B(StackCheck), //
B(Ldar), R(closure), //
B(Star), R(0), //
B(LdaUndefined), //
@@ -6563,15 +7085,17 @@ TEST(ThisFunction) {
{"var f;\n f = function f() { return f; }",
1 * kPointerSize,
1,
- 8,
+ 9,
{
B(LdaTheHole), //
B(Star), R(0), //
+ B(StackCheck), //
B(Ldar), R(closure), //
B(Star), R(0), //
B(Return), //
}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -6587,27 +7111,33 @@ TEST(NewTarget) {
int new_target = Register::new_target().index();
+ // clang-format off
ExpectedSnippet<int> snippets[] = {
{"return new.target;",
1 * kPointerSize,
1,
- 5,
+ 8,
{
B(Ldar), R(new_target), //
B(Star), R(0), //
+ B(StackCheck), //
+ B(Ldar), R(0), //
B(Return), //
}},
{"new.target;",
1 * kPointerSize,
1,
- 6,
+ 9,
{
B(Ldar), R(new_target), //
B(Star), R(0), //
+ B(StackCheck), //
+ B(Ldar), R(0), //
B(LdaUndefined), //
B(Return), //
}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -6621,6 +7151,7 @@ TEST(RemoveRedundantLdar) {
InitializedHandleScope handle_scope;
BytecodeGeneratorHelper helper;
+ // clang-format off
ExpectedSnippet<int> snippets[] = {
{"var ld_a = 1;\n" // This test is to check Ldar does not
"while(true) {\n" // get removed if the preceding Star is
@@ -6630,9 +7161,11 @@ TEST(RemoveRedundantLdar) {
"return ld_a;",
2 * kPointerSize,
1,
- 29,
- {B(LdaSmi8), U8(1), //
+ 31,
+ {B(StackCheck), //
+ B(LdaSmi8), U8(1), //
B(Star), R(0), //
+ B(StackCheck), //
B(Ldar), R(0), // This load should not be removed as it
B(Star), R(1), // is the target of the branch.
B(Ldar), R(0), //
@@ -6643,7 +7176,7 @@ TEST(RemoveRedundantLdar) {
B(TestGreaterThan), R(1), //
B(JumpIfFalse), U8(4), //
B(Jump), U8(4), //
- B(Jump), U8(-20), //
+ B(Jump), U8(-21), //
B(Ldar), R(0), //
B(Return)}},
{"var ld_a = 1;\n"
@@ -6654,9 +7187,11 @@ TEST(RemoveRedundantLdar) {
"return ld_a;",
2 * kPointerSize,
1,
- 27,
- {B(LdaSmi8), U8(1), //
+ 29,
+ {B(StackCheck), //
+ B(LdaSmi8), U8(1), //
B(Star), R(0), //
+ B(StackCheck), //
B(Ldar), R(0), //
B(Star), R(1), //
B(Ldar), R(0), //
@@ -6674,8 +7209,9 @@ TEST(RemoveRedundantLdar) {
" return ld_a;",
2 * kPointerSize,
1,
- 13,
+ 14,
{
+ B(StackCheck), //
B(LdaSmi8), U8(1), //
B(Star), R(0), //
B(Star), R(1), //
@@ -6685,6 +7221,7 @@ TEST(RemoveRedundantLdar) {
B(Return) //
}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -6698,13 +7235,15 @@ TEST(AssignmentsInBinaryExpression) {
InitializedHandleScope handle_scope;
BytecodeGeneratorHelper helper;
+ // clang-format off
ExpectedSnippet<const char*> snippets[] = {
{"var x = 0, y = 1;\n"
"return (x = 2, y = 3, x = 4, y = 5)",
2 * kPointerSize,
1,
- 24,
+ 25,
{
+ B(StackCheck), //
B(LdaZero), B(Star), R(0), //
B(LdaSmi8), U8(1), //
B(Star), R(1), //
@@ -6724,8 +7263,9 @@ TEST(AssignmentsInBinaryExpression) {
"return y",
2 * kPointerSize,
1,
- 11,
+ 12,
{
+ B(StackCheck), //
B(LdaSmi8), U8(55), //
B(Star), R(0), //
B(LdaSmi8), U8(100), //
@@ -6739,8 +7279,9 @@ TEST(AssignmentsInBinaryExpression) {
"return x;",
3 * kPointerSize,
1,
- 23,
+ 24,
{
+ B(StackCheck), //
B(LdaSmi8), U8(55), //
B(Star), R(0), //
B(Star), R(1), //
@@ -6761,8 +7302,9 @@ TEST(AssignmentsInBinaryExpression) {
"return x;",
3 * kPointerSize,
1,
- 31,
+ 32,
{
+ B(StackCheck), //
B(LdaSmi8), U8(55), //
B(Star), R(0), //
B(LdaSmi8), U8(56), //
@@ -6787,8 +7329,9 @@ TEST(AssignmentsInBinaryExpression) {
"return y;",
4 * kPointerSize,
1,
- 31,
+ 32,
{
+ B(StackCheck), //
B(LdaSmi8), U8(55), //
B(Star), R(0), //
B(Star), R(2), //
@@ -6812,8 +7355,9 @@ TEST(AssignmentsInBinaryExpression) {
"return x;",
3 * kPointerSize,
1,
- 31,
+ 32,
{
+ B(StackCheck), //
B(LdaSmi8), U8(55), //
B(Star), R(0), //
B(Star), R(1), //
@@ -6837,8 +7381,9 @@ TEST(AssignmentsInBinaryExpression) {
"y;\n",
5 * kPointerSize,
1,
- 69,
+ 70,
{
+ B(StackCheck), //
B(LdaSmi8), U8(10), //
B(Star), R(0), //
B(LdaSmi8), U8(20), //
@@ -6880,8 +7425,9 @@ TEST(AssignmentsInBinaryExpression) {
"return 1 + x + (x++) + (++x);\n",
4 * kPointerSize,
1,
- 37,
+ 38,
{
+ B(StackCheck), //
B(LdaSmi8), U8(17), //
B(Star), R(0), //
B(LdaSmi8), U8(1), //
@@ -6904,7 +7450,9 @@ TEST(AssignmentsInBinaryExpression) {
B(Add), R(3), //
B(Return), //
},
- 0}};
+ 0}
+ };
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -6925,14 +7473,15 @@ TEST(Eval) {
int first_context_slot = Context::MIN_CONTEXT_SLOTS;
+ // clang-format off
ExpectedSnippet<const char*> snippets[] = {
{"return eval('1;');",
9 * kPointerSize,
1,
- 67,
+ 68,
{
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), //
- U8(1), //
+ /* */ U8(1), //
B(PushContext), R(0), //
B(Ldar), THIS(1), //
B(StaContextSlot), R(context), U8(first_context_slot), //
@@ -6940,11 +7489,12 @@ TEST(Eval) {
B(StaContextSlot), R(context), U8(first_context_slot + 1), //
B(Ldar), R(new_target), //
B(StaContextSlot), R(context), U8(first_context_slot + 2), //
+ B(StackCheck), //
B(Mov), R(context), R(3), //
B(LdaConstant), U8(0), //
B(Star), R(4), //
B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlot), //
- R(3), U8(2), R(1), //
+ /* */ R(3), U8(2), R(1), //
B(LdaConstant), U8(1), //
B(Star), R(3), //
B(Mov), R(1), R(4), //
@@ -6955,7 +7505,7 @@ TEST(Eval) {
B(LdaSmi8), U8(10), //
B(Star), R(8), //
B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), //
- U8(5), //
+ /* */ U8(5), //
B(Star), R(1), //
B(Call), R(1), R(2), U8(2), U8(0), //
B(Return), //
@@ -6963,6 +7513,7 @@ TEST(Eval) {
2,
{"eval", "1;"}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -6981,14 +7532,15 @@ TEST(LookupSlot) {
int first_context_slot = Context::MIN_CONTEXT_SLOTS;
int new_target = Register::new_target().index();
+ // clang-format off
ExpectedSnippet<const char*> snippets[] = {
{"eval('var x = 10;'); return x;",
9 * kPointerSize,
1,
- 69,
+ 70,
{
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), //
- U8(1), //
+ /* */ U8(1), //
B(PushContext), R(0), //
B(Ldar), THIS(1), //
B(StaContextSlot), R(context), U8(first_context_slot), //
@@ -6996,6 +7548,7 @@ TEST(LookupSlot) {
B(StaContextSlot), R(context), U8(first_context_slot + 1), //
B(Ldar), R(new_target), //
B(StaContextSlot), R(context), U8(first_context_slot + 2), //
+ B(StackCheck), //
B(Mov), R(context), R(3), //
B(LdaConstant), U8(0), //
B(Star), R(4), //
@@ -7022,10 +7575,10 @@ TEST(LookupSlot) {
{"eval('var x = 10;'); return typeof x;",
9 * kPointerSize,
1,
- 70,
+ 71,
{
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), //
- U8(1), //
+ /* */ U8(1), //
B(PushContext), R(0), //
B(Ldar), THIS(1), //
B(StaContextSlot), R(context), U8(first_context_slot), //
@@ -7033,11 +7586,12 @@ TEST(LookupSlot) {
B(StaContextSlot), R(context), U8(first_context_slot + 1), //
B(Ldar), R(new_target), //
B(StaContextSlot), R(context), U8(first_context_slot + 2), //
+ B(StackCheck), //
B(Mov), R(context), R(3), //
B(LdaConstant), U8(0), //
B(Star), R(4), //
B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlot), //
- R(3), U8(2), R(1), //
+ /* */ R(3), U8(2), R(1), //
B(LdaConstant), U8(1), //
B(Star), R(3), //
B(Mov), R(1), R(4), //
@@ -7048,7 +7602,7 @@ TEST(LookupSlot) {
B(LdaSmi8), U8(10), //
B(Star), R(8), //
B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), //
- U8(5), //
+ /* */ U8(5), //
B(Star), R(1), //
B(Call), R(1), R(2), U8(2), U8(0), //
B(LdaLookupSlotInsideTypeof), U8(2), //
@@ -7060,7 +7614,7 @@ TEST(LookupSlot) {
{"x = 20; return eval('');",
9 * kPointerSize,
1,
- 71,
+ 72,
{
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), //
U8(1), //
@@ -7071,13 +7625,14 @@ TEST(LookupSlot) {
B(StaContextSlot), R(context), U8(first_context_slot + 1), //
B(Ldar), R(new_target), //
B(StaContextSlot), R(context), U8(first_context_slot + 2), //
+ B(StackCheck), //
B(LdaSmi8), U8(20), //
B(StaLookupSlotSloppy), U8(0), //
B(Mov), R(context), R(3), //
B(LdaConstant), U8(1), //
B(Star), R(4), //
B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlot), //
- R(3), U8(2), R(1), //
+ /* */ R(3), U8(2), R(1), //
B(LdaConstant), U8(2), //
B(Star), R(3), //
B(Mov), R(1), R(4), //
@@ -7088,7 +7643,7 @@ TEST(LookupSlot) {
B(LdaSmi8), U8(10), //
B(Star), R(8), //
B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), //
- U8(5), //
+ /* */ U8(5), //
B(Star), R(1), //
B(Call), R(1), R(2), U8(2), U8(0), //
B(Return), //
@@ -7096,6 +7651,7 @@ TEST(LookupSlot) {
3,
{"x", "eval", ""}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -7122,14 +7678,15 @@ TEST(CallLookupSlot) {
int context = Register::current_context().index();
int new_target = Register::new_target().index();
+ // clang-format off
ExpectedSnippet<InstanceType> snippets[] = {
{"g = function(){}; eval(''); return g();",
9 * kPointerSize,
1,
- 90,
+ 91,
{
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), //
- U8(1), //
+ /* */ U8(1), //
B(PushContext), R(0), //
B(Ldar), THIS(1), //
B(StaContextSlot), R(context), U8(4), //
@@ -7137,6 +7694,7 @@ TEST(CallLookupSlot) {
B(StaContextSlot), R(context), U8(5), //
B(Ldar), R(new_target), //
B(StaContextSlot), R(context), U8(6), //
+ B(StackCheck), //
B(CreateClosure), U8(0), U8(0), //
B(StaLookupSlotSloppy), U8(1), //
B(Mov), R(context), R(3), //
@@ -7171,6 +7729,7 @@ TEST(CallLookupSlot) {
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -7194,12 +7753,14 @@ TEST(LookupSlotInEval) {
"}"
"f1();";
+ // clang-format off
ExpectedSnippet<const char*> snippets[] = {
{"return x;",
0 * kPointerSize,
1,
- 3,
+ 4,
{
+ B(StackCheck), //
B(LdaLookupSlot), U8(0), //
B(Return) //
},
@@ -7208,8 +7769,9 @@ TEST(LookupSlotInEval) {
{"x = 10;",
0 * kPointerSize,
1,
- 6,
+ 7,
{
+ B(StackCheck), //
B(LdaSmi8), U8(10), //
B(StaLookupSlotSloppy), U8(0), //
B(LdaUndefined), //
@@ -7220,8 +7782,9 @@ TEST(LookupSlotInEval) {
{"'use strict'; x = 10;",
0 * kPointerSize,
1,
- 6,
+ 7,
{
+ B(StackCheck), //
B(LdaSmi8), U8(10), //
B(StaLookupSlotStrict), U8(0), //
B(LdaUndefined), //
@@ -7232,8 +7795,9 @@ TEST(LookupSlotInEval) {
{"return typeof x;",
0 * kPointerSize,
1,
- 4,
+ 5,
{
+ B(StackCheck), //
B(LdaLookupSlotInsideTypeof), U8(0), //
B(TypeOf), //
B(Return), //
@@ -7241,6 +7805,7 @@ TEST(LookupSlotInEval) {
1,
{"x"}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
std::string script = std::string(function_prologue) +
@@ -7268,13 +7833,15 @@ TEST(LookupSlotWideInEval) {
"f1();";
int const_count[] = {0, 0, 0, 0};
+ // clang-format off
ExpectedSnippet<InstanceType, 257> snippets[] = {
{REPEAT_256(SPACE, "var y = 2.3;")
"return x;",
1 * kPointerSize,
1,
- 1028,
+ 1029,
{
+ B(StackCheck), //
REPEAT_256(SPACE, //
B(LdaConstant), U8(const_count[0]++), //
B(Star), R(0), ) //
@@ -7288,8 +7855,9 @@ TEST(LookupSlotWideInEval) {
"return typeof x;",
1 * kPointerSize,
1,
- 1029,
+ 1030,
{
+ B(StackCheck), //
REPEAT_256(SPACE, //
B(LdaConstant), U8(const_count[1]++), //
B(Star), R(0), ) //
@@ -7304,8 +7872,9 @@ TEST(LookupSlotWideInEval) {
"x = 10;",
1 * kPointerSize,
1,
- 1031,
+ 1032,
{
+ B(StackCheck), //
REPEAT_256(SPACE, //
B(LdaConstant), U8(const_count[2]++), //
B(Star), R(0), ) //
@@ -7322,9 +7891,10 @@ TEST(LookupSlotWideInEval) {
"x = 10;",
1 * kPointerSize,
1,
- 1031,
+ 1032,
{
- REPEAT_256(SPACE,
+ B(StackCheck), //
+ REPEAT_256(SPACE, //
B(LdaConstant), U8(const_count[3]++), //
B(Star), R(0), ) //
B(LdaSmi8), U8(10), //
@@ -7336,6 +7906,7 @@ TEST(LookupSlotWideInEval) {
{REPEAT_256(COMMA, InstanceType::HEAP_NUMBER_TYPE),
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
std::string script = std::string(function_prologue) +
@@ -7362,12 +7933,14 @@ TEST(DeleteLookupSlotInEval) {
"}"
"f1();";
+ // clang-format off
ExpectedSnippet<const char*> snippets[] = {
{"delete x;",
0 * kPointerSize,
1,
- 5,
+ 6,
{
+ B(StackCheck), //
B(LdaConstant), U8(0), //
B(DeleteLookupSlot), //
B(LdaUndefined), //
@@ -7378,8 +7951,9 @@ TEST(DeleteLookupSlotInEval) {
{"return delete y;",
0 * kPointerSize,
1,
- 2,
+ 3,
{
+ B(StackCheck), //
B(LdaFalse), //
B(Return) //
},
@@ -7387,8 +7961,9 @@ TEST(DeleteLookupSlotInEval) {
{"return delete z;",
0 * kPointerSize,
1,
- 4,
+ 5,
{
+ B(StackCheck), //
B(LdaConstant), U8(0), //
B(DeleteLookupSlot), //
B(Return) //
@@ -7396,6 +7971,7 @@ TEST(DeleteLookupSlotInEval) {
1,
{"z"}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
std::string script = std::string(function_prologue) +
@@ -7415,13 +7991,15 @@ TEST(WideRegisters) {
}
std::string prologue(os.str());
+ // clang-format off
ExpectedSnippet<int> snippets[] = {
{"x0 = x127;\n"
"return x0;\n",
161 * kPointerSize,
1,
- 10,
+ 11,
{
+ B(StackCheck), //
B(MovWide), R16(131), R16(125), //
B(Ldar), R(125), //
B(Star), R(0), //
@@ -7431,8 +8009,9 @@ TEST(WideRegisters) {
"return x127;\n",
161 * kPointerSize,
1,
- 22,
+ 23,
{
+ B(StackCheck), //
B(MovWide), R16(130), R16(125), //
B(Ldar), R(125), //
B(Star), R(125), //
@@ -7445,8 +8024,9 @@ TEST(WideRegisters) {
"return x128;\n",
162 * kPointerSize,
1,
- 36,
+ 37,
{
+ B(StackCheck), //
B(Ldar), R(2), //
B(Star), R(125), //
B(MovWide), R16(125), R16(161), //
@@ -7467,8 +8047,9 @@ TEST(WideRegisters) {
"return x129;\n",
162 * kPointerSize,
1,
- 68,
+ 69,
{
+ B(StackCheck), //
B(LdaZero), //
B(Star), R(0), //
B(MovWide), R16(133), R16(125), //
@@ -7503,8 +8084,9 @@ TEST(WideRegisters) {
"return x128;\n",
162 * kPointerSize,
1,
- 97,
+ 99,
{
+ B(StackCheck), //
B(LdaZero), //
B(Star), R(0), //
B(LdaZero), //
@@ -7519,7 +8101,8 @@ TEST(WideRegisters) {
B(LdaSmi8), U8(64), //
B(MovWide), R16(161), R16(125), //
B(TestLessThan), R(125), //
- B(JumpIfFalse), U8(52), //
+ B(JumpIfFalse), U8(53), //
+ B(StackCheck), //
B(Ldar), R(1), //
B(Star), R(125), //
B(MovWide), R16(125), R16(161), //
@@ -7536,7 +8119,7 @@ TEST(WideRegisters) {
B(Inc), //
B(Star), R(125), //
B(MovWide), R16(125), R16(132), //
- B(Jump), U8(-73), //
+ B(Jump), U8(-74), //
B(MovWide), R16(132), R16(125), //
B(Ldar), R(125), //
B(Return), //
@@ -7549,17 +8132,18 @@ TEST(WideRegisters) {
"return x1;\n",
167 * kPointerSize,
1,
- 109,
+ 111,
{
+ B(StackCheck), //
B(LdaConstant), U8(0), //
B(Star), R(0), //
B(LdaZero), //
B(Star), R(1), //
B(Ldar), R(0), //
- B(JumpIfUndefined), U8(97), //
- B(JumpIfNull), U8(95), //
+ B(JumpIfUndefined), U8(98), //
+ B(JumpIfNull), U8(96), //
B(ToObject), //
- B(JumpIfNull), U8(92), //
+ B(JumpIfNull), U8(93), //
B(Star), R(125), //
B(MovWide), R16(125), R16(161), //
B(ForInPrepareWide), R16(162), //
@@ -7569,11 +8153,12 @@ TEST(WideRegisters) {
B(MovWide), R16(165), R16(125), //
B(MovWide), R16(164), R16(126), //
B(ForInDone), R(125), R(126), //
- B(JumpIfTrue), U8(59), //
+ B(JumpIfTrue), U8(60), //
B(ForInNextWide), R16(161), R16(165), R16(162), //
- B(JumpIfUndefined), U8(34), //
+ B(JumpIfUndefined), U8(35), //
B(Star), R(125), //
B(MovWide), R16(125), R16(132), //
+ B(StackCheck), //
B(Ldar), R(1), //
B(Star), R(125), //
B(MovWide), R16(125), R16(166), //
@@ -7586,7 +8171,7 @@ TEST(WideRegisters) {
B(ForInStep), R(125), //
B(Star), R(125), //
B(MovWide), R16(125), R16(165), //
- B(Jump), U8(-70), //
+ B(Jump), U8(-71), //
B(Ldar), R(1), //
B(Return), //
},
@@ -7598,8 +8183,9 @@ TEST(WideRegisters) {
"return x1;\n",
163 * kPointerSize,
1,
- 65,
+ 66,
{
+ B(StackCheck), //
B(Ldar), R(64), //
B(Star), R(125), //
B(MovWide), R16(125), R16(161), //
@@ -7620,7 +8206,9 @@ TEST(WideRegisters) {
B(CallRuntime), U16(Runtime::kTheHole), R(0), U8(0), //
B(Ldar), R(1), //
B(Return), //
- }}};
+ }}
+ };
+ // clang-format on
InitializedHandleScope handle_scope;
BytecodeGeneratorHelper helper;
@@ -7640,12 +8228,14 @@ TEST(DoExpression) {
InitializedHandleScope handle_scope;
BytecodeGeneratorHelper helper;
+ // clang-format off
ExpectedSnippet<const char*> snippets[] = {
{"var a = do { }; return a;",
2 * kPointerSize,
1,
- 5,
+ 6,
{
+ B(StackCheck), //
B(Ldar), R(0), //
B(Star), R(1), //
B(Return) //
@@ -7654,8 +8244,9 @@ TEST(DoExpression) {
{"var a = do { var x = 100; }; return a;",
3 * kPointerSize,
1,
- 10,
+ 11,
{
+ B(StackCheck), //
B(LdaSmi8), U8(100), //
B(Star), R(1), //
B(LdaUndefined), //
@@ -7667,25 +8258,28 @@ TEST(DoExpression) {
{"while(true) { var a = 10; a = do { ++a; break; }; a = 20; }",
2 * kPointerSize,
1,
- 24,
+ 26,
{
- B(LdaSmi8), U8(10), //
- B(Star), R(1), //
+ B(StackCheck), //
+ B(StackCheck), //
+ B(LdaSmi8), U8(10), //
+ B(Star), R(1), //
B(ToNumber), //
B(Inc), //
- B(Star), R(1), //
- B(Star), R(0), //
- B(Jump), U8(12), //
- B(Ldar), R(0), //
- B(Star), R(1), //
- B(LdaSmi8), U8(20), //
- B(Star), R(1), //
- B(Jump), U8(-20), //
+ B(Star), R(1), //
+ B(Star), R(0), //
+ B(Jump), U8(12), //
+ B(Ldar), R(0), //
+ B(Star), R(1), //
+ B(LdaSmi8), U8(20), //
+ B(Star), R(1), //
+ B(Jump), U8(-21), //
B(LdaUndefined), //
B(Return), //
},
0},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
@@ -7705,14 +8299,15 @@ TEST(WithStatement) {
int closure = Register::function_closure().index();
int new_target = Register::new_target().index();
+ // clang-format off
ExpectedSnippet<InstanceType> snippets[] = {
{"with ({x:42}) { return x; }",
5 * kPointerSize,
1,
- 46,
+ 47,
{
B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), //
- U8(1), //
+ /* */ U8(1), //
B(PushContext), R(0), //
B(Ldar), THIS(1), //
B(StaContextSlot), R(context), U8(4), //
@@ -7720,6 +8315,7 @@ TEST(WithStatement) {
B(StaContextSlot), R(context), U8(5), //
B(Ldar), R(new_target), //
B(StaContextSlot), R(context), U8(6), //
+ B(StackCheck), //
B(CreateObjectLiteral), U8(0), U8(0), U8(deep_elements_flags), //
B(Star), R(2), //
B(ToObject), //
@@ -7736,6 +8332,7 @@ TEST(WithStatement) {
{InstanceType::FIXED_ARRAY_TYPE,
InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}},
};
+ // clang-format on
for (size_t i = 0; i < arraysize(snippets); i++) {
Handle<BytecodeArray> bytecode_array =
« no previous file with comments | « test/cctest/cctest.status ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698