a4c14089b0
We can make better inlining decisions in TurboFan if the CallIC will provide the feedback that it's seen multiple closures that share the same SharedFunctionInfo. This is not difficult to do, and it fixes some frustrating performance cliffs. Thanks to Bmeurer@chromium.org for the prototype CL, rebased from his project a year ago. Bug: v8:2206, v8:10100 Change-Id: I4248145ea67216f9a23efa175bbe90e7a9ee0ec4 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2054100 Commit-Queue: Michael Stanton <mvstanton@chromium.org> Reviewed-by: Georg Neis <neis@chromium.org> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Reviewed-by: Toon Verwaest <verwaest@chromium.org> Cr-Commit-Position: refs/heads/master@{#66512}
25 lines
714 B
JavaScript
25 lines
714 B
JavaScript
// Copyright 2020 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 --opt
|
|
|
|
function make_closure() { return () => { return 42; } }
|
|
%PrepareFunctionForOptimization(make_closure);
|
|
%PrepareFunctionForOptimization(make_closure());
|
|
|
|
function inline_polymorphic(f) {
|
|
let answer = f();
|
|
%TurbofanStaticAssert(answer == 42);
|
|
}
|
|
|
|
%PrepareFunctionForOptimization(inline_polymorphic);
|
|
inline_polymorphic(make_closure());
|
|
inline_polymorphic(make_closure());
|
|
%OptimizeFunctionOnNextCall(inline_polymorphic);
|
|
inline_polymorphic(make_closure());
|
|
|
|
try {
|
|
inline_polymorphic(3);
|
|
} catch(e) {}
|