30
30
// TODO(ES6): properly activate extended mode
33
// Check that the following functions are optimizable.
34
var functions = [ f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14,
35
f15, f16, f17, f18, f19, f20, f21, f22, f23 ];
37
for (var i = 0; i < functions.length; ++i) {
38
var func = functions[i];
41
for (var j = 0; j < 10; ++j) {
44
%OptimizeFunctionOnNextCall(func);
46
assertTrue(%GetOptimizationStatus(func) != 2);
33
160
// Test that temporal dead zone semantics for function and block scoped
34
// ket bindings are handled by the optimizing compiler.
161
// let bindings are handled by the optimizing compiler.
163
function TestFunctionLocal(s) {
165
var func = eval("(function baz(){" + s + "; })");
168
for (var i = 0; i < 5; ++i) {
173
assertInstanceof(e, ReferenceError);
176
%OptimizeFunctionOnNextCall(func);
181
assertInstanceof(e, ReferenceError);
185
function TestFunctionContext(s) {
187
var func = eval("(function baz(){ " + s + "; (function() { x; }); })");
190
for (var i = 0; i < 5; ++i) {
196
assertInstanceof(e, ReferenceError);
200
%OptimizeFunctionOnNextCall(func);
207
assertInstanceof(e, ReferenceError);
211
function TestAll(s) {
212
TestFunctionLocal(s);
213
TestFunctionContext(s);
216
// Use before initialization in declaration statement.
217
TestAll('let x = x + 1');
218
TestAll('let x = x += 1');
219
TestAll('let x = x++');
220
TestAll('let x = ++x');
221
TestAll('const x = x + 1');
223
// Use before initialization in prior statement.
224
TestAll('x + 1; let x;');
225
TestAll('x = 1; let x;');
226
TestAll('x += 1; let x;');
227
TestAll('++x; let x;');
228
TestAll('x++; let x;');
229
TestAll('let y = x; const x = 1;');
36
232
function f(x, b) {
37
233
let y = (b ? y : x) + 42;