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

Side by Side Diff: test/mjsunit/global-nan-strict.js

Issue 1077343002: [turbofan] Optimize loads of global constants in JSTypedLowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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 | « test/mjsunit/global-nan.js ('k') | test/mjsunit/global-undefined.js » ('j') | 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 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 "use strict";
7
8 function test(expected, f) {
9 assertEquals(expected, f());
10 assertEquals(expected, f());
11 %OptimizeFunctionOnNextCall(f);
12 assertEquals(expected, f());
13 assertEquals(expected, f());
14 }
15
16 function testThrows(f) {
17 assertThrows(f);
18 assertThrows(f);
19 %OptimizeFunctionOnNextCall(f);
20 assertThrows(f);
21 assertThrows(f);
22 }
23
24 function f1() { return NaN; }
25 test((0/0), f1);
26
27 function f2() { return (0/0); }
28 test((0/0), f2);
29
30 function f3() { return (0/0) == (0/0); }
31 test(false, f3);
32
33 function f4() { return (0/0) == NaN; }
34 test(false, f4);
35
36 function f5() { return NaN == (0/0); }
37 test(false, f5);
38
39 function f6() { return "" + NaN; }
40 test("NaN", f6);
41
42 function f7() { return (0/0) === (0/0); }
43 test(false, f7);
44
45 function f8() { return (0/0) === NaN; }
46 test(false, f8);
47
48 function f9() { return NaN === (0/0); }
49 test(false, f9);
50
51 // ----
52
53 function g1() { return NaN; }
54 test((0/0), g1);
55
56 function g2() { return (0/0); }
57 test((0/0), g2);
58
59 function g3() { return (0/0) == (0/0); }
60 test(false, g3);
61
62 function g4() { return (0/0) == NaN; }
63 test(false, g4);
64
65 function g5() { return NaN == (0/0); }
66 test(false, g5);
67
68 function g6() { return "" + NaN; }
69 test("NaN", g6);
70
71 function g7() { return (0/0) === (0/0); }
72 test(false, g7);
73
74 function g8() { return (0/0) === NaN; }
75 test(false, g8);
76
77 function g9() { return NaN === (0/0); }
78 test(false, g9);
79
80 testThrows(function() { NaN = 111; });
81
82 function h1() { return NaN; }
83 test((0/0), h1);
84
85 function h2() { return (0/0); }
86 test((0/0), h2);
87
88 function h3() { return (0/0) == (0/0); }
89 test(false, h3);
90
91 function h4() { return (0/0) == NaN; }
92 test(false, h4);
93
94 function h5() { return NaN == (0/0); }
95 test(false, h5);
96
97 function h6() { return "" + NaN; }
98 test("NaN", h6);
99
100 function h7() { return (0/0) === (0/0); }
101 test(false, h7);
102
103 function h8() { return (0/0) === NaN; }
104 test(false, h8);
105
106 function h9() { return NaN === (0/0); }
107 test(false, h9);
108
109 // -------------
110
111 function k1() { return this.NaN; }
112 testThrows(k1);
113
114 function k2() { return (0/0); }
115 test((0/0), k2);
116
117 function k3() { return (0/0) == (0/0); }
118 test(false, k3);
119
120 function k4() { return (0/0) == this.NaN; }
121 testThrows(k4);
122
123 function k5() { return this.NaN == (0/0); }
124 testThrows(k5);
125
126 function k6() { return "" + this.NaN; }
127 testThrows(k6);
128
129 function k7() { return (0/0) === (0/0); }
130 test(false, k7);
131
132 function k8() { return (0/0) === this.NaN; }
133 testThrows(k8);
134
135 function k9() { return this.NaN === (0/0); }
136 testThrows(k9);
OLDNEW
« no previous file with comments | « test/mjsunit/global-nan.js ('k') | test/mjsunit/global-undefined.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698