зеркало из https://github.com/mozilla/gecko-dev.git
Bug 827539 - Remove unnecessary SkipRoots in the frontend; r=billm
This commit is contained in:
Родитель
7780c8d32b
Коммит
e1c62edda8
|
@ -119,15 +119,12 @@ frontend::IsIdentifier(JSLinearString *str)
|
||||||
TokenStream::TokenStream(JSContext *cx, const CompileOptions &options,
|
TokenStream::TokenStream(JSContext *cx, const CompileOptions &options,
|
||||||
StableCharPtr base, size_t length, StrictModeGetter *smg)
|
StableCharPtr base, size_t length, StrictModeGetter *smg)
|
||||||
: tokens(),
|
: tokens(),
|
||||||
tokensRoot(cx, &tokens),
|
|
||||||
cursor(),
|
cursor(),
|
||||||
lookahead(),
|
lookahead(),
|
||||||
lineno(options.lineno),
|
lineno(options.lineno),
|
||||||
flags(),
|
flags(),
|
||||||
linebase(base.get()),
|
linebase(base.get()),
|
||||||
prevLinebase(NULL),
|
prevLinebase(NULL),
|
||||||
linebaseRoot(cx, &linebase),
|
|
||||||
prevLinebaseRoot(cx, &prevLinebase),
|
|
||||||
userbuf(base.get(), length),
|
userbuf(base.get(), length),
|
||||||
filename(options.filename),
|
filename(options.filename),
|
||||||
sourceMap(NULL),
|
sourceMap(NULL),
|
||||||
|
@ -139,7 +136,8 @@ TokenStream::TokenStream(JSContext *cx, const CompileOptions &options,
|
||||||
cx(cx),
|
cx(cx),
|
||||||
originPrincipals(JSScript::normalizeOriginPrincipals(options.principals,
|
originPrincipals(JSScript::normalizeOriginPrincipals(options.principals,
|
||||||
options.originPrincipals)),
|
options.originPrincipals)),
|
||||||
strictModeGetter(smg)
|
strictModeGetter(smg),
|
||||||
|
tokenSkip(cx, &tokens)
|
||||||
{
|
{
|
||||||
if (originPrincipals)
|
if (originPrincipals)
|
||||||
JS_HoldPrincipals(originPrincipals);
|
JS_HoldPrincipals(originPrincipals);
|
||||||
|
@ -1442,8 +1440,6 @@ TokenStream::getTokenInternal()
|
||||||
const jschar *identStart;
|
const jschar *identStart;
|
||||||
bool hadUnicodeEscape;
|
bool hadUnicodeEscape;
|
||||||
|
|
||||||
SkipRoot skipNum(cx, &numStart), skipIdent(cx, &identStart);
|
|
||||||
|
|
||||||
#if JS_HAS_XML_SUPPORT
|
#if JS_HAS_XML_SUPPORT
|
||||||
/*
|
/*
|
||||||
* Look for XML text and tags.
|
* Look for XML text and tags.
|
||||||
|
|
|
@ -852,15 +852,12 @@ class TokenStream
|
||||||
void updateFlagsForEOL();
|
void updateFlagsForEOL();
|
||||||
|
|
||||||
Token tokens[ntokens];/* circular token buffer */
|
Token tokens[ntokens];/* circular token buffer */
|
||||||
js::SkipRoot tokensRoot; /* prevent overwriting of token buffer */
|
|
||||||
unsigned cursor; /* index of last parsed token */
|
unsigned cursor; /* index of last parsed token */
|
||||||
unsigned lookahead; /* count of lookahead tokens */
|
unsigned lookahead; /* count of lookahead tokens */
|
||||||
unsigned lineno; /* current line number */
|
unsigned lineno; /* current line number */
|
||||||
unsigned flags; /* flags -- see above */
|
unsigned flags; /* flags -- see above */
|
||||||
const jschar *linebase; /* start of current line; points into userbuf */
|
const jschar *linebase; /* start of current line; points into userbuf */
|
||||||
const jschar *prevLinebase; /* start of previous line; NULL if on the first line */
|
const jschar *prevLinebase; /* start of previous line; NULL if on the first line */
|
||||||
js::SkipRoot linebaseRoot;
|
|
||||||
js::SkipRoot prevLinebaseRoot;
|
|
||||||
TokenBuf userbuf; /* user input buffer */
|
TokenBuf userbuf; /* user input buffer */
|
||||||
const char *filename; /* input filename or null */
|
const char *filename; /* input filename or null */
|
||||||
jschar *sourceMap; /* source map's filename or null */
|
jschar *sourceMap; /* source map's filename or null */
|
||||||
|
@ -876,6 +873,13 @@ class TokenStream
|
||||||
JSPrincipals *const originPrincipals;
|
JSPrincipals *const originPrincipals;
|
||||||
StrictModeGetter *strictModeGetter; /* used to test for strict mode */
|
StrictModeGetter *strictModeGetter; /* used to test for strict mode */
|
||||||
Position lastFunctionKeyword; /* used as a starting point for reparsing strict functions */
|
Position lastFunctionKeyword; /* used as a starting point for reparsing strict functions */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The tokens array stores pointers to JSAtoms. These are rooted by the
|
||||||
|
* atoms table using AutoKeepAtoms in the Parser. This SkipRoot tells the
|
||||||
|
* exact rooting analysis to ignore the atoms in the tokens array.
|
||||||
|
*/
|
||||||
|
SkipRoot tokenSkip;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct KeywordInfo {
|
struct KeywordInfo {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче