Commit 5e431b98 authored by Jakob Gruber's avatar Jakob Gruber Committed by V8 LUCI CQ

[osr] Fix an invalid DCHECK in %CompileOptimizedOSR

This particular branch in CompileOptimizedOSR relies on a precise
invocation count at counts 0 and 1. The invocation count is unreliable
not only in the previously described situation (--always-opt), but also
e.g. when forcing optimization on the first execution through other
means like %OptimizeFunctionOnNextCall. Let's simply rewrite the
condition to explicitly exclude kIsInProgress.

Fixed: chromium:1314536
Change-Id: I27432f689c866bad3b407df7bbf276ec32c25c0d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3578644Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Jakob Linke <jgruber@chromium.org>
Auto-Submit: Jakob Linke <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79913}
parent 4e046cea
......@@ -307,11 +307,8 @@ RUNTIME_FUNCTION(Runtime_CompileOptimizedOSR) {
}
if (function->feedback_vector().invocation_count() <= 1 &&
!IsNone(function->tiering_state()) && V8_LIKELY(!FLAG_always_opt)) {
// Note: Why consider FLAG_always_opt? Because it makes invocation_count
// unreliable at low counts: the first entry may already be optimized, and
// thus won't increment invocation_count.
//
!IsNone(function->tiering_state()) &&
!IsInProgress(function->tiering_state())) {
// With lazy feedback allocation we may not have feedback for the
// initial part of the function that was executed before we allocated a
// feedback vector. Reset any tiering states for such functions.
......@@ -321,7 +318,6 @@ RUNTIME_FUNCTION(Runtime_CompileOptimizedOSR) {
// feedback. We cannot do this currently since we OSR only after we mark
// a function for optimization. We should instead change it to be based
// based on number of ticks.
DCHECK(!IsInProgress(function->tiering_state()));
function->reset_tiering_state();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment