v8/test/mjsunit/regress/regress-v8-5666.js
bmeurer 7869136716 [compiler] Improve let+const decision in AstNumbering.
Incooperate suggestion from adamk@ to only sent lexical variables to
I+TF that require explicit initialization, i.e. don't send named
function expressions to I+TF. This should recover most of the regression
now.

Also introduce a regression test for the original let issue.

BUG=chromium:670691,v8:5666
R=adamk@chromium.org,yangguo@chromium.org

Review-Url: https://codereview.chromium.org/2556663002
Cr-Commit-Position: refs/heads/master@{#41507}
2016-12-06 06:13:16 +00:00

19 lines
395 B
JavaScript

// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax
function foo(j) {
for (var i = 0; i < j + 1; i++) {
if (i === j) %OptimizeOsr();
}
let k = 1
}
foo(1000);
foo(1000);
%OptimizeFunctionOnNextCall(foo);
foo(-1);
assertOptimized(foo);