OLD | NEW |
(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 foo(x) { return Number.isNaN(x); } |
| 9 |
| 10 assertTrue(foo(+undefined)); |
| 11 assertFalse(foo(undefined)); |
| 12 %OptimizeFunctionOnNextCall(foo); |
| 13 assertTrue(foo(+undefined)); |
| 14 assertFalse(foo(undefined)); |
| 15 })(); |
| 16 |
| 17 (function() { |
| 18 function foo(x) { return Number.isNaN(+x); } |
| 19 |
| 20 assertTrue(foo(+undefined)); |
| 21 assertFalse(foo(0)); |
| 22 %OptimizeFunctionOnNextCall(foo); |
| 23 assertTrue(foo(+undefined)); |
| 24 assertFalse(foo(0)); |
| 25 })(); |
| 26 |
| 27 (function() { |
| 28 function foo(x) { return Number.isNaN(x|0); } |
| 29 |
| 30 assertFalse(foo(+undefined)); |
| 31 assertFalse(foo(0)); |
| 32 %OptimizeFunctionOnNextCall(foo); |
| 33 assertFalse(foo(+undefined)); |
| 34 assertFalse(foo(0)); |
| 35 })(); |
| 36 |
| 37 (function() { |
| 38 function foo(x) { return Number.isNaN("" + x); } |
| 39 |
| 40 assertFalse(foo(undefined)); |
| 41 assertFalse(foo(0)); |
| 42 %OptimizeFunctionOnNextCall(foo); |
| 43 assertFalse(foo(undefined)); |
| 44 assertFalse(foo(0)); |
| 45 })(); |
| 46 |
| 47 (function() { |
| 48 function foo(x) { return Number.isNaN(0/0); } |
| 49 |
| 50 assertTrue(foo()); |
| 51 assertTrue(foo()); |
| 52 %OptimizeFunctionOnNextCall(foo); |
| 53 assertTrue(foo()); |
| 54 assertTrue(foo()); |
| 55 })(); |
OLD | NEW |