Bug 767202 (part 3) - Split StmtInfo into two. r=bhackett.

This commit is contained in:
Nicholas Nethercote
2012-06-14 23:06:43 -07:00
parent 8684b632cd
commit 73c8f9c939
10 changed files with 425 additions and 373 deletions

View File

@@ -104,6 +104,10 @@ frontend::CompileScript(JSContext *cx, JSObject *scopeChain, StackFrame *callerF
TreeContext tc(&parser, &sc, staticLevel);
if (!tc.init())
return NULL;
// Inline this->statements to emit as we go to save AST space. We must
// generate our script-body blockid since we aren't calling Statements.
if (!GenerateBlockId(&tc, tc.bodyid))
return NULL;
bool savedCallerFun = compileAndGo && callerFrame && callerFrame->isFunctionFrame();
GlobalObject *globalObject = needScriptGlobal ? GetCurrentGlobal(cx) : NULL;
@@ -154,13 +158,6 @@ frontend::CompileScript(JSContext *cx, JSObject *scopeChain, StackFrame *callerF
}
}
/*
* Inline this->statements to emit as we go to save AST space. We must
* generate our script-body blockid since we aren't calling Statements.
*/
if (!GenerateBlockId(&sc, sc.bodyid))
return NULL;
ParseNode *pn;
#if JS_HAS_XML_SUPPORT
pn = NULL;
@@ -261,11 +258,15 @@ frontend::CompileFunctionBody(JSContext *cx, JSFunction *fun,
JS_ASSERT(fun);
SharedContext funsc(cx, /* scopeChain = */ NULL, fun, /* funbox = */ NULL);
funsc.bindings.transfer(bindings);
fun->setArgCount(funsc.bindings.numArgs());
unsigned staticLevel = 0;
TreeContext funtc(&parser, &funsc, staticLevel);
if (!funtc.init())
return false;
if (!GenerateBlockId(&funtc, funtc.bodyid))
return false;
GlobalObject *globalObject = fun->getParent() ? &fun->getParent()->global() : NULL;
Rooted<JSScript*> script(cx);
@@ -281,11 +282,6 @@ frontend::CompileFunctionBody(JSContext *cx, JSFunction *fun,
if (!funbce.init())
return false;
funsc.bindings.transfer(bindings);
fun->setArgCount(funsc.bindings.numArgs());
if (!GenerateBlockId(&funsc, funsc.bodyid))
return false;
/* FIXME: make Function format the source for a function definition. */
ParseNode *fn = FunctionNode::create(PNK_NAME, &parser);
if (!fn)