c6a16c10dd
With bytecode flushing and lazy feedback allocation, we need to call %PrepareForOptimization before we call %OptimizeFunctionOnNextCall, ideally after declaring the function. Bug: v8:8801, v8:8394, v8:9183 Change-Id: I3fb257282a30f6526a376a3afdedb44786320d34 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1648255 Commit-Queue: Mathias Bynens <mathias@chromium.org> Reviewed-by: Maya Lekova <mslekova@chromium.org> Reviewed-by: Mythri Alle <mythria@chromium.org> Cr-Commit-Position: refs/heads/master@{#62119}
40 lines
658 B
JavaScript
40 lines
658 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 --expose-gc --verify-heap
|
|
|
|
function A() {}
|
|
|
|
function g1() {
|
|
var obj = new A();
|
|
obj.v0 = 0;
|
|
obj.v1 = 0;
|
|
obj.v2 = 0;
|
|
obj.v3 = 0;
|
|
obj.v4 = 0;
|
|
obj.v5 = 0;
|
|
obj.v6 = 0;
|
|
obj.v7 = 0;
|
|
obj.v8 = 0;
|
|
obj.v9 = 0;
|
|
return obj;
|
|
}
|
|
|
|
function g2() {
|
|
return new A();
|
|
};
|
|
%PrepareFunctionForOptimization(g2);
|
|
var o = g1();
|
|
%OptimizeFunctionOnNextCall(g2);
|
|
g2();
|
|
o = null;
|
|
gc();
|
|
|
|
for (var i = 0; i < 20; i++) {
|
|
var o = new A();
|
|
}
|
|
g2();
|
|
|
|
gc(); // Boom!
|