Bug 770854 - Put frontend code in the frontend namespace. r=njn.
This commit is contained in:
@@ -65,7 +65,7 @@ NewTryNote(JSContext *cx, BytecodeEmitter *bce, JSTryNoteKind kind, unsigned sta
|
||||
static bool
|
||||
SetSrcNoteOffset(JSContext *cx, BytecodeEmitter *bce, unsigned index, unsigned which, ptrdiff_t offset);
|
||||
|
||||
struct js::StmtInfoBCE : public js::StmtInfoBase
|
||||
struct frontend::StmtInfoBCE : public StmtInfoBase
|
||||
{
|
||||
StmtInfoBCE *down; /* info for enclosing statement */
|
||||
StmtInfoBCE *downScope; /* next enclosing lexical scope */
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "vm/ScopeObject.h"
|
||||
|
||||
namespace js {
|
||||
namespace frontend {
|
||||
|
||||
struct TryNode {
|
||||
JSTryNote note;
|
||||
@@ -184,8 +185,6 @@ struct BytecodeEmitter
|
||||
bool reportStrictModeError(ParseNode *pn, unsigned errorNumber, ...);
|
||||
};
|
||||
|
||||
namespace frontend {
|
||||
|
||||
/*
|
||||
* Emit one bytecode.
|
||||
*/
|
||||
@@ -410,8 +409,6 @@ FinishTakingSrcNotes(JSContext *cx, BytecodeEmitter *bce, jssrcnote *notes);
|
||||
void
|
||||
FinishTakingTryNotes(BytecodeEmitter *bce, TryNoteArray *array);
|
||||
|
||||
} /* namespace frontend */
|
||||
|
||||
/*
|
||||
* Finish taking source notes in cx's notePool, copying final notes to the new
|
||||
* stable store allocated by the caller and passed in via notes. Return false
|
||||
@@ -466,6 +463,7 @@ inline bool LetDataToGroupAssign(ptrdiff_t w)
|
||||
return size_t(w) & 1;
|
||||
}
|
||||
|
||||
} /* namespace frontend */
|
||||
} /* namespace js */
|
||||
|
||||
struct JSSrcNoteSpec {
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "vm/String-inl.h"
|
||||
|
||||
using namespace js;
|
||||
using namespace js::frontend;
|
||||
|
||||
static ParseNode *
|
||||
ContainsVarOrConst(ParseNode *pn)
|
||||
@@ -401,7 +402,8 @@ Boolish(ParseNode *pn)
|
||||
}
|
||||
|
||||
bool
|
||||
js::FoldConstants(JSContext *cx, ParseNode *pn, Parser *parser, bool inGenexpLambda, bool inCond)
|
||||
frontend::FoldConstants(JSContext *cx, ParseNode *pn, Parser *parser, bool inGenexpLambda,
|
||||
bool inCond)
|
||||
{
|
||||
ParseNode *pn1 = NULL, *pn2 = NULL, *pn3 = NULL;
|
||||
|
||||
|
||||
@@ -11,11 +11,13 @@
|
||||
#include "jsprvtd.h"
|
||||
|
||||
namespace js {
|
||||
namespace frontend {
|
||||
|
||||
bool
|
||||
FoldConstants(JSContext *cx, ParseNode *pn, Parser *parser, bool inGenexpLambda = false,
|
||||
bool inCond = false);
|
||||
|
||||
} /* namespace frontend */
|
||||
} /* namespace js */
|
||||
|
||||
#endif /* FoldConstants_h__ */
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
#include "jscntxt.h"
|
||||
|
||||
#include "frontend/ParseNode.h" /* Need sizeof(js::Definition). */
|
||||
|
||||
#include "ParseMaps.h"
|
||||
#include "frontend/ParseMaps.h"
|
||||
|
||||
namespace js {
|
||||
namespace frontend {
|
||||
|
||||
template <>
|
||||
inline AtomDefnMap *
|
||||
@@ -113,6 +113,7 @@ AtomDecls::~AtomDecls()
|
||||
cx->parseMapPool().release(map);
|
||||
}
|
||||
|
||||
} /* namespace frontend */
|
||||
} /* namespace js */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,7 +9,10 @@
|
||||
#include "jscntxt.h"
|
||||
#include "jscompartment.h"
|
||||
|
||||
#include "vm/String-inl.h"
|
||||
|
||||
using namespace js;
|
||||
using namespace js::frontend;
|
||||
|
||||
void
|
||||
ParseMapPool::checkInvariants()
|
||||
@@ -153,3 +156,27 @@ AtomDecls::addHoist(JSAtom *atom, Definition *defn)
|
||||
return p.value().pushBack(cx, defn);
|
||||
return map->add(p, atom, DefinitionList(defn));
|
||||
}
|
||||
|
||||
void
|
||||
frontend::InitAtomMap(JSContext *cx, frontend::AtomIndexMap *indices, HeapPtrAtom *atoms)
|
||||
{
|
||||
if (indices->isMap()) {
|
||||
typedef AtomIndexMap::WordMap WordMap;
|
||||
const WordMap &wm = indices->asMap();
|
||||
for (WordMap::Range r = wm.all(); !r.empty(); r.popFront()) {
|
||||
JSAtom *atom = r.front().key;
|
||||
jsatomid index = r.front().value;
|
||||
JS_ASSERT(index < indices->count());
|
||||
atoms[index].init(atom);
|
||||
}
|
||||
} else {
|
||||
for (const AtomIndexMap::InlineElem *it = indices->asInline(), *end = indices->inlineEnd();
|
||||
it != end; ++it) {
|
||||
JSAtom *atom = it->key;
|
||||
if (!atom)
|
||||
continue;
|
||||
JS_ASSERT(it->value < indices->count());
|
||||
atoms[it->value].init(atom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,11 +15,23 @@
|
||||
#include "js/Vector.h"
|
||||
|
||||
namespace js {
|
||||
namespace frontend {
|
||||
|
||||
struct Definition;
|
||||
class DefinitionList;
|
||||
|
||||
typedef InlineMap<JSAtom *, jsatomid, 24> AtomIndexMap;
|
||||
typedef InlineMap<JSAtom *, Definition *, 24> AtomDefnMap;
|
||||
typedef InlineMap<JSAtom *, DefinitionList, 24> AtomDefnListMap;
|
||||
|
||||
/*
|
||||
* For all unmapped atoms recorded in al, add a mapping from the atom's index
|
||||
* to its address. map->length must already be set to the number of atoms in
|
||||
* the list and map->vector must point to pre-allocated memory.
|
||||
*/
|
||||
void
|
||||
InitAtomMap(JSContext *cx, AtomIndexMap *indices, HeapPtr<JSAtom> *atoms);
|
||||
|
||||
/*
|
||||
* A pool that permits the reuse of the backing storage for the defn, index, or
|
||||
* defn-or-header (multi) maps.
|
||||
@@ -310,14 +322,6 @@ class DefinitionList
|
||||
#endif
|
||||
};
|
||||
|
||||
namespace tl {
|
||||
|
||||
template <> struct IsPodType<DefinitionList> {
|
||||
static const bool result = true;
|
||||
};
|
||||
|
||||
} /* namespace tl */
|
||||
|
||||
/*
|
||||
* AtomDecls is a map of atoms to (sequences of) Definitions. It is used by
|
||||
* TreeContext to store declarations. A declaration associates a name with a
|
||||
@@ -415,6 +419,16 @@ typedef AtomDefnListMap::Ptr AtomDefnListPtr;
|
||||
typedef AtomDefnListMap::AddPtr AtomDefnListAddPtr;
|
||||
typedef AtomDefnListMap::Range AtomDefnListRange;
|
||||
|
||||
} /* namespace frontend */
|
||||
|
||||
namespace tl {
|
||||
|
||||
template <> struct IsPodType<frontend::DefinitionList> {
|
||||
static const bool result = true;
|
||||
};
|
||||
|
||||
} /* namespace tl */
|
||||
|
||||
} /* namepsace js */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "frontend/TreeContext-inl.h"
|
||||
|
||||
namespace js {
|
||||
namespace frontend {
|
||||
|
||||
inline bool
|
||||
UpvarCookie::set(JSContext *cx, unsigned newLevel, uint16_t newSlot)
|
||||
@@ -193,6 +194,7 @@ NameNode::initCommon(TreeContext *tc)
|
||||
pn_blockid = tc->blockid();
|
||||
}
|
||||
|
||||
} /* namespace frontend */
|
||||
} /* namespace js */
|
||||
|
||||
#endif /* ParseNode_inl_h__ */
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "frontend/ParseNode-inl.h"
|
||||
|
||||
using namespace js;
|
||||
using namespace js::frontend;
|
||||
|
||||
/*
|
||||
* Asserts to verify assumptions behind pn_ macros.
|
||||
@@ -570,7 +571,7 @@ CloneParseTree(ParseNode *opn, Parser *parser)
|
||||
* the original tree.
|
||||
*/
|
||||
ParseNode *
|
||||
js::CloneLeftHandSide(ParseNode *opn, Parser *parser)
|
||||
frontend::CloneLeftHandSide(ParseNode *opn, Parser *parser)
|
||||
{
|
||||
ParseNode *pn = parser->new_<ParseNode>(opn->getKind(), opn->getOp(), opn->getArity(),
|
||||
opn->pn_pos);
|
||||
@@ -641,7 +642,7 @@ js::CloneLeftHandSide(ParseNode *opn, Parser *parser)
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
js::DumpParseTree(ParseNode *pn, int indent)
|
||||
frontend::DumpParseTree(ParseNode *pn, int indent)
|
||||
{
|
||||
if (pn == NULL)
|
||||
fprintf(stderr, "()");
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "frontend/TreeContext.h"
|
||||
|
||||
namespace js {
|
||||
namespace frontend {
|
||||
|
||||
/*
|
||||
* Indicates a location in the stack that an upvar value can be retrieved from
|
||||
@@ -1504,6 +1505,7 @@ struct FunctionBox : public ObjectBox
|
||||
void recursivelySetStrictMode(StrictMode::StrictModeState strictness);
|
||||
};
|
||||
|
||||
} /* namespace frontend */
|
||||
} /* namespace js */
|
||||
|
||||
#endif /* ParseNode_h__ */
|
||||
|
||||
@@ -897,7 +897,7 @@ MakeDefIntoUse(Definition *dn, ParseNode *pn, JSAtom *atom, Parser *parser)
|
||||
}
|
||||
|
||||
bool
|
||||
js::DefineArg(ParseNode *pn, JSAtom *atom, unsigned i, Parser *parser)
|
||||
frontend::DefineArg(ParseNode *pn, JSAtom *atom, unsigned i, Parser *parser)
|
||||
{
|
||||
/*
|
||||
* Make an argument definition node, distinguished by being in
|
||||
@@ -940,7 +940,7 @@ BindLet(JSContext *cx, BindData *data, JSAtom *atom, Parser *parser);
|
||||
static bool
|
||||
BindVarOrConst(JSContext *cx, BindData *data, JSAtom *atom, Parser *parser);
|
||||
|
||||
struct BindData {
|
||||
struct frontend::BindData {
|
||||
BindData(JSContext *cx) : let(cx), fresh(true) {}
|
||||
|
||||
ParseNode *pn; /* name node for definition processing and
|
||||
|
||||
@@ -22,11 +22,10 @@
|
||||
#include "frontend/ParseNode.h"
|
||||
#include "frontend/TreeContext.h"
|
||||
|
||||
typedef struct BindData BindData;
|
||||
|
||||
namespace js {
|
||||
namespace frontend {
|
||||
|
||||
class StaticBlockObject;
|
||||
struct BindData;
|
||||
|
||||
enum FunctionSyntaxKind { Expression, Statement };
|
||||
enum LetContext { LetExpresion, LetStatement };
|
||||
@@ -106,7 +105,7 @@ struct Parser : private AutoGCRooter
|
||||
inline bool reportWarning(ParseNode *pn, unsigned errorNumber, ...);
|
||||
inline bool reportStrictWarning(ParseNode *pn, unsigned errorNumber, ...);
|
||||
inline bool reportStrictModeError(ParseNode *pn, unsigned errorNumber, ...);
|
||||
typedef bool (js::Parser::*Reporter)(ParseNode *pn, unsigned errorNumber, ...);
|
||||
typedef bool (Parser::*Reporter)(ParseNode *pn, unsigned errorNumber, ...);
|
||||
|
||||
private:
|
||||
ParseNode *allocParseNode(size_t size) {
|
||||
@@ -320,6 +319,7 @@ Parser::reportStrictModeError(ParseNode *pn, unsigned errorNumber, ...)
|
||||
bool
|
||||
DefineArg(ParseNode *pn, JSAtom *atom, unsigned i, Parser *parser);
|
||||
|
||||
} /* namespace frontend */
|
||||
} /* namespace js */
|
||||
|
||||
/*
|
||||
|
||||
@@ -10,15 +10,16 @@
|
||||
|
||||
namespace js {
|
||||
|
||||
struct Parser;
|
||||
class StackFrame;
|
||||
|
||||
namespace frontend {
|
||||
|
||||
class Parser;
|
||||
|
||||
/*
|
||||
* For each function in the compilation unit given by tc, decide whether the
|
||||
* function is a full closure or a null closure and set JSFunction flags
|
||||
* accordingly.
|
||||
* For each function in the compilation unit given by sc and functionList,
|
||||
* decide whether the function is a full closure or a null closure and set
|
||||
* JSFunction flags accordingly.
|
||||
*/
|
||||
bool
|
||||
AnalyzeFunctions(Parser *parser, StackFrame *callerFrame);
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#endif
|
||||
|
||||
using namespace js;
|
||||
using namespace js::frontend;
|
||||
using namespace js::unicode;
|
||||
|
||||
#define JS_KEYWORD(keyword, type, op, version) \
|
||||
@@ -58,7 +59,7 @@ static const KeywordInfo keywords[] = {
|
||||
};
|
||||
|
||||
const KeywordInfo *
|
||||
js::FindKeyword(const jschar *s, size_t length)
|
||||
frontend::FindKeyword(const jschar *s, size_t length)
|
||||
{
|
||||
JS_ASSERT(length != 0);
|
||||
|
||||
@@ -95,7 +96,7 @@ js::FindKeyword(const jschar *s, size_t length)
|
||||
}
|
||||
|
||||
bool
|
||||
js::IsIdentifier(JSLinearString *str)
|
||||
frontend::IsIdentifier(JSLinearString *str)
|
||||
{
|
||||
const jschar *chars = str->chars();
|
||||
size_t length = str->length();
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#undef JS_KEYWORD
|
||||
|
||||
namespace js {
|
||||
namespace frontend {
|
||||
|
||||
enum TokenKind {
|
||||
TOK_ERROR = -1, /* well-known as the only code < EOF */
|
||||
@@ -874,6 +875,7 @@ IsIdentifier(JSLinearString *str);
|
||||
*/
|
||||
#define JSREPORT_UC 0x100
|
||||
|
||||
} /* namespace frontend */
|
||||
} /* namespace js */
|
||||
|
||||
extern JS_FRIEND_API(int)
|
||||
@@ -881,7 +883,7 @@ js_fgets(char *buf, int size, FILE *file);
|
||||
|
||||
#ifdef DEBUG
|
||||
extern const char *
|
||||
TokenKindToString(js::TokenKind tt);
|
||||
TokenKindToString(js::frontend::TokenKind tt);
|
||||
#endif
|
||||
|
||||
#endif /* TokenStream_h__ */
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "frontend/ParseMaps-inl.h"
|
||||
|
||||
namespace js {
|
||||
namespace frontend {
|
||||
|
||||
inline
|
||||
SharedContext::SharedContext(JSContext *cx, JSObject *scopeChain, JSFunction *fun,
|
||||
@@ -38,6 +39,12 @@ SharedContext::inStrictMode()
|
||||
return strictModeState == StrictMode::STRICT;
|
||||
}
|
||||
|
||||
inline bool
|
||||
SharedContext::needStrictChecks()
|
||||
{
|
||||
return context->hasStrictOption() || strictModeState != StrictMode::NOTSTRICT;
|
||||
}
|
||||
|
||||
inline unsigned
|
||||
TreeContext::blockid()
|
||||
{
|
||||
@@ -50,12 +57,6 @@ TreeContext::atBodyLevel()
|
||||
return !topStmt || topStmt->isFunctionBodyBlock;
|
||||
}
|
||||
|
||||
inline bool
|
||||
SharedContext::needStrictChecks()
|
||||
{
|
||||
return context->hasStrictOption() || strictModeState != StrictMode::NOTSTRICT;
|
||||
}
|
||||
|
||||
inline
|
||||
TreeContext::TreeContext(Parser *prs, SharedContext *sc, unsigned staticLevel, uint32_t bodyid)
|
||||
: sc(sc),
|
||||
@@ -120,6 +121,8 @@ TreeContext::~TreeContext()
|
||||
}
|
||||
}
|
||||
|
||||
} /* namespace frontend */
|
||||
|
||||
template <class ContextT>
|
||||
void
|
||||
frontend::PushStatement(ContextT *ct, typename ContextT::StmtInfo *stmt, StmtType type)
|
||||
|
||||
@@ -19,9 +19,8 @@
|
||||
|
||||
#include "vm/ScopeObject.h"
|
||||
|
||||
typedef struct BindData BindData;
|
||||
|
||||
namespace js {
|
||||
namespace frontend {
|
||||
|
||||
class ContextFlags {
|
||||
|
||||
@@ -408,8 +407,6 @@ struct StmtInfoTC : public StmtInfoBase {
|
||||
StmtInfoTC(JSContext *cx) : StmtInfoBase(cx), isFunctionBodyBlock(false) {}
|
||||
};
|
||||
|
||||
namespace frontend {
|
||||
|
||||
bool
|
||||
GenerateBlockId(TreeContext *tc, uint32_t &blockid);
|
||||
|
||||
|
||||
@@ -86,6 +86,7 @@
|
||||
using namespace js;
|
||||
using namespace js::gc;
|
||||
using namespace js::types;
|
||||
using js::frontend::Parser;
|
||||
|
||||
bool
|
||||
JS::detail::CallMethodIfWrapped(JSContext *cx, IsAcceptableThis test, NativeImpl impl,
|
||||
@@ -6813,7 +6814,7 @@ JS_IsIdentifier(JSContext *cx, JSString *str, JSBool *isIdentifier)
|
||||
if (!linearStr)
|
||||
return false;
|
||||
|
||||
*isIdentifier = js::IsIdentifier(linearStr);
|
||||
*isIdentifier = js::frontend::IsIdentifier(linearStr);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1032,7 +1032,7 @@ class JS_PUBLIC_API(AutoGCRooter) {
|
||||
enum {
|
||||
JSVAL = -1, /* js::AutoValueRooter */
|
||||
VALARRAY = -2, /* js::AutoValueArrayRooter */
|
||||
PARSER = -3, /* js::Parser */
|
||||
PARSER = -3, /* js::frontend::Parser */
|
||||
SHAPEVECTOR = -4, /* js::AutoShapeVector */
|
||||
ENUMERATOR = -5, /* js::AutoEnumStateRooter */
|
||||
IDARRAY = -6, /* js::AutoIdArray */
|
||||
|
||||
@@ -454,30 +454,6 @@ js_DumpAtoms(JSContext *cx, FILE *fp)
|
||||
|
||||
namespace js {
|
||||
|
||||
void
|
||||
InitAtomMap(JSContext *cx, AtomIndexMap *indices, HeapPtrAtom *atoms)
|
||||
{
|
||||
if (indices->isMap()) {
|
||||
typedef AtomIndexMap::WordMap WordMap;
|
||||
const WordMap &wm = indices->asMap();
|
||||
for (WordMap::Range r = wm.all(); !r.empty(); r.popFront()) {
|
||||
JSAtom *atom = r.front().key;
|
||||
jsatomid index = r.front().value;
|
||||
JS_ASSERT(index < indices->count());
|
||||
atoms[index].init(atom);
|
||||
}
|
||||
} else {
|
||||
for (const AtomIndexMap::InlineElem *it = indices->asInline(), *end = indices->inlineEnd();
|
||||
it != end; ++it) {
|
||||
JSAtom *atom = it->key;
|
||||
if (!atom)
|
||||
continue;
|
||||
JS_ASSERT(it->value < indices->count());
|
||||
atoms[it->value].init(atom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
IndexToIdSlow(JSContext *cx, uint32_t index, jsid *idp)
|
||||
{
|
||||
|
||||
@@ -426,14 +426,6 @@ InternNonIntElementId(JSContext *cx, JSObject *obj, const Value &idval, jsid *id
|
||||
return InternNonIntElementId(cx, obj, idval, idp, &dummy);
|
||||
}
|
||||
|
||||
/*
|
||||
* For all unmapped atoms recorded in al, add a mapping from the atom's index
|
||||
* to its address. map->length must already be set to the number of atoms in
|
||||
* the list and map->vector must point to pre-allocated memory.
|
||||
*/
|
||||
extern void
|
||||
InitAtomMap(JSContext *cx, AtomIndexMap *indices, HeapPtr<JSAtom> *atoms);
|
||||
|
||||
template<XDRMode mode>
|
||||
bool
|
||||
XDRAtom(XDRState<mode> *xdr, JSAtom **atomp);
|
||||
|
||||
@@ -1027,7 +1027,7 @@ JSContext::~JSContext()
|
||||
{
|
||||
/* Free the stuff hanging off of cx. */
|
||||
if (parseMapPool_)
|
||||
Foreground::delete_<ParseMapPool>(parseMapPool_);
|
||||
Foreground::delete_(parseMapPool_);
|
||||
|
||||
if (lastMessage)
|
||||
Foreground::free_(lastMessage);
|
||||
@@ -1202,7 +1202,7 @@ void
|
||||
JSContext::purge()
|
||||
{
|
||||
if (!activeCompilations) {
|
||||
Foreground::delete_<ParseMapPool>(parseMapPool_);
|
||||
Foreground::delete_(parseMapPool_);
|
||||
parseMapPool_ = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1146,7 +1146,7 @@ struct JSContext : js::ContextFriendFields
|
||||
|
||||
private:
|
||||
/* Lazily initialized pool of maps used during parse/emit. */
|
||||
js::ParseMapPool *parseMapPool_;
|
||||
js::frontend::ParseMapPool *parseMapPool_;
|
||||
|
||||
public:
|
||||
/* Top-level object and pointer to top stack frame's scope chain. */
|
||||
@@ -1175,7 +1175,7 @@ struct JSContext : js::ContextFriendFields
|
||||
inline js::RegExpStatics *regExpStatics();
|
||||
|
||||
public:
|
||||
js::ParseMapPool &parseMapPool() {
|
||||
js::frontend::ParseMapPool &parseMapPool() {
|
||||
JS_ASSERT(parseMapPool_);
|
||||
return *parseMapPool_;
|
||||
}
|
||||
|
||||
@@ -558,7 +558,7 @@ JSContext::ensureParseMapPool()
|
||||
{
|
||||
if (parseMapPool_)
|
||||
return true;
|
||||
parseMapPool_ = js::OffTheBooks::new_<js::ParseMapPool>(this);
|
||||
parseMapPool_ = js::OffTheBooks::new_<js::frontend::ParseMapPool>(this);
|
||||
return parseMapPool_;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ using namespace mozilla;
|
||||
using namespace js;
|
||||
using namespace js::gc;
|
||||
using namespace js::types;
|
||||
using namespace js::frontend;
|
||||
|
||||
static JSBool
|
||||
fun_getProperty(JSContext *cx, HandleObject obj_, HandleId id, Value *vp)
|
||||
|
||||
@@ -2159,7 +2159,7 @@ AutoGCRooter::trace(JSTracer *trc)
|
||||
return;
|
||||
|
||||
case PARSER:
|
||||
static_cast<Parser *>(this)->trace(trc);
|
||||
static_cast<frontend::Parser *>(this)->trace(trc);
|
||||
return;
|
||||
|
||||
case ENUMERATOR:
|
||||
|
||||
@@ -70,6 +70,7 @@ using namespace mozilla;
|
||||
using namespace js;
|
||||
using namespace js::gc;
|
||||
using namespace js::types;
|
||||
using js::frontend::IsIdentifier;
|
||||
|
||||
JS_STATIC_ASSERT(int32_t((JSObject::NELEMENTS_LIMIT - 1) * sizeof(Value)) == int64_t((JSObject::NELEMENTS_LIMIT - 1) * sizeof(Value)));
|
||||
|
||||
|
||||
@@ -55,6 +55,9 @@
|
||||
using namespace mozilla;
|
||||
using namespace js;
|
||||
using namespace js::gc;
|
||||
using js::frontend::IsIdentifier;
|
||||
using js::frontend::LetDataToGroupAssign;
|
||||
using js::frontend::LetDataToOffset;
|
||||
|
||||
/*
|
||||
* Index limit must stay within 32 bits.
|
||||
|
||||
@@ -131,20 +131,6 @@ class StackSpace;
|
||||
class ContextStack;
|
||||
class ScriptFrameIter;
|
||||
|
||||
struct BytecodeEmitter;
|
||||
struct Definition;
|
||||
struct FunctionBox;
|
||||
struct ObjectBox;
|
||||
struct ParseNode;
|
||||
struct Parser;
|
||||
struct SharedContext;
|
||||
class TokenStream;
|
||||
struct Token;
|
||||
struct TokenPos;
|
||||
struct TokenPtr;
|
||||
struct TreeContext;
|
||||
class UpvarCookie;
|
||||
|
||||
class Proxy;
|
||||
class JS_FRIEND_API(BaseProxyHandler);
|
||||
class JS_FRIEND_API(DirectWrapper);
|
||||
@@ -172,13 +158,6 @@ class Bindings;
|
||||
struct StackBaseShape;
|
||||
struct StackShape;
|
||||
|
||||
class MultiDeclRange;
|
||||
class ParseMapPool;
|
||||
class DefinitionList;
|
||||
typedef InlineMap<JSAtom *, Definition *, 24> AtomDefnMap;
|
||||
typedef InlineMap<JSAtom *, jsatomid, 24> AtomIndexMap;
|
||||
typedef Vector<UpvarCookie, 8> UpvarCookies;
|
||||
|
||||
class Breakpoint;
|
||||
class BreakpointSite;
|
||||
class Debugger;
|
||||
@@ -197,6 +176,22 @@ typedef JSPropertyOp PropertyOp;
|
||||
typedef JSStrictPropertyOp StrictPropertyOp;
|
||||
typedef JSPropertyDescriptor PropertyDescriptor;
|
||||
|
||||
namespace frontend {
|
||||
|
||||
struct BytecodeEmitter;
|
||||
struct Definition;
|
||||
struct FunctionBox;
|
||||
struct ObjectBox;
|
||||
struct Token;
|
||||
struct TokenPos;
|
||||
struct TokenPtr;
|
||||
class TokenStream;
|
||||
struct Parser;
|
||||
class ParseMapPool;
|
||||
struct ParseNode;
|
||||
|
||||
} /* namespace frontend */
|
||||
|
||||
namespace analyze {
|
||||
|
||||
struct LifetimeVariable;
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace js;
|
||||
using namespace js::frontend;
|
||||
|
||||
namespace js {
|
||||
|
||||
|
||||
@@ -562,7 +562,8 @@ struct JSScript : public js::gc::Cell
|
||||
uint32_t nobjects, uint32_t nregexps, uint32_t ntrynotes, uint32_t nconsts,
|
||||
uint16_t nClosedArgs, uint16_t nClosedVars, uint32_t nTypeSets);
|
||||
static bool fullyInitTrivial(JSContext *cx, JS::Handle<JSScript*> script); // inits a JSOP_STOP-only script
|
||||
static bool fullyInitFromEmitter(JSContext *cx, JS::Handle<JSScript*> script, js::BytecodeEmitter *bce);
|
||||
static bool fullyInitFromEmitter(JSContext *cx, JS::Handle<JSScript*> script,
|
||||
js::frontend::BytecodeEmitter *bce);
|
||||
|
||||
void setVersion(JSVersion v) { version = v; }
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ using namespace mozilla;
|
||||
using namespace js;
|
||||
using namespace js::gc;
|
||||
using namespace js::types;
|
||||
using namespace js::frontend;
|
||||
|
||||
template<class T, class U>
|
||||
struct IdentityOp
|
||||
|
||||
@@ -3189,6 +3189,8 @@ Compile(JSContext *cx, unsigned argc, jsval *vp)
|
||||
static JSBool
|
||||
Parse(JSContext *cx, unsigned argc, jsval *vp)
|
||||
{
|
||||
using namespace js::frontend;
|
||||
|
||||
if (argc < 1) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_MORE_ARGS_NEEDED,
|
||||
"compile", "0", "s");
|
||||
@@ -3202,7 +3204,7 @@ Parse(JSContext *cx, unsigned argc, jsval *vp)
|
||||
}
|
||||
|
||||
JSString *scriptContents = JSVAL_TO_STRING(arg0);
|
||||
js::Parser parser(cx, /* prin = */ NULL, /* originPrin = */ NULL,
|
||||
Parser parser(cx, /* prin = */ NULL, /* originPrin = */ NULL,
|
||||
JS_GetStringCharsZ(cx, scriptContents), JS_GetStringLength(scriptContents),
|
||||
"<string>", /* lineno = */ 1, cx->findVersion(),
|
||||
/* foldConstants = */ true, /* compileAndGo = */ false);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "vm/Stack-inl.h"
|
||||
|
||||
using namespace js;
|
||||
using js::frontend::IsIdentifier;
|
||||
|
||||
|
||||
/*** Forward declarations ************************************************************************/
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
using namespace js;
|
||||
using js::detail::RegExpCode;
|
||||
using js::frontend::TokenStream;
|
||||
|
||||
JS_STATIC_ASSERT(IgnoreCaseFlag == JSREG_FOLD);
|
||||
JS_STATIC_ASSERT(GlobalFlag == JSREG_GLOB);
|
||||
|
||||
@@ -107,7 +107,9 @@ class RegExpCode
|
||||
Foreground::delete_<BytecodePattern>(byteCode);
|
||||
}
|
||||
|
||||
static bool checkSyntax(JSContext *cx, TokenStream *tokenStream, JSLinearString *source) {
|
||||
static bool checkSyntax(JSContext *cx, frontend::TokenStream *tokenStream,
|
||||
JSLinearString *source)
|
||||
{
|
||||
ErrorCode error = JSC::Yarr::checkSyntax(*source);
|
||||
if (error == JSC::Yarr::NoError)
|
||||
return true;
|
||||
@@ -119,7 +121,8 @@ class RegExpCode
|
||||
#if ENABLE_YARR_JIT
|
||||
static inline bool isJITRuntimeEnabled(JSContext *cx);
|
||||
#endif
|
||||
static void reportYarrError(JSContext *cx, TokenStream *ts, JSC::Yarr::ErrorCode error);
|
||||
static void reportYarrError(JSContext *cx, frontend::TokenStream *ts,
|
||||
JSC::Yarr::ErrorCode error);
|
||||
|
||||
static size_t getOutputSize(size_t pairCount) {
|
||||
return pairCount * 2;
|
||||
@@ -312,14 +315,14 @@ class RegExpObject : public JSObject
|
||||
*/
|
||||
static RegExpObject *
|
||||
create(JSContext *cx, RegExpStatics *res, const jschar *chars, size_t length,
|
||||
RegExpFlag flags, TokenStream *ts);
|
||||
RegExpFlag flags, frontend::TokenStream *ts);
|
||||
|
||||
static RegExpObject *
|
||||
createNoStatics(JSContext *cx, const jschar *chars, size_t length, RegExpFlag flags,
|
||||
TokenStream *ts);
|
||||
frontend::TokenStream *ts);
|
||||
|
||||
static RegExpObject *
|
||||
createNoStatics(JSContext *cx, HandleAtom atom, RegExpFlag flags, TokenStream *ts);
|
||||
createNoStatics(JSContext *cx, HandleAtom atom, RegExpFlag flags, frontend::TokenStream *ts);
|
||||
|
||||
/*
|
||||
* Run the regular expression over the input text.
|
||||
|
||||
@@ -194,17 +194,17 @@ StaticBlockObject::setStackDepth(uint32_t depth)
|
||||
}
|
||||
|
||||
inline void
|
||||
StaticBlockObject::setDefinitionParseNode(unsigned i, Definition *def)
|
||||
StaticBlockObject::setDefinitionParseNode(unsigned i, frontend::Definition *def)
|
||||
{
|
||||
JS_ASSERT(slotValue(i).isUndefined());
|
||||
setSlotValue(i, PrivateValue(def));
|
||||
}
|
||||
|
||||
inline Definition *
|
||||
inline frontend::Definition *
|
||||
StaticBlockObject::maybeDefinitionParseNode(unsigned i)
|
||||
{
|
||||
Value v = slotValue(i);
|
||||
return v.isUndefined() ? NULL : reinterpret_cast<Definition *>(v.toPrivate());
|
||||
return v.isUndefined() ? NULL : reinterpret_cast<frontend::Definition *>(v.toPrivate());
|
||||
}
|
||||
|
||||
inline void
|
||||
|
||||
@@ -313,8 +313,8 @@ class StaticBlockObject : public BlockObject
|
||||
* Frontend compilation temporarily uses the object's slots to link
|
||||
* a let var to its associated Definition parse node.
|
||||
*/
|
||||
void setDefinitionParseNode(unsigned i, Definition *def);
|
||||
Definition *maybeDefinitionParseNode(unsigned i);
|
||||
void setDefinitionParseNode(unsigned i, frontend::Definition *def);
|
||||
frontend::Definition *maybeDefinitionParseNode(unsigned i);
|
||||
|
||||
/*
|
||||
* The parser uses 'enclosingBlock' as the prev-link in the tc->blockChain
|
||||
|
||||
Reference in New Issue
Block a user