Bug 770865 - Rename TreeContext to ParseContext. r=njn.

--HG--
rename : js/src/frontend/TreeContext-inl.h => js/src/frontend/ParseContext-inl.h
rename : js/src/frontend/TreeContext.cpp => js/src/frontend/ParseContext.cpp
rename : js/src/frontend/TreeContext.h => js/src/frontend/ParseContext.h
This commit is contained in:
Jason Orendorff 2012-07-09 13:55:04 -05:00
parent f1a8883c12
commit 5a9c517f04
19 changed files with 551 additions and 562 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/TreeContext-inl.h"
#include "frontend/ParseContext-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);
TreeContext tc(&parser, &sc, staticLevel, /* bodyid = */ 0);
if (!tc.init())
ParseContext pc(&parser, &sc, staticLevel, /* bodyid = */ 0);
if (!pc.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;
tc.functionList = NULL;
pc.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 = tc.lexdeps->all(); !r.empty(); r.popFront()) {
for (AtomDefnRange r = pc.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;
TreeContext funtc(&parser, &funsc, staticLevel, /* bodyid = */ 0);
if (!funtc.init())
ParseContext funpc(&parser, &funsc, staticLevel, /* bodyid = */ 0);
if (!funpc.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/TreeContext-inl.h"
#include "frontend/ParseContext-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 tree context),
* When a finally block is active (STMT_FINALLY in our parse 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 tc->topStmt->update test
* labeled expression statements. The bce->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/TreeContext.h"
#include "frontend/ParseContext.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/TreeContext.h"
#include "frontend/ParseContext.h"
#include "vm/NumericConversions.h"
#include "jsatominlines.h"
#include "frontend/TreeContext-inl.h"
#include "frontend/ParseContext-inl.h"
#include "vm/String-inl.h"
using namespace js;

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 TreeContext_inl_h__
#define TreeContext_inl_h__
#ifndef ParseContext_inl_h__
#define ParseContext_inl_h__
#include "frontend/Parser.h"
#include "frontend/TreeContext.h"
#include "frontend/ParseContext.h"
#include "frontend/ParseMaps-inl.h"
@ -36,19 +36,19 @@ SharedContext::needStrictChecks() {
}
inline unsigned
TreeContext::blockid()
ParseContext::blockid()
{
return topStmt ? topStmt->blockid : bodyid;
}
inline bool
TreeContext::atBodyLevel()
ParseContext::atBodyLevel()
{
return !topStmt || topStmt->isFunctionBodyBlock;
}
inline
TreeContext::TreeContext(Parser *prs, SharedContext *sc, unsigned staticLevel, uint32_t bodyid)
ParseContext::ParseContext(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 @@ TreeContext::TreeContext(Parser *prs, SharedContext *sc, unsigned staticLevel, u
decls(prs->context),
yieldNode(NULL),
functionList(NULL),
parserTC(&prs->tc),
parserPC(&prs->pc),
lexdeps(prs->context),
parent(prs->tc),
parent(prs->pc),
innermostWith(NULL),
funcStmts(NULL),
hasReturnExpr(false),
@ -72,11 +72,11 @@ TreeContext::TreeContext(Parser *prs, SharedContext *sc, unsigned staticLevel, u
inForInit(false),
inDeclDestructuring(false)
{
prs->tc = this;
prs->pc = this;
}
inline bool
TreeContext::init()
ParseContext::init()
{
if (!frontend::GenerateBlockId(this, this->bodyid))
return false;
@ -84,16 +84,16 @@ TreeContext::init()
return decls.init() && lexdeps.ensureMap(sc->context);
}
// 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.
// 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.
inline
TreeContext::~TreeContext()
ParseContext::~ParseContext()
{
// |*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;
// |*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;
sc->context->delete_(funcStmts);
}
@ -176,4 +176,4 @@ frontend::LexicalLookup(ContextT *ct, JSAtom *atom, int *slotp, typename Context
} // namespace js
#endif // TreeContext_inl_h__
#endif // ParseContext_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/TreeContext.h"
#include "frontend/ParseContext.h"
#include "jsatominlines.h"
#include "frontend/TreeContext-inl.h"
#include "frontend/ParseContext-inl.h"
#include "vm/ScopeObject-inl.h"
#include "vm/String-inl.h"
@ -18,19 +18,19 @@ using namespace js;
using namespace js::frontend;
void
TreeContext::trace(JSTracer *trc)
ParseContext::trace(JSTracer *trc)
{
sc->bindings.trace(trc);
}
bool
frontend::GenerateBlockId(TreeContext *tc, uint32_t &blockid)
frontend::GenerateBlockId(ParseContext *pc, uint32_t &blockid)
{
if (tc->blockidGen == JS_BIT(20)) {
JS_ReportErrorNumber(tc->sc->context, js_GetErrorMessage, NULL, JSMSG_NEED_DIET, "program");
if (pc->blockidGen == JS_BIT(20)) {
JS_ReportErrorNumber(pc->sc->context, js_GetErrorMessage, NULL, JSMSG_NEED_DIET, "program");
return false;
}
blockid = tc->blockidGen++;
blockid = pc->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 TreeContext_h__
#define TreeContext_h__
#ifndef ParseContext_h__
#define ParseContext_h__
#include "jstypes.h"
#include "jsatom.h"
@ -187,19 +187,19 @@ struct SharedContext {
typedef HashSet<JSAtom *> FuncStmtSet;
struct Parser;
struct StmtInfoTC;
struct StmtInfoPC;
struct TreeContext { /* tree context for semantic checks */
struct ParseContext { /* parse context for semantic checks */
typedef StmtInfoTC StmtInfo;
typedef StmtInfoPC 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 */
StmtInfoTC *topStmt; /* top of statement info stack */
StmtInfoTC *topScopeStmt; /* top lexical scope statement */
StmtInfoPC *topStmt; /* top of statement info stack */
StmtInfoPC *topScopeStmt; /* top lexical scope statement */
Rooted<StaticBlockObject *> blockChain;
/* compile time block scope chain */
@ -218,14 +218,14 @@ struct TreeContext { /* tree context for semantic checks */
FunctionBox *functionList;
private:
TreeContext **parserTC; /* this points to the Parser's active tc
ParseContext **parserPC; /* this points to the Parser's active pc
and holds either |this| or one of
|this|'s descendents */
public:
OwnedAtomDefnMapPtr lexdeps; /* unresolved lexical name dependencies */
TreeContext *parent; /* Enclosing function or global context. */
ParseContext *parent; /* Enclosing function or global context. */
ParseNode *innermostWith; /* innermost WITH parse node */
@ -255,8 +255,8 @@ struct TreeContext { /* tree context for semantic checks */
void trace(JSTracer *trc);
inline TreeContext(Parser *prs, SharedContext *sc, unsigned staticLevel, uint32_t bodyid);
inline ~TreeContext();
inline ParseContext(Parser *prs, SharedContext *sc, unsigned staticLevel, uint32_t bodyid);
inline ~ParseContext();
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{TC,BCE} of the given
* StmtInfoBase::linksScope() tells whether a js::StmtInfo{PC,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.
*/
// StmtInfoTC is used by the Parser. StmtInfoBCE is used by the
// StmtInfoPC 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 StmtInfoTC : public StmtInfoBase {
StmtInfoTC *down; /* info for enclosing statement */
StmtInfoTC *downScope; /* next enclosing lexical scope */
struct StmtInfoPC : public StmtInfoBase {
StmtInfoPC *down; /* info for enclosing statement */
StmtInfoPC *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;
StmtInfoTC(JSContext *cx) : StmtInfoBase(cx), isFunctionBodyBlock(false) {}
StmtInfoPC(JSContext *cx) : StmtInfoBase(cx), isFunctionBodyBlock(false) {}
};
bool
GenerateBlockId(TreeContext *tc, uint32_t &blockid);
GenerateBlockId(ParseContext *pc, uint32_t &blockid);
// Push the C-stack-allocated struct at stmt onto the StmtInfoTC stack.
// Push the C-stack-allocated struct at stmt onto the StmtInfoPC 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 tc->topStmt. If the top StmtInfoTC struct is not stack-allocated, it
// Pop ct->topStmt. If the top StmtInfoPC 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 // TreeContext_h__
#endif // ParseContext_h__

View File

@ -9,9 +9,9 @@
#include "frontend/ParseNode.h"
#include "frontend/TokenStream.h"
#include "frontend/TreeContext.h"
#include "frontend/ParseContext.h"
#include "frontend/TreeContext-inl.h"
#include "frontend/ParseContext-inl.h"
namespace js {
namespace frontend {
@ -184,14 +184,14 @@ NameNode::dump(int indent)
#endif
inline void
NameNode::initCommon(TreeContext *tc)
NameNode::initCommon(ParseContext *pc)
{
pn_expr = NULL;
pn_cookie.makeFree();
pn_dflags = (!tc->topStmt || tc->topStmt->type == STMT_BLOCK)
pn_dflags = (!pc->topStmt || pc->topStmt->type == STMT_BLOCK)
? PND_BLOCKCHILD
: 0;
pn_blockid = tc->blockid();
pn_blockid = pc->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 |tc|, because we only clean up |tc|'s
* 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 |tc|->functionList, the
* recycle some part of it (unless you've updated |pc|->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 |tc| may not equal
// |parser->tc|.
// SharedContext passed in separately, because in this case |pc| may not equal
// |parser->pc|.
NameNode *
NameNode::create(ParseNodeKind kind, JSAtom *atom, Parser *parser, TreeContext *tc)
NameNode::create(ParseNodeKind kind, JSAtom *atom, Parser *parser, ParseContext *pc)
{
ParseNode *pn = ParseNode::create(kind, PN_NAME, parser);
if (pn) {
pn->pn_atom = atom;
((NameNode *)pn)->initCommon(tc);
((NameNode *)pn)->initCommon(pc);
}
return (NameNode *)pn;
}
@ -462,9 +462,9 @@ Definition::kindString(Kind kind)
static ParseNode *
CloneParseTree(ParseNode *opn, Parser *parser)
{
TreeContext *tc = parser->tc;
ParseContext *pc = parser->pc;
JS_CHECK_RECURSION(tc->sc->context, return NULL);
JS_CHECK_RECURSION(pc->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, tc));
parser->newFunctionBox(opn->pn_funbox->object, pn, pc));
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/TreeContext.h"
#include "frontend/ParseContext.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, TreeContext *tc);
static NameNode *create(ParseNodeKind kind, JSAtom *atom, Parser *parser, ParseContext *pc);
inline void initCommon(TreeContext *tc);
inline void initCommon(ParseContext *pc);
#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 tc->decls) { // redeclaring
* if (x in pc->decls) { // redeclaring
* pn = allocate a PN_NAME ParseNode;
* } else { // defining
* dn = lookup x in tc->lexdeps;
* dn = lookup x in pc->lexdeps;
* if (dn) // use before def
* remove x from tc->lexdeps;
* remove x from pc->lexdeps;
* else // def before use
* dn = allocate a PN_NAME Definition;
* map x to dn via tc->decls;
* map x to dn via pc->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 tc's lexical scope chain;
* dn = lookup x in pc's lexical scope chain;
* if (!dn) {
* dn = lookup x in tc->lexdeps;
* dn = lookup x in pc->lexdeps;
* if (!dn) {
* dn = pre-allocate a Definition for x;
* map x to dn in tc->lexdeps;
* map x to dn in pc->lexdeps;
* }
* }
* append pn to dn's use chain;
* }
* }
*
* See frontend/BytecodeEmitter.h for js::TreeContext and its top*Stmt,
* See frontend/BytecodeEmitter.h for js::ParseContext 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 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
* 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
* 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, tc->lexdeps
* At the end of parsing a function body or global or eval program, pc->lexdeps
* holds the lexical dependencies of the parsed unit. The name to def/use chain
* mappings are then merged into the parent tc->lexdeps.
* mappings are then merged into the parent pc->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 tc->lexdeps and re-use it
* inner function's use of x, we will remove dn from pc->lexdeps and re-use it
* as the new definition node in the outer function's parse tree.
*
* When the compiler unwinds from the outermost tc, tc->lexdeps contains the
* When the compiler unwinds from the outermost pc, pc->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, TreeContext *tc);
FunctionBox(ObjectBox* traceListHead, JSObject *obj, ParseNode *fn, ParseContext *pc);
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/TreeContext.h"
#include "frontend/ParseContext.h"
namespace js {
namespace frontend {
@ -40,7 +40,7 @@ struct Parser : private AutoGCRooter
ParseNodeAllocator allocator;
ObjectBox *traceListHead; /* list of parsed object for GC tracing */
TreeContext *tc; /* innermost tree context (stack-allocated) */
ParseContext *pc; /* innermost parse 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, TreeContext *tc);
FunctionBox *newFunctionBox(JSObject *obj, ParseNode *fn, ParseContext *pc);
/*
* Create a new function object given tree context (tc) and a name (which
* Create a new function object given parse context (pc) and a name (which
* is optional if this is a function expression).
*/
JSFunction *newFunction(TreeContext *tc, JSAtom *atom, FunctionSyntaxKind kind);
JSFunction *newFunction(ParseContext *pc, 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 TreeContext
* object, pointed to by this->tc.
* Each parser must be called during the dynamic scope of a ParseContext
* object, pointed to by this->pc.
*
* 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 !tc->sc->inStrictMode() && tokenStream.allowsXML(); }
bool allowsXML() const { return !pc->sc->inStrictMode() && tokenStream.allowsXML(); }
ParseNode *endBracketedExpr();
@ -310,9 +310,4 @@ 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/TreeContext.h"
#include "frontend/ParseContext.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)
{
TreeContext *tc = parser->tc;
SharedContext *sc = tc->sc;
if (!tc->functionList)
ParseContext *pc = parser->pc;
SharedContext *sc = pc->sc;
if (!pc->functionList)
return true;
if (!MarkExtensibleScopeDescendants(sc->context, tc->functionList, false))
if (!MarkExtensibleScopeDescendants(sc->context, pc->functionList, false))
return false;
bool isDirectEval = !!callerFrame;
bool isHeavyweight = false;
SetFunctionKinds(tc->functionList, &isHeavyweight, sc->inFunction(), isDirectEval);
SetFunctionKinds(pc->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/TreeContext.h"
#include "frontend/ParseContext.h"
#include "vm/RegExpObject.h"
#include "vm/StringBuffer.h"

View File

@ -57,7 +57,6 @@
#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,7 +46,6 @@
#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,7 +27,6 @@
#include "frontend/Parser.h"
#include "frontend/TokenStream.h"
#include "frontend/TreeContext.h"
#include "vm/RegExpObject.h"
#include "jsscriptinlines.h"

View File

@ -42,11 +42,8 @@
#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;