Title: [164900] trunk/Source/WebCore
Revision
164900
Author
akl...@apple.com
Date
2014-02-28 17:11:23 -0800 (Fri, 28 Feb 2014)

Log Message

Micro-optimize JSNodeOwner::isReachableFromOpaqueRoots().
<https://webkit.org/b/129518>

Only do image and audio element specific checks for element nodes.
Time spent in here goes from 0.8% to 0.5% on DYEB.

Reviewed by Benjamin Poulain.

* bindings/js/JSNodeCustom.cpp:
(WebCore::isReachableFromDOM):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (164899 => 164900)


--- trunk/Source/WebCore/ChangeLog	2014-03-01 01:07:01 UTC (rev 164899)
+++ trunk/Source/WebCore/ChangeLog	2014-03-01 01:11:23 UTC (rev 164900)
@@ -1,3 +1,16 @@
+2014-02-28  Andreas Kling  <akl...@apple.com>
+
+        Micro-optimize JSNodeOwner::isReachableFromOpaqueRoots().
+        <https://webkit.org/b/129518>
+
+        Only do image and audio element specific checks for element nodes.
+        Time spent in here goes from 0.8% to 0.5% on DYEB.
+
+        Reviewed by Benjamin Poulain.
+
+        * bindings/js/JSNodeCustom.cpp:
+        (WebCore::isReachableFromDOM):
+
 2014-02-28  Geoffrey Garen  <gga...@apple.com>
 
         JSC Assertion failure every time I start Safari (r164846)

Modified: trunk/Source/WebCore/bindings/js/JSNodeCustom.cpp (164899 => 164900)


--- trunk/Source/WebCore/bindings/js/JSNodeCustom.cpp	2014-03-01 01:07:01 UTC (rev 164899)
+++ trunk/Source/WebCore/bindings/js/JSNodeCustom.cpp	2014-03-01 01:11:23 UTC (rev 164900)
@@ -97,21 +97,25 @@
 static inline bool isReachableFromDOM(JSNode* jsNode, Node* node, SlotVisitor& visitor)
 {
     if (!node->inDocument()) {
-        // If a wrapper is the last reference to an image element
-        // that is loading but not in the document, the wrapper is observable
-        // because it is the only thing keeping the image element alive, and if
-        // the element is destroyed, its load event will not fire.
-        // FIXME: The DOM should manage this issue without the help of _javascript_ wrappers.
-        if (isHTMLImageElement(node)) {
-            if (toHTMLImageElement(node)->hasPendingActivity())
-                return true;
+        if (node->isElementNode()) {
+            auto& element = toElement(*node);
+
+            // If a wrapper is the last reference to an image element
+            // that is loading but not in the document, the wrapper is observable
+            // because it is the only thing keeping the image element alive, and if
+            // the element is destroyed, its load event will not fire.
+            // FIXME: The DOM should manage this issue without the help of _javascript_ wrappers.
+            if (isHTMLImageElement(element)) {
+                if (toHTMLImageElement(element).hasPendingActivity())
+                    return true;
+            }
+#if ENABLE(VIDEO)
+            else if (isHTMLAudioElement(element)) {
+                if (!toHTMLAudioElement(element).paused())
+                    return true;
+            }
+#endif
         }
-    #if ENABLE(VIDEO)
-        else if (isHTMLAudioElement(node)) {
-            if (!toHTMLAudioElement(node)->paused())
-                return true;
-        }
-    #endif
 
         // If a node is firing event listeners, its wrapper is observable because
         // its wrapper is responsible for marking those event listeners.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to