Bug 645598 - Trim last bits of fat from the scanner, part 3 of 3. r=jwalden.
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 07 Jun 2011 13:48:55 +1000
changeset 70980 b71f5419e37a43fb3b04e156fc830e5dc5665dc3
parent 70979 3bae9deeb9b4a00a1495de94f431e7b9d60c6dc3
child 70981 ef4d79fc60c0edb04ab6230f213a868e8bc95175
child 74464 8b978fbe8b9c3013e51e4a46b8cd7389550fccc9
push id20463
push usercleary@mozilla.com
push dateMon, 13 Jun 2011 17:53:39 +0000
treeherdermozilla-central@872ae1cef345 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwalden
bugs645598
milestone7.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 645598 - Trim last bits of fat from the scanner, part 3 of 3. r=jwalden.
js/src/jsscan.h
--- a/js/src/jsscan.h
+++ b/js/src/jsscan.h
@@ -428,27 +428,31 @@ class TokenStream
      * Push the last scanned token back into the stream.
      */
     void ungetToken() {
         JS_ASSERT(lookahead < ntokensMask);
         lookahead++;
         cursor = (cursor - 1) & ntokensMask;
     }
 
-    TokenKind peekToken(uintN withFlags = 0) {
-        Flagger flagger(this, withFlags);
+    TokenKind peekToken() {
         if (lookahead != 0) {
             JS_ASSERT(lookahead == 1);
             return tokens[(cursor + lookahead) & ntokensMask].type;
         }
-        TokenKind tt = getToken();
+        TokenKind tt = getTokenInternal();
         ungetToken();
         return tt;
     }
 
+    TokenKind peekToken(uintN withFlags) {
+        Flagger flagger(this, withFlags);
+        return peekToken();
+    }
+
     TokenKind peekTokenSameLine(uintN withFlags = 0) {
         if (!onCurrentLine(currentToken().pos))
             return TOK_EOL;
 
         if (lookahead != 0) {
             JS_ASSERT(lookahead == 1);
             return tokens[(cursor + lookahead) & ntokensMask].type;
         }
@@ -465,24 +469,29 @@ class TokenStream
         }
         ungetToken();
         return tt;
     }
 
     /*
      * Get the next token from the stream if its kind is |tt|.
      */
-    bool matchToken(TokenKind tt, uintN withFlags = 0) {
-        Flagger flagger(this, withFlags);
+    bool matchToken(TokenKind tt) {
         if (getToken() == tt)
             return true;
         ungetToken();
         return false;
     }
 
+    bool matchToken(TokenKind tt, uintN withFlags) {
+        Flagger flagger(this, withFlags);
+        return matchToken(tt);
+    }
+
+
   private:
     /*
      * This is the low-level interface to the JS source code buffer.  It just
      * gets raw chars, basically.  TokenStreams functions are layered on top
      * and do some extra stuff like converting all EOL sequences to '\n',
      * tracking the line number, and setting the TSF_EOF flag.  (The "raw" in
      * "raw chars" refers to the lack of EOL sequence normalization.)
      */