Changeset 207234 in webkit


Ignore:
Timestamp:
Oct 12, 2016 12:35:55 PM (7 years ago)
Author:
akling@apple.com
Message:

Make Document::existingAXObjectCache() fast with accessibility disabled.
<https://webkit.org/b/163347>

Reviewed by Antti Koivisto.

Instruments says we were spending 2.3% of Dromaeo/dom-modify.html in this function,
traversing ancestors. Track whether we've ever had a cache, and use that knowledge
to return early if possible.

  • dom/Document.cpp:

(WebCore::Document::existingAXObjectCache):
(WebCore::Document::axObjectCache):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r207232 r207234  
     12016-10-12  Andreas Kling  <akling@apple.com>
     2
     3        Make Document::existingAXObjectCache() fast with accessibility disabled.
     4        <https://webkit.org/b/163347>
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Instruments says we were spending 2.3% of Dromaeo/dom-modify.html in this function,
     9        traversing ancestors. Track whether we've ever had a cache, and use that knowledge
     10        to return early if possible.
     11
     12        * dom/Document.cpp:
     13        (WebCore::Document::existingAXObjectCache):
     14        (WebCore::Document::axObjectCache):
     15
    1162016-10-12  Jeremy Huddleston Sequoia  <jeremyhu@apple.com>
    217
  • trunk/Source/WebCore/dom/Document.cpp

    r207155 r207234  
    24282428}
    24292429
     2430static bool hasEverCreatedAnAXObjectCache = false;
     2431
    24302432AXObjectCache* Document::existingAXObjectCache() const
    24312433{
     2434    if (!hasEverCreatedAnAXObjectCache)
     2435        return nullptr;
     2436
    24322437    Document& topDocument = this->topDocument();
    24332438    if (!topDocument.hasLivingRenderTree())
     
    24522457
    24532458    ASSERT(&topDocument == this || !m_axObjectCache);
    2454     if (!topDocument.m_axObjectCache)
     2459    if (!topDocument.m_axObjectCache) {
    24552460        topDocument.m_axObjectCache = std::make_unique<AXObjectCache>(topDocument);
     2461        hasEverCreatedAnAXObjectCache = true;
     2462    }
    24562463    return topDocument.m_axObjectCache.get();
    24572464}
Note: See TracChangeset for help on using the changeset viewer.