Diff
Modified: trunk/Source/WTF/ChangeLog (131868 => 131869)
--- trunk/Source/WTF/ChangeLog 2012-10-19 07:24:32 UTC (rev 131868)
+++ trunk/Source/WTF/ChangeLog 2012-10-19 07:45:17 UTC (rev 131869)
@@ -1,3 +1,22 @@
+2012-10-17 Ilya Tikhonovsky <[email protected]>
+
+ Web Inspector: NMI provide data for mixing with tcmalloc heap dumps.
+ https://bugs.webkit.org/show_bug.cgi?id=99457
+
+ Reviewed by Yury Semikhatsky.
+
+ countObjectSize now accepts ptr as the first argument and saves it into HashMap if the binary was ran with HEAPPROFILE env variable.
+ getProcessMemoryDistribution does snapshot and calls the downstream code with the map of counted objects.
+
+ * wtf/MemoryInstrumentation.h:
+ (MemoryInstrumentationClient):
+ (WTF::MemoryInstrumentation::countObjectSize):
+ (WTF::MemoryInstrumentation::addRawBuffer):
+ (WTF::MemoryClassInfo::addPrivateBuffer):
+ (WTF::MemoryInstrumentation::addObjectImpl):
+ (WTF::MemoryInstrumentation::addListHashSet):
+ (WTF::::process):
+
2012-10-18 Michael Saboff <[email protected]>
convertUTF8ToUTF16() Should Check for ASCII Input
Modified: trunk/Source/WTF/wtf/MemoryInstrumentation.h (131868 => 131869)
--- trunk/Source/WTF/wtf/MemoryInstrumentation.h 2012-10-19 07:24:32 UTC (rev 131868)
+++ trunk/Source/WTF/wtf/MemoryInstrumentation.h 2012-10-19 07:45:17 UTC (rev 131869)
@@ -86,7 +86,7 @@
class MemoryInstrumentationClient {
public:
virtual ~MemoryInstrumentationClient() { }
- virtual void countObjectSize(MemoryObjectType, size_t) = 0;
+ virtual void countObjectSize(const void*, MemoryObjectType, size_t) = 0;
virtual bool visited(const void*) = 0;
virtual void checkCountedObject(const void*) = 0;
};
@@ -110,7 +110,7 @@
};
private:
- void countObjectSize(MemoryObjectType objectType, size_t size) { m_client->countObjectSize(objectType, size); }
+ void countObjectSize(const void* object, MemoryObjectType objectType, size_t size) { m_client->countObjectSize(object, objectType, size); }
bool visited(const void* pointer) { return m_client->visited(pointer); }
void checkCountedObject(const void* pointer) { return m_client->checkCountedObject(pointer); }
@@ -159,7 +159,7 @@
{
if (!buffer || visited(buffer))
return;
- countObjectSize(ownerObjectType, size);
+ countObjectSize(buffer, ownerObjectType, size);
}
template<typename T>
@@ -199,7 +199,7 @@
template<typename M> void addMember(const M& member) { m_memoryInstrumentation->addObject(member, m_objectType); }
template<typename ListHashSetType> void addListHashSet(const ListHashSetType& set) { m_memoryInstrumentation->addListHashSet(set, m_objectType, true); }
void addRawBuffer(const void* const& buffer, size_t size) { m_memoryInstrumentation->addRawBuffer(buffer, m_objectType, size); }
- void addPrivateBuffer(size_t size) { m_memoryInstrumentation->countObjectSize(m_objectType, size); }
+ void addPrivateBuffer(size_t size) { m_memoryInstrumentation->countObjectSize(0, m_objectType, size); }
void addWeakPointer(void*) { }
@@ -232,20 +232,16 @@
template<typename T>
void MemoryInstrumentation::addObjectImpl(const OwnPtr<T>* const& object, MemoryObjectType ownerObjectType, MemoryOwningType owningType)
{
- if (owningType == byPointer && !visited(object)) {
- countObjectSize(ownerObjectType, sizeof(*object));
- checkCountedObject(object);
- }
+ if (owningType == byPointer && !visited(object))
+ countObjectSize(object, ownerObjectType, sizeof(*object));
addObjectImpl(object->get(), ownerObjectType, byPointer);
}
template<typename T>
void MemoryInstrumentation::addObjectImpl(const RefPtr<T>* const& object, MemoryObjectType ownerObjectType, MemoryOwningType owningType)
{
- if (owningType == byPointer && !visited(object)) {
- countObjectSize(ownerObjectType, sizeof(*object));
- checkCountedObject(object);
- }
+ if (owningType == byPointer && !visited(object))
+ countObjectSize(object, ownerObjectType, sizeof(*object));
addObjectImpl(object->get(), ownerObjectType, byPointer);
}
@@ -255,7 +251,7 @@
if (visited(&hashSet))
return;
size_t size = (contentOnly ? 0 : sizeof(ListHashSetType)) + hashSet.capacity() * sizeof(void*) + hashSet.size() * (sizeof(typename ListHashSetType::ValueType) + 2 * sizeof(void*));
- countObjectSize(ownerObjectType, size);
+ countObjectSize(&hashSet, ownerObjectType, size);
}
template<typename T>
@@ -263,7 +259,7 @@
{
MemoryObjectInfo memoryObjectInfo(memoryInstrumentation, m_ownerObjectType);
reportMemoryUsage(m_pointer, &memoryObjectInfo);
- memoryInstrumentation->countObjectSize(memoryObjectInfo.objectType(), memoryObjectInfo.objectSize());
+ memoryInstrumentation->countObjectSize(m_pointer, memoryObjectInfo.objectType(), memoryObjectInfo.objectSize());
}
// Link time guard for classes with external memory instrumentation.
Modified: trunk/Source/WebCore/ChangeLog (131868 => 131869)
--- trunk/Source/WebCore/ChangeLog 2012-10-19 07:24:32 UTC (rev 131868)
+++ trunk/Source/WebCore/ChangeLog 2012-10-19 07:45:17 UTC (rev 131869)
@@ -1,3 +1,27 @@
+2012-10-17 Ilya Tikhonovsky <[email protected]>
+
+ Web Inspector: NMI provide data for mixing with tcmalloc heap dumps.
+ https://bugs.webkit.org/show_bug.cgi?id=99457
+
+ Reviewed by Yury Semikhatsky.
+
+ countObjectSize now accepts ptr as the first argument and saves it into HashMap if the binary was ran with HEAPPROFILE env variable.
+ getProcessMemoryDistribution does snapshot and calls the downstream code with the map of counted objects.
+
+ * inspector/InspectorClient.h:
+ (WebCore::InspectorClient::dumpUncountedAllocatedObjects):
+ * inspector/InspectorMemoryAgent.cpp:
+ (WebCore::reportJSHeapInfo):
+ (WebCore::reportRenderTreeInfo):
+ (WebCore):
+ (WebCore::InspectorMemoryAgent::getProcessMemoryDistribution):
+ * inspector/MemoryInstrumentationImpl.cpp:
+ (WebCore::MemoryInstrumentationClientImpl::countObjectSize):
+ (WebCore::MemoryInstrumentationClientImpl::reportMemoryUsage):
+ * inspector/MemoryInstrumentationImpl.h:
+ (MemoryInstrumentationClientImpl):
+ (WebCore::MemoryInstrumentationClientImpl::countedObjects):
+
2012-10-19 Adam Barth <[email protected]>
[V8] DOMObjectVisitor does nothing
Modified: trunk/Source/WebCore/inspector/InspectorClient.h (131868 => 131869)
--- trunk/Source/WebCore/inspector/InspectorClient.h 2012-10-19 07:24:32 UTC (rev 131868)
+++ trunk/Source/WebCore/inspector/InspectorClient.h 2012-10-19 07:45:17 UTC (rev 131869)
@@ -29,6 +29,7 @@
#include "InspectorStateClient.h"
#include <wtf/Forward.h>
+#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
namespace WebCore {
@@ -73,6 +74,7 @@
virtual bool supportsFrameInstrumentation() { return false; }
virtual void getAllocatedObjects(HashSet<const void*>&) { }
+ virtual void dumpUncountedAllocatedObjects(const HashMap<const void*, size_t>&) { }
static bool doDispatchMessageOnFrontendPage(Page* frontendPage, const String& message);
};
Modified: trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp (131868 => 131869)
--- trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp 2012-10-19 07:24:32 UTC (rev 131868)
+++ trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp 2012-10-19 07:45:17 UTC (rev 131869)
@@ -436,16 +436,16 @@
HeapInfo info;
ScriptGCEvent::getHeapSize(info);
- memoryInstrumentationClient.countObjectSize(WebCoreMemoryTypes::JSHeapUsed, info.usedJSHeapSize);
- memoryInstrumentationClient.countObjectSize(WebCoreMemoryTypes::JSHeapUnused, info.totalJSHeapSize - info.usedJSHeapSize);
+ memoryInstrumentationClient.countObjectSize(0, WebCoreMemoryTypes::JSHeapUsed, info.usedJSHeapSize);
+ memoryInstrumentationClient.countObjectSize(0, WebCoreMemoryTypes::JSHeapUnused, info.totalJSHeapSize - info.usedJSHeapSize);
}
static void reportRenderTreeInfo(WTF::MemoryInstrumentationClient& memoryInstrumentationClient, Page* page)
{
ArenaSize arenaSize = page->renderTreeSize();
- memoryInstrumentationClient.countObjectSize(WebCoreMemoryTypes::RenderTreeUsed, arenaSize.treeSize);
- memoryInstrumentationClient.countObjectSize(WebCoreMemoryTypes::RenderTreeUnused, arenaSize.allocated - arenaSize.treeSize);
+ memoryInstrumentationClient.countObjectSize(0, WebCoreMemoryTypes::RenderTreeUsed, arenaSize.treeSize);
+ memoryInstrumentationClient.countObjectSize(0, WebCoreMemoryTypes::RenderTreeUnused, arenaSize.allocated - arenaSize.treeSize);
}
namespace {
@@ -541,6 +541,8 @@
memoryInstrumentation.addRootObject(memoryInstrumentation);
memoryInstrumentation.addRootObject(memoryInstrumentationClient);
+ m_inspectorClient->dumpUncountedAllocatedObjects(memoryInstrumentationClient.countedObjects());
+
MemoryUsageStatsGenerator statsGenerator(&memoryInstrumentationClient);
statsGenerator.dump(children.get());
Modified: trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.cpp (131868 => 131869)
--- trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.cpp 2012-10-19 07:24:32 UTC (rev 131868)
+++ trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.cpp 2012-10-19 07:45:17 UTC (rev 131869)
@@ -58,13 +58,22 @@
return sizesMap;
}
-void MemoryInstrumentationClientImpl::countObjectSize(MemoryObjectType objectType, size_t size)
+void MemoryInstrumentationClientImpl::countObjectSize(const void* object, MemoryObjectType objectType, size_t size)
{
ASSERT(objectType);
+
TypeToSizeMap::AddResult result = m_totalSizes.add(objectType, size);
if (!result.isNewEntry)
result.iterator->value += size;
++m_totalCountedObjects;
+
+ if (!checkInstrumentedObjects())
+ return;
+
+ if (object) {
+ m_countedObjects.add(object, size);
+ checkCountedObject(object);
+ }
}
bool MemoryInstrumentationClientImpl::visited(const void* object)
@@ -91,6 +100,7 @@
info.addMember(m_totalSizes);
info.addMember(m_visitedObjects);
info.addMember(m_allocatedObjects);
+ info.addMember(m_countedObjects);
}
void MemoryInstrumentationImpl::processDeferredInstrumentedPointers()
Modified: trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.h (131868 => 131869)
--- trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.h 2012-10-19 07:24:32 UTC (rev 131868)
+++ trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.h 2012-10-19 07:45:17 UTC (rev 131869)
@@ -48,6 +48,8 @@
class MemoryInstrumentationClientImpl : public WTF::MemoryInstrumentationClient {
public:
+ typedef HashMap<const void*, size_t> ObjectToSizeMap;
+
MemoryInstrumentationClientImpl()
: m_totalCountedObjects(0)
, m_totalObjectsNotInAllocatedSet(0)
@@ -69,13 +71,14 @@
TypeNameToSizeMap sizesMap() const;
VisitedObjects& allocatedObjects() { return m_allocatedObjects; }
+ const ObjectToSizeMap& countedObjects() { return m_countedObjects; }
bool checkInstrumentedObjects() const { return !m_allocatedObjects.isEmpty(); }
size_t visitedObjects() const { return m_visitedObjects.size(); }
size_t totalCountedObjects() const { return m_totalCountedObjects; }
size_t totalObjectsNotInAllocatedSet() const { return m_totalObjectsNotInAllocatedSet; }
- virtual void countObjectSize(MemoryObjectType, size_t) OVERRIDE;
+ virtual void countObjectSize(const void*, MemoryObjectType, size_t) OVERRIDE;
virtual bool visited(const void*) OVERRIDE;
virtual void checkCountedObject(const void*) OVERRIDE;
@@ -86,6 +89,7 @@
TypeToSizeMap m_totalSizes;
VisitedObjects m_visitedObjects;
VisitedObjects m_allocatedObjects;
+ ObjectToSizeMap m_countedObjects;
size_t m_totalCountedObjects;
size_t m_totalObjectsNotInAllocatedSet;
};
Modified: trunk/Source/WebKit/chromium/ChangeLog (131868 => 131869)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-10-19 07:24:32 UTC (rev 131868)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-10-19 07:45:17 UTC (rev 131869)
@@ -1,3 +1,31 @@
+2012-10-17 Ilya Tikhonovsky <[email protected]>
+
+ Web Inspector: NMI provide data for mixing with tcmalloc heap dumps.
+ https://bugs.webkit.org/show_bug.cgi?id=99457
+
+ Reviewed by Yury Semikhatsky.
+
+ Embedder's code wraps the map with counted objects info into InstrumentedObjectSizeProvider
+ and forces downstream code to make tcmalloc heap snapshot.
+ The default implementation is empty.
+
+ * public/WebDevToolsAgentClient.h:
+ (InstrumentedObjectSizeProvider):
+ (WebKit::WebDevToolsAgentClient::InstrumentedObjectSizeProvider::~InstrumentedObjectSizeProvider):
+ (WebKit::WebDevToolsAgentClient::dumpUncountedAllocatedObjects):
+ (WebDevToolsAgentClient):
+ * src/InspectorClientImpl.cpp:
+ (WebKit::InspectorClientImpl::dumpUncountedAllocatedObjects):
+ (WebKit):
+ * src/InspectorClientImpl.h:
+ (InspectorClientImpl):
+ * src/WebDevToolsAgentImpl.cpp:
+ (WebKit::WebDevToolsAgentImpl::getAllocatedObjects):
+ (WebKit::WebDevToolsAgentImpl::dumpUncountedAllocatedObjects):
+ (WebKit):
+ * src/WebDevToolsAgentImpl.h:
+ (WebDevToolsAgentImpl):
+
2012-10-18 Kent Tamura <[email protected]>
Add shortMonthLabels and shortStandAloneMonthLabels to Localizer
Modified: trunk/Source/WebKit/chromium/public/WebDevToolsAgentClient.h (131868 => 131869)
--- trunk/Source/WebKit/chromium/public/WebDevToolsAgentClient.h 2012-10-19 07:24:32 UTC (rev 131868)
+++ trunk/Source/WebKit/chromium/public/WebDevToolsAgentClient.h 2012-10-19 07:45:17 UTC (rev 131869)
@@ -69,6 +69,14 @@
};
virtual void visitAllocatedObjects(AllocatedObjectVisitor*) { }
+ class InstrumentedObjectSizeProvider {
+ public:
+ virtual size_t objectSize(const void* ptr) const = 0;
+ protected:
+ virtual ~InstrumentedObjectSizeProvider() { }
+ };
+ virtual void dumpUncountedAllocatedObjects(const InstrumentedObjectSizeProvider*) { }
+
protected:
~WebDevToolsAgentClient() { }
};
Modified: trunk/Source/WebKit/chromium/src/InspectorClientImpl.cpp (131868 => 131869)
--- trunk/Source/WebKit/chromium/src/InspectorClientImpl.cpp 2012-10-19 07:24:32 UTC (rev 131868)
+++ trunk/Source/WebKit/chromium/src/InspectorClientImpl.cpp 2012-10-19 07:45:17 UTC (rev 131869)
@@ -169,6 +169,12 @@
agent->getAllocatedObjects(set);
}
+void InspectorClientImpl::dumpUncountedAllocatedObjects(const HashMap<const void*, size_t>& map)
+{
+ if (WebDevToolsAgentImpl* agent = devToolsAgent())
+ agent->dumpUncountedAllocatedObjects(map);
+}
+
void InspectorClientImpl::willProcessTask()
{
InspectorInstrumentation::willProcessTask(m_inspectedWebView->page());
Modified: trunk/Source/WebKit/chromium/src/InspectorClientImpl.h (131868 => 131869)
--- trunk/Source/WebKit/chromium/src/InspectorClientImpl.h 2012-10-19 07:24:32 UTC (rev 131868)
+++ trunk/Source/WebKit/chromium/src/InspectorClientImpl.h 2012-10-19 07:45:17 UTC (rev 131869)
@@ -79,6 +79,7 @@
virtual bool supportsFrameInstrumentation();
virtual void getAllocatedObjects(HashSet<const void*>&);
+ virtual void dumpUncountedAllocatedObjects(const HashMap<const void*, size_t>&);
private:
// WebThread::TaskObserver
Modified: trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp (131868 => 131869)
--- trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp 2012-10-19 07:24:32 UTC (rev 131868)
+++ trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp 2012-10-19 07:45:17 UTC (rev 131869)
@@ -462,12 +462,13 @@
CountingVisitor() : m_totalObjectsCount(0)
{
}
+
virtual bool visitObject(const void* ptr)
{
++m_totalObjectsCount;
return true;
}
- size_t totalObjectsCount()
+ size_t totalObjectsCount() const
{
return m_totalObjectsCount;
}
@@ -488,7 +489,7 @@
, m_pointers(new const void*[maxObjectsCount])
{
}
- ~PointerCollector()
+ virtual ~PointerCollector()
{
delete[] m_pointers;
}
@@ -531,6 +532,25 @@
}
}
+void WebDevToolsAgentImpl::dumpUncountedAllocatedObjects(const HashMap<const void*, size_t>& map)
+{
+ class InstrumentedObjectSizeProvider : public WebDevToolsAgentClient::InstrumentedObjectSizeProvider {
+ public:
+ InstrumentedObjectSizeProvider(const HashMap<const void*, size_t>& map) : m_map(map) { }
+ virtual size_t objectSize(const void* ptr) const
+ {
+ HashMap<const void*, size_t>::const_iterator i = m_map.find(ptr);
+ return i == m_map.end() ? 0 : i->value;
+ }
+
+ private:
+ const HashMap<const void*, size_t>& m_map;
+ };
+
+ InstrumentedObjectSizeProvider provider(map);
+ m_client->dumpUncountedAllocatedObjects(&provider);
+}
+
void WebDevToolsAgentImpl::dispatchOnInspectorBackend(const WebString& message)
{
inspectorController()->dispatchMessageFromFrontend(message);
Modified: trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h (131868 => 131869)
--- trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h 2012-10-19 07:24:32 UTC (rev 131868)
+++ trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h 2012-10-19 07:45:17 UTC (rev 131869)
@@ -106,6 +106,7 @@
virtual void autoZoomPageToFitWidth();
virtual void getAllocatedObjects(HashSet<const void*>&);
+ virtual void dumpUncountedAllocatedObjects(const HashMap<const void*, size_t>&);
int hostId() { return m_hostId; }
Modified: trunk/Tools/ChangeLog (131868 => 131869)
--- trunk/Tools/ChangeLog 2012-10-19 07:24:32 UTC (rev 131868)
+++ trunk/Tools/ChangeLog 2012-10-19 07:45:17 UTC (rev 131869)
@@ -1,3 +1,14 @@
+2012-10-17 Ilya Tikhonovsky <[email protected]>
+
+ Web Inspector: NMI provide data for mixing with tcmalloc heap dumps.
+ https://bugs.webkit.org/show_bug.cgi?id=99457
+
+ Reviewed by Yury Semikhatsky.
+
+ countObjectSize now requires pointer to object as the first argument.
+
+ * TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp:
+
2012-10-18 Dirk Pranke <[email protected]>
make move_overwritten_baselines_to work again while rebaselining
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp (131868 => 131869)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp 2012-10-19 07:24:32 UTC (rev 131868)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp 2012-10-19 07:45:17 UTC (rev 131869)
@@ -95,7 +95,7 @@
private:
class Client : public WTF::MemoryInstrumentationClient {
public:
- virtual void countObjectSize(MemoryObjectType objectType, size_t size)
+ virtual void countObjectSize(const void*, MemoryObjectType objectType, size_t size)
{
TypeToSizeMap::AddResult result = m_totalSizes.add(objectType, size);
if (!result.isNewEntry)