Bug 835877: Increase inline depth for small functions, r=dvander

This commit is contained in:
Hannes Verschore 2013-01-29 22:17:50 +01:00
parent aaec69836e
commit fbc0347533
2 changed files with 18 additions and 4 deletions

View File

@ -112,6 +112,16 @@ struct IonOptions
// Default: 3
uint32_t maxInlineDepth;
// The maximum inlining depth for functions.
//
// Inlining small functions has almost no compiling overhead
// and removes the otherwise needed call overhead.
// The value is currently very low.
// Actually it is only needed to make sure we don't blow out the stack.
//
// Default: 10
uint32_t smallFunctionMaxInlineDepth;
// The bytecode length limit for small function.
//
// The default for this was arrived at empirically via benchmarking.
@ -191,6 +201,7 @@ struct IonOptions
usesBeforeInlining(usesBeforeCompile),
maxStackArgs(4096),
maxInlineDepth(3),
smallFunctionMaxInlineDepth(10),
smallFunctionMaxBytecodeLength(100),
smallFunctionUsesBeforeInlining(usesBeforeInlining / 4),
polyInlineMax(4),

View File

@ -3097,9 +3097,6 @@ IonBuilder::makeInliningDecision(AutoObjectVector &targets, uint32_t argc)
{
AssertCanGC();
if (inliningDepth >= js_IonOptions.maxInlineDepth)
return false;
// For "small" functions, we should be more aggressive about inlining.
// This is based on the following intuition:
// 1. The call overhead for a small function will likely be a much
@ -3115,6 +3112,7 @@ IonBuilder::makeInliningDecision(AutoObjectVector &targets, uint32_t argc)
uint32_t totalSize = 0;
uint32_t checkUses = js_IonOptions.usesBeforeInlining;
uint32_t maxInlineDepth = js_IonOptions.maxInlineDepth;
bool allFunctionsAreSmall = true;
RootedFunction target(cx);
RootedScript targetScript(cx);
@ -3138,8 +3136,13 @@ IonBuilder::makeInliningDecision(AutoObjectVector &targets, uint32_t argc)
return false;
}
}
if (allFunctionsAreSmall)
if (allFunctionsAreSmall) {
checkUses = js_IonOptions.smallFunctionUsesBeforeInlining;
maxInlineDepth = js_IonOptions.smallFunctionMaxInlineDepth;
}
if (inliningDepth >= maxInlineDepth)
return false;
if (script()->getUseCount() < checkUses) {
IonSpew(IonSpew_Inlining, "Not inlining, caller is not hot");