mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 12:55:46 +00:00
Bug 845519 - Use SkipRoots for jschar pointers until we need to start moving them. r=terrence
--HG-- extra : rebase_source : d337dba6972e78e1994dd5563f093622e4475fc8
This commit is contained in:
parent
1a43514b59
commit
814e5274d5
@ -122,7 +122,7 @@ TokenStream::TokenStream(JSContext *cx, const CompileOptions &options,
|
||||
flags(),
|
||||
linebase(base),
|
||||
prevLinebase(NULL),
|
||||
userbuf(base, length),
|
||||
userbuf(cx, base, length),
|
||||
filename(options.filename),
|
||||
sourceMap(NULL),
|
||||
listenerTSData(),
|
||||
@ -132,7 +132,9 @@ TokenStream::TokenStream(JSContext *cx, const CompileOptions &options,
|
||||
originPrincipals(JSScript::normalizeOriginPrincipals(options.principals,
|
||||
options.originPrincipals)),
|
||||
strictModeGetter(smg),
|
||||
tokenSkip(cx, &tokens)
|
||||
tokenSkip(cx, &tokens),
|
||||
linebaseSkip(cx, &linebase),
|
||||
prevLinebaseSkip(cx, &prevLinebase)
|
||||
{
|
||||
if (originPrincipals)
|
||||
JS_HoldPrincipals(originPrincipals);
|
||||
@ -663,7 +665,7 @@ TokenStream::endOffset(const Token &tok)
|
||||
JS_ASSERT(lineno <= tok.pos.end.lineno);
|
||||
const jschar *end;
|
||||
if (lineno < tok.pos.end.lineno) {
|
||||
TokenBuf buf(tok.ptr, userbuf.addressOfNextRawChar() - userbuf.base());
|
||||
TokenBuf buf(cx, tok.ptr, userbuf.addressOfNextRawChar() - userbuf.base());
|
||||
for (; lineno < tok.pos.end.lineno; lineno++) {
|
||||
jschar c;
|
||||
do {
|
||||
|
@ -671,8 +671,10 @@ class TokenStream
|
||||
*/
|
||||
class TokenBuf {
|
||||
public:
|
||||
TokenBuf(const jschar *buf, size_t length)
|
||||
: base_(buf), limit_(buf + length), ptr(buf) { }
|
||||
TokenBuf(JSContext *cx, const jschar *buf, size_t length)
|
||||
: base_(buf), limit_(buf + length), ptr(buf),
|
||||
skipBase(cx, &base_), skipLimit(cx, &limit_), skipPtr(cx, &ptr)
|
||||
{ }
|
||||
|
||||
bool hasRawChars() const {
|
||||
return ptr < limit_;
|
||||
@ -750,6 +752,9 @@ class TokenStream
|
||||
const jschar *base_; /* base of buffer */
|
||||
const jschar *limit_; /* limit for quick bounds check */
|
||||
const jschar *ptr; /* next char to get */
|
||||
|
||||
// We are not yet moving strings
|
||||
SkipRoot skipBase, skipLimit, skipPtr;
|
||||
};
|
||||
|
||||
TokenKind getTokenInternal(); /* doesn't check for pushback or error flag. */
|
||||
@ -820,6 +825,10 @@ class TokenStream
|
||||
* exact rooting analysis to ignore the atoms in the tokens array.
|
||||
*/
|
||||
SkipRoot tokenSkip;
|
||||
|
||||
// Bug 846011
|
||||
SkipRoot linebaseSkip;
|
||||
SkipRoot prevLinebaseSkip;
|
||||
};
|
||||
|
||||
struct KeywordInfo {
|
||||
|
Loading…
Reference in New Issue
Block a user