Title: [117902] trunk/Source/WebCore
Revision
117902
Author
[email protected]
Date
2012-05-21 22:11:02 -0700 (Mon, 21 May 2012)

Log Message

Use stack-allocated BitArray in StylePropertySet serialization.
<http://webkit.org/b/87071>

Reviewed by Anders Carlsson.

Use BitArray instead of BitVector to track seen properties in StylePropertySet::asText().
This removes two heap allocations from this path.

* css/StylePropertySet.cpp:
(WebCore::StylePropertySet::asText):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (117901 => 117902)


--- trunk/Source/WebCore/ChangeLog	2012-05-22 05:08:17 UTC (rev 117901)
+++ trunk/Source/WebCore/ChangeLog	2012-05-22 05:11:02 UTC (rev 117902)
@@ -1,3 +1,16 @@
+2012-05-21  Andreas Kling  <[email protected]>
+
+        Use stack-allocated BitArray in StylePropertySet serialization.
+        <http://webkit.org/b/87071>
+
+        Reviewed by Anders Carlsson.
+
+        Use BitArray instead of BitVector to track seen properties in StylePropertySet::asText().
+        This removes two heap allocations from this path.
+
+        * css/StylePropertySet.cpp:
+        (WebCore::StylePropertySet::asText):
+
 2012-05-21  Hajime Morrita  <[email protected]>
 
         Unreviewed Qt build fix against r117898.

Modified: trunk/Source/WebCore/css/StylePropertySet.cpp (117901 => 117902)


--- trunk/Source/WebCore/css/StylePropertySet.cpp	2012-05-22 05:08:17 UTC (rev 117901)
+++ trunk/Source/WebCore/css/StylePropertySet.cpp	2012-05-22 05:11:02 UTC (rev 117902)
@@ -30,7 +30,7 @@
 #include "Document.h"
 #include "PropertySetCSSStyleDeclaration.h"
 #include "StylePropertyShorthand.h"
-#include <wtf/BitVector.h>
+#include <wtf/BitArray.h>
 #include <wtf/text/StringBuilder.h>
 
 #ifndef NDEBUG
@@ -591,9 +591,8 @@
     const CSSProperty* repeatXProp = 0;
     const CSSProperty* repeatYProp = 0;
 
-    // FIXME: Stack-allocate the buffer for these BitVectors.
-    BitVector shorthandPropertyUsed;
-    BitVector shorthandPropertyAppeared;
+    BitArray<numCSSProperties> shorthandPropertyUsed;
+    BitArray<numCSSProperties> shorthandPropertyAppeared;
 
     unsigned size = m_properties.size();
     for (unsigned n = 0; n < size; ++n) {
@@ -639,7 +638,7 @@
             if (!shorthandPropertyAppeared.get(CSSPropertyBorder - firstCSSProperty)) {
                 value = borderPropertyValue(ReturnNullOnUncommonValues);
                 if (value.isNull())
-                    shorthandPropertyAppeared.ensureSizeAndSet(CSSPropertyBorder - firstCSSProperty, numCSSProperties);
+                    shorthandPropertyAppeared.set(CSSPropertyBorder - firstCSSProperty);
                 else
                     shorthandPropertyID = CSSPropertyBorder;
             } else if (shorthandPropertyUsed.get(CSSPropertyBorder - firstCSSProperty))
@@ -736,12 +735,12 @@
                 continue;
             if (!shorthandPropertyAppeared.get(shortPropertyIndex) && value.isNull())
                 value = getPropertyValue(shorthandPropertyID);
-            shorthandPropertyAppeared.ensureSizeAndSet(shortPropertyIndex, numCSSProperties);
+            shorthandPropertyAppeared.set(shortPropertyIndex);
         }
 
         if (!value.isNull()) {
             propertyID = shorthandPropertyID;
-            shorthandPropertyUsed.ensureSizeAndSet(shortPropertyIndex, numCSSProperties);
+            shorthandPropertyUsed.set(shortPropertyIndex);
         } else
             value = prop.value()->cssText();
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to