v8/test/mjsunit/regress/regress-crbug-741078.js
Michael Starzinger 0a4ad44050 [turbofan] Fix inline JSGeneratorObject allocation.
This makes sure the inline allocation of generator objects only shrinks
initial maps when slack tracking is actually in progress. Shrinking all
unused properties unconditionally is bogus because instances using them
might have become unreachable and collected by the GC.

R=mvstanton@chromium.org
TEST=mjsunit/regress/regress-crbug-741078
BUG=chromium:741078

Change-Id: Iaf2f08a4fa82c820a945bf012d24c760a6b4f514
Reviewed-on: https://chromium-review.googlesource.com/567982
Reviewed-by: Michael Stanton <mvstanton@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46585}
2017-07-12 12:47:22 +00:00

20 lines
469 B
JavaScript

// Copyright 2017 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 --expose-gc
function* gen() {}
(function warmup() {
for (var i = 0; i < 100; ++i) {
var g = gen();
g.p = 42;
}
})();
gc(); // Ensure no instance alive.
gen(); // Still has unused fields.
%OptimizeFunctionOnNextCall(gen);
gen(); // Was shrunk, boom!