Changeset 143983 in webkit


Ignore:
Timestamp:
Feb 25, 2013 4:12:53 PM (11 years ago)
Author:
abarth@webkit.org
Message:

6% regression in intl1 page cycler on chromium-mac
https://bugs.webkit.org/show_bug.cgi?id=110784

Reviewed by Eric Seidel.

This patch reverts http://trac.webkit.org/changeset/143014 to see if
that's the cause of the PLT regression. If it's not the cause, I'll
roll it back in.

  • dom/Element.cpp:

(WebCore::Element::addAttributeInternal):
(WebCore::ShareableElementData::ShareableElementData):
(WebCore::UniqueElementData::makeShareableCopy):
(WebCore::ElementData::addAttribute):
(WebCore::ElementData::removeAttribute):
(WebCore::ElementData::reportMemoryUsage):

  • dom/Element.h:

(ElementData):
(UniqueElementData):
(WebCore::ElementData::mutableAttributeVector):
(WebCore):
(WebCore::ElementData::immutableAttributeArray):
(WebCore::ElementData::length):
(WebCore::ElementData::getAttributeItem):
(WebCore::ElementData::attributeItem):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r143979 r143983  
     12013-02-25  Adam Barth  <abarth@webkit.org>
     2
     3        6% regression in intl1 page cycler on chromium-mac
     4        https://bugs.webkit.org/show_bug.cgi?id=110784
     5
     6        Reviewed by Eric Seidel.
     7
     8        This patch reverts http://trac.webkit.org/changeset/143014 to see if
     9        that's the cause of the PLT regression. If it's not the cause, I'll
     10        roll it back in.
     11
     12        * dom/Element.cpp:
     13        (WebCore::Element::addAttributeInternal):
     14        (WebCore::ShareableElementData::ShareableElementData):
     15        (WebCore::UniqueElementData::makeShareableCopy):
     16        (WebCore::ElementData::addAttribute):
     17        (WebCore::ElementData::removeAttribute):
     18        (WebCore::ElementData::reportMemoryUsage):
     19        * dom/Element.h:
     20        (ElementData):
     21        (UniqueElementData):
     22        (WebCore::ElementData::mutableAttributeVector):
     23        (WebCore):
     24        (WebCore::ElementData::immutableAttributeArray):
     25        (WebCore::ElementData::length):
     26        (WebCore::ElementData::getAttributeItem):
     27        (WebCore::ElementData::attributeItem):
     28
    1292013-02-25  Tim Horton  <timothy_horton@apple.com>
    230
  • trunk/Source/WebCore/dom/Element.cpp

    r143926 r143983  
    18211821    if (!inSynchronizationOfLazyAttribute)
    18221822        willModifyAttribute(name, nullAtom, value);
    1823     ensureUniqueElementData()->addAttribute(name, value);
     1823    ensureUniqueElementData()->addAttribute(Attribute(name, value));
    18241824    if (!inSynchronizationOfLazyAttribute)
    18251825        didAddAttribute(name, value);
     
    29702970
    29712971    for (unsigned i = 0; i < m_arraySize; ++i)
    2972         new (&m_attributeArray[i]) Attribute(other.m_attributeVector.at(i));
     2972        new (&reinterpret_cast<Attribute*>(&m_attributeArray)[i]) Attribute(*other.attributeItem(i));
    29732973}
    29742974
     
    30203020PassRefPtr<ShareableElementData> UniqueElementData::makeShareableCopy() const
    30213021{
    3022     void* slot = WTF::fastMalloc(sizeForShareableElementDataWithAttributeCount(m_attributeVector.size()));
     3022    void* slot = WTF::fastMalloc(sizeForShareableElementDataWithAttributeCount(mutableAttributeVector().size()));
    30233023    return adoptRef(new (slot) ShareableElementData(*this));
    30243024}
    30253025
    3026 void UniqueElementData::addAttribute(const QualifiedName& attributeName, const AtomicString& value)
    3027 {
    3028     m_attributeVector.append(Attribute(attributeName, value));
    3029 }
    3030 
    3031 void UniqueElementData::removeAttribute(size_t index)
    3032 {
     3026void ElementData::addAttribute(const Attribute& attribute)
     3027{
     3028    ASSERT(isUnique());
     3029    mutableAttributeVector().append(attribute);
     3030}
     3031
     3032void ElementData::removeAttribute(size_t index)
     3033{
     3034    ASSERT(isUnique());
    30333035    ASSERT_WITH_SECURITY_IMPLICATION(index < length());
    3034     m_attributeVector.remove(index);
     3036    mutableAttributeVector().remove(index);
    30353037}
    30363038
     
    30623064    info.addMember(m_idForStyleResolution, "idForStyleResolution");
    30633065    if (m_isUnique) {
    3064         const UniqueElementData* uniqueThis = static_cast<const UniqueElementData*>(this);
    3065         info.addMember(uniqueThis->m_presentationAttributeStyle, "presentationAttributeStyle");
    3066         info.addMember(uniqueThis->m_attributeVector, "attributeVector");
     3066        info.addMember(presentationAttributeStyle(), "presentationAttributeStyle()");
     3067        info.addMember(mutableAttributeVector(), "mutableAttributeVector");
    30673068    }
    30683069    for (unsigned i = 0, len = length(); i < len; i++)
     
    30893090}
    30903091
    3091 Attribute* UniqueElementData::getAttributeItem(const QualifiedName& name)
    3092 {
    3093     for (unsigned i = 0; i < length(); ++i) {
    3094         if (m_attributeVector.at(i).name().matches(name))
    3095             return &m_attributeVector.at(i);
    3096     }
    3097     return 0;
    3098 }
    3099 
    3100 Attribute* UniqueElementData::attributeItem(unsigned index)
    3101 {
    3102     ASSERT_WITH_SECURITY_IMPLICATION(index < length());
    3103     return &m_attributeVector.at(index);
    3104 }
    3105 
    31063092} // namespace WebCore
  • trunk/Source/WebCore/dom/Element.h

    r143834 r143983  
    7676    const Attribute* attributeItem(unsigned index) const;
    7777    const Attribute* getAttributeItem(const QualifiedName&) const;
     78    Attribute* attributeItem(unsigned index);
     79    Attribute* getAttributeItem(const QualifiedName&);
    7880    size_t getAttributeItemIndex(const QualifiedName&) const;
    7981    size_t getAttributeItemIndex(const AtomicString& name, bool shouldIgnoreAttributeCase) const;
    8082
     83    // These functions do no error checking.
     84    void addAttribute(const Attribute&);
     85    void removeAttribute(size_t index);
     86
    8187    bool hasID() const { return !m_idForStyleResolution.isNull(); }
    8288    bool hasClass() const { return !m_classNames.isNull(); }
     
    8793
    8894    bool isUnique() const { return m_isUnique; }
     95    const Attribute* immutableAttributeArray() const;
    8996
    9097protected:
     
    114121#endif
    115122
     123    Attribute* getAttributeItem(const AtomicString& name, bool shouldIgnoreAttributeCase);
    116124    const Attribute* getAttributeItem(const AtomicString& name, bool shouldIgnoreAttributeCase) const;
    117125    size_t getAttributeItemIndexSlowCase(const AtomicString& name, bool shouldIgnoreAttributeCase) const;
    118126
    119127    PassRefPtr<UniqueElementData> makeUniqueCopy() const;
     128
     129    Vector<Attribute, 4>& mutableAttributeVector();
     130    const Vector<Attribute, 4>& mutableAttributeVector() const;
    120131};
    121132
     
    144155    static PassRefPtr<UniqueElementData> create();
    145156    PassRefPtr<ShareableElementData> makeShareableCopy() const;
    146 
    147     // These functions do no error/duplicate checking.
    148     void addAttribute(const QualifiedName&, const AtomicString&);
    149     void removeAttribute(size_t index);
    150 
    151     Attribute* attributeItem(unsigned index);
    152     Attribute* getAttributeItem(const QualifiedName&);
    153157
    154158    UniqueElementData();
     
    899903    return node && node->isElementNode() && toElement(node)->shadow();
    900904}
     905inline Vector<Attribute, 4>& ElementData::mutableAttributeVector()
     906{
     907    ASSERT(m_isUnique);
     908    return static_cast<UniqueElementData*>(this)->m_attributeVector;
     909}
     910
     911inline const Vector<Attribute, 4>& ElementData::mutableAttributeVector() const
     912{
     913    ASSERT(m_isUnique);
     914    return static_cast<const UniqueElementData*>(this)->m_attributeVector;
     915}
     916
     917inline const Attribute* ElementData::immutableAttributeArray() const
     918{
     919    ASSERT(!m_isUnique);
     920    return reinterpret_cast<const Attribute*>(&static_cast<const ShareableElementData*>(this)->m_attributeArray);
     921}
    901922
    902923inline size_t ElementData::length() const
    903924{
    904925    if (isUnique())
    905         return static_cast<const UniqueElementData*>(this)->m_attributeVector.size();
     926        return mutableAttributeVector().size();
    906927    return m_arraySize;
    907928}
     
    912933        return 0;
    913934    return static_cast<const UniqueElementData*>(this)->m_presentationAttributeStyle.get();
     935}
     936
     937inline Attribute* ElementData::getAttributeItem(const AtomicString& name, bool shouldIgnoreAttributeCase)
     938{
     939    size_t index = getAttributeItemIndex(name, shouldIgnoreAttributeCase);
     940    if (index != notFound)
     941        return attributeItem(index);
     942    return 0;
    914943}
    915944
     
    962991}
    963992
     993inline Attribute* ElementData::getAttributeItem(const QualifiedName& name)
     994{
     995    for (unsigned i = 0; i < length(); ++i) {
     996        if (attributeItem(i)->name().matches(name))
     997            return attributeItem(i);
     998    }
     999    return 0;
     1000}
     1001
    9641002inline const Attribute* ElementData::attributeItem(unsigned index) const
    9651003{
    9661004    ASSERT_WITH_SECURITY_IMPLICATION(index < length());
    9671005    if (m_isUnique)
    968         return &static_cast<const UniqueElementData*>(this)->m_attributeVector.at(index);
    969     return &static_cast<const ShareableElementData*>(this)->m_attributeArray[index];
     1006        return &mutableAttributeVector().at(index);
     1007    return &immutableAttributeArray()[index];
     1008}
     1009
     1010inline Attribute* ElementData::attributeItem(unsigned index)
     1011{
     1012    ASSERT_WITH_SECURITY_IMPLICATION(index < length());
     1013    return &mutableAttributeVector().at(index);
    9701014}
    9711015
Note: See TracChangeset for help on using the changeset viewer.