mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-18 15:55:36 +00:00
Bug 770092 (part 4) - Move JSFunction initialization code out of JSScript::fullyInitFromEmitter().
--HG-- extra : rebase_source : ef54cd18e6bc28947ac49d4a11e6590ee697ffd6
This commit is contained in:
parent
386a952015
commit
626a277dd3
@ -2569,6 +2569,23 @@ frontend::EmitFunctionScript(JSContext *cx, BytecodeEmitter *bce, ParseNode *bod
|
||||
if (!bce->script->fullyInitFromEmitter(cx, bce))
|
||||
return false;
|
||||
|
||||
// Initialize fun->script() so that the debugger has a valid fun->script().
|
||||
RootedFunction fun(cx, bce->script->function());
|
||||
JS_ASSERT(fun->isInterpreted());
|
||||
if (bce->sc->funIsHeavyweight())
|
||||
fun->flags |= JSFUN_HEAVYWEIGHT;
|
||||
|
||||
/* Mark functions which will only be executed once as singletons. */
|
||||
bool singleton =
|
||||
cx->typeInferenceEnabled() &&
|
||||
bce->parent &&
|
||||
bce->parent->checkSingletonContext();
|
||||
|
||||
JS_ASSERT(!fun->script());
|
||||
fun->setScript(bce->script);
|
||||
if (!fun->setTypeForScriptedFunction(cx, singleton))
|
||||
return false;
|
||||
|
||||
bce->tellDebuggerAboutCompiledScript(cx);
|
||||
|
||||
return true;
|
||||
|
@ -126,7 +126,7 @@ class ContextFlags {
|
||||
};
|
||||
|
||||
struct SharedContext {
|
||||
JSContext *context;
|
||||
JSContext *const context;
|
||||
|
||||
private:
|
||||
const RootedFunction fun_; /* function to store argument and variable
|
||||
|
@ -1340,29 +1340,8 @@ JSScript::fullyInitFromEmitter(JSContext *cx, BytecodeEmitter *bce)
|
||||
RootedFunction fun(cx, NULL);
|
||||
if (bce->sc->inFunction()) {
|
||||
JS_ASSERT(!bce->script->noScriptRval);
|
||||
|
||||
script->isGenerator = bce->sc->funIsGenerator();
|
||||
|
||||
/*
|
||||
* We initialize fun->script() to be the script constructed above
|
||||
* so that the debugger has a valid fun->script().
|
||||
*/
|
||||
fun = bce->sc->fun();
|
||||
JS_ASSERT(fun->isInterpreted());
|
||||
JS_ASSERT(!fun->script());
|
||||
if (bce->sc->funIsHeavyweight())
|
||||
fun->flags |= JSFUN_HEAVYWEIGHT;
|
||||
|
||||
/* Mark functions which will only be executed once as singletons. */
|
||||
bool singleton =
|
||||
cx->typeInferenceEnabled() &&
|
||||
bce->parent &&
|
||||
bce->parent->checkSingletonContext();
|
||||
|
||||
fun->setScript(script);
|
||||
script->setFunction(fun);
|
||||
if (!fun->setTypeForScriptedFunction(cx, singleton))
|
||||
return false;
|
||||
script->setFunction(bce->sc->fun());
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user