Bug 759246 (part 2) - Move SharedContext::functionList to TreeContext. r=jorendorff.

--HG--
extra : rebase_source : 96ddd5d4e48ed55dfe546e923cfa9bbe48a38234
This commit is contained in:
Nicholas Nethercote 2012-05-28 20:46:03 -07:00
parent 1e48727087
commit d13e6401dd
5 changed files with 12 additions and 11 deletions

View File

@ -199,7 +199,7 @@ frontend::CompileScript(JSContext *cx, JSObject *scopeChain, StackFrame *callerF
if (!AnalyzeFunctions(bce.parser))
return NULL;
sc.functionList = NULL;
tc.functionList = NULL;
if (!EmitTree(cx, &bce, pn))
return NULL;

View File

@ -173,7 +173,7 @@ Parser::newObjectBox(JSObject *obj)
FunctionBox::FunctionBox(ObjectBox* traceListHead, JSObject *obj, ParseNode *fn, TreeContext *tc)
: ObjectBox(traceListHead, obj),
node(fn),
siblings(tc->sc->functionList),
siblings(tc->functionList),
kids(NULL),
parent(tc->sc->funbox),
bindings(tc->sc->context),
@ -221,7 +221,7 @@ Parser::newFunctionBox(JSObject *obj, ParseNode *fn, TreeContext *tc)
return NULL;
}
traceListHead = tc->sc->functionList = funbox;
traceListHead = tc->functionList = funbox;
return funbox;
}
@ -1757,7 +1757,7 @@ Parser::functionDef(HandlePropertyName funName, FunctionType type, FunctionSynta
}
}
funbox->kids = funsc.functionList;
funbox->kids = funtc.functionList;
pn->pn_funbox = funbox;
pn->setOp(op);
@ -5114,7 +5114,7 @@ CompExprTransplanter::transplant(ParseNode *pn)
if (++funcLevel == 1 && genexp) {
FunctionBox *parent = tc->sc->funbox;
FunctionBox **funboxp = &tc->parent->sc->functionList;
FunctionBox **funboxp = &tc->parent->functionList;
while (*funboxp != funbox)
funboxp = &(*funboxp)->siblings;
*funboxp = funbox->siblings;

View File

@ -160,14 +160,15 @@ MarkExtensibleScopeDescendants(JSContext *context, FunctionBox *funbox, bool has
bool
frontend::AnalyzeFunctions(Parser *parser)
{
SharedContext *sc = parser->tc->sc;
if (!sc->functionList)
TreeContext *tc = parser->tc;
SharedContext *sc = tc->sc;
if (!tc->functionList)
return true;
if (!MarkExtensibleScopeDescendants(sc->context, sc->functionList, false))
if (!MarkExtensibleScopeDescendants(sc->context, tc->functionList, false))
return false;
bool isDirectEval = !!parser->callerFrame;
bool isHeavyweight = false;
SetFunctionKinds(sc->functionList, &isHeavyweight, sc->inFunction, isDirectEval);
SetFunctionKinds(tc->functionList, &isHeavyweight, sc->inFunction, isDirectEval);
if (isHeavyweight)
sc->setFunIsHeavyweight();
return true;

View File

@ -27,7 +27,6 @@ SharedContext::SharedContext(JSContext *cx, bool inFunction)
scopeChain_(cx),
staticLevel(0),
funbox(NULL),
functionList(NULL),
bindings(cx),
bindingsRoot(cx, &bindings),
inFunction(inFunction),
@ -70,6 +69,7 @@ TreeContext::TreeContext(Parser *prs, SharedContext *sc)
blockNode(NULL),
decls(prs->context),
yieldNode(NULL),
functionList(NULL),
parserTC(&prs->tc),
lexdeps(prs->context),
parent(prs->tc),

View File

@ -155,7 +155,6 @@ struct SharedContext {
FunctionBox *funbox; /* null or box for function we're compiling
if inFunction is set and not in
js::frontend::CompileFunctionBody */
FunctionBox *functionList;
Bindings bindings; /* bindings in this code, including
arguments if we're compiling a function */
@ -239,6 +238,7 @@ struct TreeContext { /* tree context for semantic checks */
ParseNode *yieldNode; /* parse node for a yield expression that might
be an error if we turn out to be inside a
generator expression */
FunctionBox *functionList;
private:
TreeContext **parserTC; /* this points to the Parser's active tc