Back out changeset a88ce0cbdba6 due to red on m-i.

This commit is contained in:
Jason Orendorff 2012-07-09 14:38:49 -05:00
parent 5a9c517f04
commit 3d5f824484
19 changed files with 562 additions and 551 deletions

View File

@ -122,13 +122,13 @@ CPPSRCS = \
BytecodeCompiler.cpp \
BytecodeEmitter.cpp \
FoldConstants.cpp \
ParseContext.cpp \
ParseMaps.cpp \
ParseNode.cpp \
Parser.cpp \
SemanticAnalysis.cpp \
SPSProfiler.cpp \
TokenStream.cpp \
TreeContext.cpp \
TestingFunctions.cpp \
LifoAlloc.cpp \
Eval.cpp \

View File

@ -16,7 +16,7 @@
#include "jsinferinlines.h"
#include "frontend/ParseContext-inl.h"
#include "frontend/TreeContext-inl.h"
using namespace js;
using namespace js::frontend;
@ -103,8 +103,8 @@ frontend::CompileScript(JSContext *cx, HandleObject scopeChain, StackFrame *call
SharedContext sc(cx, scopeChain, /* fun = */ NULL, /* funbox = */ NULL);
ParseContext pc(&parser, &sc, staticLevel, /* bodyid = */ 0);
if (!pc.init())
TreeContext tc(&parser, &sc, staticLevel, /* bodyid = */ 0);
if (!tc.init())
return NULL;
bool savedCallerFun = compileAndGo && callerFrame && callerFrame->isFunctionFrame();
@ -193,7 +193,7 @@ frontend::CompileScript(JSContext *cx, HandleObject scopeChain, StackFrame *call
if (!AnalyzeFunctions(&parser, callerFrame))
return NULL;
pc.functionList = NULL;
tc.functionList = NULL;
if (!EmitTree(cx, &bce, pn))
return NULL;
@ -221,7 +221,7 @@ frontend::CompileScript(JSContext *cx, HandleObject scopeChain, StackFrame *call
// It's an error to use |arguments| in a function that has a rest parameter.
if (callerFrame && callerFrame->isFunctionFrame() && callerFrame->fun()->hasRest()) {
PropertyName *arguments = cx->runtime->atomState.argumentsAtom;
for (AtomDefnRange r = pc.lexdeps->all(); !r.empty(); r.popFront()) {
for (AtomDefnRange r = tc.lexdeps->all(); !r.empty(); r.popFront()) {
if (r.front().key() == arguments) {
parser.reportError(NULL, JSMSG_ARGUMENTS_AND_REST);
return NULL;
@ -268,8 +268,8 @@ frontend::CompileFunctionBody(JSContext *cx, HandleFunction fun,
fun->setArgCount(funsc.bindings.numArgs());
unsigned staticLevel = 0;
ParseContext funpc(&parser, &funsc, staticLevel, /* bodyid = */ 0);
if (!funpc.init())
TreeContext funtc(&parser, &funsc, staticLevel, /* bodyid = */ 0);
if (!funtc.init())
return false;
GlobalObject *globalObject = fun->getParent() ? &fun->getParent()->global() : NULL;

View File

@ -44,7 +44,7 @@
#include "frontend/ParseMaps-inl.h"
#include "frontend/ParseNode-inl.h"
#include "frontend/ParseContext-inl.h"
#include "frontend/TreeContext-inl.h"
/* Allocation chunk counts, must be powers of two in general. */
#define BYTECODE_CHUNK_LENGTH 1024 /* initial bytecode chunk length */
@ -3890,7 +3890,7 @@ EmitTry(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
* Push stmtInfo to track jumps-over-catches and gosubs-to-finally
* for later fixup.
*
* When a finally block is active (STMT_FINALLY in our parse context),
* When a finally block is active (STMT_FINALLY in our tree context),
* non-local jumps (including jumps-over-catches) result in a GOSUB
* being written into the bytecode stream and fixed-up later (c.f.
* EmitBackPatchOp and BackPatch).
@ -5166,7 +5166,7 @@ EmitStatement(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
/*
* Don't eliminate apparently useless expressions if they are
* labeled expression statements. The bce->topStmt->update test
* labeled expression statements. The tc->topStmt->update test
* catches the case where we are nesting in EmitTree for a labeled
* compound statement.
*/

View File

@ -20,7 +20,7 @@
#include "frontend/Parser.h"
#include "frontend/ParseMaps.h"
#include "frontend/ParseContext.h"
#include "frontend/TreeContext.h"
#include "vm/ScopeObject.h"

View File

@ -15,12 +15,12 @@
#include "frontend/FoldConstants.h"
#include "frontend/ParseNode.h"
#include "frontend/Parser.h"
#include "frontend/ParseContext.h"
#include "frontend/TreeContext.h"
#include "vm/NumericConversions.h"
#include "jsatominlines.h"
#include "frontend/ParseContext-inl.h"
#include "frontend/TreeContext-inl.h"
#include "vm/String-inl.h"
using namespace js;

View File

@ -9,9 +9,9 @@
#include "frontend/ParseNode.h"
#include "frontend/TokenStream.h"
#include "frontend/ParseContext.h"
#include "frontend/TreeContext.h"
#include "frontend/ParseContext-inl.h"
#include "frontend/TreeContext-inl.h"
namespace js {
namespace frontend {
@ -184,14 +184,14 @@ NameNode::dump(int indent)
#endif
inline void
NameNode::initCommon(ParseContext *pc)
NameNode::initCommon(TreeContext *tc)
{
pn_expr = NULL;
pn_cookie.makeFree();
pn_dflags = (!pc->topStmt || pc->topStmt->type == STMT_BLOCK)
pn_dflags = (!tc->topStmt || tc->topStmt->type == STMT_BLOCK)
? PND_BLOCKCHILD
: 0;
pn_blockid = pc->blockid();
pn_blockid = tc->blockid();
}
} /* namespace frontend */

View File

@ -299,9 +299,9 @@ ParseNodeAllocator::prepareNodeForMutation(ParseNode *pn)
* 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
* in |pn| must be direct children of |tc|, because we only clean up |tc|'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
* recycle some part of it (unless you've updated |tc|->functionList, the
* way js_FoldConstants does).
*/
ParseNode *
@ -424,15 +424,15 @@ ParseNode::newBinaryOrAppend(ParseNodeKind kind, JSOp op, ParseNode *left, Parse
}
// Nb: unlike most functions that are passed a Parser, this one gets a
// SharedContext passed in separately, because in this case |pc| may not equal
// |parser->pc|.
// SharedContext passed in separately, because in this case |tc| may not equal
// |parser->tc|.
NameNode *
NameNode::create(ParseNodeKind kind, JSAtom *atom, Parser *parser, ParseContext *pc)
NameNode::create(ParseNodeKind kind, JSAtom *atom, Parser *parser, TreeContext *tc)
{
ParseNode *pn = ParseNode::create(kind, PN_NAME, parser);
if (pn) {
pn->pn_atom = atom;
((NameNode *)pn)->initCommon(pc);
((NameNode *)pn)->initCommon(tc);
}
return (NameNode *)pn;
}
@ -462,9 +462,9 @@ Definition::kindString(Kind kind)
static ParseNode *
CloneParseTree(ParseNode *opn, Parser *parser)
{
ParseContext *pc = parser->pc;
TreeContext *tc = parser->tc;
JS_CHECK_RECURSION(pc->sc->context, return NULL);
JS_CHECK_RECURSION(tc->sc->context, return NULL);
ParseNode *pn = parser->new_<ParseNode>(opn->getKind(), opn->getOp(), opn->getArity(),
opn->pn_pos);
@ -479,7 +479,7 @@ CloneParseTree(ParseNode *opn, Parser *parser)
case PN_FUNC:
NULLCHECK(pn->pn_funbox =
parser->newFunctionBox(opn->pn_funbox->object, pn, pc));
parser->newFunctionBox(opn->pn_funbox->object, pn, tc));
NULLCHECK(pn->pn_body = CloneParseTree(opn->pn_body, parser));
pn->pn_cookie = opn->pn_cookie;
pn->pn_dflags = opn->pn_dflags;

View File

@ -14,7 +14,7 @@
#include "frontend/ParseMaps.h"
#include "frontend/TokenStream.h"
#include "frontend/ParseContext.h"
#include "frontend/TreeContext.h"
namespace js {
namespace frontend {
@ -1038,9 +1038,9 @@ struct FunctionNode : public ParseNode {
};
struct NameNode : public ParseNode {
static NameNode *create(ParseNodeKind kind, JSAtom *atom, Parser *parser, ParseContext *pc);
static NameNode *create(ParseNodeKind kind, JSAtom *atom, Parser *parser, TreeContext *tc);
inline void initCommon(ParseContext *pc);
inline void initCommon(TreeContext *tc);
#ifdef DEBUG
inline void dump(int indent);
@ -1339,33 +1339,33 @@ void DumpParseTree(ParseNode *pn, int indent = 0);
*
* for (each use of unqualified name x in parse order) {
* if (this use of x is a declaration) {
* if (x in pc->decls) { // redeclaring
* if (x in tc->decls) { // redeclaring
* pn = allocate a PN_NAME ParseNode;
* } else { // defining
* dn = lookup x in pc->lexdeps;
* dn = lookup x in tc->lexdeps;
* if (dn) // use before def
* remove x from pc->lexdeps;
* remove x from tc->lexdeps;
* else // def before use
* dn = allocate a PN_NAME Definition;
* map x to dn via pc->decls;
* map x to dn via tc->decls;
* pn = dn;
* }
* insert pn into its parent PNK_VAR/PNK_CONST list;
* } else {
* pn = allocate a ParseNode for this reference to x;
* dn = lookup x in pc's lexical scope chain;
* dn = lookup x in tc's lexical scope chain;
* if (!dn) {
* dn = lookup x in pc->lexdeps;
* dn = lookup x in tc->lexdeps;
* if (!dn) {
* dn = pre-allocate a Definition for x;
* map x to dn in pc->lexdeps;
* map x to dn in tc->lexdeps;
* }
* }
* append pn to dn's use chain;
* }
* }
*
* See frontend/BytecodeEmitter.h for js::ParseContext and its top*Stmt,
* See frontend/BytecodeEmitter.h for js::TreeContext and its top*Stmt,
* decls, and lexdeps members.
*
* Notes:
@ -1377,9 +1377,9 @@ void DumpParseTree(ParseNode *pn, int indent = 0);
* statement" (ECMA-262 12.2) can be proven to be dead code. RecycleTree in
* ParseNode.cpp will not recycle a node whose pn_defn bit is set.
*
* 2. "lookup x in pc's lexical scope chain" gives up on def/use chaining if a
* with statement is found along the the scope chain, which includes pc,
* pc->parent, etc. Thus we eagerly connect an inner function's use of an
* 2. "lookup x in tc's lexical scope chain" gives up on def/use chaining if a
* with statement is found along the the scope chain, which includes tc,
* tc->parent, etc. Thus we eagerly connect an inner function's use of an
* outer's var x if the var x was parsed before the inner function.
*
* 3. A use may be eliminated as dead by the constant folder, which therefore
@ -1388,15 +1388,15 @@ void DumpParseTree(ParseNode *pn, int indent = 0);
* the pn_link pointing at the use to be removed. This is costly, so as for
* dead definitions, we do not recycle dead pn_used nodes.
*
* At the end of parsing a function body or global or eval program, pc->lexdeps
* At the end of parsing a function body or global or eval program, tc->lexdeps
* holds the lexical dependencies of the parsed unit. The name to def/use chain
* mappings are then merged into the parent pc->lexdeps.
* mappings are then merged into the parent tc->lexdeps.
*
* Thus if a later var x is parsed in the outer function satisfying an earlier
* inner function's use of x, we will remove dn from pc->lexdeps and re-use it
* inner function's use of x, we will remove dn from tc->lexdeps and re-use it
* as the new definition node in the outer function's parse tree.
*
* When the compiler unwinds from the outermost pc, pc->lexdeps contains the
* When the compiler unwinds from the outermost tc, tc->lexdeps contains the
* definition nodes with use chains for all free variables. These are either
* global variables or reference errors.
*/
@ -1521,7 +1521,7 @@ struct FunctionBox : public ObjectBox
ContextFlags cxFlags;
FunctionBox(ObjectBox* traceListHead, JSObject *obj, ParseNode *fn, ParseContext *pc);
FunctionBox(ObjectBox* traceListHead, JSObject *obj, ParseNode *fn, TreeContext *tc);
bool funIsHeavyweight() const { return cxFlags.funIsHeavyweight; }
bool funIsGenerator() const { return cxFlags.funIsGenerator; }

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@
#include "frontend/ParseMaps.h"
#include "frontend/ParseNode.h"
#include "frontend/ParseContext.h"
#include "frontend/TreeContext.h"
namespace js {
namespace frontend {
@ -40,7 +40,7 @@ struct Parser : private AutoGCRooter
ParseNodeAllocator allocator;
ObjectBox *traceListHead; /* list of parsed object for GC tracing */
ParseContext *pc; /* innermost parse context (stack-allocated) */
TreeContext *tc; /* innermost tree context (stack-allocated) */
/* Root atoms and objects allocated for the parsed tree. */
AutoKeepAtoms keepAtoms;
@ -86,13 +86,13 @@ struct Parser : private AutoGCRooter
*/
ObjectBox *newObjectBox(JSObject *obj);
FunctionBox *newFunctionBox(JSObject *obj, ParseNode *fn, ParseContext *pc);
FunctionBox *newFunctionBox(JSObject *obj, ParseNode *fn, TreeContext *tc);
/*
* Create a new function object given parse context (pc) and a name (which
* Create a new function object given tree context (tc) and a name (which
* is optional if this is a function expression).
*/
JSFunction *newFunction(ParseContext *pc, JSAtom *atom, FunctionSyntaxKind kind);
JSFunction *newFunction(TreeContext *tc, JSAtom *atom, FunctionSyntaxKind kind);
void trace(JSTracer *trc);
@ -148,8 +148,8 @@ struct Parser : private AutoGCRooter
/*
* JS parsers, from lowest to highest precedence.
*
* Each parser must be called during the dynamic scope of a ParseContext
* object, pointed to by this->pc.
* Each parser must be called during the dynamic scope of a TreeContext
* object, pointed to by this->tc.
*
* Each returns a parse node tree or null on error.
*
@ -229,7 +229,7 @@ struct Parser : private AutoGCRooter
#if JS_HAS_XML_SUPPORT
// True if E4X syntax is allowed in the current syntactic context.
bool allowsXML() const { return !pc->sc->inStrictMode() && tokenStream.allowsXML(); }
bool allowsXML() const { return !tc->sc->inStrictMode() && tokenStream.allowsXML(); }
ParseNode *endBracketedExpr();
@ -310,4 +310,9 @@ DefineArg(ParseNode *pn, JSAtom *atom, unsigned i, Parser *parser);
} /* namespace frontend */
} /* namespace js */
/*
* Convenience macro to access Parser.tokenStream as a pointer.
*/
#define TS(p) (&(p)->tokenStream)
#endif /* Parser_h__ */

View File

@ -10,7 +10,7 @@
#include "jsfun.h"
#include "frontend/Parser.h"
#include "frontend/ParseContext.h"
#include "frontend/TreeContext.h"
#include "jsobjinlines.h"
#include "jsfuninlines.h"
@ -160,15 +160,15 @@ MarkExtensibleScopeDescendants(JSContext *context, FunctionBox *funbox, bool has
bool
frontend::AnalyzeFunctions(Parser *parser, StackFrame *callerFrame)
{
ParseContext *pc = parser->pc;
SharedContext *sc = pc->sc;
if (!pc->functionList)
TreeContext *tc = parser->tc;
SharedContext *sc = tc->sc;
if (!tc->functionList)
return true;
if (!MarkExtensibleScopeDescendants(sc->context, pc->functionList, false))
if (!MarkExtensibleScopeDescendants(sc->context, tc->functionList, false))
return false;
bool isDirectEval = !!callerFrame;
bool isHeavyweight = false;
SetFunctionKinds(pc->functionList, &isHeavyweight, sc->inFunction(), isDirectEval);
SetFunctionKinds(tc->functionList, &isHeavyweight, sc->inFunction(), isDirectEval);
if (isHeavyweight)
sc->setFunIsHeavyweight();
return true;

View File

@ -32,7 +32,7 @@
#include "frontend/Parser.h"
#include "frontend/TokenStream.h"
#include "frontend/ParseContext.h"
#include "frontend/TreeContext.h"
#include "vm/RegExpObject.h"
#include "vm/StringBuffer.h"

View File

@ -5,11 +5,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef ParseContext_inl_h__
#define ParseContext_inl_h__
#ifndef TreeContext_inl_h__
#define TreeContext_inl_h__
#include "frontend/Parser.h"
#include "frontend/ParseContext.h"
#include "frontend/TreeContext.h"
#include "frontend/ParseMaps-inl.h"
@ -36,19 +36,19 @@ SharedContext::needStrictChecks() {
}
inline unsigned
ParseContext::blockid()
TreeContext::blockid()
{
return topStmt ? topStmt->blockid : bodyid;
}
inline bool
ParseContext::atBodyLevel()
TreeContext::atBodyLevel()
{
return !topStmt || topStmt->isFunctionBodyBlock;
}
inline
ParseContext::ParseContext(Parser *prs, SharedContext *sc, unsigned staticLevel, uint32_t bodyid)
TreeContext::TreeContext(Parser *prs, SharedContext *sc, unsigned staticLevel, uint32_t bodyid)
: sc(sc),
bodyid(0), // initialized in init()
blockidGen(bodyid), // used to set |bodyid| and subsequently incremented in init()
@ -62,9 +62,9 @@ ParseContext::ParseContext(Parser *prs, SharedContext *sc, unsigned staticLevel,
decls(prs->context),
yieldNode(NULL),
functionList(NULL),
parserPC(&prs->pc),
parserTC(&prs->tc),
lexdeps(prs->context),
parent(prs->pc),
parent(prs->tc),
innermostWith(NULL),
funcStmts(NULL),
hasReturnExpr(false),
@ -72,11 +72,11 @@ ParseContext::ParseContext(Parser *prs, SharedContext *sc, unsigned staticLevel,
inForInit(false),
inDeclDestructuring(false)
{
prs->pc = this;
prs->tc = this;
}
inline bool
ParseContext::init()
TreeContext::init()
{
if (!frontend::GenerateBlockId(this, this->bodyid))
return false;
@ -84,16 +84,16 @@ ParseContext::init()
return decls.init() && lexdeps.ensureMap(sc->context);
}
// For functions the parse context is constructed and destructed a second time
// during code generation. To avoid a redundant stats update in such cases, we
// store UINT16_MAX in maxScopeDepth.
// For functions the tree context is constructed and destructed a second
// time during code generation. To avoid a redundant stats update in such
// cases, we store UINT16_MAX in maxScopeDepth.
inline
ParseContext::~ParseContext()
TreeContext::~TreeContext()
{
// |*parserPC| pointed to this object. Now that this object is about to
// die, make |*parserPC| point to this object's parent.
JS_ASSERT(*parserPC == this);
*parserPC = this->parent;
// |*parserTC| pointed to this object. Now that this object is about to
// die, make |*parserTC| point to this object's parent.
JS_ASSERT(*parserTC == this);
*parserTC = this->parent;
sc->context->delete_(funcStmts);
}
@ -176,4 +176,4 @@ frontend::LexicalLookup(ContextT *ct, JSAtom *atom, int *slotp, typename Context
} // namespace js
#endif // ParseContext_inl_h__
#endif // TreeContext_inl_h__

View File

@ -6,11 +6,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "frontend/ParseNode.h"
#include "frontend/ParseContext.h"
#include "frontend/TreeContext.h"
#include "jsatominlines.h"
#include "frontend/ParseContext-inl.h"
#include "frontend/TreeContext-inl.h"
#include "vm/ScopeObject-inl.h"
#include "vm/String-inl.h"
@ -18,19 +18,19 @@ using namespace js;
using namespace js::frontend;
void
ParseContext::trace(JSTracer *trc)
TreeContext::trace(JSTracer *trc)
{
sc->bindings.trace(trc);
}
bool
frontend::GenerateBlockId(ParseContext *pc, uint32_t &blockid)
frontend::GenerateBlockId(TreeContext *tc, uint32_t &blockid)
{
if (pc->blockidGen == JS_BIT(20)) {
JS_ReportErrorNumber(pc->sc->context, js_GetErrorMessage, NULL, JSMSG_NEED_DIET, "program");
if (tc->blockidGen == JS_BIT(20)) {
JS_ReportErrorNumber(tc->sc->context, js_GetErrorMessage, NULL, JSMSG_NEED_DIET, "program");
return false;
}
blockid = pc->blockidGen++;
blockid = tc->blockidGen++;
return true;
}

View File

@ -5,8 +5,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef ParseContext_h__
#define ParseContext_h__
#ifndef TreeContext_h__
#define TreeContext_h__
#include "jstypes.h"
#include "jsatom.h"
@ -187,19 +187,19 @@ struct SharedContext {
typedef HashSet<JSAtom *> FuncStmtSet;
struct Parser;
struct StmtInfoPC;
struct StmtInfoTC;
struct ParseContext { /* parse context for semantic checks */
struct TreeContext { /* tree context for semantic checks */
typedef StmtInfoPC StmtInfo;
typedef StmtInfoTC StmtInfo;
SharedContext *sc; /* context shared between parsing and bytecode generation */
uint32_t bodyid; /* block number of program/function body */
uint32_t blockidGen; /* preincremented block number generator */
StmtInfoPC *topStmt; /* top of statement info stack */
StmtInfoPC *topScopeStmt; /* top lexical scope statement */
StmtInfoTC *topStmt; /* top of statement info stack */
StmtInfoTC *topScopeStmt; /* top lexical scope statement */
Rooted<StaticBlockObject *> blockChain;
/* compile time block scope chain */
@ -218,14 +218,14 @@ struct ParseContext { /* parse context for semantic checks */
FunctionBox *functionList;
private:
ParseContext **parserPC; /* this points to the Parser's active pc
TreeContext **parserTC; /* this points to the Parser's active tc
and holds either |this| or one of
|this|'s descendents */
public:
OwnedAtomDefnMapPtr lexdeps; /* unresolved lexical name dependencies */
ParseContext *parent; /* Enclosing function or global context. */
TreeContext *parent; /* Enclosing function or global context. */
ParseNode *innermostWith; /* innermost WITH parse node */
@ -255,8 +255,8 @@ struct ParseContext { /* parse context for semantic checks */
void trace(JSTracer *trc);
inline ParseContext(Parser *prs, SharedContext *sc, unsigned staticLevel, uint32_t bodyid);
inline ~ParseContext();
inline TreeContext(Parser *prs, SharedContext *sc, unsigned staticLevel, uint32_t bodyid);
inline ~TreeContext();
inline bool init();
@ -310,7 +310,7 @@ enum StmtType {
* pending the "reformed with" in ES4/JS2). It includes all try-catch-finally
* types, which are high-numbered maybe-scope types.
*
* StmtInfoBase::linksScope() tells whether a js::StmtInfo{PC,BCE} of the given
* StmtInfoBase::linksScope() tells whether a js::StmtInfo{TC,BCE} of the given
* type eagerly links to other scoping statement info records. It excludes the
* two early "maybe" types, block and switch, as well as the try and both
* finally types, since try and the other trailing maybe-scope types don't need
@ -321,7 +321,7 @@ enum StmtType {
* proposal for ES4, we would be able to model it statically, too.
*/
// StmtInfoPC is used by the Parser. StmtInfoBCE is used by the
// StmtInfoTC is used by the Parser. StmtInfoBCE is used by the
// BytecodeEmitter. The two types have some overlap, encapsulated by
// StmtInfoBase. Several functions below (e.g. PushStatement) are templated to
// work with both types.
@ -362,22 +362,22 @@ struct StmtInfoBase {
}
};
struct StmtInfoPC : public StmtInfoBase {
StmtInfoPC *down; /* info for enclosing statement */
StmtInfoPC *downScope; /* next enclosing lexical scope */
struct StmtInfoTC : public StmtInfoBase {
StmtInfoTC *down; /* info for enclosing statement */
StmtInfoTC *downScope; /* next enclosing lexical scope */
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) {}
StmtInfoTC(JSContext *cx) : StmtInfoBase(cx), isFunctionBodyBlock(false) {}
};
bool
GenerateBlockId(ParseContext *pc, uint32_t &blockid);
GenerateBlockId(TreeContext *tc, uint32_t &blockid);
// Push the C-stack-allocated struct at stmt onto the StmtInfoPC stack.
// Push the C-stack-allocated struct at stmt onto the StmtInfoTC stack.
template <class ContextT>
void
PushStatement(ContextT *ct, typename ContextT::StmtInfo *stmt, StmtType type);
@ -386,7 +386,7 @@ template <class ContextT>
void
FinishPushBlockScope(ContextT *ct, typename ContextT::StmtInfo *stmt, StaticBlockObject &blockObj);
// Pop ct->topStmt. If the top StmtInfoPC struct is not stack-allocated, it
// Pop tc->topStmt. If the top StmtInfoTC struct is not stack-allocated, it
// is up to the caller to free it. The dummy argument is just to make the
// template matching work.
template <class ContextT>
@ -415,4 +415,4 @@ LexicalLookup(ContextT *ct, JSAtom *atom, int *slotp, typename ContextT::StmtInf
} // namespace js
#endif // ParseContext_h__
#endif // TreeContext_h__

View File

@ -57,6 +57,7 @@
#include "builtin/RegExp.h"
#include "ds/LifoAlloc.h"
#include "frontend/BytecodeCompiler.h"
#include "frontend/TreeContext.h"
#include "gc/Marking.h"
#include "gc/Memory.h"
#include "js/MemoryMetrics.h"

View File

@ -46,6 +46,7 @@
#include "builtin/MapObject.h"
#include "frontend/BytecodeCompiler.h"
#include "frontend/Parser.h"
#include "frontend/TreeContext.h"
#include "gc/Marking.h"
#include "js/MemoryMetrics.h"
#include "vm/StringBuffer.h"

View File

@ -27,6 +27,7 @@
#include "frontend/Parser.h"
#include "frontend/TokenStream.h"
#include "frontend/TreeContext.h"
#include "vm/RegExpObject.h"
#include "jsscriptinlines.h"

View File

@ -42,8 +42,11 @@
#include "jsobjinlines.h"
#include "jsscriptinlines.h"
#include "frontend/TreeContext-inl.h"
#include "vm/RegExpObject-inl.h"
#include "frontend/TreeContext-inl.h"
using namespace js;
using namespace js::gc;
using namespace js::frontend;