Bug 764714 (part 1) - Only set JSScript::savedCallerFun when appropriate. r=jorendorff.

This commit is contained in:
Nicholas Nethercote 2012-06-13 17:26:31 -07:00
parent c50911ba29
commit 1836a4cb76

View File

@ -4725,14 +4725,19 @@ EmitFunc(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
sc.setFunMightAliasLocals(); // inherit funMightAliasLocals from parent
sc.bindings.transfer(&funbox->bindings);
// Inherit various things (principals, version, etc) from the parent.
// Inherit most things (principals, version, etc) from the parent.
GlobalObject *globalObject = fun->getParent() ? &fun->getParent()->global() : NULL;
Rooted<JSScript*> script(cx);
Rooted<JSScript*> parent(cx, bce->script);
script = JSScript::Create(cx, parent->savedCallerFun, parent->principals,
parent->originPrincipals, parent->compileAndGo,
/* noScriptRval = */ false, globalObject,
parent->getVersion(), parent->staticLevel + 1);
script = JSScript::Create(cx,
/* savedCallerFun = */ false,
parent->principals,
parent->originPrincipals,
parent->compileAndGo,
/* noScriptRval = */ false,
globalObject,
parent->getVersion(),
parent->staticLevel + 1);
if (!script)
return false;