Commit bd9609a0 authored by Mythri A's avatar Mythri A Committed by Commit Bot

[turboprop] Change heuristics for OSRing in TurboProp

Change the heuristics for OSRing in TurboProp. Currently we OSR if
a funciton is already optimized / marked for optimization but is still
running optimized code. Since TurboProp optimizes much earlier than
TurboFan using the same heuristics would cause us to OSR more often
than required. This cl adds an additional check on the number of ticks
to make sure the function is hot enough for OSRing.

Bug: v8:9684
Change-Id: I7a1c8229182a928fd85efb23e2d385413c5209ef
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2339098
Commit-Queue: Mythri Alle <mythria@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#69252}
parent 82fc74c9
......@@ -38,6 +38,14 @@ static const int kOSRBytecodeSizeAllowancePerTick = 48;
// the very first time it is seen on the stack.
static const int kMaxBytecodeSizeForEarlyOpt = 90;
// Number of times a function has to be seen on the stack before it is
// OSRed in TurboProp
// This value is chosen so TurboProp OSRs at similar time as TurboFan. The
// current interrupt budger of TurboFan is approximately 10 times that of
// TurboProp and we wait for 3 ticks (2 for marking for optimization and an
// additional tick to mark it for OSR) and hence this is set to 3 * 10.
static const int kProfilerTicksForTurboPropOSR = 3 * 10;
#define OPTIMIZATION_REASON_LIST(V) \
V(DoNotOptimize, "do not optimize") \
V(HotAndStable, "hot and stable") \
......@@ -158,6 +166,12 @@ bool RuntimeProfiler::MaybeOSR(JSFunction function, InterpretedFrame* frame) {
// TODO(rmcilroy): Also ensure we only OSR top-level code if it is smaller
// than kMaxToplevelSourceSize.
// Turboprop optimizes quite early. So don't attempt to OSR if the loop isn't
// hot enough.
if (FLAG_turboprop && ticks < kProfilerTicksForTurboPropOSR) {
return false;
}
if (function.IsMarkedForOptimization() ||
function.IsMarkedForConcurrentOptimization() ||
function.HasOptimizedCode()) {
......
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