Title: [150105] trunk/Source/WebCore
- Revision
- 150105
- Author
- [email protected]
- Date
- 2013-05-15 01:28:43 -0700 (Wed, 15 May 2013)
Log Message
Do not bloat HTMLTokenizer with a giant inline InputStreamPreprocessor::peek
https://bugs.webkit.org/show_bug.cgi?id=116066
Patch by Benjamin Poulain <[email protected]> on 2013-05-15
Reviewed by Ryosuke Niwa.
Merge https://chromium.googlesource.com/chromium/blink/+/45e0337b2f2db535ab08365f6e763a5015e4d990.
On x86_64, this removes 40kb from the binary. On my machine it is completely neutral on performance.
* html/parser/InputStreamPreprocessor.h:
(WebCore::InputStreamPreprocessor::peek):
(InputStreamPreprocessor):
(WebCore::InputStreamPreprocessor::advance):
(WebCore::InputStreamPreprocessor::skipNextNewLine):
(WebCore::InputStreamPreprocessor::reset):
(WebCore::InputStreamPreprocessor::processNextInputCharacter):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (150104 => 150105)
--- trunk/Source/WebCore/ChangeLog 2013-05-15 08:07:28 UTC (rev 150104)
+++ trunk/Source/WebCore/ChangeLog 2013-05-15 08:28:43 UTC (rev 150105)
@@ -1,3 +1,22 @@
+2013-05-15 Benjamin Poulain <[email protected]>
+
+ Do not bloat HTMLTokenizer with a giant inline InputStreamPreprocessor::peek
+ https://bugs.webkit.org/show_bug.cgi?id=116066
+
+ Reviewed by Ryosuke Niwa.
+
+ Merge https://chromium.googlesource.com/chromium/blink/+/45e0337b2f2db535ab08365f6e763a5015e4d990.
+
+ On x86_64, this removes 40kb from the binary. On my machine it is completely neutral on performance.
+
+ * html/parser/InputStreamPreprocessor.h:
+ (WebCore::InputStreamPreprocessor::peek):
+ (InputStreamPreprocessor):
+ (WebCore::InputStreamPreprocessor::advance):
+ (WebCore::InputStreamPreprocessor::skipNextNewLine):
+ (WebCore::InputStreamPreprocessor::reset):
+ (WebCore::InputStreamPreprocessor::processNextInputCharacter):
+
2013-05-14 Carlos Garcia Campos <[email protected]>
Remove WTF_USE_PLATFORM_STRATEGIES
Modified: trunk/Source/WebCore/html/parser/InputStreamPreprocessor.h (150104 => 150105)
--- trunk/Source/WebCore/html/parser/InputStreamPreprocessor.h 2013-05-15 08:07:28 UTC (rev 150104)
+++ trunk/Source/WebCore/html/parser/InputStreamPreprocessor.h 2013-05-15 08:28:43 UTC (rev 150105)
@@ -53,7 +53,6 @@
// 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,7 +64,32 @@
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;
source.advancePastNewlineAndUpdateLineNumber();
@@ -87,7 +111,8 @@
source.advancePastNonNewline();
if (source.isEmpty())
return false;
- goto PeekAgain;
+ m_nextInputCharacter = source.currentChar();
+ goto ProcessAgain;
}
m_nextInputCharacter = 0xFFFD;
}
@@ -95,24 +120,6 @@
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;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes