Changeset 117902 in webkit


Ignore:
Timestamp:
May 21, 2012 10:11:02 PM (12 years ago)
Author:
kling@webkit.org
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r117899 r117902  
     12012-05-21  Andreas Kling  <kling@webkit.org>
     2
     3        Use stack-allocated BitArray in StylePropertySet serialization.
     4        <http://webkit.org/b/87071>
     5
     6        Reviewed by Anders Carlsson.
     7
     8        Use BitArray instead of BitVector to track seen properties in StylePropertySet::asText().
     9        This removes two heap allocations from this path.
     10
     11        * css/StylePropertySet.cpp:
     12        (WebCore::StylePropertySet::asText):
     13
    1142012-05-21  Hajime Morrita  <morrita@chromium.org>
    215
  • trunk/Source/WebCore/css/StylePropertySet.cpp

    r117809 r117902  
    3131#include "PropertySetCSSStyleDeclaration.h"
    3232#include "StylePropertyShorthand.h"
    33 #include <wtf/BitVector.h>
     33#include <wtf/BitArray.h>
    3434#include <wtf/text/StringBuilder.h>
    3535
     
    592592    const CSSProperty* repeatYProp = 0;
    593593
    594     // FIXME: Stack-allocate the buffer for these BitVectors.
    595     BitVector shorthandPropertyUsed;
    596     BitVector shorthandPropertyAppeared;
     594    BitArray<numCSSProperties> shorthandPropertyUsed;
     595    BitArray<numCSSProperties> shorthandPropertyAppeared;
    597596
    598597    unsigned size = m_properties.size();
     
    640639                value = borderPropertyValue(ReturnNullOnUncommonValues);
    641640                if (value.isNull())
    642                     shorthandPropertyAppeared.ensureSizeAndSet(CSSPropertyBorder - firstCSSProperty, numCSSProperties);
     641                    shorthandPropertyAppeared.set(CSSPropertyBorder - firstCSSProperty);
    643642                else
    644643                    shorthandPropertyID = CSSPropertyBorder;
     
    737736            if (!shorthandPropertyAppeared.get(shortPropertyIndex) && value.isNull())
    738737                value = getPropertyValue(shorthandPropertyID);
    739             shorthandPropertyAppeared.ensureSizeAndSet(shortPropertyIndex, numCSSProperties);
     738            shorthandPropertyAppeared.set(shortPropertyIndex);
    740739        }
    741740
    742741        if (!value.isNull()) {
    743742            propertyID = shorthandPropertyID;
    744             shorthandPropertyUsed.ensureSizeAndSet(shortPropertyIndex, numCSSProperties);
     743            shorthandPropertyUsed.set(shortPropertyIndex);
    745744        } else
    746745            value = prop.value()->cssText();
Note: See TracChangeset for help on using the changeset viewer.