Reviewed by Maciej.
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Dec 2007 20:11:09 +0000 (20:11 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Dec 2007 20:11:09 +0000 (20:11 +0000)
commit72bd6899764d349ce0df3e49b418c60eee8d8bb7
tree2db876486dfc7108d37084c0074a7dde6a8c0518
parente9fdfe9d5d074875489266b646cfb1fdef3cc579
    Reviewed by Maciej.

        http://bugs.webkit.org/show_bug.cgi?id=16511
        Speed up ClassNodeList and NamedNodeList by using the caching mechanism employed by ChildNodeList.
        - This give a ~2.15x speedup on the native test @ http://ejohn.org/apps/classname/

        * dom/ChildNodeList.cpp: Use the caching NodeList constructor to turn on caching.
        (WebCore::ChildNodeList::ChildNodeList):
        * dom/ClassNodeList.cpp:
        (WebCore::ClassNodeList::ClassNodeList):
        * dom/ClassNodeList.h:

        Move getElementsByName and getElementsByClassName to Node so they
        can use easily employ the caching already used by ChildNodeLists.  In the case of
        getElementsByClassName, this reduces code duplication in Element as well
        * dom/Document.cpp:
        * dom/Document.h:

        Move getElementsByClassName to Node.
        * dom/Element.cpp:
        * dom/Element.h:

        * dom/NameNodeList.cpp: Use the caching NodeList constructor to turn on caching.
        (WebCore::NameNodeList::NameNodeList):
        (WebCore::NameNodeList::item):
        * dom/NameNodeList.h:

        Add maps of caches for ClassNodeLists and NameNodeList to NodeListsNodeData.
        * dom/Node.cpp:
        (WebCore::TagNodeList::TagNodeList):
        (WebCore::Node::Node):
        (WebCore::Node::~Node):
        (WebCore::Node::childNodes):
        (WebCore::Node::registerNodeList):
        (WebCore::Node::getElementsByName):
        (WebCore::Node::getElementsByClassName):
        * dom/Node.h: Make m_nodeLists an OwnPtr.  Moved getElementsByName and getElementsByClassName here

        Allow subclasses to choose whether they want to receive the notifications using a new bit.
        * dom/NodeList.cpp:
        (WebCore::NodeList::NodeList):
        * dom/NodeList.h:
        (WebCore::NodeList::needsNotifications):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28868 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
WebCore/ChangeLog
WebCore/dom/ChildNodeList.cpp
WebCore/dom/ClassNodeList.cpp
WebCore/dom/ClassNodeList.h
WebCore/dom/Document.cpp
WebCore/dom/Document.h
WebCore/dom/Element.cpp
WebCore/dom/Element.h
WebCore/dom/NameNodeList.cpp
WebCore/dom/NameNodeList.h
WebCore/dom/Node.cpp
WebCore/dom/Node.h
WebCore/dom/NodeList.cpp
WebCore/dom/NodeList.h