Commit 9efe315e authored by Mythri A's avatar Mythri A Committed by Commit Bot

Mark functions for optimization only on bytecode budget interrupts

We used to mark functions for optimization on any interrupt. This sometimes
causes functions to OSR when not needed. The implementation was such because
we didn't have a different runtime function to distinguish bytecode budget
interrupts from other interrupts. For lazy feedback allocation we added a
new runtime function for bytecode budget interrupts so it makes it easier
to actually mark functions only when needed.

This also includes a fix to reduce the stack limits for interrupts when
entering a scope that allows interrupts from a postponed interrupt scope.

Bug: chromium:993061
Change-Id: Iaf7b4dccb7a503e5b6bfcbb993bc7482aa593955
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1829218Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Commit-Queue: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64048}
parent 3b9f8155
......@@ -87,6 +87,8 @@ void StackGuard::PushInterruptsScope(InterruptsScope* scope) {
current->intercepted_flags_ &= ~scope->intercept_mask_;
}
thread_local_.interrupt_flags_ |= restored_flags;
if (has_pending_interrupts(access)) set_interrupt_limits(access);
}
if (!has_pending_interrupts(access)) reset_limits(access);
// Add scope to the chain.
......@@ -305,8 +307,6 @@ Object StackGuard::HandleInterrupts() {
}
isolate_->counters()->stack_interrupts()->Increment();
isolate_->counters()->runtime_profiler_ticks()->Increment();
isolate_->runtime_profiler()->MarkCandidatesForOptimization();
return ReadOnlyRoots(isolate_).undefined_value();
}
......
......@@ -14,6 +14,7 @@
#include "src/execution/frames-inl.h"
#include "src/execution/isolate-inl.h"
#include "src/execution/messages.h"
#include "src/execution/runtime-profiler.h"
#include "src/handles/maybe-handles.h"
#include "src/init/bootstrapper.h"
#include "src/logging/counters.h"
......@@ -296,10 +297,11 @@ RUNTIME_FUNCTION(Runtime_BytecodeBudgetInterrupt) {
function->feedback_vector().set_invocation_count(1);
return ReadOnlyRoots(isolate).undefined_value();
}
// Handle interrupts.
{
SealHandleScope shs(isolate);
return isolate->stack_guard()->HandleInterrupts();
isolate->counters()->runtime_profiler_ticks()->Increment();
isolate->runtime_profiler()->MarkCandidatesForOptimization();
return ReadOnlyRoots(isolate).undefined_value();
}
}
......
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