| 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 <fstream> | 5 #include <fstream> |
| 6 | 6 |
| 7 #include "src/v8.h" | 7 #include "src/v8.h" |
| 8 | 8 |
| 9 #include "src/interpreter/bytecode-array-iterator.h" | 9 #include "src/interpreter/bytecode-array-iterator.h" |
| 10 #include "src/interpreter/bytecode-generator.h" | 10 #include "src/interpreter/bytecode-generator.h" |
| (...skipping 1781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1792 "return eval('1;');\n", | 1792 "return eval('1;');\n", |
| 1793 }; | 1793 }; |
| 1794 | 1794 |
| 1795 CHECK( | 1795 CHECK( |
| 1796 CompareTexts(BuildActual(printer, snippets), LoadGolden("Eval.golden"))); | 1796 CompareTexts(BuildActual(printer, snippets), LoadGolden("Eval.golden"))); |
| 1797 } | 1797 } |
| 1798 | 1798 |
| 1799 TEST(LookupSlot) { | 1799 TEST(LookupSlot) { |
| 1800 InitializedIgnitionHandleScope scope; | 1800 InitializedIgnitionHandleScope scope; |
| 1801 BytecodeExpectationsPrinter printer(CcTest::isolate()); | 1801 BytecodeExpectationsPrinter printer(CcTest::isolate()); |
| 1802 printer.set_test_function_name("f"); |
| 1802 | 1803 |
| 1804 // clang-format off |
| 1803 const char* snippets[] = { | 1805 const char* snippets[] = { |
| 1804 "eval('var x = 10;'); return x;\n", | 1806 "eval('var x = 10;'); return x;\n", |
| 1805 | 1807 |
| 1806 "eval('var x = 10;'); return typeof x;\n", | 1808 "eval('var x = 10;'); return typeof x;\n", |
| 1807 | 1809 |
| 1808 "x = 20; return eval('');\n", | 1810 "x = 20; return eval('');\n", |
| 1811 |
| 1812 "var x = 20;\n" |
| 1813 "f = function(){\n" |
| 1814 " eval('var x = 10');\n" |
| 1815 " return x;\n" |
| 1816 "}\n" |
| 1817 "f();\n" |
| 1809 }; | 1818 }; |
| 1819 // clang-format on |
| 1810 | 1820 |
| 1811 CHECK(CompareTexts(BuildActual(printer, snippets), | 1821 CHECK(CompareTexts(BuildActual(printer, snippets), |
| 1812 LoadGolden("LookupSlot.golden"))); | 1822 LoadGolden("LookupSlot.golden"))); |
| 1813 } | 1823 } |
| 1814 | 1824 |
| 1815 TEST(CallLookupSlot) { | 1825 TEST(CallLookupSlot) { |
| 1816 InitializedIgnitionHandleScope scope; | 1826 InitializedIgnitionHandleScope scope; |
| 1817 BytecodeExpectationsPrinter printer(CcTest::isolate()); | 1827 BytecodeExpectationsPrinter printer(CcTest::isolate()); |
| 1818 const char* snippets[] = { | 1828 const char* snippets[] = { |
| 1819 "g = function(){}; eval(''); return g();\n", | 1829 "g = function(){}; eval(''); return g();\n", |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2184 "f();\n", | 2194 "f();\n", |
| 2185 }; | 2195 }; |
| 2186 | 2196 |
| 2187 CHECK(CompareTexts(BuildActual(printer, snippets), | 2197 CHECK(CompareTexts(BuildActual(printer, snippets), |
| 2188 LoadGolden("Generators.golden"))); | 2198 LoadGolden("Generators.golden"))); |
| 2189 } | 2199 } |
| 2190 | 2200 |
| 2191 } // namespace interpreter | 2201 } // namespace interpreter |
| 2192 } // namespace internal | 2202 } // namespace internal |
| 2193 } // namespace v8 | 2203 } // namespace v8 |
| OLD | NEW |