5133bbf68e
The JSInliningHeuristic is now completely heap-access free. JSInliner still includes Allow* guards and will be brokerized as a follow-up CL. R=neis@chromium.org Bug: v8:7790 Change-Id: I6df5d8515bb8bd8d512e8442e4f4dba9ebe9dd2e Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1528437 Reviewed-by: Georg Neis <neis@chromium.org> Commit-Queue: Maya Lekova <mslekova@chromium.org> Cr-Commit-Position: refs/heads/master@{#60680}
37 lines
662 B
JavaScript
37 lines
662 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 --opt --no-always-opt
|
|
|
|
function f() {
|
|
return 42;
|
|
}
|
|
|
|
function g() {
|
|
return 52;
|
|
}
|
|
|
|
%NeverOptimizeFunction(f);
|
|
|
|
function foo(cond) {
|
|
let func;
|
|
if (cond) {
|
|
func = f;
|
|
} else {
|
|
func = g;
|
|
}
|
|
func();
|
|
}
|
|
|
|
%PrepareFunctionForOptimization(foo);
|
|
foo(true);
|
|
foo(false);
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
foo(true);
|
|
foo(false);
|
|
|
|
// Just a sanitary check, we have a DCHECK in js-inlining.cc to make sure
|
|
// f is not inlined into foo.
|
|
assertUnoptimized(f);
|