OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
8 #include "src/interpreter/bytecode-array-iterator.h" | 8 #include "src/interpreter/bytecode-array-iterator.h" |
9 #include "src/interpreter/bytecode-generator.h" | 9 #include "src/interpreter/bytecode-generator.h" |
10 #include "src/interpreter/interpreter.h" | 10 #include "src/interpreter/interpreter.h" |
(...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1399 ExpectedSnippet<const char*> snippets[] = { | 1399 ExpectedSnippet<const char*> snippets[] = { |
1400 {"function f(a) { return a.func(); }\nf(" FUNC_ARG ")", | 1400 {"function f(a) { return a.func(); }\nf(" FUNC_ARG ")", |
1401 2 * kPointerSize, | 1401 2 * kPointerSize, |
1402 2, | 1402 2, |
1403 16, | 1403 16, |
1404 { | 1404 { |
1405 B(Ldar), A(1, 2), // | 1405 B(Ldar), A(1, 2), // |
1406 B(Star), R(1), // | 1406 B(Star), R(1), // |
1407 B(LoadICSloppy), R(1), U8(0), U8(vector->GetIndex(slot2)), // | 1407 B(LoadICSloppy), R(1), U8(0), U8(vector->GetIndex(slot2)), // |
1408 B(Star), R(0), // | 1408 B(Star), R(0), // |
1409 B(Call), R(0), R(1), U8(0), U8(vector->GetIndex(slot1)), // | 1409 B(Call), R(0), R(1), U8(1), U8(vector->GetIndex(slot1)), // |
1410 B(Return), // | 1410 B(Return), // |
1411 }, | 1411 }, |
1412 1, | 1412 1, |
1413 {"func"}}, | 1413 {"func"}}, |
1414 {"function f(a, b, c) { return a.func(b, c); }\nf(" FUNC_ARG ", 1, 2)", | 1414 {"function f(a, b, c) { return a.func(b, c); }\nf(" FUNC_ARG ", 1, 2)", |
1415 4 * kPointerSize, | 1415 4 * kPointerSize, |
1416 4, | 1416 4, |
1417 24, | 1417 24, |
1418 { | 1418 { |
1419 B(Ldar), A(1, 4), // | 1419 B(Ldar), A(1, 4), // |
1420 B(Star), R(1), // | 1420 B(Star), R(1), // |
1421 B(LoadICSloppy), R(1), U8(0), U8(vector->GetIndex(slot2)), // | 1421 B(LoadICSloppy), R(1), U8(0), U8(vector->GetIndex(slot2)), // |
1422 B(Star), R(0), // | 1422 B(Star), R(0), // |
1423 B(Ldar), A(2, 4), // | 1423 B(Ldar), A(2, 4), // |
1424 B(Star), R(2), // | 1424 B(Star), R(2), // |
1425 B(Ldar), A(3, 4), // | 1425 B(Ldar), A(3, 4), // |
1426 B(Star), R(3), // | 1426 B(Star), R(3), // |
1427 B(Call), R(0), R(1), U8(2), U8(vector->GetIndex(slot1)), // | 1427 B(Call), R(0), R(1), U8(3), U8(vector->GetIndex(slot1)), // |
1428 B(Return) // | 1428 B(Return) // |
1429 }, | 1429 }, |
1430 1, | 1430 1, |
1431 {"func"}}, | 1431 {"func"}}, |
1432 {"function f(a, b) { return a.func(b + b, b); }\nf(" FUNC_ARG ", 1)", | 1432 {"function f(a, b) { return a.func(b + b, b); }\nf(" FUNC_ARG ", 1)", |
1433 4 * kPointerSize, | 1433 4 * kPointerSize, |
1434 3, | 1434 3, |
1435 30, | 1435 30, |
1436 { | 1436 { |
1437 B(Ldar), A(1, 3), // | 1437 B(Ldar), A(1, 3), // |
1438 B(Star), R(1), // | 1438 B(Star), R(1), // |
1439 B(LoadICSloppy), R(1), U8(0), U8(vector->GetIndex(slot2)), // | 1439 B(LoadICSloppy), R(1), U8(0), U8(vector->GetIndex(slot2)), // |
1440 B(Star), R(0), // | 1440 B(Star), R(0), // |
1441 B(Ldar), A(2, 3), // | 1441 B(Ldar), A(2, 3), // |
1442 B(Star), R(3), // | 1442 B(Star), R(3), // |
1443 B(Ldar), A(2, 3), // | 1443 B(Ldar), A(2, 3), // |
1444 B(Add), R(3), // | 1444 B(Add), R(3), // |
1445 B(Star), R(2), // | 1445 B(Star), R(2), // |
1446 B(Ldar), A(2, 3), // | 1446 B(Ldar), A(2, 3), // |
1447 B(Star), R(3), // | 1447 B(Star), R(3), // |
1448 B(Call), R(0), R(1), U8(2), U8(vector->GetIndex(slot1)), // | 1448 B(Call), R(0), R(1), U8(3), U8(vector->GetIndex(slot1)), // |
1449 B(Return), // | 1449 B(Return), // |
1450 }, | 1450 }, |
1451 1, | 1451 1, |
1452 {"func"}}, | 1452 {"func"}}, |
1453 {"function f(a) {\n" | 1453 {"function f(a) {\n" |
1454 " a.func;\n" REPEAT_127( | 1454 " a.func;\n" REPEAT_127( |
1455 SPACE, " a.func;\n") " return a.func(); }\nf(" FUNC_ARG ")", | 1455 SPACE, " a.func;\n") " return a.func(); }\nf(" FUNC_ARG ")", |
1456 2 * kPointerSize, | 1456 2 * kPointerSize, |
1457 2, | 1457 2, |
1458 1046, | 1458 1046, |
1459 { | 1459 { |
1460 B(Ldar), A(1, 2), // | 1460 B(Ldar), A(1, 2), // |
1461 B(Star), R(0), // | 1461 B(Star), R(0), // |
1462 B(LoadICSloppy), R(0), U8(0), U8(wide_idx += 2), // | 1462 B(LoadICSloppy), R(0), U8(0), U8(wide_idx += 2), // |
1463 REPEAT_127(COMMA, // | 1463 REPEAT_127(COMMA, // |
1464 B(Ldar), A(1, 2), // | 1464 B(Ldar), A(1, 2), // |
1465 B(Star), R(0), // | 1465 B(Star), R(0), // |
1466 B(LoadICSloppy), R(0), U8(0), U8((wide_idx += 2))), // | 1466 B(LoadICSloppy), R(0), U8(0), U8((wide_idx += 2))), // |
1467 B(Ldar), | 1467 B(Ldar), A(1, 2), // |
1468 A(1, 2), // | 1468 B(Star), R(1), // |
1469 B(Star), R(1), // | 1469 B(LoadICSloppyWide), R(1), U16(0), U16(wide_idx + 4), // |
1470 B(LoadICSloppyWide), R(1), U16(0), U16(wide_idx + 4), // | 1470 B(Star), R(0), // |
1471 B(Star), R(0), // | 1471 B(CallWide), R16(0), R16(1), U16(1), U16(wide_idx + 2), // |
1472 B(CallWide), R16(0), R16(1), U16(0), U16(wide_idx + 2), // | 1472 B(Return), // |
1473 B(Return), // | |
1474 }, | 1473 }, |
1475 1, | 1474 1, |
1476 {"func"}}, | 1475 {"func"}}, |
1477 }; | 1476 }; |
1478 for (size_t i = 0; i < arraysize(snippets); i++) { | 1477 for (size_t i = 0; i < arraysize(snippets); i++) { |
1479 Handle<BytecodeArray> bytecode_array = | 1478 Handle<BytecodeArray> bytecode_array = |
1480 helper.MakeBytecode(snippets[i].code_snippet, helper.kFunctionName); | 1479 helper.MakeBytecode(snippets[i].code_snippet, helper.kFunctionName); |
1481 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 1480 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
1482 } | 1481 } |
1483 } | 1482 } |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1732 ExpectedSnippet<const char*> snippets[] = { | 1731 ExpectedSnippet<const char*> snippets[] = { |
1733 {"function t() { }\nfunction f() { return t(); }\nf()", | 1732 {"function t() { }\nfunction f() { return t(); }\nf()", |
1734 2 * kPointerSize, | 1733 2 * kPointerSize, |
1735 1, | 1734 1, |
1736 14, | 1735 14, |
1737 { | 1736 { |
1738 B(LdaUndefined), // | 1737 B(LdaUndefined), // |
1739 B(Star), R(1), // | 1738 B(Star), R(1), // |
1740 B(LdaGlobalSloppy), U8(0), U8(vector->GetIndex(slot2)), // | 1739 B(LdaGlobalSloppy), U8(0), U8(vector->GetIndex(slot2)), // |
1741 B(Star), R(0), // | 1740 B(Star), R(0), // |
1742 B(Call), R(0), R(1), U8(0), U8(vector->GetIndex(slot1)), // | 1741 B(Call), R(0), R(1), U8(1), U8(vector->GetIndex(slot1)), // |
1743 B(Return) // | 1742 B(Return) // |
1744 }, | 1743 }, |
1745 1, | 1744 1, |
1746 {"t"}}, | 1745 {"t"}}, |
1747 {"function t(a, b, c) { }\nfunction f() { return t(1, 2, 3); }\nf()", | 1746 {"function t(a, b, c) { }\nfunction f() { return t(1, 2, 3); }\nf()", |
1748 5 * kPointerSize, | 1747 5 * kPointerSize, |
1749 1, | 1748 1, |
1750 26, | 1749 26, |
1751 { | 1750 { |
1752 B(LdaUndefined), // | 1751 B(LdaUndefined), // |
1753 B(Star), R(1), // | 1752 B(Star), R(1), // |
1754 B(LdaGlobalSloppy), U8(0), U8(vector->GetIndex(slot2)), // | 1753 B(LdaGlobalSloppy), U8(0), U8(vector->GetIndex(slot2)), // |
1755 B(Star), R(0), // | 1754 B(Star), R(0), // |
1756 B(LdaSmi8), U8(1), // | 1755 B(LdaSmi8), U8(1), // |
1757 B(Star), R(2), // | 1756 B(Star), R(2), // |
1758 B(LdaSmi8), U8(2), // | 1757 B(LdaSmi8), U8(2), // |
1759 B(Star), R(3), // | 1758 B(Star), R(3), // |
1760 B(LdaSmi8), U8(3), // | 1759 B(LdaSmi8), U8(3), // |
1761 B(Star), R(4), // | 1760 B(Star), R(4), // |
1762 B(Call), R(0), R(1), U8(3), U8(vector->GetIndex(slot1)), // | 1761 B(Call), R(0), R(1), U8(4), U8(vector->GetIndex(slot1)), // |
1763 B(Return) // | 1762 B(Return) // |
1764 }, | 1763 }, |
1765 1, | 1764 1, |
1766 {"t"}}, | 1765 {"t"}}, |
1767 }; | 1766 }; |
1768 | 1767 |
1769 size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]); | 1768 size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]); |
1770 for (size_t i = 0; i < num_snippets; i++) { | 1769 for (size_t i = 0; i < num_snippets; i++) { |
1771 Handle<BytecodeArray> bytecode_array = | 1770 Handle<BytecodeArray> bytecode_array = |
1772 helper.MakeBytecode(snippets[i].code_snippet, "f"); | 1771 helper.MakeBytecode(snippets[i].code_snippet, "f"); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1821 "function f() { return %spread_iterable([1]) }\nf()", | 1820 "function f() { return %spread_iterable([1]) }\nf()", |
1822 2 * kPointerSize, | 1821 2 * kPointerSize, |
1823 1, | 1822 1, |
1824 15, | 1823 15, |
1825 { | 1824 { |
1826 B(LdaUndefined), // | 1825 B(LdaUndefined), // |
1827 B(Star), R(0), // | 1826 B(Star), R(0), // |
1828 B(CreateArrayLiteral), U8(0), U8(0), U8(3), // | 1827 B(CreateArrayLiteral), U8(0), U8(0), U8(3), // |
1829 B(Star), R(1), // | 1828 B(Star), R(1), // |
1830 B(CallJSRuntime), U16(Context::SPREAD_ITERABLE_INDEX), R(0), // | 1829 B(CallJSRuntime), U16(Context::SPREAD_ITERABLE_INDEX), R(0), // |
1831 U8(1), // | 1830 U8(2), // |
1832 B(Return), // | 1831 B(Return), // |
1833 }, | 1832 }, |
1834 1, | 1833 1, |
1835 {InstanceType::FIXED_ARRAY_TYPE}, | 1834 {InstanceType::FIXED_ARRAY_TYPE}, |
1836 }, | 1835 }, |
1837 }; | 1836 }; |
1838 | 1837 |
1839 for (size_t i = 0; i < arraysize(snippets); i++) { | 1838 for (size_t i = 0; i < arraysize(snippets); i++) { |
1840 Handle<BytecodeArray> bytecode_array = | 1839 Handle<BytecodeArray> bytecode_array = |
1841 helper.MakeBytecode(snippets[i].code_snippet, "f"); | 1840 helper.MakeBytecode(snippets[i].code_snippet, "f"); |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2175 B(LdaConstant), U8(0), // | 2174 B(LdaConstant), U8(0), // |
2176 B(Star), R(1), // | 2175 B(Star), R(1), // |
2177 B(LdaZero), // | 2176 B(LdaZero), // |
2178 B(Star), R(2), // | 2177 B(Star), R(2), // |
2179 B(CallRuntime), U16(Runtime::kDeclareGlobals), R(1), U8(2), // | 2178 B(CallRuntime), U16(Runtime::kDeclareGlobals), R(1), U8(2), // |
2180 B(LdaUndefined), // | 2179 B(LdaUndefined), // |
2181 B(Star), R(2), // | 2180 B(Star), R(2), // |
2182 B(LdaGlobalSloppy), U8(1), // | 2181 B(LdaGlobalSloppy), U8(1), // |
2183 U8(load_vector->GetIndex(load_slot_1)), // | 2182 U8(load_vector->GetIndex(load_slot_1)), // |
2184 B(Star), R(1), // | 2183 B(Star), R(1), // |
2185 B(Call), R(1), R(2), U8(0), // | 2184 B(Call), R(1), R(2), U8(1), // |
2186 U8(load_vector->GetIndex(call_slot_1)), // | 2185 U8(load_vector->GetIndex(call_slot_1)), // |
2187 B(Star), R(0), // | 2186 B(Star), R(0), // |
2188 B(Return) // | 2187 B(Return) // |
2189 }, | 2188 }, |
2190 2, | 2189 2, |
2191 {InstanceType::FIXED_ARRAY_TYPE, | 2190 {InstanceType::FIXED_ARRAY_TYPE, |
2192 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, | 2191 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, |
2193 }; | 2192 }; |
2194 | 2193 |
2195 for (size_t i = 0; i < arraysize(snippets); i++) { | 2194 for (size_t i = 0; i < arraysize(snippets); i++) { |
(...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3536 {InstanceType::SHARED_FUNCTION_INFO_TYPE}}, | 3535 {InstanceType::SHARED_FUNCTION_INFO_TYPE}}, |
3537 {"return (function(){ })()", | 3536 {"return (function(){ })()", |
3538 2 * kPointerSize, | 3537 2 * kPointerSize, |
3539 1, | 3538 1, |
3540 14, | 3539 14, |
3541 { | 3540 { |
3542 B(LdaUndefined), // | 3541 B(LdaUndefined), // |
3543 B(Star), R(1), // | 3542 B(Star), R(1), // |
3544 B(CreateClosure), U8(0), U8(0), // | 3543 B(CreateClosure), U8(0), U8(0), // |
3545 B(Star), R(0), // | 3544 B(Star), R(0), // |
3546 B(Call), R(0), R(1), U8(0), U8(vector->GetIndex(slot)), // | 3545 B(Call), R(0), R(1), U8(1), U8(vector->GetIndex(slot)), // |
3547 B(Return) // | 3546 B(Return) // |
3548 }, | 3547 }, |
3549 1, | 3548 1, |
3550 {InstanceType::SHARED_FUNCTION_INFO_TYPE}}, | 3549 {InstanceType::SHARED_FUNCTION_INFO_TYPE}}, |
3551 {"return (function(x){ return x; })(1)", | 3550 {"return (function(x){ return x; })(1)", |
3552 3 * kPointerSize, | 3551 3 * kPointerSize, |
3553 1, | 3552 1, |
3554 18, | 3553 18, |
3555 { | 3554 { |
3556 B(LdaUndefined), // | 3555 B(LdaUndefined), // |
3557 B(Star), R(1), // | 3556 B(Star), R(1), // |
3558 B(CreateClosure), U8(0), U8(0), // | 3557 B(CreateClosure), U8(0), U8(0), // |
3559 B(Star), R(0), // | 3558 B(Star), R(0), // |
3560 B(LdaSmi8), U8(1), // | 3559 B(LdaSmi8), U8(1), // |
3561 B(Star), R(2), // | 3560 B(Star), R(2), // |
3562 B(Call), R(0), R(1), U8(1), U8(vector->GetIndex(slot)), // | 3561 B(Call), R(0), R(1), U8(2), U8(vector->GetIndex(slot)), // |
3563 B(Return) // | 3562 B(Return) // |
3564 }, | 3563 }, |
3565 1, | 3564 1, |
3566 {InstanceType::SHARED_FUNCTION_INFO_TYPE}}, | 3565 {InstanceType::SHARED_FUNCTION_INFO_TYPE}}, |
3567 }; | 3566 }; |
3568 | 3567 |
3569 for (size_t i = 0; i < arraysize(snippets); i++) { | 3568 for (size_t i = 0; i < arraysize(snippets); i++) { |
3570 Handle<BytecodeArray> bytecode_array = | 3569 Handle<BytecodeArray> bytecode_array = |
3571 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 3570 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
3572 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 3571 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3612 3 * kPointerSize, | 3611 3 * kPointerSize, |
3613 1, | 3612 1, |
3614 22, | 3613 22, |
3615 { | 3614 { |
3616 B(CreateRegExpLiteral), U8(0), U8(0), U8(0), // | 3615 B(CreateRegExpLiteral), U8(0), U8(0), U8(0), // |
3617 B(Star), R(1), // | 3616 B(Star), R(1), // |
3618 B(LoadICSloppy), R(1), U8(1), U8(vector->GetIndex(slot2)), // | 3617 B(LoadICSloppy), R(1), U8(1), U8(vector->GetIndex(slot2)), // |
3619 B(Star), R(0), // | 3618 B(Star), R(0), // |
3620 B(LdaConstant), U8(2), // | 3619 B(LdaConstant), U8(2), // |
3621 B(Star), R(2), // | 3620 B(Star), R(2), // |
3622 B(Call), R(0), R(1), U8(1), U8(vector->GetIndex(slot1)), // | 3621 B(Call), R(0), R(1), U8(2), U8(vector->GetIndex(slot1)), // |
3623 B(Return), // | 3622 B(Return), // |
3624 }, | 3623 }, |
3625 3, | 3624 3, |
3626 {"ab+d", "exec", "abdd"}}, | 3625 {"ab+d", "exec", "abdd"}}, |
3627 }; | 3626 }; |
3628 | 3627 |
3629 for (size_t i = 0; i < arraysize(snippets); i++) { | 3628 for (size_t i = 0; i < arraysize(snippets); i++) { |
3630 Handle<BytecodeArray> bytecode_array = | 3629 Handle<BytecodeArray> bytecode_array = |
3631 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 3630 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
3632 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 3631 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4714 1, | 4713 1, |
4715 24, | 4714 24, |
4716 { | 4715 { |
4717 B(CallRuntime), U16(Runtime::kNewFunctionContext), // | 4716 B(CallRuntime), U16(Runtime::kNewFunctionContext), // |
4718 R(closure), U8(1), // | 4717 R(closure), U8(1), // |
4719 B(PushContext), R(0), // | 4718 B(PushContext), R(0), // |
4720 B(LdaUndefined), // | 4719 B(LdaUndefined), // |
4721 B(Star), R(2), // | 4720 B(Star), R(2), // |
4722 B(CreateClosure), U8(0), U8(0), // | 4721 B(CreateClosure), U8(0), U8(0), // |
4723 B(Star), R(1), // | 4722 B(Star), R(1), // |
4724 B(Call), R(1), R(2), U8(0), U8(vector->GetIndex(slot)), // | 4723 B(Call), R(1), R(2), U8(1), U8(vector->GetIndex(slot)), // |
4725 B(LdaContextSlot), R(context), U8(first_context_slot), // | 4724 B(LdaContextSlot), R(context), U8(first_context_slot), // |
4726 B(Return), // | 4725 B(Return), // |
4727 }, | 4726 }, |
4728 1, | 4727 1, |
4729 {InstanceType::SHARED_FUNCTION_INFO_TYPE}}, | 4728 {InstanceType::SHARED_FUNCTION_INFO_TYPE}}, |
4730 {"'use strict'; let a = 1; { let b = 2; return function() { a + b; }; }", | 4729 {"'use strict'; let a = 1; { let b = 2; return function() { a + b; }; }", |
4731 4 * kPointerSize, | 4730 4 * kPointerSize, |
4732 1, | 4731 1, |
4733 46, | 4732 46, |
4734 { | 4733 { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4774 B(StaContextSlot), R(context), U8(first_context_slot + 1), // | 4773 B(StaContextSlot), R(context), U8(first_context_slot + 1), // |
4775 B(Ldar), R(new_target), // | 4774 B(Ldar), R(new_target), // |
4776 B(StaContextSlot), R(context), U8(first_context_slot + 2), // | 4775 B(StaContextSlot), R(context), U8(first_context_slot + 2), // |
4777 REPEAT_249(COMMA, // | 4776 REPEAT_249(COMMA, // |
4778 B(LdaZero), // | 4777 B(LdaZero), // |
4779 B(StaContextSlot), R(context), U8(wide_slot++)), // | 4778 B(StaContextSlot), R(context), U8(wide_slot++)), // |
4780 B(LdaUndefined), // | 4779 B(LdaUndefined), // |
4781 B(Star), R(2), // | 4780 B(Star), R(2), // |
4782 B(LdaGlobalStrict), U8(0), U8(1), // | 4781 B(LdaGlobalStrict), U8(0), U8(1), // |
4783 B(Star), R(1), // | 4782 B(Star), R(1), // |
4784 B(Call), R(1), R(2), U8(0), U8(0), // | 4783 B(Call), R(1), R(2), U8(1), U8(0), // |
4785 B(LdaSmi8), U8(100), // | 4784 B(LdaSmi8), U8(100), // |
4786 B(StaContextSlotWide), R(context), U16(256), // | 4785 B(StaContextSlotWide), R(context), U16(256), // |
4787 B(LdaContextSlotWide), R(context), U16(256), // | 4786 B(LdaContextSlotWide), R(context), U16(256), // |
4788 B(Return), // | 4787 B(Return), // |
4789 }, | 4788 }, |
4790 1, | 4789 1, |
4791 {InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, | 4790 {InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, |
4792 }; | 4791 }; |
4793 | 4792 |
4794 for (size_t i = 0; i < arraysize(snippets); i++) { | 4793 for (size_t i = 0; i < arraysize(snippets); i++) { |
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5800 {"for (var p of [0, 1, 2]) {}", | 5799 {"for (var p of [0, 1, 2]) {}", |
5801 7 * kPointerSize, | 5800 7 * kPointerSize, |
5802 1, | 5801 1, |
5803 82, | 5802 82, |
5804 { | 5803 { |
5805 B(CreateArrayLiteral), U8(0), U8(0), U8(array_literal_flags), // | 5804 B(CreateArrayLiteral), U8(0), U8(0), U8(array_literal_flags), // |
5806 B(Star), R(5), // | 5805 B(Star), R(5), // |
5807 B(LdaConstant), U8(1), // | 5806 B(LdaConstant), U8(1), // |
5808 B(KeyedLoadICSloppy), R(5), U8(vector->GetIndex(slot2)), // | 5807 B(KeyedLoadICSloppy), R(5), U8(vector->GetIndex(slot2)), // |
5809 B(Star), R(4), // | 5808 B(Star), R(4), // |
5810 B(Call), R(4), R(5), U8(0), U8(vector->GetIndex(slot1)), // | 5809 B(Call), R(4), R(5), U8(1), U8(vector->GetIndex(slot1)), // |
5811 B(Star), R(1), // | 5810 B(Star), R(1), // |
5812 B(Ldar), R(1), // | 5811 B(Ldar), R(1), // |
5813 B(Star), R(6), // | 5812 B(Star), R(6), // |
5814 B(LoadICSloppy), R(6), U8(2), U8(vector->GetIndex(slot4)), // | 5813 B(LoadICSloppy), R(6), U8(2), U8(vector->GetIndex(slot4)), // |
5815 B(Star), R(5), // | 5814 B(Star), R(5), // |
5816 B(Call), R(5), R(6), U8(0), U8(vector->GetIndex(slot3)), // | 5815 B(Call), R(5), R(6), U8(1), U8(vector->GetIndex(slot3)), // |
5817 B(Star), R(2), // | 5816 B(Star), R(2), // |
5818 B(Star), R(4), // | 5817 B(Star), R(4), // |
5819 B(CallRuntime), U16(Runtime::kInlineIsJSReceiver), R(4), U8(1), // | 5818 B(CallRuntime), U16(Runtime::kInlineIsJSReceiver), R(4), U8(1), // |
5820 B(LogicalNot), // | 5819 B(LogicalNot), // |
5821 B(JumpIfFalse), U8(11), // | 5820 B(JumpIfFalse), U8(11), // |
5822 B(Ldar), R(2), // | 5821 B(Ldar), R(2), // |
5823 B(Star), R(4), // | 5822 B(Star), R(4), // |
5824 B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), // | 5823 B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), // |
5825 R(4), U8(1), // | 5824 R(4), U8(1), // |
5826 B(Ldar), R(2), // | 5825 B(Ldar), R(2), // |
(...skipping 19 matching lines...) Expand all Loading... |
5846 8 * kPointerSize, | 5845 8 * kPointerSize, |
5847 1, | 5846 1, |
5848 81, | 5847 81, |
5849 { | 5848 { |
5850 B(LdaConstant), U8(0), // | 5849 B(LdaConstant), U8(0), // |
5851 B(Star), R(3), // | 5850 B(Star), R(3), // |
5852 B(Star), R(6), // | 5851 B(Star), R(6), // |
5853 B(LdaConstant), U8(1), // | 5852 B(LdaConstant), U8(1), // |
5854 B(KeyedLoadICSloppy), R(6), U8(vector->GetIndex(slot2)), // | 5853 B(KeyedLoadICSloppy), R(6), U8(vector->GetIndex(slot2)), // |
5855 B(Star), R(5), // | 5854 B(Star), R(5), // |
5856 B(Call), R(5), R(6), U8(0), U8(vector->GetIndex(slot1)), // | 5855 B(Call), R(5), R(6), U8(1), U8(vector->GetIndex(slot1)), // |
5857 B(Star), R(1), // | 5856 B(Star), R(1), // |
5858 B(Ldar), R(1), // | 5857 B(Ldar), R(1), // |
5859 B(Star), R(7), // | 5858 B(Star), R(7), // |
5860 B(LoadICSloppy), R(7), U8(2), U8(vector->GetIndex(slot4)), // | 5859 B(LoadICSloppy), R(7), U8(2), U8(vector->GetIndex(slot4)), // |
5861 B(Star), R(6), // | 5860 B(Star), R(6), // |
5862 B(Call), R(6), R(7), U8(0), U8(vector->GetIndex(slot3)), // | 5861 B(Call), R(6), R(7), U8(1), U8(vector->GetIndex(slot3)), // |
5863 B(Star), R(2), // | 5862 B(Star), R(2), // |
5864 B(Star), R(5), // | 5863 B(Star), R(5), // |
5865 B(CallRuntime), U16(Runtime::kInlineIsJSReceiver), R(5), U8(1), // | 5864 B(CallRuntime), U16(Runtime::kInlineIsJSReceiver), R(5), U8(1), // |
5866 B(LogicalNot), // | 5865 B(LogicalNot), // |
5867 B(JumpIfFalse), U8(11), // | 5866 B(JumpIfFalse), U8(11), // |
5868 B(Ldar), R(2), // | 5867 B(Ldar), R(2), // |
5869 B(Star), R(5), // | 5868 B(Star), R(5), // |
5870 B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), // | 5869 B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), // |
5871 R(5), U8(1), // | 5870 R(5), U8(1), // |
5872 B(Ldar), R(2), // | 5871 B(Ldar), R(2), // |
(...skipping 21 matching lines...) Expand all Loading... |
5894 "}", | 5893 "}", |
5895 7 * kPointerSize, | 5894 7 * kPointerSize, |
5896 1, | 5895 1, |
5897 104, | 5896 104, |
5898 { | 5897 { |
5899 B(CreateArrayLiteral), U8(0), U8(0), U8(array_literal_flags), // | 5898 B(CreateArrayLiteral), U8(0), U8(0), U8(array_literal_flags), // |
5900 B(Star), R(5), // | 5899 B(Star), R(5), // |
5901 B(LdaConstant), U8(1), // | 5900 B(LdaConstant), U8(1), // |
5902 B(KeyedLoadICSloppy), R(5), U8(vector->GetIndex(slot2)), // | 5901 B(KeyedLoadICSloppy), R(5), U8(vector->GetIndex(slot2)), // |
5903 B(Star), R(4), // | 5902 B(Star), R(4), // |
5904 B(Call), R(4), R(5), U8(0), U8(vector->GetIndex(slot1)), // | 5903 B(Call), R(4), R(5), U8(1), U8(vector->GetIndex(slot1)), // |
5905 B(Star), R(1), // | 5904 B(Star), R(1), // |
5906 B(Ldar), R(1), // | 5905 B(Ldar), R(1), // |
5907 B(Star), R(6), // | 5906 B(Star), R(6), // |
5908 B(LoadICSloppy), R(6), U8(2), U8(vector->GetIndex(slot4)), // | 5907 B(LoadICSloppy), R(6), U8(2), U8(vector->GetIndex(slot4)), // |
5909 B(Star), R(5), // | 5908 B(Star), R(5), // |
5910 B(Call), R(5), R(6), U8(0), U8(vector->GetIndex(slot3)), // | 5909 B(Call), R(5), R(6), U8(1), U8(vector->GetIndex(slot3)), // |
5911 B(Star), R(2), // | 5910 B(Star), R(2), // |
5912 B(Star), R(4), // | 5911 B(Star), R(4), // |
5913 B(CallRuntime), U16(Runtime::kInlineIsJSReceiver), R(4), U8(1), // | 5912 B(CallRuntime), U16(Runtime::kInlineIsJSReceiver), R(4), U8(1), // |
5914 B(LogicalNot), // | 5913 B(LogicalNot), // |
5915 B(JumpIfFalse), U8(11), // | 5914 B(JumpIfFalse), U8(11), // |
5916 B(Ldar), R(2), // | 5915 B(Ldar), R(2), // |
5917 B(Star), R(4), // | 5916 B(Star), R(4), // |
5918 B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), // | 5917 B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), // |
5919 R(4), U8(1), // | 5918 R(4), U8(1), // |
5920 B(Ldar), R(2), // | 5919 B(Ldar), R(2), // |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5953 101, | 5952 101, |
5954 { | 5953 { |
5955 B(CreateObjectLiteral), U8(0), U8(0), U8(object_literal_flags), // | 5954 B(CreateObjectLiteral), U8(0), U8(0), U8(object_literal_flags), // |
5956 B(Star), R(3), // | 5955 B(Star), R(3), // |
5957 B(Star), R(2), // | 5956 B(Star), R(2), // |
5958 B(CreateArrayLiteral), U8(1), U8(1), U8(array_literal_flags), // | 5957 B(CreateArrayLiteral), U8(1), U8(1), U8(array_literal_flags), // |
5959 B(Star), R(4), // | 5958 B(Star), R(4), // |
5960 B(LdaConstant), U8(2), // | 5959 B(LdaConstant), U8(2), // |
5961 B(KeyedLoadICSloppy), R(4), U8(vector->GetIndex(slot2)), // | 5960 B(KeyedLoadICSloppy), R(4), U8(vector->GetIndex(slot2)), // |
5962 B(Star), R(3), // | 5961 B(Star), R(3), // |
5963 B(Call), R(3), R(4), U8(0), U8(vector->GetIndex(slot1)), // | 5962 B(Call), R(3), R(4), U8(1), U8(vector->GetIndex(slot1)), // |
5964 B(Star), R(0), // | 5963 B(Star), R(0), // |
5965 B(Ldar), R(0), // | 5964 B(Ldar), R(0), // |
5966 B(Star), R(5), // | 5965 B(Star), R(5), // |
5967 B(LoadICSloppy), R(5), U8(3), U8(vector->GetIndex(slot4)), // | 5966 B(LoadICSloppy), R(5), U8(3), U8(vector->GetIndex(slot4)), // |
5968 B(Star), R(4), // | 5967 B(Star), R(4), // |
5969 B(Call), R(4), R(5), U8(0), U8(vector->GetIndex(slot3)), // | 5968 B(Call), R(4), R(5), U8(1), U8(vector->GetIndex(slot3)), // |
5970 B(Star), R(1), // | 5969 B(Star), R(1), // |
5971 B(Star), R(3), // | 5970 B(Star), R(3), // |
5972 B(CallRuntime), U16(Runtime::kInlineIsJSReceiver), R(3), U8(1), // | 5971 B(CallRuntime), U16(Runtime::kInlineIsJSReceiver), R(3), U8(1), // |
5973 B(LogicalNot), // | 5972 B(LogicalNot), // |
5974 B(JumpIfFalse), U8(11), // | 5973 B(JumpIfFalse), U8(11), // |
5975 B(Ldar), R(1), // | 5974 B(Ldar), R(1), // |
5976 B(Star), R(3), // | 5975 B(Star), R(3), // |
5977 B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), // | 5976 B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), // |
5978 R(3), U8(1), // | 5977 R(3), U8(1), // |
5979 B(Ldar), R(1), // | 5978 B(Ldar), R(1), // |
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6857 B(Mov), R(1), R(4), // | 6856 B(Mov), R(1), R(4), // |
6858 B(Mov), R(3), R(5), // | 6857 B(Mov), R(3), R(5), // |
6859 B(Mov), R(closure), R(6), // | 6858 B(Mov), R(closure), R(6), // |
6860 B(LdaZero), // | 6859 B(LdaZero), // |
6861 B(Star), R(7), // | 6860 B(Star), R(7), // |
6862 B(LdaSmi8), U8(10), // | 6861 B(LdaSmi8), U8(10), // |
6863 B(Star), R(8), // | 6862 B(Star), R(8), // |
6864 B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), // | 6863 B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), // |
6865 U8(5), // | 6864 U8(5), // |
6866 B(Star), R(1), // | 6865 B(Star), R(1), // |
6867 B(Call), R(1), R(2), U8(1), U8(0), // | 6866 B(Call), R(1), R(2), U8(2), U8(0), // |
6868 B(Return), // | 6867 B(Return), // |
6869 }, | 6868 }, |
6870 2, | 6869 2, |
6871 {"eval", "1;"}}, | 6870 {"eval", "1;"}}, |
6872 }; | 6871 }; |
6873 | 6872 |
6874 for (size_t i = 0; i < arraysize(snippets); i++) { | 6873 for (size_t i = 0; i < arraysize(snippets); i++) { |
6875 Handle<BytecodeArray> bytecode_array = | 6874 Handle<BytecodeArray> bytecode_array = |
6876 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 6875 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
6877 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 6876 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6913 B(Mov), R(1), R(4), // | 6912 B(Mov), R(1), R(4), // |
6914 B(Mov), R(3), R(5), // | 6913 B(Mov), R(3), R(5), // |
6915 B(Mov), R(closure), R(6), // | 6914 B(Mov), R(closure), R(6), // |
6916 B(LdaZero), // | 6915 B(LdaZero), // |
6917 B(Star), R(7), // | 6916 B(Star), R(7), // |
6918 B(LdaSmi8), U8(10), // | 6917 B(LdaSmi8), U8(10), // |
6919 B(Star), R(8), // | 6918 B(Star), R(8), // |
6920 B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), // | 6919 B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), // |
6921 U8(5), // | 6920 U8(5), // |
6922 B(Star), R(1), // | 6921 B(Star), R(1), // |
6923 B(Call), R(1), R(2), U8(1), U8(0), // | 6922 B(Call), R(1), R(2), U8(2), U8(0), // |
6924 B(LdaLookupSlot), U8(2), // | 6923 B(LdaLookupSlot), U8(2), // |
6925 B(Return), // | 6924 B(Return), // |
6926 }, | 6925 }, |
6927 3, | 6926 3, |
6928 {"eval", "var x = 10;", "x"}}, | 6927 {"eval", "var x = 10;", "x"}}, |
6929 {"eval('var x = 10;'); return typeof x;", | 6928 {"eval('var x = 10;'); return typeof x;", |
6930 9 * kPointerSize, | 6929 9 * kPointerSize, |
6931 1, | 6930 1, |
6932 70, | 6931 70, |
6933 { | 6932 { |
(...skipping 16 matching lines...) Expand all Loading... |
6950 B(Mov), R(1), R(4), // | 6949 B(Mov), R(1), R(4), // |
6951 B(Mov), R(3), R(5), // | 6950 B(Mov), R(3), R(5), // |
6952 B(Mov), R(closure), R(6), // | 6951 B(Mov), R(closure), R(6), // |
6953 B(LdaZero), // | 6952 B(LdaZero), // |
6954 B(Star), R(7), // | 6953 B(Star), R(7), // |
6955 B(LdaSmi8), U8(10), // | 6954 B(LdaSmi8), U8(10), // |
6956 B(Star), R(8), // | 6955 B(Star), R(8), // |
6957 B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), // | 6956 B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), // |
6958 U8(5), // | 6957 U8(5), // |
6959 B(Star), R(1), // | 6958 B(Star), R(1), // |
6960 B(Call), R(1), R(2), U8(1), U8(0), // | 6959 B(Call), R(1), R(2), U8(2), U8(0), // |
6961 B(LdaLookupSlotInsideTypeof), U8(2), // | 6960 B(LdaLookupSlotInsideTypeof), U8(2), // |
6962 B(TypeOf), // | 6961 B(TypeOf), // |
6963 B(Return), // | 6962 B(Return), // |
6964 }, | 6963 }, |
6965 3, | 6964 3, |
6966 {"eval", "var x = 10;", "x"}}, | 6965 {"eval", "var x = 10;", "x"}}, |
6967 {"x = 20; return eval('');", | 6966 {"x = 20; return eval('');", |
6968 9 * kPointerSize, | 6967 9 * kPointerSize, |
6969 1, | 6968 1, |
6970 71, | 6969 71, |
(...skipping 19 matching lines...) Expand all Loading... |
6990 B(Mov), R(1), R(4), // | 6989 B(Mov), R(1), R(4), // |
6991 B(Mov), R(3), R(5), // | 6990 B(Mov), R(3), R(5), // |
6992 B(Mov), R(closure), R(6), // | 6991 B(Mov), R(closure), R(6), // |
6993 B(LdaZero), // | 6992 B(LdaZero), // |
6994 B(Star), R(7), // | 6993 B(Star), R(7), // |
6995 B(LdaSmi8), U8(10), // | 6994 B(LdaSmi8), U8(10), // |
6996 B(Star), R(8), // | 6995 B(Star), R(8), // |
6997 B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), // | 6996 B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), // |
6998 U8(5), // | 6997 U8(5), // |
6999 B(Star), R(1), // | 6998 B(Star), R(1), // |
7000 B(Call), R(1), R(2), U8(1), U8(0), // | 6999 B(Call), R(1), R(2), U8(2), U8(0), // |
7001 B(Return), // | 7000 B(Return), // |
7002 }, | 7001 }, |
7003 3, | 7002 3, |
7004 {"x", "eval", ""}}, | 7003 {"x", "eval", ""}}, |
7005 }; | 7004 }; |
7006 | 7005 |
7007 for (size_t i = 0; i < arraysize(snippets); i++) { | 7006 for (size_t i = 0; i < arraysize(snippets); i++) { |
7008 Handle<BytecodeArray> bytecode_array = | 7007 Handle<BytecodeArray> bytecode_array = |
7009 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 7008 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
7010 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 7009 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7056 B(Mov), R(1), R(4), // | 7055 B(Mov), R(1), R(4), // |
7057 B(Mov), R(3), R(5), // | 7056 B(Mov), R(3), R(5), // |
7058 B(Mov), R(closure), R(6), // | 7057 B(Mov), R(closure), R(6), // |
7059 B(LdaZero), // | 7058 B(LdaZero), // |
7060 B(Star), R(7), // | 7059 B(Star), R(7), // |
7061 B(LdaSmi8), U8(10), // | 7060 B(LdaSmi8), U8(10), // |
7062 B(Star), R(8), // | 7061 B(Star), R(8), // |
7063 B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), // | 7062 B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), // |
7064 U8(5), // | 7063 U8(5), // |
7065 B(Star), R(1), // | 7064 B(Star), R(1), // |
7066 B(Call), R(1), R(2), U8(1), U8(0), // | 7065 B(Call), R(1), R(2), U8(2), U8(0), // |
7067 B(Mov), R(context), R(3), // | 7066 B(Mov), R(context), R(3), // |
7068 B(LdaConstant), U8(1), // | 7067 B(LdaConstant), U8(1), // |
7069 B(Star), R(4), // | 7068 B(Star), R(4), // |
7070 B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlot), // | 7069 B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlot), // |
7071 R(3), U8(2), R(1), // | 7070 R(3), U8(2), R(1), // |
7072 B(Call), R(1), R(2), U8(0), U8(vector->GetIndex(slot2)), // | 7071 B(Call), R(1), R(2), U8(1), U8(vector->GetIndex(slot2)), // |
7073 B(Return), // | 7072 B(Return), // |
7074 }, | 7073 }, |
7075 4, | 7074 4, |
7076 {InstanceType::SHARED_FUNCTION_INFO_TYPE, | 7075 {InstanceType::SHARED_FUNCTION_INFO_TYPE, |
7077 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, | 7076 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, |
7078 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, | 7077 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, |
7079 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, | 7078 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, |
7080 }; | 7079 }; |
7081 | 7080 |
7082 for (size_t i = 0; i < arraysize(snippets); i++) { | 7081 for (size_t i = 0; i < arraysize(snippets); i++) { |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7647 for (size_t i = 0; i < arraysize(snippets); i++) { | 7646 for (size_t i = 0; i < arraysize(snippets); i++) { |
7648 Handle<BytecodeArray> bytecode_array = | 7647 Handle<BytecodeArray> bytecode_array = |
7649 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 7648 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
7650 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 7649 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
7651 } | 7650 } |
7652 } | 7651 } |
7653 | 7652 |
7654 } // namespace interpreter | 7653 } // namespace interpreter |
7655 } // namespace internal | 7654 } // namespace internal |
7656 } // namespace v8 | 7655 } // namespace v8 |
OLD | NEW |