OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Flags: --allow-natives-syntax |
| 6 |
| 7 function test(expected, f) { |
| 8 assertEquals(expected, f()); |
| 9 assertEquals(expected, f()); |
| 10 %OptimizeFunctionOnNextCall(f); |
| 11 assertEquals(expected, f()); |
| 12 assertEquals(expected, f()); |
| 13 } |
| 14 |
| 15 function f1() { return NaN; } |
| 16 test((0/0), f1); |
| 17 |
| 18 function f2() { return (0/0); } |
| 19 test((0/0), f2); |
| 20 |
| 21 function f3() { return (0/0) == (0/0); } |
| 22 test(false, f3); |
| 23 |
| 24 function f4() { return (0/0) == NaN; } |
| 25 test(false, f4); |
| 26 |
| 27 function f5() { return NaN == (0/0); } |
| 28 test(false, f5); |
| 29 |
| 30 function f6() { return "" + NaN; } |
| 31 test("NaN", f6); |
| 32 |
| 33 function f7() { return (0/0) === (0/0); } |
| 34 test(false, f7); |
| 35 |
| 36 function f8() { return (0/0) === NaN; } |
| 37 test(false, f8); |
| 38 |
| 39 function f9() { return NaN === (0/0); } |
| 40 test(false, f9); |
| 41 |
| 42 delete NaN; |
| 43 |
| 44 function g1() { return NaN; } |
| 45 test((0/0), g1); |
| 46 |
| 47 function g2() { return (0/0); } |
| 48 test((0/0), g2); |
| 49 |
| 50 function g3() { return (0/0) == (0/0); } |
| 51 test(false, g3); |
| 52 |
| 53 function g4() { return (0/0) == NaN; } |
| 54 test(false, g4); |
| 55 |
| 56 function g5() { return NaN == (0/0); } |
| 57 test(false, g5); |
| 58 |
| 59 function g6() { return "" + NaN; } |
| 60 test("NaN", g6); |
| 61 |
| 62 function g7() { return (0/0) === (0/0); } |
| 63 test(false, g7); |
| 64 |
| 65 function g8() { return (0/0) === NaN; } |
| 66 test(false, g8); |
| 67 |
| 68 function g9() { return NaN === (0/0); } |
| 69 test(false, g9); |
| 70 |
| 71 NaN = 111; |
| 72 |
| 73 function h1() { return NaN; } |
| 74 test((0/0), h1); |
| 75 |
| 76 function h2() { return (0/0); } |
| 77 test((0/0), h2); |
| 78 |
| 79 function h3() { return (0/0) == (0/0); } |
| 80 test(false, h3); |
| 81 |
| 82 function h4() { return (0/0) == NaN; } |
| 83 test(false, h4); |
| 84 |
| 85 function h5() { return NaN == (0/0); } |
| 86 test(false, h5); |
| 87 |
| 88 function h6() { return "" + NaN; } |
| 89 test("NaN", h6); |
| 90 |
| 91 function h7() { return (0/0) === (0/0); } |
| 92 test(false, h7); |
| 93 |
| 94 function h8() { return (0/0) === NaN; } |
| 95 test(false, h8); |
| 96 |
| 97 function h9() { return NaN === (0/0); } |
| 98 test(false, h9); |
| 99 |
| 100 // ------------- |
| 101 |
| 102 function k1() { return this.NaN; } |
| 103 test((0/0), k1); |
| 104 |
| 105 function k2() { return (0/0); } |
| 106 test((0/0), k2); |
| 107 |
| 108 function k3() { return (0/0) == (0/0); } |
| 109 test(false, k3); |
| 110 |
| 111 function k4() { return (0/0) == this.NaN; } |
| 112 test(false, k4); |
| 113 |
| 114 function k5() { return this.NaN == (0/0); } |
| 115 test(false, k5); |
| 116 |
| 117 function k6() { return "" + this.NaN; } |
| 118 test("NaN", k6); |
| 119 |
| 120 function k7() { return (0/0) === (0/0); } |
| 121 test(false, k7); |
| 122 |
| 123 function k8() { return (0/0) === this.NaN; } |
| 124 test(false, k8); |
| 125 |
| 126 function k9() { return this.NaN === (0/0); } |
| 127 test(false, k9); |
OLD | NEW |