Title: [207234] trunk/Source/WebCore
Revision
207234
Author
akl...@apple.com
Date
2016-10-12 12:35:55 -0700 (Wed, 12 Oct 2016)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (207233 => 207234)


--- trunk/Source/WebCore/ChangeLog	2016-10-12 19:31:47 UTC (rev 207233)
+++ trunk/Source/WebCore/ChangeLog	2016-10-12 19:35:55 UTC (rev 207234)
@@ -1,3 +1,18 @@
+2016-10-12  Andreas Kling  <akl...@apple.com>
+
+        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):
+
 2016-10-12  Jeremy Huddleston Sequoia  <jerem...@apple.com>
 
         [SOUP] trunk r207192 fails to compile due to missing std::function being unavailable (missing #include <functional>)

Modified: trunk/Source/WebCore/dom/Document.cpp (207233 => 207234)


--- trunk/Source/WebCore/dom/Document.cpp	2016-10-12 19:31:47 UTC (rev 207233)
+++ trunk/Source/WebCore/dom/Document.cpp	2016-10-12 19:35:55 UTC (rev 207234)
@@ -2427,8 +2427,13 @@
     m_axObjectCache = nullptr;
 }
 
+static bool hasEverCreatedAnAXObjectCache = false;
+
 AXObjectCache* Document::existingAXObjectCache() const
 {
+    if (!hasEverCreatedAnAXObjectCache)
+        return nullptr;
+
     Document& topDocument = this->topDocument();
     if (!topDocument.hasLivingRenderTree())
         return nullptr;
@@ -2451,8 +2456,10 @@
         return nullptr;
 
     ASSERT(&topDocument == this || !m_axObjectCache);
-    if (!topDocument.m_axObjectCache)
+    if (!topDocument.m_axObjectCache) {
         topDocument.m_axObjectCache = std::make_unique<AXObjectCache>(topDocument);
+        hasEverCreatedAnAXObjectCache = true;
+    }
     return topDocument.m_axObjectCache.get();
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to