| 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 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1590 {"function f(a) { return a.func(); }\nf(" FUNC_ARG ")", | 1590 {"function f(a) { return a.func(); }\nf(" FUNC_ARG ")", |
| 1591 2 * kPointerSize, | 1591 2 * kPointerSize, |
| 1592 2, | 1592 2, |
| 1593 17, | 1593 17, |
| 1594 { | 1594 { |
| 1595 B(StackCheck), // | 1595 B(StackCheck), // |
| 1596 B(Ldar), A(1, 2), // | 1596 B(Ldar), A(1, 2), // |
| 1597 B(Star), R(1), // | 1597 B(Star), R(1), // |
| 1598 B(LoadICSloppy), R(1), U8(0), U8(vector->GetIndex(slot2)), // | 1598 B(LoadICSloppy), R(1), U8(0), U8(vector->GetIndex(slot2)), // |
| 1599 B(Star), R(0), // | 1599 B(Star), R(0), // |
| 1600 B(Call), R(0), R(1), U8(1), U8(vector->GetIndex(slot1)), // | 1600 B(CallIC), R(0), R(1), U8(1), U8(vector->GetIndex(slot1)), // |
| 1601 B(Return), // | 1601 B(Return), // |
| 1602 }, | 1602 }, |
| 1603 1, | 1603 1, |
| 1604 {"func"}}, | 1604 {"func"}}, |
| 1605 {"function f(a, b, c) { return a.func(b, c); }\nf(" FUNC_ARG ", 1, 2)", | 1605 {"function f(a, b, c) { return a.func(b, c); }\nf(" FUNC_ARG ", 1, 2)", |
| 1606 4 * kPointerSize, | 1606 4 * kPointerSize, |
| 1607 4, | 1607 4, |
| 1608 25, | 1608 25, |
| 1609 { | 1609 { |
| 1610 B(StackCheck), // | 1610 B(StackCheck), // |
| 1611 B(Ldar), A(1, 4), // | 1611 B(Ldar), A(1, 4), // |
| 1612 B(Star), R(1), // | 1612 B(Star), R(1), // |
| 1613 B(LoadICSloppy), R(1), U8(0), U8(vector->GetIndex(slot2)), // | 1613 B(LoadICSloppy), R(1), U8(0), U8(vector->GetIndex(slot2)), // |
| 1614 B(Star), R(0), // | 1614 B(Star), R(0), // |
| 1615 B(Ldar), A(2, 4), // | 1615 B(Ldar), A(2, 4), // |
| 1616 B(Star), R(2), // | 1616 B(Star), R(2), // |
| 1617 B(Ldar), A(3, 4), // | 1617 B(Ldar), A(3, 4), // |
| 1618 B(Star), R(3), // | 1618 B(Star), R(3), // |
| 1619 B(Call), R(0), R(1), U8(3), U8(vector->GetIndex(slot1)), // | 1619 B(CallIC), R(0), R(1), U8(3), U8(vector->GetIndex(slot1)), // |
| 1620 B(Return) // | 1620 B(Return) // |
| 1621 }, | 1621 }, |
| 1622 1, | 1622 1, |
| 1623 {"func"}}, | 1623 {"func"}}, |
| 1624 {"function f(a, b) { return a.func(b + b, b); }\nf(" FUNC_ARG ", 1)", | 1624 {"function f(a, b) { return a.func(b + b, b); }\nf(" FUNC_ARG ", 1)", |
| 1625 4 * kPointerSize, | 1625 4 * kPointerSize, |
| 1626 3, | 1626 3, |
| 1627 31, | 1627 31, |
| 1628 { | 1628 { |
| 1629 B(StackCheck), // | 1629 B(StackCheck), // |
| 1630 B(Ldar), A(1, 3), // | 1630 B(Ldar), A(1, 3), // |
| 1631 B(Star), R(1), // | 1631 B(Star), R(1), // |
| 1632 B(LoadICSloppy), R(1), U8(0), U8(vector->GetIndex(slot2)), // | 1632 B(LoadICSloppy), R(1), U8(0), U8(vector->GetIndex(slot2)), // |
| 1633 B(Star), R(0), // | 1633 B(Star), R(0), // |
| 1634 B(Ldar), A(2, 3), // | 1634 B(Ldar), A(2, 3), // |
| 1635 B(Star), R(3), // | 1635 B(Star), R(3), // |
| 1636 B(Ldar), A(2, 3), // | 1636 B(Ldar), A(2, 3), // |
| 1637 B(Add), R(3), // | 1637 B(Add), R(3), // |
| 1638 B(Star), R(2), // | 1638 B(Star), R(2), // |
| 1639 B(Ldar), A(2, 3), // | 1639 B(Ldar), A(2, 3), // |
| 1640 B(Star), R(3), // | 1640 B(Star), R(3), // |
| 1641 B(Call), R(0), R(1), U8(3), U8(vector->GetIndex(slot1)), // | 1641 B(CallIC), R(0), R(1), U8(3), U8(vector->GetIndex(slot1)), // |
| 1642 B(Return), // | 1642 B(Return), // |
| 1643 }, | 1643 }, |
| 1644 1, | 1644 1, |
| 1645 {"func"}}, | 1645 {"func"}}, |
| 1646 {"function f(a) {\n" | 1646 {"function f(a) {\n" |
| 1647 " a.func;\n" REPEAT_127( | 1647 " a.func;\n" REPEAT_127( |
| 1648 SPACE, " a.func;\n") " return a.func(); }\nf(" FUNC_ARG ")", | 1648 SPACE, " a.func;\n") " return a.func(); }\nf(" FUNC_ARG ")", |
| 1649 2 * kPointerSize, | 1649 2 * kPointerSize, |
| 1650 2, | 1650 2, |
| 1651 1047, | 1651 1047, |
| 1652 { | 1652 { |
| 1653 B(StackCheck), // | 1653 B(StackCheck), // |
| 1654 B(Ldar), A(1, 2), // | 1654 B(Ldar), A(1, 2), // |
| 1655 B(Star), R(0), // | 1655 B(Star), R(0), // |
| 1656 B(LoadICSloppy), R(0), U8(0), U8(wide_idx += 2), // | 1656 B(LoadICSloppy), R(0), U8(0), U8(wide_idx += 2), // |
| 1657 REPEAT_127(COMMA, // | 1657 REPEAT_127(COMMA, // |
| 1658 B(Ldar), A(1, 2), // | 1658 B(Ldar), A(1, 2), // |
| 1659 B(Star), R(0), // | 1659 B(Star), R(0), // |
| 1660 B(LoadICSloppy), R(0), U8(0), U8((wide_idx += 2))), // | 1660 B(LoadICSloppy), R(0), U8(0), U8((wide_idx += 2))), // |
| 1661 B(Ldar), A(1, 2), // | 1661 B(Ldar), A(1, 2), // |
| 1662 B(Star), R(1), // | 1662 B(Star), R(1), // |
| 1663 B(LoadICSloppyWide), R(1), U16(0), U16(wide_idx + 4), // | 1663 B(LoadICSloppyWide), R(1), U16(0), U16(wide_idx + 4), // |
| 1664 B(Star), R(0), // | 1664 B(Star), R(0), // |
| 1665 B(CallWide), R16(0), R16(1), U16(1), U16(wide_idx + 2), // | 1665 B(CallICWide), R16(0), R16(1), U16(1), U16(wide_idx + 2), // |
| 1666 B(Return), // | 1666 B(Return), // |
| 1667 }, | 1667 }, |
| 1668 1, | 1668 1, |
| 1669 {"func"}}, | 1669 {"func"}}, |
| 1670 }; | 1670 }; |
| 1671 // clang-format on | 1671 // clang-format on |
| 1672 | 1672 |
| 1673 for (size_t i = 0; i < arraysize(snippets); i++) { | 1673 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 1674 Handle<BytecodeArray> bytecode_array = | 1674 Handle<BytecodeArray> bytecode_array = |
| 1675 helper.MakeBytecode(snippets[i].code_snippet, helper.kFunctionName); | 1675 helper.MakeBytecode(snippets[i].code_snippet, helper.kFunctionName); |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1940 Handle<i::TypeFeedbackVector> vector = | 1940 Handle<i::TypeFeedbackVector> vector = |
| 1941 i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec); | 1941 i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec); |
| 1942 | 1942 |
| 1943 // clang-format off | 1943 // clang-format off |
| 1944 ExpectedSnippet<const char*> snippets[] = { | 1944 ExpectedSnippet<const char*> snippets[] = { |
| 1945 {"function t() { }\nfunction f() { return t(); }\nf()", | 1945 {"function t() { }\nfunction f() { return t(); }\nf()", |
| 1946 2 * kPointerSize, | 1946 2 * kPointerSize, |
| 1947 1, | 1947 1, |
| 1948 15, | 1948 15, |
| 1949 { | 1949 { |
| 1950 B(StackCheck), // | 1950 B(StackCheck), // |
| 1951 B(LdaUndefined), // | 1951 B(LdaUndefined), // |
| 1952 B(Star), R(1), // | 1952 B(Star), R(1), // |
| 1953 B(LdaGlobalSloppy), U8(0), U8(vector->GetIndex(slot2)), // | 1953 B(LdaGlobalSloppy), U8(0), U8(vector->GetIndex(slot2)), // |
| 1954 B(Star), R(0), // | 1954 B(Star), R(0), // |
| 1955 B(Call), R(0), R(1), U8(1), U8(vector->GetIndex(slot1)), // | 1955 B(CallIC), R(0), R(1), U8(1), U8(vector->GetIndex(slot1)), // |
| 1956 B(Return) // | 1956 B(Return) // |
| 1957 }, | 1957 }, |
| 1958 1, | 1958 1, |
| 1959 {"t"}}, | 1959 {"t"}}, |
| 1960 {"function t(a, b, c) { }\nfunction f() { return t(1, 2, 3); }\nf()", | 1960 {"function t(a, b, c) { }\nfunction f() { return t(1, 2, 3); }\nf()", |
| 1961 5 * kPointerSize, | 1961 5 * kPointerSize, |
| 1962 1, | 1962 1, |
| 1963 27, | 1963 27, |
| 1964 { | 1964 { |
| 1965 B(StackCheck), // | 1965 B(StackCheck), // |
| 1966 B(LdaUndefined), // | 1966 B(LdaUndefined), // |
| 1967 B(Star), R(1), // | 1967 B(Star), R(1), // |
| 1968 B(LdaGlobalSloppy), U8(0), U8(vector->GetIndex(slot2)), // | 1968 B(LdaGlobalSloppy), U8(0), U8(vector->GetIndex(slot2)), // |
| 1969 B(Star), R(0), // | 1969 B(Star), R(0), // |
| 1970 B(LdaSmi8), U8(1), // | 1970 B(LdaSmi8), U8(1), // |
| 1971 B(Star), R(2), // | 1971 B(Star), R(2), // |
| 1972 B(LdaSmi8), U8(2), // | 1972 B(LdaSmi8), U8(2), // |
| 1973 B(Star), R(3), // | 1973 B(Star), R(3), // |
| 1974 B(LdaSmi8), U8(3), // | 1974 B(LdaSmi8), U8(3), // |
| 1975 B(Star), R(4), // | 1975 B(Star), R(4), // |
| 1976 B(Call), R(0), R(1), U8(4), U8(vector->GetIndex(slot1)), // | 1976 B(CallIC), R(0), R(1), U8(4), U8(vector->GetIndex(slot1)), // |
| 1977 B(Return) // | 1977 B(Return) // |
| 1978 }, | 1978 }, |
| 1979 1, | 1979 1, |
| 1980 {"t"}}, | 1980 {"t"}}, |
| 1981 }; | 1981 }; |
| 1982 // clang-format on | 1982 // clang-format on |
| 1983 | 1983 |
| 1984 size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]); | 1984 size_t num_snippets = sizeof(snippets) / sizeof(snippets[0]); |
| 1985 for (size_t i = 0; i < num_snippets; i++) { | 1985 for (size_t i = 0; i < num_snippets; i++) { |
| 1986 Handle<BytecodeArray> bytecode_array = | 1986 Handle<BytecodeArray> bytecode_array = |
| 1987 helper.MakeBytecode(snippets[i].code_snippet, "f"); | 1987 helper.MakeBytecode(snippets[i].code_snippet, "f"); |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2415 B(Star), R(1), // | 2415 B(Star), R(1), // |
| 2416 B(LdaZero), // | 2416 B(LdaZero), // |
| 2417 B(Star), R(2), // | 2417 B(Star), R(2), // |
| 2418 B(CallRuntime), U16(Runtime::kDeclareGlobals), R(1), U8(2), // | 2418 B(CallRuntime), U16(Runtime::kDeclareGlobals), R(1), U8(2), // |
| 2419 B(StackCheck), // | 2419 B(StackCheck), // |
| 2420 B(LdaUndefined), // | 2420 B(LdaUndefined), // |
| 2421 B(Star), R(2), // | 2421 B(Star), R(2), // |
| 2422 B(LdaGlobalSloppy), U8(1), // | 2422 B(LdaGlobalSloppy), U8(1), // |
| 2423 /* */ U8(load_vector->GetIndex(load_slot_1)), // | 2423 /* */ U8(load_vector->GetIndex(load_slot_1)), // |
| 2424 B(Star), R(1), // | 2424 B(Star), R(1), // |
| 2425 B(Call), R(1), R(2), U8(1), // | 2425 B(CallIC), R(1), R(2), U8(1), // |
| 2426 /* */ U8(load_vector->GetIndex(call_slot_1)), // | 2426 /* */ U8(load_vector->GetIndex(call_slot_1)), // |
| 2427 B(Star), R(0), // | 2427 B(Star), R(0), // |
| 2428 B(Return) // | 2428 B(Return) // |
| 2429 }, | 2429 }, |
| 2430 2, | 2430 2, |
| 2431 {InstanceType::FIXED_ARRAY_TYPE, | 2431 {InstanceType::FIXED_ARRAY_TYPE, |
| 2432 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, | 2432 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, |
| 2433 }; | 2433 }; |
| 2434 // clang-format on | 2434 // clang-format on |
| 2435 | 2435 |
| (...skipping 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3907 B(CreateClosure), U8(0), U8(0), // | 3907 B(CreateClosure), U8(0), U8(0), // |
| 3908 B(Return) // | 3908 B(Return) // |
| 3909 }, | 3909 }, |
| 3910 1, | 3910 1, |
| 3911 {InstanceType::SHARED_FUNCTION_INFO_TYPE}}, | 3911 {InstanceType::SHARED_FUNCTION_INFO_TYPE}}, |
| 3912 {"return (function(){ })()", | 3912 {"return (function(){ })()", |
| 3913 2 * kPointerSize, | 3913 2 * kPointerSize, |
| 3914 1, | 3914 1, |
| 3915 15, | 3915 15, |
| 3916 { | 3916 { |
| 3917 B(StackCheck), // | 3917 B(StackCheck), // |
| 3918 B(LdaUndefined), // | 3918 B(LdaUndefined), // |
| 3919 B(Star), R(1), // | 3919 B(Star), R(1), // |
| 3920 B(CreateClosure), U8(0), U8(0), // | 3920 B(CreateClosure), U8(0), U8(0), // |
| 3921 B(Star), R(0), // | 3921 B(Star), R(0), // |
| 3922 B(Call), R(0), R(1), U8(1), U8(vector->GetIndex(slot)), // | 3922 B(CallIC), R(0), R(1), U8(1), U8(vector->GetIndex(slot)), // |
| 3923 B(Return) // | 3923 B(Return) // |
| 3924 }, | 3924 }, |
| 3925 1, | 3925 1, |
| 3926 {InstanceType::SHARED_FUNCTION_INFO_TYPE}}, | 3926 {InstanceType::SHARED_FUNCTION_INFO_TYPE}}, |
| 3927 {"return (function(x){ return x; })(1)", | 3927 {"return (function(x){ return x; })(1)", |
| 3928 3 * kPointerSize, | 3928 3 * kPointerSize, |
| 3929 1, | 3929 1, |
| 3930 19, | 3930 19, |
| 3931 { | 3931 { |
| 3932 B(StackCheck), // | 3932 B(StackCheck), // |
| 3933 B(LdaUndefined), // | 3933 B(LdaUndefined), // |
| 3934 B(Star), R(1), // | 3934 B(Star), R(1), // |
| 3935 B(CreateClosure), U8(0), U8(0), // | 3935 B(CreateClosure), U8(0), U8(0), // |
| 3936 B(Star), R(0), // | 3936 B(Star), R(0), // |
| 3937 B(LdaSmi8), U8(1), // | 3937 B(LdaSmi8), U8(1), // |
| 3938 B(Star), R(2), // | 3938 B(Star), R(2), // |
| 3939 B(Call), R(0), R(1), U8(2), U8(vector->GetIndex(slot)), // | 3939 B(CallIC), R(0), R(1), U8(2), U8(vector->GetIndex(slot)), // |
| 3940 B(Return) // | 3940 B(Return) // |
| 3941 }, | 3941 }, |
| 3942 1, | 3942 1, |
| 3943 {InstanceType::SHARED_FUNCTION_INFO_TYPE}}, | 3943 {InstanceType::SHARED_FUNCTION_INFO_TYPE}}, |
| 3944 }; | 3944 }; |
| 3945 // clang-format on | 3945 // clang-format on |
| 3946 | 3946 |
| 3947 for (size_t i = 0; i < arraysize(snippets); i++) { | 3947 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 3948 Handle<BytecodeArray> bytecode_array = | 3948 Handle<BytecodeArray> bytecode_array = |
| 3949 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 3949 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
| 3950 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 3950 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3994 1, | 3994 1, |
| 3995 23, | 3995 23, |
| 3996 { | 3996 { |
| 3997 B(StackCheck), // | 3997 B(StackCheck), // |
| 3998 B(CreateRegExpLiteral), U8(0), U8(0), U8(0), // | 3998 B(CreateRegExpLiteral), U8(0), U8(0), U8(0), // |
| 3999 B(Star), R(1), // | 3999 B(Star), R(1), // |
| 4000 B(LoadICSloppy), R(1), U8(1), U8(vector->GetIndex(slot2)), // | 4000 B(LoadICSloppy), R(1), U8(1), U8(vector->GetIndex(slot2)), // |
| 4001 B(Star), R(0), // | 4001 B(Star), R(0), // |
| 4002 B(LdaConstant), U8(2), // | 4002 B(LdaConstant), U8(2), // |
| 4003 B(Star), R(2), // | 4003 B(Star), R(2), // |
| 4004 B(Call), R(0), R(1), U8(2), U8(vector->GetIndex(slot1)), // | 4004 B(CallIC), R(0), R(1), U8(2), U8(vector->GetIndex(slot1)), // |
| 4005 B(Return), // | 4005 B(Return), // |
| 4006 }, | 4006 }, |
| 4007 3, | 4007 3, |
| 4008 {"ab+d", "exec", "abdd"}}, | 4008 {"ab+d", "exec", "abdd"}}, |
| 4009 }; | 4009 }; |
| 4010 // clang-format on | 4010 // clang-format on |
| 4011 | 4011 |
| 4012 for (size_t i = 0; i < arraysize(snippets); i++) { | 4012 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 4013 Handle<BytecodeArray> bytecode_array = | 4013 Handle<BytecodeArray> bytecode_array = |
| 4014 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 4014 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
| (...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5167 B(CreateClosure), U8(0), U8(0), // | 5167 B(CreateClosure), U8(0), U8(0), // |
| 5168 B(Return), // | 5168 B(Return), // |
| 5169 }, | 5169 }, |
| 5170 1, | 5170 1, |
| 5171 {InstanceType::SHARED_FUNCTION_INFO_TYPE}}, | 5171 {InstanceType::SHARED_FUNCTION_INFO_TYPE}}, |
| 5172 {"var a; (function() { a = 2; })(); return a;", | 5172 {"var a; (function() { a = 2; })(); return a;", |
| 5173 3 * kPointerSize, | 5173 3 * kPointerSize, |
| 5174 1, | 5174 1, |
| 5175 25, | 5175 25, |
| 5176 { | 5176 { |
| 5177 B(CallRuntime), U16(Runtime::kNewFunctionContext), // | 5177 B(CallRuntime), U16(Runtime::kNewFunctionContext), // |
| 5178 /* */ R(closure), U8(1), // | 5178 /* */ R(closure), U8(1), // |
| 5179 B(PushContext), R(0), // | 5179 B(PushContext), R(0), // |
| 5180 B(StackCheck), // | 5180 B(StackCheck), // |
| 5181 B(LdaUndefined), // | 5181 B(LdaUndefined), // |
| 5182 B(Star), R(2), // | 5182 B(Star), R(2), // |
| 5183 B(CreateClosure), U8(0), U8(0), // | 5183 B(CreateClosure), U8(0), U8(0), // |
| 5184 B(Star), R(1), // | 5184 B(Star), R(1), // |
| 5185 B(Call), R(1), R(2), U8(1), U8(vector->GetIndex(slot)), // | 5185 B(CallIC), R(1), R(2), U8(1), U8(vector->GetIndex(slot)), // |
| 5186 B(LdaContextSlot), R(context), U8(first_context_slot), // | 5186 B(LdaContextSlot), R(context), U8(first_context_slot), // |
| 5187 B(Return), // | 5187 B(Return), // |
| 5188 }, | 5188 }, |
| 5189 1, | 5189 1, |
| 5190 {InstanceType::SHARED_FUNCTION_INFO_TYPE}}, | 5190 {InstanceType::SHARED_FUNCTION_INFO_TYPE}}, |
| 5191 {"'use strict'; let a = 1; { let b = 2; return function() { a + b; }; }", | 5191 {"'use strict'; let a = 1; { let b = 2; return function() { a + b; }; }", |
| 5192 4 * kPointerSize, | 5192 4 * kPointerSize, |
| 5193 1, | 5193 1, |
| 5194 47, | 5194 47, |
| 5195 { | 5195 { |
| 5196 B(CallRuntime), U16(Runtime::kNewFunctionContext), // | 5196 B(CallRuntime), U16(Runtime::kNewFunctionContext), // |
| 5197 /* */ R(closure), U8(1), // | 5197 /* */ R(closure), U8(1), // |
| (...skipping 20 matching lines...) Expand all Loading... |
| 5218 2, | 5218 2, |
| 5219 {InstanceType::FIXED_ARRAY_TYPE, | 5219 {InstanceType::FIXED_ARRAY_TYPE, |
| 5220 InstanceType::SHARED_FUNCTION_INFO_TYPE}}, | 5220 InstanceType::SHARED_FUNCTION_INFO_TYPE}}, |
| 5221 {"'use strict';\n" | 5221 {"'use strict';\n" |
| 5222 REPEAT_249_UNIQUE_VARS() | 5222 REPEAT_249_UNIQUE_VARS() |
| 5223 "eval();" | 5223 "eval();" |
| 5224 "var b = 100;" | 5224 "var b = 100;" |
| 5225 "return b", | 5225 "return b", |
| 5226 3 * kPointerSize, | 5226 3 * kPointerSize, |
| 5227 1, | 5227 1, |
| 5228 1042, | 5228 1041, |
| 5229 { | 5229 { |
| 5230 B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), // | 5230 B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), // |
| 5231 /* */ U8(1), // | 5231 /* */ U8(1), // |
| 5232 B(PushContext), R(0), // | 5232 B(PushContext), R(0), // |
| 5233 B(Ldar), THIS(1), // | 5233 B(Ldar), THIS(1), // |
| 5234 B(StaContextSlot), R(context), U8(first_context_slot), // | 5234 B(StaContextSlot), R(context), U8(first_context_slot), // |
| 5235 B(CreateUnmappedArguments), // | 5235 B(CreateUnmappedArguments), // |
| 5236 B(StaContextSlot), R(context), U8(first_context_slot + 1), // | 5236 B(StaContextSlot), R(context), U8(first_context_slot + 1), // |
| 5237 B(Ldar), R(new_target), // | 5237 B(Ldar), R(new_target), // |
| 5238 B(StaContextSlot), R(context), U8(first_context_slot + 2), // | 5238 B(StaContextSlot), R(context), U8(first_context_slot + 2), // |
| 5239 B(StackCheck), // | 5239 B(StackCheck), // |
| 5240 REPEAT_249(COMMA, // | 5240 REPEAT_249(COMMA, // |
| 5241 B(LdaZero), // | 5241 B(LdaZero), // |
| 5242 B(StaContextSlot), R(context), U8(wide_slot++)), // | 5242 B(StaContextSlot), R(context), U8(wide_slot++)), // |
| 5243 B(LdaUndefined), // | 5243 B(LdaUndefined), // |
| 5244 B(Star), R(2), // | 5244 B(Star), R(2), // |
| 5245 B(LdaGlobalStrict), U8(0), U8(1), // | 5245 B(LdaGlobalStrict), U8(0), U8(1), // |
| 5246 B(Star), R(1), // | 5246 B(Star), R(1), // |
| 5247 B(Call), R(1), R(2), U8(1), U8(0), // | 5247 B(Call), R(1), R(2), U8(1), // |
| 5248 B(LdaSmi8), U8(100), // | 5248 B(LdaSmi8), U8(100), // |
| 5249 B(StaContextSlotWide), R(context), U16(256), // | 5249 B(StaContextSlotWide), R(context), U16(256), // |
| 5250 B(LdaContextSlotWide), R(context), U16(256), // | 5250 B(LdaContextSlotWide), R(context), U16(256), // |
| 5251 B(Return), // | 5251 B(Return), // |
| 5252 }, | 5252 }, |
| 5253 1, | 5253 1, |
| 5254 {InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, | 5254 {InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, |
| 5255 }; | 5255 }; |
| 5256 // clang-format on | 5256 // clang-format on |
| 5257 | 5257 |
| (...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6453 7 * kPointerSize, | 6453 7 * kPointerSize, |
| 6454 1, | 6454 1, |
| 6455 86, | 6455 86, |
| 6456 { | 6456 { |
| 6457 B(StackCheck), // | 6457 B(StackCheck), // |
| 6458 B(CreateArrayLiteral), U8(0), U8(0), U8(array_literal_flags), // | 6458 B(CreateArrayLiteral), U8(0), U8(0), U8(array_literal_flags), // |
| 6459 B(Star), R(5), // | 6459 B(Star), R(5), // |
| 6460 B(LdaConstant), U8(1), // | 6460 B(LdaConstant), U8(1), // |
| 6461 B(KeyedLoadICSloppy), R(5), U8(vector->GetIndex(slot2)), // | 6461 B(KeyedLoadICSloppy), R(5), U8(vector->GetIndex(slot2)), // |
| 6462 B(Star), R(4), // | 6462 B(Star), R(4), // |
| 6463 B(Call), R(4), R(5), U8(1), U8(vector->GetIndex(slot1)), // | 6463 B(CallIC), R(4), R(5), U8(1), U8(vector->GetIndex(slot1)), // |
| 6464 B(Star), R(1), // | 6464 B(Star), R(1), // |
| 6465 B(Ldar), R(1), // | 6465 B(Ldar), R(1), // |
| 6466 B(Star), R(6), // | 6466 B(Star), R(6), // |
| 6467 B(LoadICSloppy), R(6), U8(2), U8(vector->GetIndex(slot4)), // | 6467 B(LoadICSloppy), R(6), U8(2), U8(vector->GetIndex(slot4)), // |
| 6468 B(Star), R(5), // | 6468 B(Star), R(5), // |
| 6469 B(Call), R(5), R(6), U8(1), U8(vector->GetIndex(slot3)), // | 6469 B(CallIC), R(5), R(6), U8(1), U8(vector->GetIndex(slot3)), // |
| 6470 B(Star), R(2), // | 6470 B(Star), R(2), // |
| 6471 B(Star), R(4), // | 6471 B(Star), R(4), // |
| 6472 B(CallRuntime), U16(Runtime::kInlineIsJSReceiver), R(4), U8(1), // | 6472 B(CallRuntime), U16(Runtime::kInlineIsJSReceiver), R(4), U8(1), // |
| 6473 B(LogicalNot), // | 6473 B(LogicalNot), // |
| 6474 B(JumpIfFalse), U8(11), // | 6474 B(JumpIfFalse), U8(11), // |
| 6475 B(Ldar), R(2), // | 6475 B(Ldar), R(2), // |
| 6476 B(Star), R(4), // | 6476 B(Star), R(4), // |
| 6477 B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), // | 6477 B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), // |
| 6478 /* */ R(4), U8(1), // | 6478 /* */ R(4), U8(1), // |
| 6479 B(Ldar), R(2), // | 6479 B(Ldar), R(2), // |
| (...skipping 22 matching lines...) Expand all Loading... |
| 6502 1, | 6502 1, |
| 6503 85, | 6503 85, |
| 6504 { | 6504 { |
| 6505 B(StackCheck), // | 6505 B(StackCheck), // |
| 6506 B(LdaConstant), U8(0), // | 6506 B(LdaConstant), U8(0), // |
| 6507 B(Star), R(3), // | 6507 B(Star), R(3), // |
| 6508 B(Star), R(6), // | 6508 B(Star), R(6), // |
| 6509 B(LdaConstant), U8(1), // | 6509 B(LdaConstant), U8(1), // |
| 6510 B(KeyedLoadICSloppy), R(6), U8(vector->GetIndex(slot2)), // | 6510 B(KeyedLoadICSloppy), R(6), U8(vector->GetIndex(slot2)), // |
| 6511 B(Star), R(5), // | 6511 B(Star), R(5), // |
| 6512 B(Call), R(5), R(6), U8(1), U8(vector->GetIndex(slot1)), // | 6512 B(CallIC), R(5), R(6), U8(1), U8(vector->GetIndex(slot1)), // |
| 6513 B(Star), R(1), // | 6513 B(Star), R(1), // |
| 6514 B(Ldar), R(1), // | 6514 B(Ldar), R(1), // |
| 6515 B(Star), R(7), // | 6515 B(Star), R(7), // |
| 6516 B(LoadICSloppy), R(7), U8(2), U8(vector->GetIndex(slot4)), // | 6516 B(LoadICSloppy), R(7), U8(2), U8(vector->GetIndex(slot4)), // |
| 6517 B(Star), R(6), // | 6517 B(Star), R(6), // |
| 6518 B(Call), R(6), R(7), U8(1), U8(vector->GetIndex(slot3)), // | 6518 B(CallIC), R(6), R(7), U8(1), U8(vector->GetIndex(slot3)), // |
| 6519 B(Star), R(2), // | 6519 B(Star), R(2), // |
| 6520 B(Star), R(5), // | 6520 B(Star), R(5), // |
| 6521 B(CallRuntime), U16(Runtime::kInlineIsJSReceiver), R(5), U8(1), // | 6521 B(CallRuntime), U16(Runtime::kInlineIsJSReceiver), R(5), U8(1), // |
| 6522 B(LogicalNot), // | 6522 B(LogicalNot), // |
| 6523 B(JumpIfFalse), U8(11), // | 6523 B(JumpIfFalse), U8(11), // |
| 6524 B(Ldar), R(2), // | 6524 B(Ldar), R(2), // |
| 6525 B(Star), R(5), // | 6525 B(Star), R(5), // |
| 6526 B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), // | 6526 B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), // |
| 6527 /* */ R(5), U8(1), // | 6527 /* */ R(5), U8(1), // |
| 6528 B(Ldar), R(2), // | 6528 B(Ldar), R(2), // |
| (...skipping 24 matching lines...) Expand all Loading... |
| 6553 7 * kPointerSize, | 6553 7 * kPointerSize, |
| 6554 1, | 6554 1, |
| 6555 108, | 6555 108, |
| 6556 { | 6556 { |
| 6557 B(StackCheck), // | 6557 B(StackCheck), // |
| 6558 B(CreateArrayLiteral), U8(0), U8(0), U8(array_literal_flags), // | 6558 B(CreateArrayLiteral), U8(0), U8(0), U8(array_literal_flags), // |
| 6559 B(Star), R(5), // | 6559 B(Star), R(5), // |
| 6560 B(LdaConstant), U8(1), // | 6560 B(LdaConstant), U8(1), // |
| 6561 B(KeyedLoadICSloppy), R(5), U8(vector->GetIndex(slot2)), // | 6561 B(KeyedLoadICSloppy), R(5), U8(vector->GetIndex(slot2)), // |
| 6562 B(Star), R(4), // | 6562 B(Star), R(4), // |
| 6563 B(Call), R(4), R(5), U8(1), U8(vector->GetIndex(slot1)), // | 6563 B(CallIC), R(4), R(5), U8(1), U8(vector->GetIndex(slot1)), // |
| 6564 B(Star), R(1), // | 6564 B(Star), R(1), // |
| 6565 B(Ldar), R(1), // | 6565 B(Ldar), R(1), // |
| 6566 B(Star), R(6), // | 6566 B(Star), R(6), // |
| 6567 B(LoadICSloppy), R(6), U8(2), U8(vector->GetIndex(slot4)), // | 6567 B(LoadICSloppy), R(6), U8(2), U8(vector->GetIndex(slot4)), // |
| 6568 B(Star), R(5), // | 6568 B(Star), R(5), // |
| 6569 B(Call), R(5), R(6), U8(1), U8(vector->GetIndex(slot3)), // | 6569 B(CallIC), R(5), R(6), U8(1), U8(vector->GetIndex(slot3)), // |
| 6570 B(Star), R(2), // | 6570 B(Star), R(2), // |
| 6571 B(Star), R(4), // | 6571 B(Star), R(4), // |
| 6572 B(CallRuntime), U16(Runtime::kInlineIsJSReceiver), R(4), U8(1), // | 6572 B(CallRuntime), U16(Runtime::kInlineIsJSReceiver), R(4), U8(1), // |
| 6573 B(LogicalNot), // | 6573 B(LogicalNot), // |
| 6574 B(JumpIfFalse), U8(11), // | 6574 B(JumpIfFalse), U8(11), // |
| 6575 B(Ldar), R(2), // | 6575 B(Ldar), R(2), // |
| 6576 B(Star), R(4), // | 6576 B(Star), R(4), // |
| 6577 B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), // | 6577 B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), // |
| 6578 /* */ R(4), U8(1), // | 6578 /* */ R(4), U8(1), // |
| 6579 B(Ldar), R(2), // | 6579 B(Ldar), R(2), // |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6615 { | 6615 { |
| 6616 B(StackCheck), // | 6616 B(StackCheck), // |
| 6617 B(CreateObjectLiteral), U8(0), U8(0), U8(object_literal_flags), // | 6617 B(CreateObjectLiteral), U8(0), U8(0), U8(object_literal_flags), // |
| 6618 B(Star), R(3), // | 6618 B(Star), R(3), // |
| 6619 B(Star), R(2), // | 6619 B(Star), R(2), // |
| 6620 B(CreateArrayLiteral), U8(1), U8(1), U8(array_literal_flags), // | 6620 B(CreateArrayLiteral), U8(1), U8(1), U8(array_literal_flags), // |
| 6621 B(Star), R(4), // | 6621 B(Star), R(4), // |
| 6622 B(LdaConstant), U8(2), // | 6622 B(LdaConstant), U8(2), // |
| 6623 B(KeyedLoadICSloppy), R(4), U8(vector->GetIndex(slot2)), // | 6623 B(KeyedLoadICSloppy), R(4), U8(vector->GetIndex(slot2)), // |
| 6624 B(Star), R(3), // | 6624 B(Star), R(3), // |
| 6625 B(Call), R(3), R(4), U8(1), U8(vector->GetIndex(slot1)), // | 6625 B(CallIC), R(3), R(4), U8(1), U8(vector->GetIndex(slot1)), // |
| 6626 B(Star), R(0), // | 6626 B(Star), R(0), // |
| 6627 B(Ldar), R(0), // | 6627 B(Ldar), R(0), // |
| 6628 B(Star), R(5), // | 6628 B(Star), R(5), // |
| 6629 B(LoadICSloppy), R(5), U8(3), U8(vector->GetIndex(slot4)), // | 6629 B(LoadICSloppy), R(5), U8(3), U8(vector->GetIndex(slot4)), // |
| 6630 B(Star), R(4), // | 6630 B(Star), R(4), // |
| 6631 B(Call), R(4), R(5), U8(1), U8(vector->GetIndex(slot3)), // | 6631 B(CallIC), R(4), R(5), U8(1), U8(vector->GetIndex(slot3)), // |
| 6632 B(Star), R(1), // | 6632 B(Star), R(1), // |
| 6633 B(Star), R(3), // | 6633 B(Star), R(3), // |
| 6634 B(CallRuntime), U16(Runtime::kInlineIsJSReceiver), R(3), U8(1), // | 6634 B(CallRuntime), U16(Runtime::kInlineIsJSReceiver), R(3), U8(1), // |
| 6635 B(LogicalNot), // | 6635 B(LogicalNot), // |
| 6636 B(JumpIfFalse), U8(11), // | 6636 B(JumpIfFalse), U8(11), // |
| 6637 B(Ldar), R(1), // | 6637 B(Ldar), R(1), // |
| 6638 B(Star), R(3), // | 6638 B(Star), R(3), // |
| 6639 B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), // | 6639 B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), // |
| 6640 /* */ R(3), U8(1), // | 6640 /* */ R(3), U8(1), // |
| 6641 B(Ldar), R(1), // | 6641 B(Ldar), R(1), // |
| (...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7569 int context = Register::current_context().index(); | 7569 int context = Register::current_context().index(); |
| 7570 int new_target = Register::new_target().index(); | 7570 int new_target = Register::new_target().index(); |
| 7571 | 7571 |
| 7572 int first_context_slot = Context::MIN_CONTEXT_SLOTS; | 7572 int first_context_slot = Context::MIN_CONTEXT_SLOTS; |
| 7573 | 7573 |
| 7574 // clang-format off | 7574 // clang-format off |
| 7575 ExpectedSnippet<const char*> snippets[] = { | 7575 ExpectedSnippet<const char*> snippets[] = { |
| 7576 {"return eval('1;');", | 7576 {"return eval('1;');", |
| 7577 9 * kPointerSize, | 7577 9 * kPointerSize, |
| 7578 1, | 7578 1, |
| 7579 65, | 7579 64, |
| 7580 { | 7580 { |
| 7581 B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), // | 7581 B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), // |
| 7582 /* */ U8(1), // | 7582 /* */ U8(1), // |
| 7583 B(PushContext), R(0), // | 7583 B(PushContext), R(0), // |
| 7584 B(Ldar), THIS(1), // | 7584 B(Ldar), THIS(1), // |
| 7585 B(StaContextSlot), R(context), U8(first_context_slot), // | 7585 B(StaContextSlot), R(context), U8(first_context_slot), // |
| 7586 B(CreateMappedArguments), // | 7586 B(CreateMappedArguments), // |
| 7587 B(StaContextSlot), R(context), U8(first_context_slot + 1), // | 7587 B(StaContextSlot), R(context), U8(first_context_slot + 1), // |
| 7588 B(Ldar), R(new_target), // | 7588 B(Ldar), R(new_target), // |
| 7589 B(StaContextSlot), R(context), U8(first_context_slot + 2), // | 7589 B(StaContextSlot), R(context), U8(first_context_slot + 2), // |
| 7590 B(StackCheck), // | 7590 B(StackCheck), // |
| 7591 B(LdaConstant), U8(0), // | 7591 B(LdaConstant), U8(0), // |
| 7592 B(Star), R(3), // | 7592 B(Star), R(3), // |
| 7593 B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), // | 7593 B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), // |
| 7594 /* */ R(3), U8(1), R(1), // | 7594 /* */ R(3), U8(1), R(1), // |
| 7595 B(LdaConstant), U8(1), // | 7595 B(LdaConstant), U8(1), // |
| 7596 B(Star), R(3), // | 7596 B(Star), R(3), // |
| 7597 B(Mov), R(1), R(4), // | 7597 B(Mov), R(1), R(4), // |
| 7598 B(Mov), R(3), R(5), // | 7598 B(Mov), R(3), R(5), // |
| 7599 B(Mov), R(closure), R(6), // | 7599 B(Mov), R(closure), R(6), // |
| 7600 B(LdaZero), // | 7600 B(LdaZero), // |
| 7601 B(Star), R(7), // | 7601 B(Star), R(7), // |
| 7602 B(LdaSmi8), U8(10), // | 7602 B(LdaSmi8), U8(10), // |
| 7603 B(Star), R(8), // | 7603 B(Star), R(8), // |
| 7604 B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), // | 7604 B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), // |
| 7605 /* */ U8(5), // | 7605 /* */ U8(5), // |
| 7606 B(Star), R(1), // | 7606 B(Star), R(1), // |
| 7607 B(Call), R(1), R(2), U8(2), U8(0), // | 7607 B(Call), R(1), R(2), U8(2), // |
| 7608 B(Return), // | 7608 B(Return), // |
| 7609 }, | 7609 }, |
| 7610 2, | 7610 2, |
| 7611 {"eval", "1;"}}, | 7611 {"eval", "1;"}}, |
| 7612 }; | 7612 }; |
| 7613 // clang-format on | 7613 // clang-format on |
| 7614 | 7614 |
| 7615 for (size_t i = 0; i < arraysize(snippets); i++) { | 7615 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 7616 Handle<BytecodeArray> bytecode_array = | 7616 Handle<BytecodeArray> bytecode_array = |
| 7617 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 7617 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
| 7618 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 7618 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 7619 } | 7619 } |
| 7620 } | 7620 } |
| 7621 | 7621 |
| 7622 | 7622 |
| 7623 TEST(LookupSlot) { | 7623 TEST(LookupSlot) { |
| 7624 InitializedHandleScope handle_scope; | 7624 InitializedHandleScope handle_scope; |
| 7625 BytecodeGeneratorHelper helper; | 7625 BytecodeGeneratorHelper helper; |
| 7626 | 7626 |
| 7627 int closure = Register::function_closure().index(); | 7627 int closure = Register::function_closure().index(); |
| 7628 int context = Register::current_context().index(); | 7628 int context = Register::current_context().index(); |
| 7629 int first_context_slot = Context::MIN_CONTEXT_SLOTS; | 7629 int first_context_slot = Context::MIN_CONTEXT_SLOTS; |
| 7630 int new_target = Register::new_target().index(); | 7630 int new_target = Register::new_target().index(); |
| 7631 | 7631 |
| 7632 // clang-format off | 7632 // clang-format off |
| 7633 ExpectedSnippet<const char*> snippets[] = { | 7633 ExpectedSnippet<const char*> snippets[] = { |
| 7634 {"eval('var x = 10;'); return x;", | 7634 {"eval('var x = 10;'); return x;", |
| 7635 9 * kPointerSize, | 7635 9 * kPointerSize, |
| 7636 1, | 7636 1, |
| 7637 67, | 7637 66, |
| 7638 { | 7638 { |
| 7639 B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), // | 7639 B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), // |
| 7640 /* */ U8(1), // | 7640 /* */ U8(1), // |
| 7641 B(PushContext), R(0), // | 7641 B(PushContext), R(0), // |
| 7642 B(Ldar), THIS(1), // | 7642 B(Ldar), THIS(1), // |
| 7643 B(StaContextSlot), R(context), U8(first_context_slot), // | 7643 B(StaContextSlot), R(context), U8(first_context_slot), // |
| 7644 B(CreateMappedArguments), // | 7644 B(CreateMappedArguments), // |
| 7645 B(StaContextSlot), R(context), U8(first_context_slot + 1), // | 7645 B(StaContextSlot), R(context), U8(first_context_slot + 1), // |
| 7646 B(Ldar), R(new_target), // | 7646 B(Ldar), R(new_target), // |
| 7647 B(StaContextSlot), R(context), U8(first_context_slot + 2), // | 7647 B(StaContextSlot), R(context), U8(first_context_slot + 2), // |
| 7648 B(StackCheck), // | 7648 B(StackCheck), // |
| 7649 B(LdaConstant), U8(0), // | 7649 B(LdaConstant), U8(0), // |
| 7650 B(Star), R(3), // | 7650 B(Star), R(3), // |
| 7651 B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), // | 7651 B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), // |
| 7652 R(3), U8(1), R(1), // | 7652 R(3), U8(1), R(1), // |
| 7653 B(LdaConstant), U8(1), // | 7653 B(LdaConstant), U8(1), // |
| 7654 B(Star), R(3), // | 7654 B(Star), R(3), // |
| 7655 B(Mov), R(1), R(4), // | 7655 B(Mov), R(1), R(4), // |
| 7656 B(Mov), R(3), R(5), // | 7656 B(Mov), R(3), R(5), // |
| 7657 B(Mov), R(closure), R(6), // | 7657 B(Mov), R(closure), R(6), // |
| 7658 B(LdaZero), // | 7658 B(LdaZero), // |
| 7659 B(Star), R(7), // | 7659 B(Star), R(7), // |
| 7660 B(LdaSmi8), U8(10), // | 7660 B(LdaSmi8), U8(10), // |
| 7661 B(Star), R(8), // | 7661 B(Star), R(8), // |
| 7662 B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), // | 7662 B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), // |
| 7663 U8(5), // | 7663 U8(5), // |
| 7664 B(Star), R(1), // | 7664 B(Star), R(1), // |
| 7665 B(Call), R(1), R(2), U8(2), U8(0), // | 7665 B(Call), R(1), R(2), U8(2), // |
| 7666 B(LdaLookupSlot), U8(2), // | 7666 B(LdaLookupSlot), U8(2), // |
| 7667 B(Return), // | 7667 B(Return), // |
| 7668 }, | 7668 }, |
| 7669 3, | 7669 3, |
| 7670 {"eval", "var x = 10;", "x"}}, | 7670 {"eval", "var x = 10;", "x"}}, |
| 7671 {"eval('var x = 10;'); return typeof x;", | 7671 {"eval('var x = 10;'); return typeof x;", |
| 7672 9 * kPointerSize, | 7672 9 * kPointerSize, |
| 7673 1, | 7673 1, |
| 7674 68, | 7674 67, |
| 7675 { | 7675 { |
| 7676 B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), // | 7676 B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), // |
| 7677 /* */ U8(1), // | 7677 /* */ U8(1), // |
| 7678 B(PushContext), R(0), // | 7678 B(PushContext), R(0), // |
| 7679 B(Ldar), THIS(1), // | 7679 B(Ldar), THIS(1), // |
| 7680 B(StaContextSlot), R(context), U8(first_context_slot), // | 7680 B(StaContextSlot), R(context), U8(first_context_slot), // |
| 7681 B(CreateMappedArguments), // | 7681 B(CreateMappedArguments), // |
| 7682 B(StaContextSlot), R(context), U8(first_context_slot + 1), // | 7682 B(StaContextSlot), R(context), U8(first_context_slot + 1), // |
| 7683 B(Ldar), R(new_target), // | 7683 B(Ldar), R(new_target), // |
| 7684 B(StaContextSlot), R(context), U8(first_context_slot + 2), // | 7684 B(StaContextSlot), R(context), U8(first_context_slot + 2), // |
| 7685 B(StackCheck), // | 7685 B(StackCheck), // |
| 7686 B(LdaConstant), U8(0), // | 7686 B(LdaConstant), U8(0), // |
| 7687 B(Star), R(3), // | 7687 B(Star), R(3), // |
| 7688 B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), // | 7688 B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), // |
| 7689 /* */ R(3), U8(1), R(1), // | 7689 /* */ R(3), U8(1), R(1), // |
| 7690 B(LdaConstant), U8(1), // | 7690 B(LdaConstant), U8(1), // |
| 7691 B(Star), R(3), // | 7691 B(Star), R(3), // |
| 7692 B(Mov), R(1), R(4), // | 7692 B(Mov), R(1), R(4), // |
| 7693 B(Mov), R(3), R(5), // | 7693 B(Mov), R(3), R(5), // |
| 7694 B(Mov), R(closure), R(6), // | 7694 B(Mov), R(closure), R(6), // |
| 7695 B(LdaZero), // | 7695 B(LdaZero), // |
| 7696 B(Star), R(7), // | 7696 B(Star), R(7), // |
| 7697 B(LdaSmi8), U8(10), // | 7697 B(LdaSmi8), U8(10), // |
| 7698 B(Star), R(8), // | 7698 B(Star), R(8), // |
| 7699 B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), // | 7699 B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), // |
| 7700 /* */ U8(5), // | 7700 /* */ U8(5), // |
| 7701 B(Star), R(1), // | 7701 B(Star), R(1), // |
| 7702 B(Call), R(1), R(2), U8(2), U8(0), // | 7702 B(Call), R(1), R(2), U8(2), // |
| 7703 B(LdaLookupSlotInsideTypeof), U8(2), // | 7703 B(LdaLookupSlotInsideTypeof), U8(2), // |
| 7704 B(TypeOf), // | 7704 B(TypeOf), // |
| 7705 B(Return), // | 7705 B(Return), // |
| 7706 }, | 7706 }, |
| 7707 3, | 7707 3, |
| 7708 {"eval", "var x = 10;", "x"}}, | 7708 {"eval", "var x = 10;", "x"}}, |
| 7709 {"x = 20; return eval('');", | 7709 {"x = 20; return eval('');", |
| 7710 9 * kPointerSize, | 7710 9 * kPointerSize, |
| 7711 1, | 7711 1, |
| 7712 69, | 7712 68, |
| 7713 { | 7713 { |
| 7714 B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), // | 7714 B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), // |
| 7715 U8(1), // | 7715 U8(1), // |
| 7716 B(PushContext), R(0), // | 7716 B(PushContext), R(0), // |
| 7717 B(Ldar), THIS(1), // | 7717 B(Ldar), THIS(1), // |
| 7718 B(StaContextSlot), R(context), U8(first_context_slot), // | 7718 B(StaContextSlot), R(context), U8(first_context_slot), // |
| 7719 B(CreateMappedArguments), // | 7719 B(CreateMappedArguments), // |
| 7720 B(StaContextSlot), R(context), U8(first_context_slot + 1), // | 7720 B(StaContextSlot), R(context), U8(first_context_slot + 1), // |
| 7721 B(Ldar), R(new_target), // | 7721 B(Ldar), R(new_target), // |
| 7722 B(StaContextSlot), R(context), U8(first_context_slot + 2), // | 7722 B(StaContextSlot), R(context), U8(first_context_slot + 2), // |
| 7723 B(StackCheck), // | 7723 B(StackCheck), // |
| 7724 B(LdaSmi8), U8(20), // | 7724 B(LdaSmi8), U8(20), // |
| 7725 B(StaLookupSlotSloppy), U8(0), // | 7725 B(StaLookupSlotSloppy), U8(0), // |
| 7726 B(LdaConstant), U8(1), // | 7726 B(LdaConstant), U8(1), // |
| 7727 B(Star), R(3), // | 7727 B(Star), R(3), // |
| 7728 B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), // | 7728 B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), // |
| 7729 /* */ R(3), U8(1), R(1), // | 7729 /* */ R(3), U8(1), R(1), // |
| 7730 B(LdaConstant), U8(2), // | 7730 B(LdaConstant), U8(2), // |
| 7731 B(Star), R(3), // | 7731 B(Star), R(3), // |
| 7732 B(Mov), R(1), R(4), // | 7732 B(Mov), R(1), R(4), // |
| 7733 B(Mov), R(3), R(5), // | 7733 B(Mov), R(3), R(5), // |
| 7734 B(Mov), R(closure), R(6), // | 7734 B(Mov), R(closure), R(6), // |
| 7735 B(LdaZero), // | 7735 B(LdaZero), // |
| 7736 B(Star), R(7), // | 7736 B(Star), R(7), // |
| 7737 B(LdaSmi8), U8(10), // | 7737 B(LdaSmi8), U8(10), // |
| 7738 B(Star), R(8), // | 7738 B(Star), R(8), // |
| 7739 B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), // | 7739 B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), // |
| 7740 /* */ U8(5), // | 7740 /* */ U8(5), // |
| 7741 B(Star), R(1), // | 7741 B(Star), R(1), // |
| 7742 B(Call), R(1), R(2), U8(2), U8(0), // | 7742 B(Call), R(1), R(2), U8(2), // |
| 7743 B(Return), // | 7743 B(Return), // |
| 7744 }, | 7744 }, |
| 7745 3, | 7745 3, |
| 7746 {"x", "eval", ""}}, | 7746 {"x", "eval", ""}}, |
| 7747 }; | 7747 }; |
| 7748 // clang-format on | 7748 // clang-format on |
| 7749 | 7749 |
| 7750 for (size_t i = 0; i < arraysize(snippets); i++) { | 7750 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 7751 Handle<BytecodeArray> bytecode_array = | 7751 Handle<BytecodeArray> bytecode_array = |
| 7752 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 7752 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
| 7753 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 7753 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 7754 } | 7754 } |
| 7755 } | 7755 } |
| 7756 | 7756 |
| 7757 | 7757 |
| 7758 TEST(CallLookupSlot) { | 7758 TEST(CallLookupSlot) { |
| 7759 InitializedHandleScope handle_scope; | 7759 InitializedHandleScope handle_scope; |
| 7760 BytecodeGeneratorHelper helper; | 7760 BytecodeGeneratorHelper helper; |
| 7761 Zone zone; | 7761 Zone zone; |
| 7762 | 7762 |
| 7763 FeedbackVectorSpec feedback_spec(&zone); | |
| 7764 FeedbackVectorSlot slot1 = feedback_spec.AddLoadICSlot(); | |
| 7765 FeedbackVectorSlot slot2 = feedback_spec.AddCallICSlot(); | |
| 7766 USE(slot1); | |
| 7767 | |
| 7768 Handle<i::TypeFeedbackVector> vector = | |
| 7769 i::NewTypeFeedbackVector(helper.isolate(), &feedback_spec); | |
| 7770 | |
| 7771 int closure = Register::function_closure().index(); | 7763 int closure = Register::function_closure().index(); |
| 7772 int context = Register::current_context().index(); | 7764 int context = Register::current_context().index(); |
| 7773 int new_target = Register::new_target().index(); | 7765 int new_target = Register::new_target().index(); |
| 7774 | 7766 |
| 7775 // clang-format off | 7767 // clang-format off |
| 7776 ExpectedSnippet<InstanceType> snippets[] = { | 7768 ExpectedSnippet<InstanceType> snippets[] = { |
| 7777 {"g = function(){}; eval(''); return g();", | 7769 {"g = function(){}; eval(''); return g();", |
| 7778 9 * kPointerSize, | 7770 9 * kPointerSize, |
| 7779 1, | 7771 1, |
| 7780 85, | 7772 83, |
| 7781 { | 7773 { |
| 7782 B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), // | 7774 B(CallRuntime), U16(Runtime::kNewFunctionContext), R(closure), // |
| 7783 /* */ U8(1), // | 7775 /* */ U8(1), // |
| 7784 B(PushContext), R(0), // | 7776 B(PushContext), R(0), // |
| 7785 B(Ldar), THIS(1), // | 7777 B(Ldar), THIS(1), // |
| 7786 B(StaContextSlot), R(context), U8(4), // | 7778 B(StaContextSlot), R(context), U8(4), // |
| 7787 B(CreateMappedArguments), // | 7779 B(CreateMappedArguments), // |
| 7788 B(StaContextSlot), R(context), U8(5), // | 7780 B(StaContextSlot), R(context), U8(5), // |
| 7789 B(Ldar), R(new_target), // | 7781 B(Ldar), R(new_target), // |
| 7790 B(StaContextSlot), R(context), U8(6), // | 7782 B(StaContextSlot), R(context), U8(6), // |
| 7791 B(StackCheck), // | 7783 B(StackCheck), // |
| 7792 B(CreateClosure), U8(0), U8(0), // | 7784 B(CreateClosure), U8(0), U8(0), // |
| 7793 B(StaLookupSlotSloppy), U8(1), // | 7785 B(StaLookupSlotSloppy), U8(1), // |
| 7794 B(LdaConstant), U8(2), // | 7786 B(LdaConstant), U8(2), // |
| 7795 B(Star), R(3), // | 7787 B(Star), R(3), // |
| 7796 B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), // | 7788 B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), // |
| 7797 R(3), U8(1), R(1), // | 7789 R(3), U8(1), R(1), // |
| 7798 B(LdaConstant), U8(3), // | 7790 B(LdaConstant), U8(3), // |
| 7799 B(Star), R(3), // | 7791 B(Star), R(3), // |
| 7800 B(Mov), R(1), R(4), // | 7792 B(Mov), R(1), R(4), // |
| 7801 B(Mov), R(3), R(5), // | 7793 B(Mov), R(3), R(5), // |
| 7802 B(Mov), R(closure), R(6), // | 7794 B(Mov), R(closure), R(6), // |
| 7803 B(LdaZero), // | 7795 B(LdaZero), // |
| 7804 B(Star), R(7), // | 7796 B(Star), R(7), // |
| 7805 B(LdaSmi8), U8(10), // | 7797 B(LdaSmi8), U8(10), // |
| 7806 B(Star), R(8), // | 7798 B(Star), R(8), // |
| 7807 B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), // | 7799 B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), // |
| 7808 U8(5), // | 7800 U8(5), // |
| 7809 B(Star), R(1), // | 7801 B(Star), R(1), // |
| 7810 B(Call), R(1), R(2), U8(2), U8(0), // | 7802 B(Call), R(1), R(2), U8(2), // |
| 7811 B(LdaConstant), U8(1), // | 7803 B(LdaConstant), U8(1), // |
| 7812 B(Star), R(3), // | 7804 B(Star), R(3), // |
| 7813 B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), // | 7805 B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), // |
| 7814 R(3), U8(1), R(1), // | 7806 R(3), U8(1), R(1), // |
| 7815 B(Call), R(1), R(2), U8(1), U8(vector->GetIndex(slot2)), // | 7807 B(Call), R(1), R(2), U8(1), // |
| 7816 B(Return), // | 7808 B(Return), // |
| 7817 }, | 7809 }, |
| 7818 4, | 7810 4, |
| 7819 {InstanceType::SHARED_FUNCTION_INFO_TYPE, | 7811 {InstanceType::SHARED_FUNCTION_INFO_TYPE, |
| 7820 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, | 7812 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, |
| 7821 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, | 7813 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, |
| 7822 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, | 7814 InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE}}, |
| 7823 }; | 7815 }; |
| 7824 // clang-format on | 7816 // clang-format on |
| 7825 | 7817 |
| (...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9228 for (size_t i = 0; i < arraysize(snippets); i++) { | 9220 for (size_t i = 0; i < arraysize(snippets); i++) { |
| 9229 Handle<BytecodeArray> bytecode_array = | 9221 Handle<BytecodeArray> bytecode_array = |
| 9230 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 9222 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
| 9231 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 9223 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
| 9232 } | 9224 } |
| 9233 } | 9225 } |
| 9234 | 9226 |
| 9235 } // namespace interpreter | 9227 } // namespace interpreter |
| 9236 } // namespace internal | 9228 } // namespace internal |
| 9237 } // namespace v8 | 9229 } // namespace v8 |
| OLD | NEW |