Changeset 96192 in webkit


Ignore:
Timestamp:
Sep 27, 2011 11:32:38 PM (13 years ago)
Author:
macpherson@chromium.org
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r96187 r96192  
     12011-09-27  Luke Macpherson   <macpherson@chromium.org>
     2
     3        Defer call to CSSValue::isPrimitiveValue(), saves ~4% in CSSStyleSelector::applyProperty().
     4        https://bugs.webkit.org/show_bug.cgi?id=68964
     5
     6        Reviewed by Eric Seidel.
     7
     8        No new tests / no functionality changed.
     9
     10        Doing value->isPrimitiveValue() is relatviely expensive, so moving it after the early returns but
     11        before the result is used saves a significant number of cycles. (Tested with Shark profiler in Safari).
     12
     13        * css/CSSStyleSelector.cpp:
     14        (WebCore::CSSStyleSelector::applyProperty):
     15
    1162011-09-27  Ryosuke Niwa  <rniwa@webkit.org>
    217
  • trunk/Source/WebCore/css/CSSStyleSelector.cpp

    r96168 r96192  
    23492349void CSSStyleSelector::applyProperty(int id, CSSValue *value)
    23502350{
    2351     CSSPrimitiveValue* primitiveValue = 0;
    2352     if (value->isPrimitiveValue())
    2353         primitiveValue = static_cast<CSSPrimitiveValue*>(value);
    2354 
    2355     float zoomFactor = m_style->effectiveZoom();
    2356 
    23572351    Length l;
    23582352
     
    23612355    bool isInherit = m_parentNode && valueType == CSSValue::CSS_INHERIT;
    23622356    bool isInitial = valueType == CSSValue::CSS_INITIAL || (!m_parentNode && valueType == CSSValue::CSS_INHERIT);
    2363    
     2357
    23642358    id = CSSProperty::resolveDirectionAwareProperty(id, m_style->direction(), m_style->writingMode());
    23652359
     
    23682362        return;
    23692363    }
    2370    
     2364
    23712365    CSSPropertyID property = static_cast<CSSPropertyID>(id);
    23722366
     
    23822376    }
    23832377
     2378    CSSPrimitiveValue* primitiveValue = value->isPrimitiveValue() ? static_cast<CSSPrimitiveValue*>(value) : 0;
     2379
     2380    float zoomFactor = m_style->effectiveZoom();
     2381   
    23842382    // What follows is a list that maps the CSS properties into their corresponding front-end
    23852383    // RenderStyle values.  Shorthands (e.g. border, background) occur in this list as well and
Note: See TracChangeset for help on using the changeset viewer.