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

Side by Side Diff: test/mjsunit/global-undefined.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-strict.js ('k') | test/mjsunit/global-undefined-strict.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
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 testThrows(f) {
16 assertThrows(f);
17 assertThrows(f);
18 %OptimizeFunctionOnNextCall(f);
19 assertThrows(f);
20 assertThrows(f);
21 }
22
23 function f1() { return undefined; }
24 test(void 0, f1);
25
26 function f2() { return void 0; }
27 test(void 0, f2);
28
29 function f3() { return void 0 == void 0; }
30 test(true, f3);
31
32 function f4() { return void 0 == undefined; }
33 test(true, f4);
34
35 function f5() { return undefined == void 0; }
36 test(true, f5);
37
38 function f6() { return "" + undefined; }
39 test("undefined", f6);
40
41 function f7() { return void 0 === void 0; }
42 test(true, f7);
43
44 function f8() { return void 0 === undefined; }
45 test(true, f8);
46
47 function f9() { return undefined === void 0; }
48 test(true, f9);
49
50 delete undefined;
51
52 function g1() { return undefined; }
53 test(void 0, g1);
54
55 function g2() { return void 0; }
56 test(void 0, g2);
57
58 function g3() { return void 0 == void 0; }
59 test(true, g3);
60
61 function g4() { return void 0 == undefined; }
62 test(true, g4);
63
64 function g5() { return undefined == void 0; }
65 test(true, g5);
66
67 function g6() { return "" + undefined; }
68 test("undefined", g6);
69
70 function g7() { return void 0 === void 0; }
71 test(true, g7);
72
73 function g8() { return void 0 === undefined; }
74 test(true, g8);
75
76 function g9() { return undefined === void 0; }
77 test(true, g9);
78
79 undefined = 111;
80
81 function h1() { return undefined; }
82 test(void 0, h1);
83
84 function h2() { return void 0; }
85 test(void 0, h2);
86
87 function h3() { return void 0 == void 0; }
88 test(true, h3);
89
90 function h4() { return void 0 == undefined; }
91 test(true, h4);
92
93 function h5() { return undefined == void 0; }
94 test(true, h5);
95
96 function h6() { return "" + undefined; }
97 test("undefined", h6);
98
99 function h7() { return void 0 === void 0; }
100 test(true, h7);
101
102 function h8() { return void 0 === undefined; }
103 test(true, h8);
104
105 function h9() { return undefined === void 0; }
106 test(true, h9);
107
108 // -------------
109
110 function k1() { return this.undefined; }
111 test(void 0, k1);
112
113 function k2() { return void 0; }
114 test(void 0, k2);
115
116 function k3() { return void 0 == void 0; }
117 test(true, k3);
118
119 function k4() { return void 0 == this.undefined; }
120 test(true, k4);
121
122 function k5() { return this.undefined == void 0; }
123 test(true, k5);
124
125 function k6() { return "" + this.undefined; }
126 test("undefined", k6);
127
128 function k7() { return void 0 === void 0; }
129 test(true, k7);
130
131 function k8() { return void 0 === this.undefined; }
132 test(true, k8);
133
134 function k9() { return this.undefined === void 0; }
135 test(true, k9);
136
137 // -------------
138
139 function m1() { return undefined.x; }
140 testThrows(m1);
141
142 function m2() { return undefined.undefined; }
143 testThrows(m2);
144
145 function m3() { return (void 0).x; }
146 testThrows(m3);
147
148 function m4() { return (void 0).undefined; }
149 testThrows(m4);
OLDNEW
« no previous file with comments | « test/mjsunit/global-nan-strict.js ('k') | test/mjsunit/global-undefined-strict.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698