Unreviewed, rolling out r143044.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Feb 2013 22:47:35 +0000 (22:47 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Feb 2013 22:47:35 +0000 (22:47 +0000)
http://trac.webkit.org/changeset/143044
https://bugs.webkit.org/show_bug.cgi?id=109974

broke windows build (Requested by kling on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2013-02-15

* dom/DocumentSharedObjectPool.cpp:
(WebCore::DocumentSharedObjectPool::cachedShareableElementDataWithAttributes):
* dom/Element.cpp:
(WebCore::sizeForShareableElementDataWithAttributeCount):
(WebCore::ShareableElementData::ShareableElementData):
(WebCore::ShareableElementData::~ShareableElementData):
(WebCore::UniqueElementData::UniqueElementData):
* dom/Element.h:
(WebCore::ShareableElementData::immutableAttributeArray):
(ShareableElementData):
(WebCore::ElementData::attributeItem):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@143054 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/dom/DocumentSharedObjectPool.cpp
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h

index bfc97ed930eb05f1ae467f18f705154f54902367..89c933e58b1534df4d981cf58b1fcf8549c28a75 100644 (file)
@@ -1,3 +1,23 @@
+2013-02-15  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r143044.
+        http://trac.webkit.org/changeset/143044
+        https://bugs.webkit.org/show_bug.cgi?id=109974
+
+        broke windows build (Requested by kling on #webkit).
+
+        * dom/DocumentSharedObjectPool.cpp:
+        (WebCore::DocumentSharedObjectPool::cachedShareableElementDataWithAttributes):
+        * dom/Element.cpp:
+        (WebCore::sizeForShareableElementDataWithAttributeCount):
+        (WebCore::ShareableElementData::ShareableElementData):
+        (WebCore::ShareableElementData::~ShareableElementData):
+        (WebCore::UniqueElementData::UniqueElementData):
+        * dom/Element.h:
+        (WebCore::ShareableElementData::immutableAttributeArray):
+        (ShareableElementData):
+        (WebCore::ElementData::attributeItem):
+
 2013-02-15  Adam Barth  <abarth@webkit.org>
 
         Enable the preload scanner on the background parser thread
index 997e8668d15b505c51386d41ad2bc230d7bd2b07..0301000e90e8c82c0370a962ee17b376a8e770d7 100644 (file)
@@ -86,7 +86,7 @@ PassRefPtr<ShareableElementData> DocumentSharedObjectPool::cachedShareableElemen
     if (!cacheHash || cacheIterator->value)
         return elementData.release();
 
-    cacheIterator->value = adoptPtr(new ShareableElementDataCacheEntry(ShareableElementDataCacheKey(elementData->m_attributeArray, elementData->length()), elementData));
+    cacheIterator->value = adoptPtr(new ShareableElementDataCacheEntry(ShareableElementDataCacheKey(elementData->immutableAttributeArray(), elementData->length()), elementData));
 
     return elementData.release();
 }
index 025aba111f04628651652a8e3f6eb74d3a64a887..a589750e282e871e3013e0b07f17cb811f82e0c1 100644 (file)
@@ -2863,7 +2863,7 @@ COMPILE_ASSERT(sizeof(ElementData) == sizeof(SameSizeAsElementData), element_att
 
 static size_t sizeForShareableElementDataWithAttributeCount(unsigned count)
 {
-    return sizeof(ShareableElementData) + sizeof(Attribute) * count;
+    return sizeof(ShareableElementData) - sizeof(void*) + sizeof(Attribute) * count;
 }
 
 PassRefPtr<ShareableElementData> ShareableElementData::createWithAttributes(const Vector<Attribute>& attributes)
@@ -2881,13 +2881,13 @@ ShareableElementData::ShareableElementData(const Vector<Attribute>& attributes)
     : ElementData(attributes.size())
 {
     for (unsigned i = 0; i < m_arraySize; ++i)
-        new (&m_attributeArray[i]) Attribute(attributes[i]);
+        new (&reinterpret_cast<Attribute*>(&m_attributeArray)[i]) Attribute(attributes[i]);
 }
 
 ShareableElementData::~ShareableElementData()
 {
     for (unsigned i = 0; i < m_arraySize; ++i)
-        m_attributeArray[i].~Attribute();
+        (reinterpret_cast<Attribute*>(&m_attributeArray)[i]).~Attribute();
 }
 
 ShareableElementData::ShareableElementData(const UniqueElementData& other)
@@ -2901,7 +2901,7 @@ ShareableElementData::ShareableElementData(const UniqueElementData& other)
     }
 
     for (unsigned i = 0; i < m_arraySize; ++i)
-        new (&m_attributeArray[i]) Attribute(other.m_attributeVector.at(i));
+        new (&reinterpret_cast<Attribute*>(&m_attributeArray)[i]) Attribute(other.m_attributeVector.at(i));
 }
 
 ElementData::ElementData(const ElementData& other, bool isUnique)
@@ -2939,7 +2939,7 @@ UniqueElementData::UniqueElementData(const ShareableElementData& other)
 
     m_attributeVector.reserveCapacity(other.length());
     for (unsigned i = 0; i < other.length(); ++i)
-        m_attributeVector.uncheckedAppend(other.m_attributeArray[i]);
+        m_attributeVector.uncheckedAppend(other.immutableAttributeArray()[i]);
 }
 
 PassRefPtr<UniqueElementData> ElementData::makeUniqueCopy() const
index df0125c9f0cbb1737b3f91205ea55d5103dfa070..f1d6bfe3cb8a4d96df13c4b400b08e6f8cedfae3 100644 (file)
@@ -119,26 +119,19 @@ private:
     PassRefPtr<UniqueElementData> makeUniqueCopy() const;
 };
 
-#if COMPILER(MSVC)
-#pragma warning(push)
-#pragma warning(disable: 4200) // Disable "zero-sized array in struct/union" warning
-#endif
-
 class ShareableElementData : public ElementData {
 public:
     static PassRefPtr<ShareableElementData> createWithAttributes(const Vector<Attribute>&);
 
+    const Attribute* immutableAttributeArray() const { return reinterpret_cast<const Attribute*>(&m_attributeArray); }
+
     explicit ShareableElementData(const Vector<Attribute>&);
     explicit ShareableElementData(const UniqueElementData&);
     ~ShareableElementData();
 
-    Attribute m_attributeArray[0];
+    void* m_attributeArray;
 };
 
-#if COMPILER(MSVC)
-#pragma warning(pop)
-#endif
-
 class UniqueElementData : public ElementData {
 public:
     static PassRefPtr<UniqueElementData> create();
@@ -1041,7 +1034,7 @@ inline const Attribute* ElementData::attributeItem(unsigned index) const
     ASSERT_WITH_SECURITY_IMPLICATION(index < length());
     if (m_isUnique)
         return &static_cast<const UniqueElementData*>(this)->m_attributeVector.at(index);
-    return &static_cast<const ShareableElementData*>(this)->m_attributeArray[index];
+    return &static_cast<const ShareableElementData*>(this)->immutableAttributeArray()[index];
 }
 
 } // namespace