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

Side by Side Diff: test/mjsunit/harmony/block-let-crankshaft.js

Issue 8820015: Hydrogen support for context allocated harmony bindings. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « src/x64/lithium-x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 function f11() { 88 function f11() {
89 let x; 89 let x;
90 x = 1; 90 x = 1;
91 } 91 }
92 92
93 function f12() { 93 function f12() {
94 function x() {}; 94 function x() {};
95 x = 1; 95 x = 1;
96 } 96 }
97 97
98 function f13(x) {
fschneider 2011/12/08 12:58:54 Where is f13-f23 invoked and optimized? I don't se
Steven 2011/12/08 14:25:41 Done.
99 (function() { x; });
100 }
101
102 function f14() {
103 let x;
104 (function() { x; });
105 }
106
107 function f15() {
108 function x() {
109 }
110 (function() { x; });
111 }
112
113 function f16() {
114 let x = 1;
115 (function() { x; });
116 }
117
118 function f17() {
119 const x = 1;
120 (function() { x; });
121 }
122
123 function f18(x) {
124 return x;
125 (function() { x; });
126 }
127
128 function f19() {
129 let x;
130 return x;
131 (function() { x; });
132 }
133
134 function f20() {
135 function x() {
136 }
137 return x;
138 (function() { x; });
139 }
140
141 function f21(x) {
142 x = 1;
143 (function() { x; });
144 }
145
146 function f22() {
147 let x;
148 x = 1;
149 (function() { x; });
150 }
151
152 function f23() {
153 function x() { }
154 x = 1;
155 (function() { x; });
156 }
157
98 158
99 // Test that temporal dead zone semantics for function and block scoped 159 // Test that temporal dead zone semantics for function and block scoped
100 // let bindings are handled by the optimizing compiler. 160 // let bindings are handled by the optimizing compiler.
101 161
102 function TestFunctionLocal(s) { 162 function TestFunctionLocal(s) {
103 'use strict'; 163 'use strict';
104 var func = eval("(function baz(){" + s + "; })"); 164 var func = eval("(function baz(){" + s + "; })");
105 print("Testing:"); 165 print("Testing:");
106 print(func); 166 print(func);
107 for (var i = 0; i < 5; ++i) { 167 for (var i = 0; i < 5; ++i) {
108 try { 168 try {
109 func(); 169 func();
110 assertUnreachable(); 170 assertUnreachable();
111 } catch (e) { 171 } catch (e) {
112 assertInstanceof(e, ReferenceError); 172 assertInstanceof(e, ReferenceError);
113 } 173 }
114 } 174 }
115 %OptimizeFunctionOnNextCall(func); 175 %OptimizeFunctionOnNextCall(func);
116 try { 176 try {
117 func(); 177 func();
118 assertUnreachable(); 178 assertUnreachable();
119 } catch (e) { 179 } catch (e) {
120 assertInstanceof(e, ReferenceError); 180 assertInstanceof(e, ReferenceError);
121 } 181 }
122 } 182 }
123 183
184 function TestFunctionContext(s) {
185 'use strict';
186 var func = eval("(function baz(){ " + s + "; (function() { x; }); })");
187 print("Testing:");
188 print(func);
189 for (var i = 0; i < 5; ++i) {
190 print(i);
191 try {
192 func();
193 assertUnreachable();
194 } catch (e) {
195 assertInstanceof(e, ReferenceError);
196 }
197 }
198 print("optimize");
199 %OptimizeFunctionOnNextCall(func);
200 try {
201 print("call");
202 func();
203 assertUnreachable();
204 } catch (e) {
205 print("catch");
206 assertInstanceof(e, ReferenceError);
207 }
208 }
209
124 function TestAll(s) { 210 function TestAll(s) {
125 TestFunctionLocal(s); 211 TestFunctionLocal(s);
212 TestFunctionContext(s);
126 } 213 }
127 214
128 // Use before initialization in declaration statement. 215 // Use before initialization in declaration statement.
129 TestAll('let x = x + 1'); 216 TestAll('let x = x + 1');
130 TestAll('let x = x += 1'); 217 TestAll('let x = x += 1');
131 TestAll('let x = x++'); 218 TestAll('let x = x++');
132 TestAll('let x = ++x'); 219 TestAll('let x = ++x');
133 TestAll('const x = x + 1'); 220 TestAll('const x = x + 1');
134 221
135 // Use before initialization in prior statement. 222 // Use before initialization in prior statement.
(...skipping 29 matching lines...) Expand all
165 f(42, true); 252 f(42, true);
166 } catch (e) { 253 } catch (e) {
167 assertInstanceof(e, ReferenceError); 254 assertInstanceof(e, ReferenceError);
168 } 255 }
169 256
170 try { 257 try {
171 g(42, true); 258 g(42, true);
172 } catch (e) { 259 } catch (e) {
173 assertInstanceof(e, ReferenceError); 260 assertInstanceof(e, ReferenceError);
174 } 261 }
OLDNEW
« no previous file with comments | « src/x64/lithium-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698