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 1732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1743 } | 1743 } |
1744 | 1744 |
1745 TEST(GenerateTestUndetectable) { | 1745 TEST(GenerateTestUndetectable) { |
1746 InitializedIgnitionHandleScope scope; | 1746 InitializedIgnitionHandleScope scope; |
1747 BytecodeExpectationsPrinter printer(CcTest::isolate()); | 1747 BytecodeExpectationsPrinter printer(CcTest::isolate()); |
1748 const char* snippets[] = { | 1748 const char* snippets[] = { |
1749 "var obj_a = {val:1};\n" | 1749 "var obj_a = {val:1};\n" |
1750 "var b = 10;\n" | 1750 "var b = 10;\n" |
1751 "if (obj_a == null) { b = 20;}\n" | 1751 "if (obj_a == null) { b = 20;}\n" |
1752 "return b;\n", | 1752 "return b;\n", |
| 1753 |
1753 "var obj_a = {val:1};\n" | 1754 "var obj_a = {val:1};\n" |
1754 "var b = 10;\n" | 1755 "var b = 10;\n" |
1755 "if (obj_a == undefined) { b = 20;}\n" | 1756 "if (obj_a == undefined) { b = 20;}\n" |
1756 "return b;\n", | 1757 "return b;\n", |
| 1758 |
1757 "var obj_a = {val:1};\n" | 1759 "var obj_a = {val:1};\n" |
1758 "var b = 10;\n" | 1760 "var b = 10;\n" |
1759 "if (obj_a != null) { b = 20;}\n" | 1761 "if (obj_a != null) { b = 20;}\n" |
1760 "return b;\n", | 1762 "return b;\n", |
| 1763 |
1761 "var obj_a = {val:1};\n" | 1764 "var obj_a = {val:1};\n" |
1762 "var b = 10;\n" | 1765 "var b = 10;\n" |
1763 "if (obj_a != undefined) { b = 20;}\n" | 1766 "if (obj_a != undefined) { b = 20;}\n" |
| 1767 "return b;\n", |
| 1768 |
| 1769 "var obj_a = {val:1};\n" |
| 1770 "var b = 10;\n" |
| 1771 "if (obj_a === null) { b = 20;}\n" |
| 1772 "return b;\n", |
| 1773 |
| 1774 "var obj_a = {val:1};\n" |
| 1775 "var b = 10;\n" |
| 1776 "if (obj_a === undefined) { b = 20;}\n" |
| 1777 "return b;\n", |
| 1778 |
| 1779 "var obj_a = {val:1};\n" |
| 1780 "var b = 10;\n" |
| 1781 "if (obj_a !== null) { b = 20;}\n" |
| 1782 "return b;\n", |
| 1783 |
| 1784 "var obj_a = {val:1};\n" |
| 1785 "var b = 10;\n" |
| 1786 "if (obj_a !== undefined) { b = 20;}\n" |
1764 "return b;\n"}; | 1787 "return b;\n"}; |
1765 | 1788 |
1766 CHECK(CompareTexts(BuildActual(printer, snippets), | 1789 CHECK(CompareTexts(BuildActual(printer, snippets), |
1767 LoadGolden("GenerateTestUndetectable.golden"))); | 1790 LoadGolden("GenerateTestUndetectable.golden"))); |
1768 } | 1791 } |
1769 | 1792 |
1770 TEST(AssignmentsInBinaryExpression) { | 1793 TEST(AssignmentsInBinaryExpression) { |
1771 InitializedIgnitionHandleScope scope; | 1794 InitializedIgnitionHandleScope scope; |
1772 BytecodeExpectationsPrinter printer(CcTest::isolate()); | 1795 BytecodeExpectationsPrinter printer(CcTest::isolate()); |
1773 const char* snippets[] = { | 1796 const char* snippets[] = { |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2312 "})();\n", | 2335 "})();\n", |
2313 }; | 2336 }; |
2314 | 2337 |
2315 CHECK(CompareTexts(BuildActual(printer, snippets), | 2338 CHECK(CompareTexts(BuildActual(printer, snippets), |
2316 LoadGolden("SuperCallAndSpread.golden"))); | 2339 LoadGolden("SuperCallAndSpread.golden"))); |
2317 } | 2340 } |
2318 | 2341 |
2319 } // namespace interpreter | 2342 } // namespace interpreter |
2320 } // namespace internal | 2343 } // namespace internal |
2321 } // namespace v8 | 2344 } // namespace v8 |
OLD | NEW |