Bug 849367 (part 1) - Speed up TokenStream::matchChar(). r=jorendorff.

--HG--
extra : rebase_source : 1527af5e38158a69f74d252320a899d9208055c6
This commit is contained in:
Nicholas Nethercote 2013-03-11 22:43:23 -07:00
parent c8cee2f373
commit a6acef8a0c

View File

@ -805,12 +805,11 @@ class TokenStream
bool peekChars(int n, jschar *cp);
bool getAtSourceMappingURL(bool isMultiline);
// |expect| cannot be an EOL char.
bool matchChar(int32_t expect) {
int32_t c = getChar();
if (c == expect)
return true;
ungetChar(c);
return false;
MOZ_ASSERT(!TokenBuf::isRawEOLChar(expect));
return JS_LIKELY(userbuf.hasRawChars()) &&
userbuf.matchRawChar(expect);
}
void consumeKnownChar(int32_t expect) {