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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/crankshaft/hydrogen.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regress/regress-5802.js
diff --git a/test/mjsunit/regress/regress-5802.js b/test/mjsunit/regress/regress-5802.js
new file mode 100644
index 0000000000000000000000000000000000000000..6a84c09851f4998d9e79e046969a8eaacb857c4b
--- /dev/null
+++ b/test/mjsunit/regress/regress-5802.js
@@ -0,0 +1,117 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+(function() {
+ function eq(a, b) { return a == b; }
+
+ var o = { [Symbol.toPrimitive]: () => "o" };
+
+ assertTrue(eq(o, o));
+ %BaselineFunctionOnNextCall(eq);
+ assertTrue(eq(o, o));
+ %OptimizeFunctionOnNextCall(eq);
+ assertTrue(eq(o, o));
+ assertTrue(eq("o", o));
+ assertTrue(eq(o, "o"));
+ %OptimizeFunctionOnNextCall(eq);
+ assertTrue(eq(o, o));
+ assertTrue(eq("o", o));
+ assertTrue(eq(o, "o"));
+ assertOptimized(eq);
+})();
+
+(function() {
+ function ne(a, b) { return a != b; }
+
+ var o = { [Symbol.toPrimitive]: () => "o" };
+
+ assertFalse(ne(o, o));
+ %BaselineFunctionOnNextCall(ne);
+ assertFalse(ne(o, o));
+ %OptimizeFunctionOnNextCall(ne);
+ assertFalse(ne(o, o));
+ assertFalse(ne("o", o));
+ assertFalse(ne(o, "o"));
+ %OptimizeFunctionOnNextCall(ne);
+ assertFalse(ne(o, o));
+ assertFalse(ne("o", o));
+ assertFalse(ne(o, "o"));
+ assertOptimized(ne);
+})();
+
+(function() {
+ function eq(a, b) { return a == b; }
+
+ var a = {};
+ var b = {b};
+ var u = %GetUndetectable();
+
+ assertTrue(eq(a, a));
+ assertTrue(eq(b, b));
+ assertFalse(eq(a, b));
+ assertFalse(eq(b, a));
+ %BaselineFunctionOnNextCall(eq);
+ assertTrue(eq(a, a));
+ assertTrue(eq(b, b));
+ assertFalse(eq(a, b));
+ assertFalse(eq(b, a));
+ %OptimizeFunctionOnNextCall(eq);
+ assertTrue(eq(a, a));
+ assertTrue(eq(b, b));
+ assertFalse(eq(a, b));
+ assertFalse(eq(b, a));
+ assertTrue(eq(null, u));
+ assertTrue(eq(undefined, u));
+ assertTrue(eq(u, null));
+ assertTrue(eq(u, undefined));
+ %OptimizeFunctionOnNextCall(eq);
+ assertTrue(eq(a, a));
+ assertTrue(eq(b, b));
+ assertFalse(eq(a, b));
+ assertFalse(eq(b, a));
+ assertTrue(eq(null, u));
+ assertTrue(eq(undefined, u));
+ assertTrue(eq(u, null));
+ assertTrue(eq(u, undefined));
+ assertOptimized(eq);
+})();
+
+(function() {
+ function ne(a, b) { return a != b; }
+
+ var a = {};
+ var b = {b};
+ var u = %GetUndetectable();
+
+ assertFalse(ne(a, a));
+ assertFalse(ne(b, b));
+ assertTrue(ne(a, b));
+ assertTrue(ne(b, a));
+ %BaselineFunctionOnNextCall(ne);
+ assertFalse(ne(a, a));
+ assertFalse(ne(b, b));
+ assertTrue(ne(a, b));
+ assertTrue(ne(b, a));
+ %OptimizeFunctionOnNextCall(ne);
+ assertFalse(ne(a, a));
+ assertFalse(ne(b, b));
+ assertTrue(ne(a, b));
+ assertTrue(ne(b, a));
+ assertFalse(ne(null, u));
+ assertFalse(ne(undefined, u));
+ assertFalse(ne(u, null));
+ assertFalse(ne(u, undefined));
+ %OptimizeFunctionOnNextCall(ne);
+ assertFalse(ne(a, a));
+ assertFalse(ne(b, b));
+ assertTrue(ne(a, b));
+ assertTrue(ne(b, a));
+ assertFalse(ne(null, u));
+ assertFalse(ne(undefined, u));
+ assertFalse(ne(u, null));
+ assertFalse(ne(u, undefined));
+ assertOptimized(ne);
+})();
« 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