Bug 767202 (part 4) - Initialize bodyid in TreeContext's constructor. r=bhackett.

This commit is contained in:
Nicholas Nethercote
2012-06-14 23:36:03 -07:00
parent 73c8f9c939
commit 348080d982
4 changed files with 13 additions and 24 deletions

View File

@@ -101,13 +101,9 @@ frontend::CompileScript(JSContext *cx, JSObject *scopeChain, StackFrame *callerF
SharedContext sc(cx, scopeChain, /* fun = */ NULL, /* funbox = */ NULL);
TreeContext tc(&parser, &sc, staticLevel);
TreeContext tc(&parser, &sc, staticLevel, /* bodyid = */ 0);
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;
@@ -262,11 +258,9 @@ frontend::CompileFunctionBody(JSContext *cx, JSFunction *fun,
fun->setArgCount(funsc.bindings.numArgs());
unsigned staticLevel = 0;
TreeContext funtc(&parser, &funsc, staticLevel);
TreeContext funtc(&parser, &funsc, staticLevel, /* bodyid = */ 0);
if (!funtc.init())
return false;
if (!GenerateBlockId(&funtc, funtc.bodyid))
return false;
GlobalObject *globalObject = fun->getParent() ? &fun->getParent()->global() : NULL;
Rooted<JSScript*> script(cx);