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

Unified Diff: test/mjsunit/number-isnan-opt.js

Issue 2722483003: [turbofan] Introduce dedicated ObjectIsNaN operator. (Closed)
Patch Set: Use GetUpperBound. Add test cases. Created 3 years, 10 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/compiler/verifier.cc ('k') | test/unittests/compiler/js-builtin-reducer-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/number-isnan-opt.js
diff --git a/test/mjsunit/number-isnan-opt.js b/test/mjsunit/number-isnan-opt.js
new file mode 100644
index 0000000000000000000000000000000000000000..a5d4b9f3372c3737d4012484e6f6482f17a652f1
--- /dev/null
+++ b/test/mjsunit/number-isnan-opt.js
@@ -0,0 +1,55 @@
+// 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 foo(x) { return Number.isNaN(x); }
+
+ assertTrue(foo(+undefined));
+ assertFalse(foo(undefined));
+ %OptimizeFunctionOnNextCall(foo);
+ assertTrue(foo(+undefined));
+ assertFalse(foo(undefined));
+})();
+
+(function() {
+ function foo(x) { return Number.isNaN(+x); }
+
+ assertTrue(foo(+undefined));
+ assertFalse(foo(0));
+ %OptimizeFunctionOnNextCall(foo);
+ assertTrue(foo(+undefined));
+ assertFalse(foo(0));
+})();
+
+(function() {
+ function foo(x) { return Number.isNaN(x|0); }
+
+ assertFalse(foo(+undefined));
+ assertFalse(foo(0));
+ %OptimizeFunctionOnNextCall(foo);
+ assertFalse(foo(+undefined));
+ assertFalse(foo(0));
+})();
+
+(function() {
+ function foo(x) { return Number.isNaN("" + x); }
+
+ assertFalse(foo(undefined));
+ assertFalse(foo(0));
+ %OptimizeFunctionOnNextCall(foo);
+ assertFalse(foo(undefined));
+ assertFalse(foo(0));
+})();
+
+(function() {
+ function foo(x) { return Number.isNaN(0/0); }
+
+ assertTrue(foo());
+ assertTrue(foo());
+ %OptimizeFunctionOnNextCall(foo);
+ assertTrue(foo());
+ assertTrue(foo());
+})();
« no previous file with comments | « src/compiler/verifier.cc ('k') | test/unittests/compiler/js-builtin-reducer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698