v8/test/mjsunit/compiler/regress-crbug-974476.js
Tobias Tebbi 92fdbc1c42 [turbofan] fix escape analysis bug: revisit phis
Bug: chromium:974476
Change-Id: I719812e93345b5f7aa9b1e4e594d02ae9a1c4208
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1664063
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62239}
2019-06-18 12:10:46 +00:00

35 lines
684 B
JavaScript

// Copyright 2019 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 use(x) { return x; }
%NeverOptimizeFunction(use);
function foo() {
let result = undefined;
(function () {
const a = {};
for (_ of [0]) {
const empty = [];
(function () {
result = 42;
for (_ of [0]) {
for (_ of [0]) {
use(empty);
}
}
result = a;
})();
}
})();
return result;
}
%PrepareFunctionForOptimization(foo);
foo();
foo();
%OptimizeFunctionOnNextCall(foo);
foo();