Title: [128284] trunk/Source
Revision
128284
Author
commit-qu...@webkit.org
Date
2012-09-12 02:46:32 -0700 (Wed, 12 Sep 2012)

Log Message

Unreviewed, rolling out r128279.
http://trac.webkit.org/changeset/128279
https://bugs.webkit.org/show_bug.cgi?id=96487

"Snow Leopard compilation broken" (Requested by yurys on
#webkit).

Patch by Sheriff Bot <webkit.review....@gmail.com> on 2012-09-12

Source/WebCore:

* dom/WebCoreMemoryInstrumentation.cpp:
(WebCore):
(WebCore::String):
(WebCore::StringImpl):
(WebCore::AtomicString):
* dom/WebCoreMemoryInstrumentation.h:
(WebCore):
* inspector/MemoryInstrumentationImpl.cpp:
(WebCore::MemoryInstrumentationImpl::countObjectSize):
* platform/SharedBuffer.cpp:
(WebCore::SharedBuffer::reportMemoryUsage):

Source/WebKit/chromium:

* tests/MemoryInstrumentationTest.cpp:
(WebCore::InstrumentedUndefined::reportMemoryUsage):
(WebCore::TEST):

Source/WTF:

* wtf/MemoryInstrumentation.h:
(GenericMemoryTypes):
(WebCore):
(WebCore::MemoryInstrumentation::addRootObject):
(WebCore::MemoryObjectInfo::reportObjectInfo):
(WebCore::MemoryClassInfo::MemoryClassInfo):
* wtf/text/AtomicString.h:
(AtomicString):
* wtf/text/StringImpl.h:
* wtf/text/WTFString.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (128283 => 128284)


--- trunk/Source/WTF/ChangeLog	2012-09-12 09:45:04 UTC (rev 128283)
+++ trunk/Source/WTF/ChangeLog	2012-09-12 09:46:32 UTC (rev 128284)
@@ -1,3 +1,23 @@
+2012-09-12  Sheriff Bot  <webkit.review....@gmail.com>
+
+        Unreviewed, rolling out r128279.
+        http://trac.webkit.org/changeset/128279
+        https://bugs.webkit.org/show_bug.cgi?id=96487
+
+        "Snow Leopard compilation broken" (Requested by yurys on
+        #webkit).
+
+        * wtf/MemoryInstrumentation.h:
+        (GenericMemoryTypes):
+        (WebCore):
+        (WebCore::MemoryInstrumentation::addRootObject):
+        (WebCore::MemoryObjectInfo::reportObjectInfo):
+        (WebCore::MemoryClassInfo::MemoryClassInfo):
+        * wtf/text/AtomicString.h:
+        (AtomicString):
+        * wtf/text/StringImpl.h:
+        * wtf/text/WTFString.h:
+
 2012-09-12  Yury Semikhatsky  <yu...@chromium.org>
 
         Web Inspector: Persistent handle referenced from ScriptWrappable is double counted

Modified: trunk/Source/WTF/wtf/MemoryInstrumentation.h (128283 => 128284)


--- trunk/Source/WTF/wtf/MemoryInstrumentation.h	2012-09-12 09:45:04 UTC (rev 128283)
+++ trunk/Source/WTF/wtf/MemoryInstrumentation.h	2012-09-12 09:46:32 UTC (rev 128284)
@@ -43,6 +43,11 @@
 
 typedef const char* MemoryObjectType;
 
+class GenericMemoryTypes {
+public:
+    static MemoryObjectType Undefined;
+};
+
 enum MemoryOwningType {
     byPointer,
     byReference
@@ -60,7 +65,7 @@
 
     template <typename T> void addRootObject(const T& t)
     {
-        addInstrumentedObject(t, 0);
+        addInstrumentedObject(t, GenericMemoryTypes::Undefined);
         processDeferredInstrumentedPointers();
     }
 
@@ -179,7 +184,7 @@
     {
         if (!m_objectSize) {
             m_objectSize = actualSize ? actualSize : sizeof(T);
-            if (!objectType)
+            if (objectType != GenericMemoryTypes::Undefined)
                 m_objectType = objectType;
         }
     }
@@ -192,7 +197,7 @@
 class MemoryClassInfo {
 public:
     template<typename T>
-    MemoryClassInfo(MemoryObjectInfo* memoryObjectInfo, const T*, MemoryObjectType objectType = 0, size_t actualSize = 0)
+    MemoryClassInfo(MemoryObjectInfo* memoryObjectInfo, const T*, MemoryObjectType objectType = GenericMemoryTypes::Undefined, size_t actualSize = 0)
         : m_memoryObjectInfo(memoryObjectInfo)
         , m_memoryInstrumentation(memoryObjectInfo->memoryInstrumentation())
     {

Modified: trunk/Source/WTF/wtf/text/AtomicString.h (128283 => 128284)


--- trunk/Source/WTF/wtf/text/AtomicString.h	2012-09-12 09:45:04 UTC (rev 128283)
+++ trunk/Source/WTF/wtf/text/AtomicString.h	2012-09-12 09:46:32 UTC (rev 128284)
@@ -154,14 +154,6 @@
 #ifndef NDEBUG
     void show() const;
 #endif
-
-    template<typename MemoryObjectInfo>
-    void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
-    {
-        typename MemoryObjectInfo::ClassInfo info(memoryObjectInfo, this);
-        info.addInstrumentedMember(m_string);
-    }
-    
 private:
     // The explicit constructors with AtomicString::ConstructFromLiteral must be used for literals.
     AtomicString(ASCIILiteral);

Modified: trunk/Source/WTF/wtf/text/StringImpl.h (128283 => 128284)


--- trunk/Source/WTF/wtf/text/StringImpl.h	2012-09-12 09:45:04 UTC (rev 128283)
+++ trunk/Source/WTF/wtf/text/StringImpl.h	2012-09-12 09:46:32 UTC (rev 128284)
@@ -714,28 +714,6 @@
 #ifdef STRING_STATS
     ALWAYS_INLINE static StringStats& stringStats() { return m_stringStats; }
 #endif
-
-    template<typename MemoryObjectInfo>
-    void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
-    {
-        size_t selfSize = sizeof(StringImpl);
-
-        // Count size used by internal buffer but skip strings that were constructed from literals.
-        if ((m_hashAndFlags & BufferInternal) && !hasTerminatingNullCharacter())
-            // Three cases are covered here:
-            // 1) a normal 8-bit string with internal storage (BufferInternal)
-            // 2) a normal 16-bit string with internal storage (BufferInternal)
-            // 3) empty unique string with length = 0 (BufferInternal)
-            selfSize += m_length * (m_hashAndFlags & s_hashFlag8BitBuffer ? sizeof(LChar) : sizeof(UChar));
-
-        typename MemoryObjectInfo::ClassInfo info(memoryObjectInfo, this, 0, selfSize);
-
-        if (m_hashAndFlags & BufferSubstring)
-            info.addInstrumentedMember(m_substringBuffer);
-        else if (m_hashAndFlags & s_hashFlagHas16BitShadow) // Substring never has its own shadow.
-            info.addRawBuffer(m_copyData16, (m_length + (hasTerminatingNullCharacter() ? 1 : 0)) * sizeof(UChar));
-    }
-
 private:
     // This number must be at least 2 to avoid sharing empty, null as well as 1 character strings from SmallStrings.
     static const unsigned s_copyCharsInlineCutOff = 20;

Modified: trunk/Source/WTF/wtf/text/WTFString.h (128283 => 128284)


--- trunk/Source/WTF/wtf/text/WTFString.h	2012-09-12 09:45:04 UTC (rev 128283)
+++ trunk/Source/WTF/wtf/text/WTFString.h	2012-09-12 09:46:32 UTC (rev 128284)
@@ -455,13 +455,6 @@
         return (*m_impl)[index];
     }
 
-    template<typename MemoryObjectInfo>
-    void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
-    {
-        typename MemoryObjectInfo::ClassInfo info(memoryObjectInfo, this);
-        info.addInstrumentedMember(m_impl);
-    }
-
 private:
     RefPtr<StringImpl> m_impl;
 };

Modified: trunk/Source/WebCore/ChangeLog (128283 => 128284)


--- trunk/Source/WebCore/ChangeLog	2012-09-12 09:45:04 UTC (rev 128283)
+++ trunk/Source/WebCore/ChangeLog	2012-09-12 09:46:32 UTC (rev 128284)
@@ -1,3 +1,24 @@
+2012-09-12  Sheriff Bot  <webkit.review....@gmail.com>
+
+        Unreviewed, rolling out r128279.
+        http://trac.webkit.org/changeset/128279
+        https://bugs.webkit.org/show_bug.cgi?id=96487
+
+        "Snow Leopard compilation broken" (Requested by yurys on
+        #webkit).
+
+        * dom/WebCoreMemoryInstrumentation.cpp:
+        (WebCore):
+        (WebCore::String):
+        (WebCore::StringImpl):
+        (WebCore::AtomicString):
+        * dom/WebCoreMemoryInstrumentation.h:
+        (WebCore):
+        * inspector/MemoryInstrumentationImpl.cpp:
+        (WebCore::MemoryInstrumentationImpl::countObjectSize):
+        * platform/SharedBuffer.cpp:
+        (WebCore::SharedBuffer::reportMemoryUsage):
+
 2012-09-12  Yury Semikhatsky  <yu...@chromium.org>
 
         Web Inspector: Persistent handle referenced from ScriptWrappable is double counted

Modified: trunk/Source/WebCore/dom/WebCoreMemoryInstrumentation.cpp (128283 => 128284)


--- trunk/Source/WebCore/dom/WebCoreMemoryInstrumentation.cpp	2012-09-12 09:45:04 UTC (rev 128283)
+++ trunk/Source/WebCore/dom/WebCoreMemoryInstrumentation.cpp	2012-09-12 09:46:32 UTC (rev 128284)
@@ -37,6 +37,8 @@
 
 namespace WebCore {
 
+MemoryObjectType GenericMemoryTypes::Undefined = 0;
+
 MemoryObjectType WebCoreMemoryTypes::Page = "Page";
 MemoryObjectType WebCoreMemoryTypes::DOM = "Page.DOM";
 MemoryObjectType WebCoreMemoryTypes::CSS = "Page.CSS";
@@ -55,6 +57,32 @@
 MemoryObjectType WebCoreMemoryTypes::CachedResourceShader = "MemoryCache.Shader";
 MemoryObjectType WebCoreMemoryTypes::CachedResourceXSLT = "MemoryCache.XSLT";
 
+template<> void MemoryInstrumentationTraits::addInstrumentedObject<String>(MemoryInstrumentation* instrumentation, const String* const& string, MemoryObjectType ownerObjectType, MemoryOwningType owningType)
+{
+    MemoryInstrumentationTraits::addInstrumentedObject<const String>(instrumentation, string, ownerObjectType, owningType);
+}
+
+template<> void MemoryInstrumentationTraits::addInstrumentedObject<const String>(MemoryInstrumentation* instrumentation, const String* const& string, MemoryObjectType ownerObjectType, MemoryOwningType owningType)
+{
+    if (!string || instrumentation->visited(string))
+        return;
+    if (owningType == byPointer)
+        instrumentation->countObjectSize(ownerObjectType, sizeof(String));
+    instrumentation->addInstrumentedObject(string->impl(), ownerObjectType);
+}
+
+template<> void MemoryInstrumentationTraits::addInstrumentedObject<StringImpl>(MemoryInstrumentation* instrumentation, const StringImpl* const& stringImpl, MemoryObjectType ownerObjectType, MemoryOwningType owningType)
+{
+    MemoryInstrumentationTraits::addInstrumentedObject<const StringImpl>(instrumentation, stringImpl, ownerObjectType, owningType);
+}
+
+template<> void MemoryInstrumentationTraits::addInstrumentedObject<const StringImpl>(MemoryInstrumentation* instrumentation, const StringImpl* const& stringImpl, MemoryObjectType ownerObjectType, MemoryOwningType)
+{
+    if (!stringImpl || instrumentation->visited(stringImpl))
+        return;
+    instrumentation->countObjectSize(ownerObjectType, stringImpl->sizeInBytes());
+}
+
 template<> void MemoryInstrumentationTraits::addInstrumentedObject<KURL>(MemoryInstrumentation* instrumentation, const KURL* const& url, MemoryObjectType ownerObjectType, MemoryOwningType owningType)
 {
     MemoryInstrumentationTraits::addInstrumentedObject<const KURL>(instrumentation, url, ownerObjectType, owningType);
@@ -71,4 +99,14 @@
         instrumentation->addInstrumentedObject(url->innerURL(), ownerObjectType);
 }
 
+template<> void MemoryInstrumentationTraits::addInstrumentedObject<AtomicString>(MemoryInstrumentation* instrumentation, const AtomicString* const& atomicString, MemoryObjectType ownerObjectType, MemoryOwningType owningType)
+{
+    MemoryInstrumentationTraits::addInstrumentedObject<const AtomicString>(instrumentation, atomicString, ownerObjectType, owningType);
+}
+
+template<> void MemoryInstrumentationTraits::addInstrumentedObject<const AtomicString>(MemoryInstrumentation* instrumentation, const AtomicString* const& atomicString, MemoryObjectType ownerObjectType, MemoryOwningType owningType)
+{
+    MemoryInstrumentationTraits::addInstrumentedObject<const String>(instrumentation, reinterpret_cast<const String* const>(atomicString), ownerObjectType, owningType);
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/dom/WebCoreMemoryInstrumentation.h (128283 => 128284)


--- trunk/Source/WebCore/dom/WebCoreMemoryInstrumentation.h	2012-09-12 09:45:04 UTC (rev 128283)
+++ trunk/Source/WebCore/dom/WebCoreMemoryInstrumentation.h	2012-09-12 09:46:32 UTC (rev 128284)
@@ -42,10 +42,29 @@
 template<> void MemoryInstrumentationTraits::addInstrumentedObject<KURL>(MemoryInstrumentation*, const KURL* const&, MemoryObjectType, MemoryOwningType);
 template<> void MemoryInstrumentationTraits::addInstrumentedObject<const KURL>(MemoryInstrumentation*, const KURL* const&, MemoryObjectType, MemoryOwningType);
 
+template<> void MemoryInstrumentationTraits::addInstrumentedObject<String>(MemoryInstrumentation*, const String* const&, MemoryObjectType, MemoryOwningType);
+template<> void MemoryInstrumentationTraits::addInstrumentedObject<const String>(MemoryInstrumentation*, const String* const&, MemoryObjectType, MemoryOwningType);
+
+template<> void MemoryInstrumentationTraits::addInstrumentedObject<StringImpl>(MemoryInstrumentation*, const StringImpl* const&, MemoryObjectType, MemoryOwningType);
+template<> void MemoryInstrumentationTraits::addInstrumentedObject<const StringImpl>(MemoryInstrumentation*, const StringImpl* const&, MemoryObjectType, MemoryOwningType);
+
+template<> void MemoryInstrumentationTraits::addInstrumentedObject<AtomicString>(MemoryInstrumentation*, const AtomicString* const&, MemoryObjectType, MemoryOwningType);
+template<> void MemoryInstrumentationTraits::addInstrumentedObject<const AtomicString>(MemoryInstrumentation*, const AtomicString* const&, MemoryObjectType, MemoryOwningType);
+
+
 // Link time guards with no body.
 template<> void MemoryInstrumentationTraits::addObject<KURL>(MemoryInstrumentation*, const KURL* const&, MemoryObjectType, MemoryOwningType);
 template<> void MemoryInstrumentationTraits::addObject<const KURL>(MemoryInstrumentation*, const KURL* const&, MemoryObjectType, MemoryOwningType);
 
+template<> void MemoryInstrumentationTraits::addObject<String>(MemoryInstrumentation*, const String* const&, MemoryObjectType, MemoryOwningType);
+template<> void MemoryInstrumentationTraits::addObject<const String>(MemoryInstrumentation*, const String* const&, MemoryObjectType, MemoryOwningType);
+
+template<> void MemoryInstrumentationTraits::addObject<StringImpl>(MemoryInstrumentation*, const StringImpl* const&, MemoryObjectType, MemoryOwningType);
+template<> void MemoryInstrumentationTraits::addObject<const StringImpl>(MemoryInstrumentation*, const StringImpl* const&, MemoryObjectType, MemoryOwningType);
+
+template<> void MemoryInstrumentationTraits::addObject<AtomicString>(MemoryInstrumentation*, const AtomicString* const&, MemoryObjectType, MemoryOwningType);
+template<> void MemoryInstrumentationTraits::addObject<const AtomicString>(MemoryInstrumentation*, const AtomicString* const&, MemoryObjectType, MemoryOwningType);
+
 class WebCoreMemoryTypes {
 public:
     static MemoryObjectType Page;

Modified: trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.cpp (128283 => 128284)


--- trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.cpp	2012-09-12 09:45:04 UTC (rev 128283)
+++ trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.cpp	2012-09-12 09:46:32 UTC (rev 128284)
@@ -52,7 +52,7 @@
 
 void MemoryInstrumentationImpl::countObjectSize(MemoryObjectType objectType, size_t size)
 {
-    ASSERT(objectType);
+    ASSERT(objectType != GenericMemoryTypes::Undefined);
     TypeToSizeMap::AddResult result = m_totalSizes.add(objectType, size);
     if (!result.isNewEntry)
         result.iterator->second += size;

Modified: trunk/Source/WebCore/platform/SharedBuffer.cpp (128283 => 128284)


--- trunk/Source/WebCore/platform/SharedBuffer.cpp	2012-09-12 09:45:04 UTC (rev 128283)
+++ trunk/Source/WebCore/platform/SharedBuffer.cpp	2012-09-12 09:46:32 UTC (rev 128284)
@@ -250,7 +250,7 @@
 
 void SharedBuffer::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
-    MemoryClassInfo info(memoryObjectInfo, this);
+    MemoryClassInfo info(memoryObjectInfo, this, GenericMemoryTypes::Undefined);
     info.addVector(m_buffer);
     info.addVector(m_segments);
     for (unsigned i = 0; i < m_segments.size(); ++i)

Modified: trunk/Source/WebKit/chromium/ChangeLog (128283 => 128284)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-09-12 09:45:04 UTC (rev 128283)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-09-12 09:46:32 UTC (rev 128284)
@@ -1,3 +1,16 @@
+2012-09-12  Sheriff Bot  <webkit.review....@gmail.com>
+
+        Unreviewed, rolling out r128279.
+        http://trac.webkit.org/changeset/128279
+        https://bugs.webkit.org/show_bug.cgi?id=96487
+
+        "Snow Leopard compilation broken" (Requested by yurys on
+        #webkit).
+
+        * tests/MemoryInstrumentationTest.cpp:
+        (WebCore::InstrumentedUndefined::reportMemoryUsage):
+        (WebCore::TEST):
+
 2012-09-12  Ilya Tikhonovsky  <loi...@chromium.org>
 
         Web Inspector: NMI move String* instrumentation to wtf.

Modified: trunk/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp (128283 => 128284)


--- trunk/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp	2012-09-12 09:45:04 UTC (rev 128283)
+++ trunk/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp	2012-09-12 09:46:32 UTC (rev 128284)
@@ -179,7 +179,7 @@
 
     void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     {
-        MemoryClassInfo info(memoryObjectInfo, this);
+        MemoryClassInfo info(memoryObjectInfo, this, GenericMemoryTypes::Undefined);
     }
     int m_data;
 };
@@ -245,9 +245,8 @@
     VisitedObjects visitedObjects;
     MemoryInstrumentationImpl impl(visitedObjects);
     StringOwnerInstrumented stringOwnerInstrumented;
-    stringOwnerInstrumented.m_name.characters(); // Force 16bit shadow creation.
     impl.addRootObject(stringOwnerInstrumented);
-    EXPECT_EQ(sizeof(StringImpl) + stringOwnerInstrumented.m_name.length() * 2, impl.reportedSizeForAllTypes());
+    EXPECT_EQ(stringOwnerInstrumented.m_name.impl()->sizeInBytes(), impl.reportedSizeForAllTypes());
     EXPECT_EQ(2, visitedObjects.size());
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to