[ignition] Remove code-size multiplier
Now that FCG is gone, we don't need to have a code-size multiplier to distinguish Ignition and FCG code sizes. Bug: v8:6409 Change-Id: I05e5fa2483bfc17e91de22736b66ad27a5aab49b Reviewed-on: https://chromium-review.googlesource.com/649149 Commit-Queue: Leszek Swirski <leszeks@chromium.org> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Cr-Commit-Position: refs/heads/master@{#47819}
This commit is contained in:
parent
79aee24581
commit
76960c052e
@ -61,12 +61,8 @@ class Interpreter {
|
|||||||
return reinterpret_cast<Address>(bytecode_dispatch_counters_table_.get());
|
return reinterpret_cast<Address>(bytecode_dispatch_counters_table_.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(ignition): Tune code size multiplier.
|
|
||||||
static const int kCodeSizeMultiplier = 24;
|
|
||||||
|
|
||||||
// The interrupt budget which should be used for the profiler counter.
|
// The interrupt budget which should be used for the profiler counter.
|
||||||
// TODO(ignition): Tune interrupt budget.
|
static const int kInterruptBudget = 144 * KB;
|
||||||
static const int kInterruptBudget = kCodeSizeMultiplier * 0x1800;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class SetupInterpreter;
|
friend class SetupInterpreter;
|
||||||
|
@ -21,36 +21,23 @@ namespace internal {
|
|||||||
// Number of times a function has to be seen on the stack before it is
|
// Number of times a function has to be seen on the stack before it is
|
||||||
// optimized.
|
// optimized.
|
||||||
static const int kProfilerTicksBeforeOptimization = 2;
|
static const int kProfilerTicksBeforeOptimization = 2;
|
||||||
// If the function optimization was disabled due to high deoptimization count,
|
|
||||||
// but the function is hot and has been seen on the stack this number of times,
|
|
||||||
// then we try to reenable optimization for this function.
|
|
||||||
static const int kProfilerTicksBeforeReenablingOptimization = 250;
|
|
||||||
// We only have one byte to store the number of ticks.
|
|
||||||
STATIC_ASSERT(kProfilerTicksBeforeOptimization < 256);
|
|
||||||
STATIC_ASSERT(kProfilerTicksBeforeReenablingOptimization < 256);
|
|
||||||
|
|
||||||
// The number of ticks required for optimizing a function increases with
|
// The number of ticks required for optimizing a function increases with
|
||||||
// the size of the bytecode. This is in addition to the
|
// the size of the bytecode. This is in addition to the
|
||||||
// kProfilerTicksBeforeOptimization required for any function.
|
// kProfilerTicksBeforeOptimization required for any function.
|
||||||
static const int kCodeSizeAllowancePerTick =
|
static const int kBytecodeSizeAllowancePerTick = 1200;
|
||||||
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 kOSRBytecodeSizeAllowanceBase = 240;
|
||||||
10 * interpreter::Interpreter::kCodeSizeMultiplier;
|
|
||||||
|
|
||||||
static const int kOSRCodeSizeAllowancePerTick =
|
static const int kOSRBytecodeSizeAllowancePerTick = 48;
|
||||||
2 * interpreter::Interpreter::kCodeSizeMultiplier;
|
|
||||||
|
|
||||||
// Maximum size in bytes of generated code for a function to be optimized
|
// Maximum size in bytes of generated code for a function to be optimized
|
||||||
// the very first time it is seen on the stack.
|
// the very first time it is seen on the stack.
|
||||||
static const int kMaxSizeEarlyOpt =
|
static const int kMaxBytecodeSizeForEarlyOpt = 120;
|
||||||
5 * interpreter::Interpreter::kCodeSizeMultiplier;
|
|
||||||
|
|
||||||
// Certain functions are simply too big to be worth optimizing.
|
// Certain functions are simply too big to be worth optimizing.
|
||||||
// We aren't using the code size multiplier here because there is no
|
static const int kMaxBytecodeSizeForOpt = 60 * KB;
|
||||||
// "kMaxSizeOpt" with which we would need to normalize.
|
|
||||||
static const int kMaxSizeOpt = 60 * KB;
|
|
||||||
|
|
||||||
#define OPTIMIZATION_REASON_LIST(V) \
|
#define OPTIMIZATION_REASON_LIST(V) \
|
||||||
V(DoNotOptimize, "do not optimize") \
|
V(DoNotOptimize, "do not optimize") \
|
||||||
@ -218,8 +205,8 @@ bool RuntimeProfiler::MaybeOSR(JSFunction* function, JavaScriptFrame* frame) {
|
|||||||
// Attempt OSR if we are still running interpreted code even though the
|
// Attempt OSR if we are still running interpreted code even though the
|
||||||
// the function has long been marked or even already been optimized.
|
// the function has long been marked or even already been optimized.
|
||||||
int64_t allowance =
|
int64_t allowance =
|
||||||
kOSRCodeSizeAllowanceBase +
|
kOSRBytecodeSizeAllowanceBase +
|
||||||
static_cast<int64_t>(ticks) * kOSRCodeSizeAllowancePerTick;
|
static_cast<int64_t>(ticks) * kOSRBytecodeSizeAllowancePerTick;
|
||||||
if (shared->bytecode_array()->Size() <= allowance) {
|
if (shared->bytecode_array()->Size() <= allowance) {
|
||||||
AttemptOnStackReplacement(frame);
|
AttemptOnStackReplacement(frame);
|
||||||
}
|
}
|
||||||
@ -233,17 +220,17 @@ OptimizationReason RuntimeProfiler::ShouldOptimize(JSFunction* function,
|
|||||||
SharedFunctionInfo* shared = function->shared();
|
SharedFunctionInfo* shared = function->shared();
|
||||||
int ticks = function->feedback_vector()->profiler_ticks();
|
int ticks = function->feedback_vector()->profiler_ticks();
|
||||||
|
|
||||||
if (shared->bytecode_array()->Size() > kMaxSizeOpt) {
|
if (shared->bytecode_array()->Size() > kMaxBytecodeSizeForOpt) {
|
||||||
return OptimizationReason::kDoNotOptimize;
|
return OptimizationReason::kDoNotOptimize;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ticks_for_optimization =
|
int ticks_for_optimization =
|
||||||
kProfilerTicksBeforeOptimization +
|
kProfilerTicksBeforeOptimization +
|
||||||
(shared->bytecode_array()->Size() / kCodeSizeAllowancePerTick);
|
(shared->bytecode_array()->Size() / kBytecodeSizeAllowancePerTick);
|
||||||
if (ticks >= ticks_for_optimization) {
|
if (ticks >= ticks_for_optimization) {
|
||||||
return OptimizationReason::kHotAndStable;
|
return OptimizationReason::kHotAndStable;
|
||||||
} else if (!any_ic_changed_ &&
|
} else if (!any_ic_changed_ &&
|
||||||
shared->bytecode_array()->Size() < kMaxSizeEarlyOpt) {
|
shared->bytecode_array()->Size() < kMaxBytecodeSizeForEarlyOpt) {
|
||||||
// If no IC was patched since the last tick and this function is very
|
// If no IC was patched since the last tick and this function is very
|
||||||
// small, optimistically optimize it now.
|
// small, optimistically optimize it now.
|
||||||
return OptimizationReason::kSmallFunction;
|
return OptimizationReason::kSmallFunction;
|
||||||
@ -256,7 +243,7 @@ OptimizationReason RuntimeProfiler::ShouldOptimize(JSFunction* function,
|
|||||||
PrintF("ICs changed]\n");
|
PrintF("ICs changed]\n");
|
||||||
} else {
|
} else {
|
||||||
PrintF(" too large for small function optimization: %d/%d]\n",
|
PrintF(" too large for small function optimization: %d/%d]\n",
|
||||||
shared->bytecode_array()->Size(), kMaxSizeEarlyOpt);
|
shared->bytecode_array()->Size(), kMaxBytecodeSizeForEarlyOpt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return OptimizationReason::kDoNotOptimize;
|
return OptimizationReason::kDoNotOptimize;
|
||||||
|
Loading…
Reference in New Issue
Block a user