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

Side by Side Diff: test/mjsunit/regress/regress-5802.js

Issue 2612213002: [crankshaft] Fix abstract equality for receivers. (Closed)
Patch Set: Created 3 years, 11 months 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
« no previous file with comments | « src/crankshaft/hydrogen.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --allow-natives-syntax
6
7 (function() {
8 function eq(a, b) { return a == b; }
9
10 var o = { [Symbol.toPrimitive]: () => "o" };
11
12 assertTrue(eq(o, o));
13 %BaselineFunctionOnNextCall(eq);
14 assertTrue(eq(o, o));
15 %OptimizeFunctionOnNextCall(eq);
16 assertTrue(eq(o, o));
17 assertTrue(eq("o", o));
18 assertTrue(eq(o, "o"));
19 %OptimizeFunctionOnNextCall(eq);
20 assertTrue(eq(o, o));
21 assertTrue(eq("o", o));
22 assertTrue(eq(o, "o"));
23 assertOptimized(eq);
24 })();
25
26 (function() {
27 function ne(a, b) { return a != b; }
28
29 var o = { [Symbol.toPrimitive]: () => "o" };
30
31 assertFalse(ne(o, o));
32 %BaselineFunctionOnNextCall(ne);
33 assertFalse(ne(o, o));
34 %OptimizeFunctionOnNextCall(ne);
35 assertFalse(ne(o, o));
36 assertFalse(ne("o", o));
37 assertFalse(ne(o, "o"));
38 %OptimizeFunctionOnNextCall(ne);
39 assertFalse(ne(o, o));
40 assertFalse(ne("o", o));
41 assertFalse(ne(o, "o"));
42 assertOptimized(ne);
43 })();
44
45 (function() {
46 function eq(a, b) { return a == b; }
47
48 var a = {};
49 var b = {b};
50 var u = %GetUndetectable();
51
52 assertTrue(eq(a, a));
53 assertTrue(eq(b, b));
54 assertFalse(eq(a, b));
55 assertFalse(eq(b, a));
56 %BaselineFunctionOnNextCall(eq);
57 assertTrue(eq(a, a));
58 assertTrue(eq(b, b));
59 assertFalse(eq(a, b));
60 assertFalse(eq(b, a));
61 %OptimizeFunctionOnNextCall(eq);
62 assertTrue(eq(a, a));
63 assertTrue(eq(b, b));
64 assertFalse(eq(a, b));
65 assertFalse(eq(b, a));
66 assertTrue(eq(null, u));
67 assertTrue(eq(undefined, u));
68 assertTrue(eq(u, null));
69 assertTrue(eq(u, undefined));
70 %OptimizeFunctionOnNextCall(eq);
71 assertTrue(eq(a, a));
72 assertTrue(eq(b, b));
73 assertFalse(eq(a, b));
74 assertFalse(eq(b, a));
75 assertTrue(eq(null, u));
76 assertTrue(eq(undefined, u));
77 assertTrue(eq(u, null));
78 assertTrue(eq(u, undefined));
79 assertOptimized(eq);
80 })();
81
82 (function() {
83 function ne(a, b) { return a != b; }
84
85 var a = {};
86 var b = {b};
87 var u = %GetUndetectable();
88
89 assertFalse(ne(a, a));
90 assertFalse(ne(b, b));
91 assertTrue(ne(a, b));
92 assertTrue(ne(b, a));
93 %BaselineFunctionOnNextCall(ne);
94 assertFalse(ne(a, a));
95 assertFalse(ne(b, b));
96 assertTrue(ne(a, b));
97 assertTrue(ne(b, a));
98 %OptimizeFunctionOnNextCall(ne);
99 assertFalse(ne(a, a));
100 assertFalse(ne(b, b));
101 assertTrue(ne(a, b));
102 assertTrue(ne(b, a));
103 assertFalse(ne(null, u));
104 assertFalse(ne(undefined, u));
105 assertFalse(ne(u, null));
106 assertFalse(ne(u, undefined));
107 %OptimizeFunctionOnNextCall(ne);
108 assertFalse(ne(a, a));
109 assertFalse(ne(b, b));
110 assertTrue(ne(a, b));
111 assertTrue(ne(b, a));
112 assertFalse(ne(null, u));
113 assertFalse(ne(undefined, u));
114 assertFalse(ne(u, null));
115 assertFalse(ne(u, undefined));
116 assertOptimized(ne);
117 })();
OLDNEW
« no previous file with comments | « src/crankshaft/hydrogen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698