Skip to content
  • rniwa@webkit.org's avatar
    Remove NodeListsNodeData when it's no longer needed · e6ab325d
    rniwa@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=107074
    
    Reviewed by Darin Adler.
    
    PerformanceTests: 
    
    Added a micro benchmark to see the benefit of removing NodeListsNodeData.
    The test traverses all elements in the html5 specification page and accesses childNodes.
    
    Don't enable this test for now since it's really a micro benchmark specifically
    designed to test this patch.
    
    * DOM/TraverseChildNodes.html: Added.
    * Skipped: Don't enable newly added test by default.
    * resources/results-template.html: Compare against the unscaled unit (e.g. "bytes") as
    opposed to scaled units such as "K bytes".
    * resources/runner.js:
    (.start): Moved the code to call currentTest.setup from measureRunsPerSecondOnce so that
    it'll be ran for all test types, namely of PerfTestRunner.measureTime.
    (.measureRunsPerSecondOnce):
    
    Source/WebCore: 
    
    Remove NodeListsNodeData when the last node list is removed from it.
    
    If we detect that we have only one node list left in the data structure,
    we'll simply destroy the entire "this" object to free up the memory space.
    
    This reduced the memory usage of the micro benchmark by roughly 3%.
    
    Performance Tests: DOM/TraverseChildNodes.html
    
    * dom/Node.cpp:
    (WebCore::Node::clearNodeLists): Added.
    * dom/Node.h:
    * dom/NodeRareData.h:
    (WebCore::NodeListsNodeData::removeChildNodeList):
    (WebCore::NodeListsNodeData::removeCacheWithAtomicName):
    (WebCore::NodeListsNodeData::removeCacheWithName):
    (WebCore::NodeListsNodeData::removeCacheWithQualifiedName):
    (WebCore::NodeListsNodeData::deleteThisAndUpdateNodeRareDataIfAboutToRemoveLastList): Added.
    Removes "this" NodeListsNodeData if there is only one node list left.
    
    Tools: 
    
    Generalize the warning a little so that it's also ignored on PerformanceTests/DOM/TraverseChildNodes.html
    
    * Scripts/webkitpy/performance_tests/perftest.py:
    (PerfTest):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140070 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    e6ab325d