Title: [143054] trunk/Source/WebCore
Revision
143054
Author
commit-qu...@webkit.org
Date
2013-02-15 14:47:35 -0800 (Fri, 15 Feb 2013)

Log Message

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).

Patch by Sheriff Bot <webkit.review....@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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (143053 => 143054)


--- trunk/Source/WebCore/ChangeLog	2013-02-15 22:41:23 UTC (rev 143053)
+++ trunk/Source/WebCore/ChangeLog	2013-02-15 22:47:35 UTC (rev 143054)
@@ -1,3 +1,23 @@
+2013-02-15  Sheriff Bot  <webkit.review....@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  <aba...@webkit.org>
 
         Enable the preload scanner on the background parser thread

Modified: trunk/Source/WebCore/dom/DocumentSharedObjectPool.cpp (143053 => 143054)


--- trunk/Source/WebCore/dom/DocumentSharedObjectPool.cpp	2013-02-15 22:41:23 UTC (rev 143053)
+++ trunk/Source/WebCore/dom/DocumentSharedObjectPool.cpp	2013-02-15 22:47:35 UTC (rev 143054)
@@ -86,7 +86,7 @@
     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();
 }

Modified: trunk/Source/WebCore/dom/Element.cpp (143053 => 143054)


--- trunk/Source/WebCore/dom/Element.cpp	2013-02-15 22:41:23 UTC (rev 143053)
+++ trunk/Source/WebCore/dom/Element.cpp	2013-02-15 22:47:35 UTC (rev 143054)
@@ -2863,7 +2863,7 @@
 
 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 @@
     : 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 @@
     }
 
     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 @@
 
     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

Modified: trunk/Source/WebCore/dom/Element.h (143053 => 143054)


--- trunk/Source/WebCore/dom/Element.h	2013-02-15 22:41:23 UTC (rev 143053)
+++ trunk/Source/WebCore/dom/Element.h	2013-02-15 22:47:35 UTC (rev 143054)
@@ -119,26 +119,19 @@
     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 @@
     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
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to