LayoutTests:
authorggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Aug 2006 22:51:04 +0000 (22:51 +0000)
committerggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Aug 2006 22:51:04 +0000 (22:51 +0000)
commit4477791ee5acf80af31f8adfcb0a9c66f701a636
tree6ddb3a402546e6f6d8b0ee9222e1ea9b17e11816
parent25dd3435bf0d89f376ba23a4f711c7c6adf52f4f
LayoutTests:

        Layout test for <rdar://problem/4661982> (crash in KHTMLParser::popBlock)

        * fast/parser/remove-node-stack-expected.txt: Added.
        * fast/parser/remove-node-stack.html: Added.

WebCore:

        Reviewed by Darin.

        - This patch reworks a previous fix for <rdar://problem/3524912> repro
        crash in KHTMLParser::parseToken, due to parser's current element being
        destroyed (www.gnnetcom.dk), along with subsequent adjustments to fix
        leaks.

        The previous solutions caused a ~2% performance regression on iBench HTML,
        due to RefPtr churn. The optimizations here gain back that ~2% plus ~1% more,
        for a total win of ~3% vs current TOT.

        We can merge this fix to the branch to fix <rdar://problem/4661982>
        (crash in KHTMLParser::popBlock).

        The solution here is:
        (1) Don't let the parser ref document nodes -- that causes leaks.
        (2) Handle ref/deref manually, to avoid RefPtr churn. Specifically, when
        moving a node between stacks or to/from 'current', rather than deref'ing
        and then ref'ing again, simply move the node, along with its refcount, to
        its new location, and overwrite its old location.

        * WebCore.xcodeproj/project.pbxproj:
        * html/HTMLParser.cpp:
        (WebCore::HTMLStackElem::HTMLStackElem):
        (WebCore::HTMLStackElem::derefNode):
        (WebCore::HTMLParser::HTMLParser):
        (WebCore::HTMLParser::setCurrent):
        (WebCore::HTMLParser::insertNode):
        (WebCore::HTMLParser::popNestedHeaderTag):
        (WebCore::HTMLParser::handleResidualStyleCloseTagAcrossBlocks):
        (WebCore::HTMLParser::reopenResidualStyleTags):
        (WebCore::HTMLParser::pushBlock):
        (WebCore::HTMLParser::popBlock):
        (WebCore::HTMLParser::popOneBlockCommon):
        (WebCore::HTMLParser::popOneBlock):
        (WebCore::HTMLParser::moveOneBlockToStack):
        * html/HTMLParser.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15890 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/parser/remove-node-stack-expected.txt [new file with mode: 0644]
LayoutTests/fast/parser/remove-node-stack.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/html/HTMLParser.cpp
WebCore/html/HTMLParser.h