Title: [208813] trunk/Source/WebCore
Revision
208813
Author
[email protected]
Date
2016-11-16 14:30:43 -0800 (Wed, 16 Nov 2016)

Log Message

Micro-optimize ContainerNode::removeBetween()
https://bugs.webkit.org/show_bug.cgi?id=164832

Reviewed by Sam Weinig.

Micro-optimize ContainerNode::removeBetween() by updating pointers only
when strictly needed and reducing branching.

No new tests, no Web-exposed behavior change.

* dom/ContainerNode.cpp:
(WebCore::ContainerNode::removeBetween):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (208812 => 208813)


--- trunk/Source/WebCore/ChangeLog	2016-11-16 22:28:33 UTC (rev 208812)
+++ trunk/Source/WebCore/ChangeLog	2016-11-16 22:30:43 UTC (rev 208813)
@@ -1,5 +1,20 @@
 2016-11-16  Chris Dumez  <[email protected]>
 
+        Micro-optimize ContainerNode::removeBetween()
+        https://bugs.webkit.org/show_bug.cgi?id=164832
+
+        Reviewed by Sam Weinig.
+
+        Micro-optimize ContainerNode::removeBetween() by updating pointers only
+        when strictly needed and reducing branching.
+
+        No new tests, no Web-exposed behavior change.
+
+        * dom/ContainerNode.cpp:
+        (WebCore::ContainerNode::removeBetween):
+
+2016-11-16  Chris Dumez  <[email protected]>
+
         Micro-optimize AtomicHTMLToken::initializeAttributes()
         https://bugs.webkit.org/show_bug.cgi?id=164826
 

Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (208812 => 208813)


--- trunk/Source/WebCore/dom/ContainerNode.cpp	2016-11-16 22:28:33 UTC (rev 208812)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp	2016-11-16 22:30:43 UTC (rev 208813)
@@ -558,17 +558,25 @@
 
     destroyRenderTreeIfNeeded(oldChild);
 
-    if (nextChild)
+    if (nextChild) {
         nextChild->setPreviousSibling(previousChild);
-    if (previousChild)
+        oldChild.setNextSibling(nullptr);
+    } else {
+        ASSERT(m_lastChild == &oldChild);
+        m_lastChild = previousChild;
+    }
+    if (previousChild) {
         previousChild->setNextSibling(nextChild);
-    if (m_firstChild == &oldChild)
+        oldChild.setPreviousSibling(nullptr);
+    } else {
+        ASSERT(m_firstChild == &oldChild);
         m_firstChild = nextChild;
-    if (m_lastChild == &oldChild)
-        m_lastChild = previousChild;
+    }
 
-    oldChild.setPreviousSibling(nullptr);
-    oldChild.setNextSibling(nullptr);
+    ASSERT(m_firstChild != &oldChild);
+    ASSERT(m_lastChild != &oldChild);
+    ASSERT(!oldChild.previousSibling());
+    ASSERT(!oldChild.nextSibling());
     oldChild.setParentNode(nullptr);
 
     document().adoptIfNeeded(&oldChild);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to