20% regression on dom_perf/DomDivWalk
authorfalken@chromium.org <falken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jan 2013 07:31:30 +0000 (07:31 +0000)
committerfalken@chromium.org <falken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jan 2013 07:31:30 +0000 (07:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=106726

Reviewed by Hajime Morita.

This patch moves the checks in Element::removedFrom for Fullscreen and top layer flags
into a slow path. The idea is for the two checks for Fullscreen and top layer
to be replaced by one faster check in the fast path.

The plan is to migrate the Fullscreen implementation to use top layer, so this is just a
short-term fix for the perf regression.

No new tests: no functionality change

* dom/Element.cpp:
(WebCore::Element::removedFrom): Create a slow path to move the Fullscreen and top layer checks into.
* dom/Node.cpp:
(WebCore::Node::setIsInTopLayer): To allow for cleaner code in Element::removedFrom, define
setIsInTopLayer and isInTopLayer even when the feature flag is off.
* dom/Node.h:
(WebCore::Node::isInTopLayer): Ditto.
(Node):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@140512 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Node.h

index e7a9f13..4b4b002 100644 (file)
@@ -1,3 +1,28 @@
+2013-01-22  Matt Falkenhagen  <falken@chromium.org>
+
+        20% regression on dom_perf/DomDivWalk
+        https://bugs.webkit.org/show_bug.cgi?id=106726
+
+        Reviewed by Hajime Morita.
+
+        This patch moves the checks in Element::removedFrom for Fullscreen and top layer flags
+        into a slow path. The idea is for the two checks for Fullscreen and top layer
+        to be replaced by one faster check in the fast path.
+
+        The plan is to migrate the Fullscreen implementation to use top layer, so this is just a
+        short-term fix for the perf regression.
+
+        No new tests: no functionality change
+
+        * dom/Element.cpp:
+        (WebCore::Element::removedFrom): Create a slow path to move the Fullscreen and top layer checks into.
+        * dom/Node.cpp:
+        (WebCore::Node::setIsInTopLayer): To allow for cleaner code in Element::removedFrom, define
+        setIsInTopLayer and isInTopLayer even when the feature flag is off.
+        * dom/Node.h:
+        (WebCore::Node::isInTopLayer): Ditto.
+        (Node):
+
 2013-01-22  Mark Lam  <mark.lam@apple.com>
 
         Change the Supplementable class to not use AtomicString.
index c2031da..42bfb4a 100644 (file)
@@ -1182,14 +1182,22 @@ void Element::removedFrom(ContainerNode* insertionPoint)
     if (Element* after = pseudoElement(AFTER))
         after->removedFrom(insertionPoint);
 
+    // FIXME: Fullscreen should be migrated to use the top layer (bug 107617). Then this can just be a single check.
+    // The purpose of the outer if statement is to quickly determine whether we must do the additional
+    // checks in a slow path.
+#if ENABLE(DIALOG_ELEMENT) || ENABLE(FULLSCREEN_API)
+    if (hasRareData() || isInTopLayer()) {
 #if ENABLE(DIALOG_ELEMENT)
-    if (isInTopLayer())
-        document()->removeFromTopLayer(this);
+        if (isInTopLayer())
+            document()->removeFromTopLayer(this);
 #endif
 #if ENABLE(FULLSCREEN_API)
-    if (containsFullScreenElement())
-        setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false);
+        if (containsFullScreenElement())
+            setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false);
 #endif
+    }
+#endif
+
 #if ENABLE(POINTER_LOCK)
     if (document()->page())
         document()->page()->pointerLockController()->elementRemoved(this);
index 9dd6019..a3d4eff 100644 (file)
@@ -685,6 +685,9 @@ public:
 #if ENABLE(DIALOG_ELEMENT)
     bool isInTopLayer() const { return getFlag(IsInTopLayer); }
     void setIsInTopLayer(bool);
+#else
+    bool isInTopLayer() const { return false; }
+    void setIsInTopLayer(bool) { }
 #endif
 
 private: