Bug 886193 - Part 1: Remove usages of fun->nonLazyScript. r=jandem

--HG--
extra : rebase_source : 1b21c291669c181e057a65c9e0d73840a0af41d2
This commit is contained in:
Till Schneidereit 2014-01-02 20:53:59 +01:00
Родитель 22c34b10ac
Коммит 10e4c56a16
7 изменённых файлов: 29 добавлений и 17 удалений

Просмотреть файл

@ -72,7 +72,9 @@ CheckArgumentsWithinEval(JSContext *cx, Parser<FullParseHandler> &parser, Handle
// Force construction of arguments objects for functions that use
// |arguments| within an eval.
RootedScript script(cx, fun->nonLazyScript());
RootedScript script(cx, fun->getOrCreateScript(cx));
if (!script)
return false;
if (script->argumentsHasVarBinding()) {
if (!JSScript::argumentsOptimizationFailed(cx, script))
return false;
@ -123,7 +125,9 @@ MaybeCheckEvalFreeVariables(ExclusiveContext *cxArg, HandleScript evalCaller, Ha
RootedObject scope(cx, scopeChain);
while (scope->is<ScopeObject>() || scope->is<DebugScopeObject>()) {
if (scope->is<CallObject>() && !scope->as<CallObject>().isForEval()) {
RootedScript script(cx, scope->as<CallObject>().callee().nonLazyScript());
RootedScript script(cx, scope->as<CallObject>().callee().getOrCreateScript(cx));
if (!script)
return false;
if (script->argumentsHasVarBinding()) {
if (!JSScript::argumentsOptimizationFailed(cx, script))
return false;

Просмотреть файл

@ -2143,11 +2143,10 @@ jit::AnalyzeNewScriptProperties(JSContext *cx, JSFunction *fun,
// which will definitely be added to the created object before it has a
// chance to escape and be accessed elsewhere.
if (fun->isInterpretedLazy() && !fun->getOrCreateScript(cx))
RootedScript script(cx, fun->getOrCreateScript(cx));
if (!script)
return false;
RootedScript script(cx, fun->nonLazyScript());
if (!script->compileAndGo() || !script->canBaselineCompile())
return true;

Просмотреть файл

@ -349,10 +349,10 @@ IonBuilder::canInlineTarget(JSFunction *target, CallInfo &callInfo)
// Allow constructing lazy scripts when performing the definite properties
// analysis, as baseline has not been used to warm the caller up yet.
if (target->isInterpreted() && info().executionMode() == DefinitePropertiesAnalysis) {
if (!target->getOrCreateScript(analysisContext))
RootedScript script(analysisContext, target->getOrCreateScript(analysisContext));
if (!script)
return InliningDecision_Error;
RootedScript script(analysisContext, target->nonLazyScript());
if (!script->hasBaselineScript() && script->canBaselineCompile()) {
MethodStatus status = BaselineCompile(analysisContext, script);
if (status == Method_Error)
@ -3830,7 +3830,7 @@ class AutoAccumulateReturns
bool
IonBuilder::inlineScriptedCall(CallInfo &callInfo, JSFunction *target)
{
JS_ASSERT(target->isInterpreted());
JS_ASSERT(target->hasScript());
JS_ASSERT(IsIonInlinablePC(pc));
callInfo.setImplicitlyUsedUnchecked();

Просмотреть файл

@ -3984,16 +3984,16 @@ JS_CloneFunctionObject(JSContext *cx, JSObject *funobjArg, JSObject *parentArg)
return nullptr;
}
/*
* If a function was compiled to be lexically nested inside some other
* script, we cannot clone it without breaking the compiler's assumptions.
*/
RootedFunction fun(cx, &funobj->as<JSFunction>());
if (fun->isInterpretedLazy()) {
AutoCompartment ac(cx, funobj);
if (!fun->getOrCreateScript(cx))
return nullptr;
}
/*
* If a function was compiled to be lexically nested inside some other
* script, we cannot clone it without breaking the compiler's assumptions.
*/
if (fun->isInterpreted() && (fun->nonLazyScript()->enclosingStaticScope() ||
(fun->nonLazyScript()->compileAndGo() && !parent->is<GlobalObject>())))
{

Просмотреть файл

@ -455,7 +455,9 @@ js::CloneFunctionAndScript(JSContext *cx, HandleObject enclosingScope, HandleFun
if (!clone)
return nullptr;
RootedScript srcScript(cx, srcFun->nonLazyScript());
RootedScript srcScript(cx, srcFun->getOrCreateScript(cx));
if (!srcScript)
return nullptr;
RootedScript clonedScript(cx, CloneScript(cx, enclosingScope, clone, srcScript));
if (!clonedScript)
return nullptr;

Просмотреть файл

@ -2328,9 +2328,12 @@ AnalyzeEntrainedVariablesInScript(JSContext *cx, HandleScript script, HandleScri
JSObject *obj = objects->vector[i];
if (obj->is<JSFunction>() && obj->as<JSFunction>().isInterpreted()) {
JSFunction *fun = &obj->as<JSFunction>();
RootedScript innerInnerScript(cx, fun->nonLazyScript());
if (!AnalyzeEntrainedVariablesInScript(cx, script, innerInnerScript))
RootedScript innerInnerScript(cx, fun->getOrCreateScript(cx));
if (!innerInnerScript ||
!AnalyzeEntrainedVariablesInScript(cx, script, innerInnerScript))
{
return false;
}
}
}
}

Просмотреть файл

@ -225,7 +225,9 @@ intrinsic_SetScriptHints(JSContext *cx, unsigned argc, Value *vp)
JS_ASSERT(args[1].isObject());
RootedFunction fun(cx, &args[0].toObject().as<JSFunction>());
RootedScript funScript(cx, fun->nonLazyScript());
RootedScript funScript(cx, fun->getOrCreateScript(cx));
if (!funScript)
return false;
RootedObject flags(cx, &args[1].toObject());
RootedId id(cx);
@ -958,7 +960,9 @@ JSRuntime::cloneSelfHostedFunctionScript(JSContext *cx, Handle<PropertyName*> na
// JSFunction::generatorKind can't handle lazy self-hosted functions, so we make sure there
// aren't any.
JS_ASSERT(!sourceFun->isGenerator());
RootedScript sourceScript(cx, sourceFun->nonLazyScript());
RootedScript sourceScript(cx, sourceFun->getOrCreateScript(cx));
if (!sourceScript)
return false;
JS_ASSERT(!sourceScript->enclosingStaticScope());
JSScript *cscript = CloneScript(cx, NullPtr(), targetFun, sourceScript);
if (!cscript)