Bug 821788 - Prevent elimination of phis and resume point operands for operands of inline calls, r=jandem.

This commit is contained in:
Brian Hackett 2012-12-17 15:10:12 -07:00
parent 3df5586b3c
commit 88c9f11bcc
3 changed files with 28 additions and 1 deletions

View File

@ -3098,9 +3098,12 @@ IonBuilder::jsop_call_inline(HandleFunction callee, uint32_t argc, bool construc
{
AssertCanGC();
int calleePos = -((int) argc + 2);
current->peek(calleePos)->setFoldedUnchecked();
// Rewrite the stack position containing the function with the constant
// function definition, before we take the inlineResumePoint
current->rewriteAtDepth(-((int) argc + 2), constFun);
current->rewriteAtDepth(calleePos, constFun);
// This resume point collects outer variables only. It is used to recover
// the stack state before the current bytecode.
@ -3506,6 +3509,7 @@ IonBuilder::inlineScriptedCall(AutoObjectVector &targets, uint32_t argc, bool co
MPassArg *passArg = top->peek(argSlotDepth)->toPassArg();
MBasicBlock *block = passArg->block();
MDefinition *wrapped = passArg->getArgument();
wrapped->setFoldedUnchecked();
passArg->replaceAllUsesWith(wrapped);
top->rewriteAtDepth(argSlotDepth, wrapped);
block->discard(passArg);

View File

@ -0,0 +1,13 @@
var appendToActual = function(s) {
actual += s + ',';
}
gczeal(2,(3));
actual = '';
function loop(f) {}
function f(j, k) {
var g = function(a, b, c) {}
for (k = 0; k < 5; ++k)
appendToActual(loop(g));
}
f(1);

View File

@ -0,0 +1,10 @@
gczeal(2);
function bitsinbyte() {
var [ summary ] = true;
}
function TimeFunc(func) {
for(var y=0; y<11000; y++)
func();
}
TimeFunc(bitsinbyte);