Commit d59e97e1 authored by abarth@webkit.org's avatar abarth@webkit.org

2010-06-04 Adam Barth <abarth@webkit.org>

        Reviewed by Eric Seidel.

        Make HTML5Lexer go fast
        https://bugs.webkit.org/show_bug.cgi?id=40048

        This patch handles the FLUSH_AND_ADVANCE_TO case.  Again, this patch
        introduces style errors that will be fixed shortly.

        * html/HTML5Lexer.cpp:
        (WebCore::HTML5Lexer::nextToken):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@60701 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ee7d9c38
2010-06-04 Adam Barth <abarth@webkit.org>
Reviewed by Eric Seidel.
Make HTML5Lexer go fast
https://bugs.webkit.org/show_bug.cgi?id=40048
This patch handles the FLUSH_AND_ADVANCE_TO case. Again, this patch
introduces style errors that will be fixed shortly.
* html/HTML5Lexer.cpp:
(WebCore::HTML5Lexer::nextToken):
2010-06-04 Adam Barth <abarth@webkit.org>
Reviewed by Eric Seidel.
......
......@@ -342,6 +342,9 @@ inline bool HTML5Lexer::processEntity(SegmentedString& source)
break; \
}
// When we move away from using a jump table, these macros will be different.
#define FLUSH_AND_ADVANCE_TO(stateName) FLUSH_EMIT_AND_RESUME_IN(stateName)
bool HTML5Lexer::nextToken(SegmentedString& source, HTML5Token& token)
{
// If we have a token in progress, then we're supposed to be called back
......@@ -539,15 +542,11 @@ bool HTML5Lexer::nextToken(SegmentedString& source, HTML5Token& token)
} else {
if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') {
if (isAppropriateEndTag()) {
m_state = BeforeAttributeNameState;
maybeFlushBufferedEndTag();
break;
FLUSH_AND_ADVANCE_TO(BeforeAttributeNameState);
}
} else if (cc == '/') {
if (isAppropriateEndTag()) {
m_state = SelfClosingStartTagState;
maybeFlushBufferedEndTag();
break;
FLUSH_AND_ADVANCE_TO(SelfClosingStartTagState);
}
} else if (cc == '>') {
if (isAppropriateEndTag()) {
......@@ -605,15 +604,11 @@ bool HTML5Lexer::nextToken(SegmentedString& source, HTML5Token& token)
} else {
if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') {
if (isAppropriateEndTag()) {
m_state = BeforeAttributeNameState;
maybeFlushBufferedEndTag();
break;
FLUSH_AND_ADVANCE_TO(BeforeAttributeNameState);
}
} else if (cc == '/') {
if (isAppropriateEndTag()) {
m_state = SelfClosingStartTagState;
maybeFlushBufferedEndTag();
break;
FLUSH_AND_ADVANCE_TO(SelfClosingStartTagState);
}
} else if (cc == '>') {
if (isAppropriateEndTag()) {
......@@ -675,15 +670,11 @@ bool HTML5Lexer::nextToken(SegmentedString& source, HTML5Token& token)
} else {
if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') {
if (isAppropriateEndTag()) {
m_state = BeforeAttributeNameState;
maybeFlushBufferedEndTag();
break;
FLUSH_AND_ADVANCE_TO(BeforeAttributeNameState);
}
} else if (cc == '/') {
if (isAppropriateEndTag()) {
m_state = SelfClosingStartTagState;
maybeFlushBufferedEndTag();
break;
FLUSH_AND_ADVANCE_TO(SelfClosingStartTagState);
}
} else if (cc == '>') {
if (isAppropriateEndTag()) {
......@@ -820,15 +811,11 @@ bool HTML5Lexer::nextToken(SegmentedString& source, HTML5Token& token)
} else {
if (cc == '\x09' || cc == '\x0A' || cc == '\x0C' || cc == ' ') {
if (isAppropriateEndTag()) {
m_state = BeforeAttributeNameState;
maybeFlushBufferedEndTag();
break;
FLUSH_AND_ADVANCE_TO(BeforeAttributeNameState);
}
} else if (cc == '/') {
if (isAppropriateEndTag()) {
m_state = SelfClosingStartTagState;
maybeFlushBufferedEndTag();
break;
FLUSH_AND_ADVANCE_TO(SelfClosingStartTagState);
}
} else if (cc == '>') {
if (isAppropriateEndTag()) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment