Don't waste cycles on zeroing every CascadedProperties::Property.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Dec 2013 02:29:41 +0000 (02:29 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Dec 2013 02:29:41 +0000 (02:29 +0000)
<https://webkit.org/b/125966>

The CascadedProperties constructor already zeroes out the whole
property array. Move the memset() to setDeferred() which is the only
other place we create a Property.

Brought to you by Instruments.app. Profile your code today!

Reviewed by Antti Koivisto.

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

Source/WebCore/ChangeLog
Source/WebCore/css/StyleResolver.cpp

index ec6167f9ac6d4c2fc314782b6e2e2281d738f9bd..f97bd21fac8f4733d080056732c060029461a5a1 100644 (file)
@@ -1,3 +1,16 @@
+2013-12-18  Andreas Kling  <akling@apple.com>
+
+        Don't waste cycles on zeroing every CascadedProperties::Property.
+        <https://webkit.org/b/125966>
+
+        The CascadedProperties constructor already zeroes out the whole
+        property array. Move the memset() to setDeferred() which is the only
+        other place we create a Property.
+
+        Brought to you by Instruments.app. Profile your code today!
+
+        Reviewed by Antti Koivisto.
+
 2013-12-18  Hans Muller  <hmuller@adobe.com>
 
         [CSS Shapes] Simplify the BoxShape implementation
index d79dd25fb05cde0ee8a3d7a7ba998be570c52b1c..cf7f2b8457bdb25fe5b0b19ea2d91a9ed5f7b7f3 100644 (file)
@@ -196,7 +196,6 @@ public:
     CascadedProperties(TextDirection, WritingMode);
 
     struct Property {
-        Property();
         void apply(StyleResolver&);
 
         CSSPropertyID id;
@@ -1667,7 +1666,6 @@ void StyleResolver::applyMatchedProperties(const MatchResult& matchResult, bool
 
 unsigned StyleResolver::computeMatchedPropertiesHash(const MatchedProperties* properties, unsigned size)
 {
-    
     return StringHasher::hashMemory(properties, sizeof(MatchedProperties) * size);
 }
 
@@ -4192,13 +4190,6 @@ int StyleResolver::viewportPercentageValue(CSSPrimitiveValue& unit, int percenta
     return 0;
 }
 
-StyleResolver::CascadedProperties::Property::Property()
-    : id(CSSPropertyInvalid)
-    , isPresent(false)
-{
-    memset(cssValue, 0, sizeof(cssValue));
-}
-
 StyleResolver::CascadedProperties::CascadedProperties(TextDirection direction, WritingMode writingMode)
     : m_direction(direction)
     , m_writingMode(writingMode)
@@ -4241,6 +4232,7 @@ void StyleResolver::CascadedProperties::setDeferred(CSSPropertyID id, CSSValue&
     ASSERT(shouldApplyPropertyInParseOrder(id));
 
     Property property;
+    memset(property.cssValue, 0, sizeof(property.cssValue));
     setPropertyInternal(property, id, cssValue, linkMatchType);
     m_deferredProperties.append(property);
 }