Bug 843866: IonMonkey: Make sure inference ran before inlining empty script, r=jandem

This commit is contained in:
Hannes Verschore 2013-02-26 11:20:03 +01:00
parent aabb1feab3
commit 7067f66e5d
3 changed files with 16 additions and 7 deletions

View File

@ -3237,14 +3237,12 @@ IonBuilder::makeInliningDecision(AutoObjectVector &targets)
uint32_t totalSize = 0;
uint32_t maxInlineDepth = js_IonOptions.maxInlineDepth;
bool allFunctionsAreSmall = true;
RootedFunction target(cx);
RootedScript targetScript(cx);
for (size_t i = 0; i < targets.length(); i++) {
target = targets[i]->toFunction();
JSFunction *target = targets[i]->toFunction();
if (!target->isInterpreted())
return false;
targetScript = target->nonLazyScript();
JSScript *targetScript = target->nonLazyScript();
uint32_t calleeUses = targetScript->getUseCount();
totalSize += targetScript->length;
@ -3281,6 +3279,7 @@ IonBuilder::makeInliningDecision(AutoObjectVector &targets)
JSOp op = JSOp(*pc);
for (size_t i = 0; i < targets.length(); i++) {
JSFunction *target = targets[i]->toFunction();
JSScript *targetScript = target->nonLazyScript();
if (!canInlineTarget(target)) {
IonSpew(IonSpew_Inlining, "Decided not to inline");

View File

@ -603,9 +603,11 @@ TypeInferenceOracle::canEnterInlinedFunction(RawScript caller, jsbytecode *pc, R
AssertCanGC();
RootedScript targetScript(cx, target->nonLazyScript());
// Always permit the empty script.
if (targetScript->length == 1)
return true;
// Make sure empty script has type information, to allow inlining in more cases.
if (targetScript->length == 1) {
if (!targetScript->ensureRanInference(cx))
return false;
}
if (!targetScript->hasAnalysis() ||
!targetScript->analysis()->ranInference() ||

View File

@ -0,0 +1,8 @@
function g(f) {}
function f(b) {
g.apply(null, arguments);
if (b < 10)
f(b+1);
}
f(0);