Title: [96192] trunk/Source/WebCore
Revision
96192
Author
[email protected]
Date
2011-09-27 23:32:38 -0700 (Tue, 27 Sep 2011)

Log Message

Defer call to CSSValue::isPrimitiveValue(), saves ~4% in CSSStyleSelector::applyProperty().
https://bugs.webkit.org/show_bug.cgi?id=68964

Reviewed by Eric Seidel.

No new tests / no functionality changed.

Doing value->isPrimitiveValue() is relatviely expensive, so moving it after the early returns but
before the result is used saves a significant number of cycles. (Tested with Shark profiler in Safari).

* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::applyProperty):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (96191 => 96192)


--- trunk/Source/WebCore/ChangeLog	2011-09-28 05:43:38 UTC (rev 96191)
+++ trunk/Source/WebCore/ChangeLog	2011-09-28 06:32:38 UTC (rev 96192)
@@ -1,3 +1,18 @@
+2011-09-27  Luke Macpherson   <[email protected]>
+
+        Defer call to CSSValue::isPrimitiveValue(), saves ~4% in CSSStyleSelector::applyProperty().
+        https://bugs.webkit.org/show_bug.cgi?id=68964
+
+        Reviewed by Eric Seidel.
+
+        No new tests / no functionality changed.
+
+        Doing value->isPrimitiveValue() is relatviely expensive, so moving it after the early returns but
+        before the result is used saves a significant number of cycles. (Tested with Shark profiler in Safari).
+
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::applyProperty):
+
 2011-09-27  Ryosuke Niwa  <[email protected]>
 
         Simplify ReplaceSelectionCommand::positionAtStartOfInsertedContent

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (96191 => 96192)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-09-28 05:43:38 UTC (rev 96191)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-09-28 06:32:38 UTC (rev 96192)
@@ -2348,26 +2348,20 @@
 
 void CSSStyleSelector::applyProperty(int id, CSSValue *value)
 {
-    CSSPrimitiveValue* primitiveValue = 0;
-    if (value->isPrimitiveValue())
-        primitiveValue = static_cast<CSSPrimitiveValue*>(value);
-
-    float zoomFactor = m_style->effectiveZoom();
-
     Length l;
 
     unsigned short valueType = value->cssValueType();
 
     bool isInherit = m_parentNode && valueType == CSSValue::CSS_INHERIT;
     bool isInitial = valueType == CSSValue::CSS_INITIAL || (!m_parentNode && valueType == CSSValue::CSS_INHERIT);
-    
+
     id = CSSProperty::resolveDirectionAwareProperty(id, m_style->direction(), m_style->writingMode());
 
     if (m_checker.isMatchingVisitedPseudoClass() && !isValidVisitedLinkProperty(id)) {
         // Limit the properties that can be applied to only the ones honored by :visited.
         return;
     }
-    
+
     CSSPropertyID property = static_cast<CSSPropertyID>(id);
 
     // check lookup table for implementations and use when available
@@ -2381,6 +2375,10 @@
         return;
     }
 
+    CSSPrimitiveValue* primitiveValue = value->isPrimitiveValue() ? static_cast<CSSPrimitiveValue*>(value) : 0;
+
+    float zoomFactor = m_style->effectiveZoom();
+    
     // What follows is a list that maps the CSS properties into their corresponding front-end
     // RenderStyle values.  Shorthands (e.g. border, background) occur in this list as well and
     // are only hit when mapping "inherit" or "initial" into front-end values.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to