Reviewed by Mitz.
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Nov 2007 04:09:30 +0000 (04:09 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Nov 2007 04:09:30 +0000 (04:09 +0000)
commita560e964180cebc0b4083c9f8b30ab17bfcaf1d4
tree7f5aa6ffba08cf5baa529b11a88fe5cada9b547c
parent6a788271c7eb7edfa549743a51f788a149df068a
    Reviewed by Mitz.

        - http://bugs.webkit.org/show_bug.cgi?id=15944
          streamline SegmentedString to speed up parsing

        I measured a speed-up of the page load test while developing this patch. I don't
        have a precise figure, though.

        * html/HTMLTokenizer.h: Removed unneeded lineNumberPtr() function. Also renamed
        lineno to m_lineNumber.
        * html/HTMLTokenizer.cpp:
        (WebCore::HTMLTokenizer::processListing): Don't pass 0 to the advance function
        since we don't want to update a line number.
        (WebCore::HTMLTokenizer::parseSpecial): Ditto.
        (WebCore::HTMLTokenizer::parseComment): Pass the line number data member directly
        instead of lineNumberPtr() since the advance function now takes a reference.
        (WebCore::HTMLTokenizer::parseServer): Ditto.
        (WebCore::HTMLTokenizer::parseProcessingInstruction): Ditto.
        (WebCore::HTMLTokenizer::parseText): Ditto.
        (WebCore::HTMLTokenizer::parseEntity): Ditto.
        (WebCore::HTMLTokenizer::parseTag): Ditto.
        (WebCore::HTMLTokenizer::write): Ditto.

        * loader/FTPDirectoryDocument.cpp: (WebCore::FTPDirectoryTokenizer::write):
        * loader/TextDocument.cpp: (WebCore::TextTokenizer::write):
        Don't pass 0 to the advance function.

        * platform/SegmentedString.h: (WebCore::SegmentedString::advance): Streamlined
        the most common case, and pushed less common cases into a separate function
        that is not inlined. Also got rid of a branch by separating the case with a
        line number from the case without one.

        * platform/SegmentedString.cpp: (WebCore::SegmentedString::advanceSlowCase):
        Added. The aforementioned less common cases are here.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27699 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebCore/ChangeLog
WebCore/html/HTMLTokenizer.cpp
WebCore/html/HTMLTokenizer.h
WebCore/loader/FTPDirectoryDocument.cpp
WebCore/loader/TextDocument.cpp
WebCore/platform/SegmentedString.cpp
WebCore/platform/SegmentedString.h