0010be5b23
Currently we count optimizations to decide to disable optimization, and count deopts to detect this decision and allow re-enabling optimizations after a while. However, throwing out TurboFan OSR code and GC optimized code evictions do not count as deopts, which means that the optimization count increases without increasing the deopt count. This increased optimization count disables further optimization -- which is bad, because these are not "true" deopts -- and can stop the optimization from being re-enabled, because the deopt count can't go high enough. Instead, we now only ever look at deopts to disable/re-enable optimization, and opt counts are only used for naming log files and in tests. Change-Id: I0c7d6be497545449a38cf952cd2f007ee51982ba Reviewed-on: https://chromium-review.googlesource.com/468811 Commit-Queue: Leszek Swirski <leszeks@chromium.org> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Reviewed-by: Jaroslav Sevcik <jarin@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org> Cr-Commit-Position: refs/heads/master@{#44647}
35 lines
815 B
JavaScript
35 lines
815 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 --crankshaft --turbo --no-always-opt
|
|
|
|
function foo(i, deopt = false) {
|
|
if (i == 0) {
|
|
if (deopt) {
|
|
// Trigger an eager deopt.
|
|
%_DeoptimizeNow();
|
|
}
|
|
} else {
|
|
foo(i - 1, deopt);
|
|
}
|
|
}
|
|
|
|
assertEquals(0, %GetOptimizationCount(foo));
|
|
assertEquals(0, %GetDeoptCount(foo));
|
|
|
|
foo(10);
|
|
foo(10);
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
foo(10);
|
|
|
|
assertOptimized(foo);
|
|
assertEquals(1, %GetOptimizationCount(foo));
|
|
assertEquals(0, %GetDeoptCount(foo));
|
|
|
|
foo(10, true);
|
|
|
|
assertUnoptimized(foo);
|
|
assertEquals(1, %GetOptimizationCount(foo));
|
|
assertEquals(1, %GetDeoptCount(foo));
|