Bug 1266676 - IonMonkey: Compile smaller functions faster, r=jandem

This commit is contained in:
Hannes Verschore 2016-04-22 11:34:00 -04:00
parent 6af4f44564
commit 7e35e0201f
4 changed files with 30 additions and 0 deletions

View File

@ -49,6 +49,7 @@ OptimizationInfo::initNormalOptimizationInfo()
scalarReplacement_ = true;
smallFunctionMaxInlineDepth_ = 10;
compilerWarmUpThreshold_ = CompilerWarmupThreshold;
compilerSmallFunctionWarmUpThreshold_ = CompilerSmallFunctionWarmupThreshold;
inliningWarmUpThresholdFactor_ = 0.125;
inliningRecompileThresholdFactor_ = 4;
}
@ -86,6 +87,12 @@ OptimizationInfo::compilerWarmUpThreshold(JSScript* script, jsbytecode* pc) cons
if (JitOptions.forcedDefaultIonWarmUpThreshold.isSome())
warmUpThreshold = JitOptions.forcedDefaultIonWarmUpThreshold.ref();
if (JitOptions.isSmallFunction(script)) {
warmUpThreshold = compilerSmallFunctionWarmUpThreshold_;
if (JitOptions.forcedDefaultIonSmallFunctionWarmUpThreshold.isSome())
warmUpThreshold = JitOptions.forcedDefaultIonSmallFunctionWarmUpThreshold.ref();
}
// If the script is too large to compile on the main thread, we can still
// compile it off thread. In these cases, increase the warm-up counter
// threshold to improve the compilation's type information and hopefully

View File

@ -134,6 +134,13 @@ class OptimizationInfo
// Default compiler warmup threshold, unless it is overridden.
static const uint32_t CompilerWarmupThreshold = 1000;
// How many invocations or loop iterations are needed before small functions
// are compiled.
uint32_t compilerSmallFunctionWarmUpThreshold_;
// Default small function compiler warmup threshold, unless it is overridden.
static const uint32_t CompilerSmallFunctionWarmupThreshold = 100;
// How many invocations or loop iterations are needed before calls
// are inlined, as a fraction of compilerWarmUpThreshold.
double inliningWarmUpThresholdFactor_;

View File

@ -178,6 +178,17 @@ DefaultJitOptions::DefaultJitOptions()
Warn(forcedDefaultIonWarmUpThresholdEnv, env);
}
// Same but for compiling small functions.
const char* forcedDefaultIonSmallFunctionWarmUpThresholdEnv =
"JIT_OPTION_forcedDefaultIonSmallFunctionWarmUpThreshold";
if (const char* env = getenv(forcedDefaultIonSmallFunctionWarmUpThresholdEnv)) {
Maybe<int> value = ParseInt(env);
if (value.isSome())
forcedDefaultIonSmallFunctionWarmUpThreshold.emplace(value.ref());
else
Warn(forcedDefaultIonSmallFunctionWarmUpThresholdEnv, env);
}
// Force the used register allocator instead of letting the optimization
// pass decide.
const char* forcedRegisterAllocatorEnv = "JIT_OPTION_forcedRegisterAllocator";
@ -213,6 +224,8 @@ DefaultJitOptions::setEagerCompilation()
baselineWarmUpThreshold = 0;
forcedDefaultIonWarmUpThreshold.reset();
forcedDefaultIonWarmUpThreshold.emplace(0);
forcedDefaultIonSmallFunctionWarmUpThreshold.reset();
forcedDefaultIonSmallFunctionWarmUpThreshold.emplace(0);
}
void
@ -220,6 +233,8 @@ DefaultJitOptions::setCompilerWarmUpThreshold(uint32_t warmUpThreshold)
{
forcedDefaultIonWarmUpThreshold.reset();
forcedDefaultIonWarmUpThreshold.emplace(warmUpThreshold);
forcedDefaultIonSmallFunctionWarmUpThreshold.reset();
forcedDefaultIonSmallFunctionWarmUpThreshold.emplace(warmUpThreshold);
// Undo eager compilation
if (eagerCompilation && warmUpThreshold != 0) {

View File

@ -75,6 +75,7 @@ struct DefaultJitOptions
uint32_t smallFunctionMaxBytecodeLength_;
uint32_t jumpThreshold;
mozilla::Maybe<uint32_t> forcedDefaultIonWarmUpThreshold;
mozilla::Maybe<uint32_t> forcedDefaultIonSmallFunctionWarmUpThreshold;
mozilla::Maybe<IonRegisterAllocator> forcedRegisterAllocator;
// The options below affect the rest of the VM, and not just the JIT.