Bug 790424 (part 2) - Remove ParseContext::functionList and FunctionBox::{siblings,kids}. r=jimb.

--HG--
extra : rebase_source : 54dfebcaeb3b5ce3c335e9bc6e9dd6ea085cf8d2
This commit is contained in:
Nicholas Nethercote 2012-09-12 18:50:39 -07:00
parent 52d340b01b
commit 12ea64c9f7
6 changed files with 2 additions and 44 deletions

View File

@ -194,8 +194,6 @@ frontend::CompileScript(JSContext *cx, HandleObject scopeChain, StackFrame *call
if (!NameFunctions(cx, pn))
return NULL;
pc.functionList = NULL;
if (!EmitTree(cx, &bce, pn))
return NULL;
@ -310,7 +308,7 @@ frontend::CompileFunctionBody(JSContext *cx, HandleFunction fun, CompileOptions
* at the end.
*/
ParseNode *pn = parser.functionBody(Parser::StatementListBody);
if (!pn)
if (!pn)
return false;
if (!parser.tokenStream.matchToken(TOK_EOF)) {

View File

@ -263,12 +263,6 @@ ParseNodeAllocator::prepareNodeForMutation(ParseNode *pn)
/*
* Return the nodes in the subtree |pn| to the parser's free node list, for
* reallocation.
*
* Note that all functions in |pn| that are not enclosed by other functions
* in |pn| must be direct children of |pc|, because we only clean up |pc|'s
* function and method lists. You must not reach into a function and
* recycle some part of it (unless you've updated |pc|->functionList, the
* way js_FoldConstants does).
*/
ParseNode *
ParseNodeAllocator::freeTree(ParseNode *pn)

View File

@ -41,7 +41,6 @@ ParseContext::ParseContext(Parser *prs, SharedContext *sc, unsigned staticLevel,
args_(prs->context),
vars_(prs->context),
yieldNode(NULL),
functionList(NULL),
queuedStrictModeError(NULL),
parserPC(&prs->pc),
lexdeps(prs->context),

View File

@ -403,8 +403,6 @@ FunctionBox::FunctionBox(JSContext *cx, ObjectBox* traceListHead, JSFunction *fu
ParseContext *outerpc, StrictMode sms)
: SharedContext(cx, /* isFunction = */ true, sms),
objbox(traceListHead, fun, this),
siblings(outerpc ? outerpc->functionList : NULL),
kids(NULL),
bindings(),
bufStart(0),
bufEnd(0),
@ -475,8 +473,6 @@ Parser::newFunctionBox(JSFunction *fun, ParseContext *outerpc, StrictMode sms)
return NULL;
}
if (outerpc)
outerpc->functionList = funbox;
traceListHead = &funbox->objbox;
return funbox;
@ -1151,7 +1147,6 @@ LeaveFunction(ParseNode *fn, Parser *parser, PropertyName *funName = NULL,
FunctionBox *funbox = fn->pn_funbox;
JS_ASSERT(funbox == funpc->sc->asFunbox());
funbox->kids = funpc->functionList;
if (!pc->topStmt || pc->topStmt->type == STMT_BLOCK)
fn->pn_dflags |= PND_BLOCKCHILD;
@ -4769,12 +4764,11 @@ class CompExprTransplanter {
Parser *parser;
bool genexp;
unsigned adjust;
unsigned funcLevel;
HashSet<Definition *> visitedImplicitArguments;
public:
CompExprTransplanter(ParseNode *pn, Parser *parser, bool ge, unsigned adj)
: root(pn), parser(parser), genexp(ge), adjust(adj), funcLevel(0),
: root(pn), parser(parser), genexp(ge), adjust(adj),
visitedImplicitArguments(parser->context)
{}
@ -4953,33 +4947,9 @@ CompExprTransplanter::transplant(ParseNode *pn)
break;
case PN_FUNC:
{
/*
* Only the first level of transplant recursion through functions needs
* to reparent the funbox, since all descendant functions are correctly
* linked under the top-most funbox.
*/
FunctionBox *funbox = pn->pn_funbox;
if (++funcLevel == 1 && genexp) {
FunctionBox *parent = pc->sc->asFunbox();
FunctionBox **funboxp = &pc->parent->functionList;
while (*funboxp != funbox)
funboxp = &(*funboxp)->siblings;
*funboxp = funbox->siblings;
funbox->siblings = parent->kids;
parent->kids = funbox;
}
/* FALL THROUGH */
}
case PN_NAME:
if (!transplant(pn->maybeExpr()))
return false;
if (pn->isArity(PN_FUNC))
--funcLevel;
if (pn->isDefn()) {
if (genexp && !BumpStaticLevel(pn, pc))

View File

@ -157,7 +157,6 @@ struct ParseContext /* 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;
// A strict mode error found in this scope or one of its children. It is
// used only when strictModeState is UNKNOWN. If the scope turns out to be

View File

@ -194,8 +194,6 @@ class FunctionBox : public SharedContext
{
public:
ObjectBox objbox;
FunctionBox *siblings;
FunctionBox *kids;
Bindings bindings; /* bindings for this function */
size_t bufStart;
size_t bufEnd;