mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 920322 - Enable XDR of CompileAndGo scripts. r=luke
This commit is contained in:
parent
fedbdf04d7
commit
a8b3fdf7d0
@ -427,8 +427,6 @@ js::XDRInterpretedFunction(XDRState<mode> *xdr, HandleObject enclosingScope, Han
|
||||
if (!JSFunction::setTypeForScriptedFunction(cx, fun))
|
||||
return false;
|
||||
JS_ASSERT(fun->nargs() == fun->nonLazyScript()->bindings.numArgs());
|
||||
RootedScript script(cx, fun->nonLazyScript());
|
||||
CallNewScriptHook(cx, script, fun);
|
||||
objp.set(fun);
|
||||
}
|
||||
|
||||
|
@ -413,7 +413,8 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
|
||||
IsStarGenerator,
|
||||
OwnSource,
|
||||
ExplicitUseStrict,
|
||||
SelfHosted
|
||||
SelfHosted,
|
||||
IsCompileAndGo
|
||||
};
|
||||
|
||||
uint32_t length, lineno, nslots;
|
||||
@ -507,8 +508,8 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
|
||||
scriptBits |= (1 << IsLegacyGenerator);
|
||||
if (script->isStarGenerator())
|
||||
scriptBits |= (1 << IsStarGenerator);
|
||||
|
||||
JS_ASSERT(!script->compileAndGo());
|
||||
if (script->compileAndGo())
|
||||
scriptBits |= (1 << IsCompileAndGo);
|
||||
JS_ASSERT(!script->hasSingletons());
|
||||
}
|
||||
|
||||
@ -616,6 +617,8 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
|
||||
script->setNeedsArgsObj(true);
|
||||
if (scriptBits & (1 << IsGeneratorExp))
|
||||
script->isGeneratorExp_ = true;
|
||||
if (scriptBits & (1 << IsCompileAndGo))
|
||||
script->compileAndGo_ = true;
|
||||
|
||||
if (scriptBits & (1 << IsLegacyGenerator)) {
|
||||
JS_ASSERT(!(scriptBits & (1 << IsStarGenerator)));
|
||||
@ -814,9 +817,17 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
|
||||
}
|
||||
}
|
||||
|
||||
if (mode == XDR_DECODE)
|
||||
if (mode == XDR_DECODE) {
|
||||
scriptp.set(script);
|
||||
|
||||
/* see BytecodeEmitter::tellDebuggerAboutCompiledScript */
|
||||
CallNewScriptHook(cx, script, fun);
|
||||
if (!fun) {
|
||||
RootedGlobalObject global(cx, script->compileAndGo() ? &script->global() : NULL);
|
||||
Debugger::onNewScript(cx, script, global);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -102,27 +102,15 @@ template<XDRMode mode>
|
||||
bool
|
||||
XDRState<mode>::codeScript(MutableHandleScript scriptp)
|
||||
{
|
||||
RootedScript script(cx());
|
||||
if (mode == XDR_DECODE) {
|
||||
script = nullptr;
|
||||
if (mode == XDR_DECODE)
|
||||
scriptp.set(nullptr);
|
||||
} else {
|
||||
script = scriptp.get();
|
||||
}
|
||||
|
||||
if (!VersionCheck(this))
|
||||
return false;
|
||||
|
||||
if (!XDRScript(this, NullPtr(), NullPtr(), NullPtr(), &script))
|
||||
if (!XDRScript(this, NullPtr(), NullPtr(), NullPtr(), scriptp))
|
||||
return false;
|
||||
|
||||
if (mode == XDR_DECODE) {
|
||||
JS_ASSERT(!script->compileAndGo());
|
||||
CallNewScriptHook(cx(), script, NullPtr());
|
||||
Debugger::onNewScript(cx(), script, nullptr);
|
||||
scriptp.set(script);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user