Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: Source/core/html/parser/InputStreamPreprocessor.h

Issue 14885016: Shrunk HTMLTokenizer.o by 28.2% (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Make impl private Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/parser/InputStreamPreprocessor.h
diff --git a/Source/core/html/parser/InputStreamPreprocessor.h b/Source/core/html/parser/InputStreamPreprocessor.h
index 0d6ee30fad76133b7b890bc9e4ea88ce8a228350..a35711d704440a76f355490bb5459a7b3474e3dc 100644
--- a/Source/core/html/parser/InputStreamPreprocessor.h
+++ b/Source/core/html/parser/InputStreamPreprocessor.h
@@ -53,7 +53,6 @@ public:
// characters in |source| (after collapsing \r\n, etc).
ALWAYS_INLINE bool peek(SegmentedString& source)
{
- PeekAgain:
m_nextInputCharacter = source.currentChar();
// Every branch in this function is expensive, so we have a
@@ -65,6 +64,31 @@ public:
m_skipNextNewLine = false;
return true;
}
+ return processNextInputCharacter(source);
+ }
+
+ // Returns whether there are more characters in |source| after advancing.
+ ALWAYS_INLINE bool advance(SegmentedString& source)
+ {
+ source.advanceAndUpdateLineNumber();
+ if (source.isEmpty())
+ return false;
+ return peek(source);
+ }
+
+ bool skipNextNewLine() const { return m_skipNextNewLine; }
+
+ void reset(bool skipNextNewLine = false)
+ {
+ m_nextInputCharacter = '\0';
+ m_skipNextNewLine = skipNextNewLine;
+ }
+
+private:
+ bool processNextInputCharacter(SegmentedString& source)
+ {
+ ProcessAgain:
+ ASSERT(m_nextInputCharacter == source.currentChar());
if (m_nextInputCharacter == '\n' && m_skipNextNewLine) {
m_skipNextNewLine = false;
@@ -87,7 +111,8 @@ public:
source.advancePastNonNewline();
if (source.isEmpty())
return false;
- goto PeekAgain;
+ m_nextInputCharacter = source.currentChar();
+ goto ProcessAgain;
}
m_nextInputCharacter = 0xFFFD;
}
@@ -95,24 +120,6 @@ public:
return true;
}
- // Returns whether there are more characters in |source| after advancing.
- ALWAYS_INLINE bool advance(SegmentedString& source)
- {
- source.advanceAndUpdateLineNumber();
- if (source.isEmpty())
- return false;
- return peek(source);
- }
-
- bool skipNextNewLine() const { return m_skipNextNewLine; }
-
- void reset(bool skipNextNewLine = false)
- {
- m_nextInputCharacter = '\0';
- m_skipNextNewLine = skipNextNewLine;
- }
-
-private:
bool shouldTreatNullAsEndOfFileMarker(SegmentedString& source) const
{
return source.isClosed() && source.length() == 1;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698