Commit ef4957ba authored by Mythri's avatar Mythri Committed by Commit Bot

Set the number of ticks required to optimize based on function size.

Currently, the number of ticks to wait before optimizing is a constant (if
sufficient feedback is available). This cl changes it so that, larger
functions would have to wait longer for optimizing. The number of ticks
required scales linearly with the function size.

Bug: 
Change-Id: Id27bea715cf15960667cf63381b1cbe8dac94428
Reviewed-on: https://chromium-review.googlesource.com/538614
Commit-Queue: Mythri Alle <mythria@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46097}
parent 736693c4
...@@ -35,6 +35,12 @@ STATIC_ASSERT(kProfilerTicksBeforeOptimization < 256); ...@@ -35,6 +35,12 @@ STATIC_ASSERT(kProfilerTicksBeforeOptimization < 256);
STATIC_ASSERT(kProfilerTicksBeforeReenablingOptimization < 256); STATIC_ASSERT(kProfilerTicksBeforeReenablingOptimization < 256);
STATIC_ASSERT(kTicksWhenNotEnoughTypeInfo < 256); STATIC_ASSERT(kTicksWhenNotEnoughTypeInfo < 256);
// The number of ticks required for optimizing a function increases with
// the size of the bytecode. This is in addition to the
// kProfilerTicksBeforeOptimization required for any function.
static const int kCodeSizeAllowancePerTickIgnition =
50 * interpreter::Interpreter::kCodeSizeMultiplier;
// Maximum size in bytes of generate code for a function to allow OSR. // Maximum size in bytes of generate code for a function to allow OSR.
static const int kOSRCodeSizeAllowanceBase = static const int kOSRCodeSizeAllowanceBase =
100 * FullCodeGenerator::kCodeSizeMultiplier; 100 * FullCodeGenerator::kCodeSizeMultiplier;
...@@ -366,7 +372,10 @@ OptimizationReason RuntimeProfiler::ShouldOptimizeIgnition( ...@@ -366,7 +372,10 @@ OptimizationReason RuntimeProfiler::ShouldOptimizeIgnition(
return OptimizationReason::kDoNotOptimize; return OptimizationReason::kDoNotOptimize;
} }
if (ticks >= kProfilerTicksBeforeOptimization) { int ticks_for_optimization =
kProfilerTicksBeforeOptimization +
(shared->bytecode_array()->Size() / kCodeSizeAllowancePerTickIgnition);
if (ticks >= ticks_for_optimization) {
int typeinfo, generic, total, type_percentage, generic_percentage; int typeinfo, generic, total, type_percentage, generic_percentage;
GetICCounts(function, &typeinfo, &generic, &total, &type_percentage, GetICCounts(function, &typeinfo, &generic, &total, &type_percentage,
&generic_percentage); &generic_percentage);
......
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