Changeset 143983 in webkit
- Timestamp:
- Feb 25, 2013 4:12:53 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r143979 r143983 1 2013-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 1 29 2013-02-25 Tim Horton <timothy_horton@apple.com> 2 30 -
trunk/Source/WebCore/dom/Element.cpp
r143926 r143983 1821 1821 if (!inSynchronizationOfLazyAttribute) 1822 1822 willModifyAttribute(name, nullAtom, value); 1823 ensureUniqueElementData()->addAttribute( name, value);1823 ensureUniqueElementData()->addAttribute(Attribute(name, value)); 1824 1824 if (!inSynchronizationOfLazyAttribute) 1825 1825 didAddAttribute(name, value); … … 2970 2970 2971 2971 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)); 2973 2973 } 2974 2974 … … 3020 3020 PassRefPtr<ShareableElementData> UniqueElementData::makeShareableCopy() const 3021 3021 { 3022 void* slot = WTF::fastMalloc(sizeForShareableElementDataWithAttributeCount(m _attributeVector.size()));3022 void* slot = WTF::fastMalloc(sizeForShareableElementDataWithAttributeCount(mutableAttributeVector().size())); 3023 3023 return adoptRef(new (slot) ShareableElementData(*this)); 3024 3024 } 3025 3025 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 { 3026 void ElementData::addAttribute(const Attribute& attribute) 3027 { 3028 ASSERT(isUnique()); 3029 mutableAttributeVector().append(attribute); 3030 } 3031 3032 void ElementData::removeAttribute(size_t index) 3033 { 3034 ASSERT(isUnique()); 3033 3035 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); 3034 m _attributeVector.remove(index);3036 mutableAttributeVector().remove(index); 3035 3037 } 3036 3038 … … 3062 3064 info.addMember(m_idForStyleResolution, "idForStyleResolution"); 3063 3065 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"); 3067 3068 } 3068 3069 for (unsigned i = 0, len = length(); i < len; i++) … … 3089 3090 } 3090 3091 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 3106 3092 } // namespace WebCore -
trunk/Source/WebCore/dom/Element.h
r143834 r143983 76 76 const Attribute* attributeItem(unsigned index) const; 77 77 const Attribute* getAttributeItem(const QualifiedName&) const; 78 Attribute* attributeItem(unsigned index); 79 Attribute* getAttributeItem(const QualifiedName&); 78 80 size_t getAttributeItemIndex(const QualifiedName&) const; 79 81 size_t getAttributeItemIndex(const AtomicString& name, bool shouldIgnoreAttributeCase) const; 80 82 83 // These functions do no error checking. 84 void addAttribute(const Attribute&); 85 void removeAttribute(size_t index); 86 81 87 bool hasID() const { return !m_idForStyleResolution.isNull(); } 82 88 bool hasClass() const { return !m_classNames.isNull(); } … … 87 93 88 94 bool isUnique() const { return m_isUnique; } 95 const Attribute* immutableAttributeArray() const; 89 96 90 97 protected: … … 114 121 #endif 115 122 123 Attribute* getAttributeItem(const AtomicString& name, bool shouldIgnoreAttributeCase); 116 124 const Attribute* getAttributeItem(const AtomicString& name, bool shouldIgnoreAttributeCase) const; 117 125 size_t getAttributeItemIndexSlowCase(const AtomicString& name, bool shouldIgnoreAttributeCase) const; 118 126 119 127 PassRefPtr<UniqueElementData> makeUniqueCopy() const; 128 129 Vector<Attribute, 4>& mutableAttributeVector(); 130 const Vector<Attribute, 4>& mutableAttributeVector() const; 120 131 }; 121 132 … … 144 155 static PassRefPtr<UniqueElementData> create(); 145 156 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&);153 157 154 158 UniqueElementData(); … … 899 903 return node && node->isElementNode() && toElement(node)->shadow(); 900 904 } 905 inline Vector<Attribute, 4>& ElementData::mutableAttributeVector() 906 { 907 ASSERT(m_isUnique); 908 return static_cast<UniqueElementData*>(this)->m_attributeVector; 909 } 910 911 inline const Vector<Attribute, 4>& ElementData::mutableAttributeVector() const 912 { 913 ASSERT(m_isUnique); 914 return static_cast<const UniqueElementData*>(this)->m_attributeVector; 915 } 916 917 inline const Attribute* ElementData::immutableAttributeArray() const 918 { 919 ASSERT(!m_isUnique); 920 return reinterpret_cast<const Attribute*>(&static_cast<const ShareableElementData*>(this)->m_attributeArray); 921 } 901 922 902 923 inline size_t ElementData::length() const 903 924 { 904 925 if (isUnique()) 905 return static_cast<const UniqueElementData*>(this)->m_attributeVector.size();926 return mutableAttributeVector().size(); 906 927 return m_arraySize; 907 928 } … … 912 933 return 0; 913 934 return static_cast<const UniqueElementData*>(this)->m_presentationAttributeStyle.get(); 935 } 936 937 inline 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; 914 943 } 915 944 … … 962 991 } 963 992 993 inline 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 964 1002 inline const Attribute* ElementData::attributeItem(unsigned index) const 965 1003 { 966 1004 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); 967 1005 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 1010 inline Attribute* ElementData::attributeItem(unsigned index) 1011 { 1012 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); 1013 return &mutableAttributeVector().at(index); 970 1014 } 971 1015
Note: See TracChangeset
for help on using the changeset viewer.