зеркало из https://github.com/mozilla/gecko-dev.git
Bug 777583 - Add caller/callee use count ratio to balance inlining cost. r=djvj
This commit is contained in:
Родитель
5bca2c570a
Коммит
9cbce41576
|
@ -129,6 +129,12 @@ struct IonOptions
|
||||||
// Default: 800
|
// Default: 800
|
||||||
uint32 inlineMaxTotalBytecodeLength;
|
uint32 inlineMaxTotalBytecodeLength;
|
||||||
|
|
||||||
|
// Minimal ratio between the use counts of the caller and the callee to
|
||||||
|
// enable inlining of functions.
|
||||||
|
//
|
||||||
|
// Default: 128
|
||||||
|
uint32 inlineUseCountRatio;
|
||||||
|
|
||||||
// Whether functions are compiled immediately.
|
// Whether functions are compiled immediately.
|
||||||
//
|
//
|
||||||
// Default: false
|
// Default: false
|
||||||
|
@ -170,6 +176,7 @@ struct IonOptions
|
||||||
smallFunctionUsesBeforeInlining(usesBeforeInlining / 4),
|
smallFunctionUsesBeforeInlining(usesBeforeInlining / 4),
|
||||||
polyInlineMax(4),
|
polyInlineMax(4),
|
||||||
inlineMaxTotalBytecodeLength(800),
|
inlineMaxTotalBytecodeLength(800),
|
||||||
|
inlineUseCountRatio(128),
|
||||||
eagerCompilation(false),
|
eagerCompilation(false),
|
||||||
slowCallLimit(512)
|
slowCallLimit(512)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2898,6 +2898,10 @@ IonBuilder::makeInliningDecision(AutoObjectVector &targets)
|
||||||
// 2. The cost of inlining (in terms of size expansion of the SSA graph),
|
// 2. The cost of inlining (in terms of size expansion of the SSA graph),
|
||||||
// and size expansion of the ultimately generated code, will be
|
// and size expansion of the ultimately generated code, will be
|
||||||
// less significant.
|
// less significant.
|
||||||
|
// 3. Do not inline functions which are not called as frequently as their
|
||||||
|
// callers.
|
||||||
|
|
||||||
|
uint32_t callerUses = script_->getUseCount();
|
||||||
|
|
||||||
uint32_t totalSize = 0;
|
uint32_t totalSize = 0;
|
||||||
uint32_t checkUses = js_IonOptions.usesBeforeInlining;
|
uint32_t checkUses = js_IonOptions.usesBeforeInlining;
|
||||||
|
@ -2908,12 +2912,18 @@ IonBuilder::makeInliningDecision(AutoObjectVector &targets)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
JSScript *script = target->script();
|
JSScript *script = target->script();
|
||||||
|
uint32_t calleeUses = script->getUseCount();
|
||||||
totalSize += script->length;
|
totalSize += script->length;
|
||||||
if (totalSize > js_IonOptions.inlineMaxTotalBytecodeLength)
|
if (totalSize > js_IonOptions.inlineMaxTotalBytecodeLength)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (script->length > js_IonOptions.smallFunctionMaxBytecodeLength)
|
if (script->length > js_IonOptions.smallFunctionMaxBytecodeLength)
|
||||||
allFunctionsAreSmall = false;
|
allFunctionsAreSmall = false;
|
||||||
|
|
||||||
|
if (calleeUses * js_IonOptions.inlineUseCountRatio < callerUses) {
|
||||||
|
IonSpew(IonSpew_Inlining, "Not inlining, callee is not hot");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (allFunctionsAreSmall)
|
if (allFunctionsAreSmall)
|
||||||
checkUses = js_IonOptions.smallFunctionUsesBeforeInlining;
|
checkUses = js_IonOptions.smallFunctionUsesBeforeInlining;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче