From 335dd478e262ed807784f197e9e6e1fe23e8f038 Mon Sep 17 00:00:00 2001 From: Eddy Bruel Date: Tue, 2 Oct 2012 16:04:25 +0200 Subject: [PATCH] Bug 795625 - Don't push StmtInfo for Parser::functionBody; r=jorendorff on irc --- js/src/frontend/Parser-inl.h | 2 +- js/src/frontend/Parser.cpp | 11 +---------- js/src/frontend/Parser.h | 5 +---- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/js/src/frontend/Parser-inl.h b/js/src/frontend/Parser-inl.h index d85b92303d9..632d44e2474 100644 --- a/js/src/frontend/Parser-inl.h +++ b/js/src/frontend/Parser-inl.h @@ -22,7 +22,7 @@ ParseContext::blockid() inline bool ParseContext::atBodyLevel() { - return !topStmt || topStmt->isFunctionBodyBlock; + return !topStmt; } inline diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index 717926c5625..e3dc542718f 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -114,7 +114,6 @@ PushStatementPC(ParseContext *pc, StmtInfoPC *stmt, StmtType type) { stmt->blockid = pc->blockid(); PushStatement(pc, stmt, type); - stmt->isFunctionBodyBlock = false; } // See comment on member function declaration. @@ -711,11 +710,6 @@ ParseNode * Parser::functionBody(FunctionBodyType type) { JS_ASSERT(pc->sc->isFunction); - - StmtInfoPC stmtInfo(context); - PushStatementPC(pc, &stmtInfo, STMT_BLOCK); - stmtInfo.isFunctionBodyBlock = true; - JS_ASSERT(!pc->funHasReturnExpr && !pc->funHasReturnVoid); ParseNode *pn; @@ -751,9 +745,6 @@ Parser::functionBody(FunctionBodyType type) if (!pn) return NULL; - JS_ASSERT(!pc->topStmt->isBlockScope); - FinishPopStatement(pc); - /* Check for falling off the end of a function that returns a value. */ if (context->hasStrictOption() && pc->funHasReturnExpr && !CheckFinalReturn(context, this, pn)) @@ -3584,7 +3575,7 @@ Parser::letStatement() if (stmt && stmt->isBlockScope) { JS_ASSERT(pc->blockChain == stmt->blockObj); } else { - if (!stmt || stmt->isFunctionBodyBlock) { + if (pc->atBodyLevel()) { /* * ES4 specifies that let at top level and at body-block scope * does not shadow var, so convert back to var. diff --git a/js/src/frontend/Parser.h b/js/src/frontend/Parser.h index f0d8962e81c..e4b6b20bb84 100644 --- a/js/src/frontend/Parser.h +++ b/js/src/frontend/Parser.h @@ -31,10 +31,7 @@ struct StmtInfoPC : public StmtInfoBase { uint32_t blockid; /* for simplified dominance computation */ - /* True if type == STMT_BLOCK and this block is a function body. */ - bool isFunctionBodyBlock; - - StmtInfoPC(JSContext *cx) : StmtInfoBase(cx), isFunctionBodyBlock(false) {} + StmtInfoPC(JSContext *cx) : StmtInfoBase(cx) {} }; typedef HashSet FuncStmtSet;