Bug 827539 - Remove unnecessary SkipRoots in the frontend; r=billm

This commit is contained in:
Terrence Cole 2013-01-07 17:23:08 -08:00
Родитель 7780c8d32b
Коммит e1c62edda8
2 изменённых файлов: 9 добавлений и 9 удалений

Просмотреть файл

@ -119,15 +119,12 @@ frontend::IsIdentifier(JSLinearString *str)
TokenStream::TokenStream(JSContext *cx, const CompileOptions &options,
StableCharPtr base, size_t length, StrictModeGetter *smg)
: tokens(),
tokensRoot(cx, &tokens),
cursor(),
lookahead(),
lineno(options.lineno),
flags(),
linebase(base.get()),
prevLinebase(NULL),
linebaseRoot(cx, &linebase),
prevLinebaseRoot(cx, &prevLinebase),
userbuf(base.get(), length),
filename(options.filename),
sourceMap(NULL),
@ -139,7 +136,8 @@ TokenStream::TokenStream(JSContext *cx, const CompileOptions &options,
cx(cx),
originPrincipals(JSScript::normalizeOriginPrincipals(options.principals,
options.originPrincipals)),
strictModeGetter(smg)
strictModeGetter(smg),
tokenSkip(cx, &tokens)
{
if (originPrincipals)
JS_HoldPrincipals(originPrincipals);
@ -1442,8 +1440,6 @@ TokenStream::getTokenInternal()
const jschar *identStart;
bool hadUnicodeEscape;
SkipRoot skipNum(cx, &numStart), skipIdent(cx, &identStart);
#if JS_HAS_XML_SUPPORT
/*
* Look for XML text and tags.

Просмотреть файл

@ -852,15 +852,12 @@ class TokenStream
void updateFlagsForEOL();
Token tokens[ntokens];/* circular token buffer */
js::SkipRoot tokensRoot; /* prevent overwriting of token buffer */
unsigned cursor; /* index of last parsed token */
unsigned lookahead; /* count of lookahead tokens */
unsigned lineno; /* current line number */
unsigned flags; /* flags -- see above */
const jschar *linebase; /* start of current line; points into userbuf */
const jschar *prevLinebase; /* start of previous line; NULL if on the first line */
js::SkipRoot linebaseRoot;
js::SkipRoot prevLinebaseRoot;
TokenBuf userbuf; /* user input buffer */
const char *filename; /* input filename or null */
jschar *sourceMap; /* source map's filename or null */
@ -876,6 +873,13 @@ class TokenStream
JSPrincipals *const originPrincipals;
StrictModeGetter *strictModeGetter; /* used to test for strict mode */
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 {