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

Side by Side Diff: test/cctest/interpreter/test-bytecode-generator.cc

Issue 2547043002: [Interpreter] Optimize equality check with null/undefined with a check on the map. (Closed)
Patch Set: Address comments from Ross. Created 4 years 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 unified diff | Download patch
OLDNEW
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 1724 matching lines...) Expand 10 before | Expand all | Expand 10 after
1735 1735
1736 "var ld_a = 1;\n" 1736 "var ld_a = 1;\n"
1737 " ld_a = ld_a + ld_a;\n" 1737 " ld_a = ld_a + ld_a;\n"
1738 " return ld_a;\n", 1738 " return ld_a;\n",
1739 }; 1739 };
1740 1740
1741 CHECK(CompareTexts(BuildActual(printer, snippets), 1741 CHECK(CompareTexts(BuildActual(printer, snippets),
1742 LoadGolden("RemoveRedundantLdar.golden"))); 1742 LoadGolden("RemoveRedundantLdar.golden")));
1743 } 1743 }
1744 1744
1745 TEST(GenerateTestUndetectable) {
1746 InitializedIgnitionHandleScope scope;
1747 BytecodeExpectationsPrinter printer(CcTest::isolate());
1748 const char* snippets[] = {
1749 "var obj_a = {val:1};\n"
1750 "var b = 10;\n"
1751 "if (obj_a == null) { b = 20;}\n"
1752 "return b;\n",
1753 "var obj_a = {val:1};\n"
1754 "var b = 10;\n"
1755 "if (obj_a == undefined) { b = 20;}\n"
1756 "return b;\n",
1757 "var obj_a = {val:1};\n"
1758 "var b = 10;\n"
1759 "if (obj_a != null) { b = 20;}\n"
1760 "return b;\n",
1761 "var obj_a = {val:1};\n"
1762 "var b = 10;\n"
1763 "if (obj_a != undefined) { b = 20;}\n"
1764 "return b;\n"};
1765
1766 CHECK(CompareTexts(BuildActual(printer, snippets),
1767 LoadGolden("GenerateTestUndetectable.golden")));
1768 }
1769
1745 TEST(AssignmentsInBinaryExpression) { 1770 TEST(AssignmentsInBinaryExpression) {
1746 InitializedIgnitionHandleScope scope; 1771 InitializedIgnitionHandleScope scope;
1747 BytecodeExpectationsPrinter printer(CcTest::isolate()); 1772 BytecodeExpectationsPrinter printer(CcTest::isolate());
1748 const char* snippets[] = { 1773 const char* snippets[] = {
1749 "var x = 0, y = 1;\n" 1774 "var x = 0, y = 1;\n"
1750 "return (x = 2, y = 3, x = 4, y = 5);\n", 1775 "return (x = 2, y = 3, x = 4, y = 5);\n",
1751 1776
1752 "var x = 55;\n" 1777 "var x = 55;\n"
1753 "var y = (x = 100);\n" 1778 "var y = (x = 100);\n"
1754 "return y;\n", 1779 "return y;\n",
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
2242 "foo.f(foo, foo.x);\n", 2267 "foo.f(foo, foo.x);\n",
2243 }; 2268 };
2244 2269
2245 CHECK(CompareTexts(BuildActual(printer, snippets), 2270 CHECK(CompareTexts(BuildActual(printer, snippets),
2246 LoadGolden("Modules.golden"))); 2271 LoadGolden("Modules.golden")));
2247 } 2272 }
2248 2273
2249 } // namespace interpreter 2274 } // namespace interpreter
2250 } // namespace internal 2275 } // namespace internal
2251 } // namespace v8 2276 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/interpreter/bytecode_expectations/Generators.golden ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698