Title: [160901] trunk/Source/WebCore
Revision
160901
Author
commit-qu...@webkit.org
Date
2013-12-20 03:02:18 -0800 (Fri, 20 Dec 2013)

Log Message

Move function calls outside loop in dom
https://bugs.webkit.org/show_bug.cgi?id=125916

Patch by Laszlo Vidacs <lvidacs.u-sze...@partner.samsung.com> on 2013-12-20
Reviewed by Csaba Osztrogonác.

Do not call length() in each iteration.

* dom/Element.cpp:
(WebCore::Element::cloneAttributesFromElement):
* dom/Node.cpp:
(WebCore::Node::dumpStatistics):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (160900 => 160901)


--- trunk/Source/WebCore/ChangeLog	2013-12-20 11:00:51 UTC (rev 160900)
+++ trunk/Source/WebCore/ChangeLog	2013-12-20 11:02:18 UTC (rev 160901)
@@ -1,3 +1,17 @@
+2013-12-20  Laszlo Vidacs  <lvidacs.u-sze...@partner.samsung.com>
+
+        Move function calls outside loop in dom
+        https://bugs.webkit.org/show_bug.cgi?id=125916
+
+        Reviewed by Csaba Osztrogonác.
+
+        Do not call length() in each iteration.
+
+        * dom/Element.cpp:
+        (WebCore::Element::cloneAttributesFromElement):
+        * dom/Node.cpp:
+        (WebCore::Node::dumpStatistics):
+
 2013-12-19  Beth Dakin  <bda...@apple.com>
 
         REGRESSION: cnn.com will continue to reveal 1 px of overhang after rubber-banding 

Modified: trunk/Source/WebCore/dom/Element.cpp (160900 => 160901)


--- trunk/Source/WebCore/dom/Element.cpp	2013-12-20 11:00:51 UTC (rev 160900)
+++ trunk/Source/WebCore/dom/Element.cpp	2013-12-20 11:02:18 UTC (rev 160901)
@@ -3059,7 +3059,8 @@
     else
         m_elementData = other.m_elementData->makeUniqueCopy();
 
-    for (unsigned i = 0; i < m_elementData->length(); ++i) {
+    unsigned length = m_elementData->length();
+    for (unsigned i = 0; i < length; ++i) {
         const Attribute& attribute = const_cast<const ElementData*>(m_elementData.get())->attributeAt(i);
         attributeChanged(attribute.name(), attribute.value(), ModifiedByCloning);
     }

Modified: trunk/Source/WebCore/dom/Node.cpp (160900 => 160901)


--- trunk/Source/WebCore/dom/Node.cpp	2013-12-20 11:00:51 UTC (rev 160900)
+++ trunk/Source/WebCore/dom/Node.cpp	2013-12-20 11:02:18 UTC (rev 160901)
@@ -153,9 +153,10 @@
                     result.iterator->value++;
 
                 if (ElementData* elementData = element->elementData()) {
-                    attributes += elementData->length();
+                    unsigned length = elementData->length();
+                    attributes += length;
                     ++elementsWithAttributeStorage;
-                    for (unsigned i = 0; i < elementData->length(); ++i) {
+                    for (unsigned i = 0; i < length; ++i) {
                         Attribute& attr = elementData->attributeAt(i);
                         if (attr.attr())
                             ++attributesWithAttr;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to