Changeset 121658 in webkit
- Timestamp:
- Jul 2, 2012 12:04:41 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r121657 r121658 1 2012-06-28 Yury Semikhatsky <yurys@chromium.org> 2 3 Web Inspector: add v8 bindings memory info to the native memory graph 4 https://bugs.webkit.org/show_bug.cgi?id=90149 5 6 Reviewed by Pavel Feldman. 7 8 Size of V8 binding maps is now reported on the memory chart. 9 10 * bindings/js/ScriptProfiler.h: 11 (WebCore::ScriptProfiler::collectBindingMemoryInfo): 12 * bindings/v8/DOMDataStore.cpp: 13 (WebCore::DOMDataStore::reportMemoryUsage): 14 (WebCore): 15 * bindings/v8/DOMDataStore.h: 16 (WebCore): 17 (DOMDataStore): 18 * bindings/v8/IntrusiveDOMWrapperMap.h: 19 (WebCore::ChunkedTable::reportMemoryUsage): 20 (ChunkedTable): 21 * bindings/v8/ScriptProfiler.cpp: 22 (WebCore::ScriptProfiler::collectBindingMemoryInfo): 23 (WebCore): 24 * bindings/v8/ScriptProfiler.h: 25 (WebCore): 26 (ScriptProfiler): 27 * bindings/v8/V8Binding.cpp: 28 (WebCore::V8BindingPerIsolateData::reportMemoryUsage): 29 (WebCore): 30 (WebCore::StringCache::reportMemoryUsage): 31 * bindings/v8/V8Binding.h: 32 (WebCore): 33 (StringCache): 34 (V8BindingPerIsolateData): 35 * bindings/v8/V8DOMMap.h: 36 (WebCore): 37 (AbstractWeakReferenceMap): 38 * dom/MemoryInstrumentation.h: 39 (MemoryInstrumentation): 40 (WebCore): 41 (WebCore::MemoryInstrumentation::reportHashMap): added a method for reporting 42 size of a HashMap. 43 * inspector/InspectorMemoryAgent.cpp: 44 (MemoryBlockName): 45 (WebCore): 46 (WebCore::domTreeInfo): 47 1 48 2012-07-01 Christophe Dumez <christophe.dumez@intel.com> 2 49 -
trunk/Source/WebCore/bindings/js/ScriptProfiler.h
r121144 r121658 39 39 class ExternalArrayVisitor; 40 40 class ExternalStringVisitor; 41 class MemoryInstrumentation; 41 42 class NodeWrapperVisitor; 42 43 class Page; … … 76 77 // FIXME: Implement this counter for JSC. See bug 73936 for more details. 77 78 static void visitNodeWrappers(NodeWrapperVisitor*) { } 79 // FIXME: Support these methods for JSC. See bug 90358. 78 80 static void visitExternalStrings(ExternalStringVisitor*) { } 79 81 static void visitExternalArrays(ExternalArrayVisitor*) { } 82 static void collectBindingMemoryInfo(MemoryInstrumentation*) { } 80 83 static size_t profilerSnapshotsSize() { return 0; } 81 84 }; -
trunk/Source/WebCore/bindings/v8/DOMDataStore.cpp
r113806 r121658 33 33 34 34 #include "DOMData.h" 35 #include "MemoryInstrumentation.h" 35 36 #include "V8Binding.h" 36 37 #include <wtf/MainThread.h> … … 119 120 } 120 121 122 void DOMDataStore::reportMemoryUsage(MemoryInstrumentation* instrumentation) 123 { 124 instrumentation->reportPointer(this, MemoryInstrumentation::Binding); 125 domNodeMap().reportMemoryUsage(instrumentation); 126 activeDomNodeMap().reportMemoryUsage(instrumentation); 127 domObjectMap().reportMemoryUsage(instrumentation); 128 activeDomObjectMap().reportMemoryUsage(instrumentation); 129 } 130 121 131 // Called when the object is near death (not reachable from JS roots). 122 132 // It is time to remove the entry from the table and dispose the handle. -
trunk/Source/WebCore/bindings/v8/DOMDataStore.h
r113806 r121658 48 48 class DOMData; 49 49 class DOMDataStore; 50 class MemoryInstrumentation; 50 51 51 52 typedef WTF::Vector<DOMDataStore*> DOMDataList; … … 87 88 static void weakNodeCallback(v8::Persistent<v8::Value> v8Object, void* domObject); 88 89 90 void reportMemoryUsage(MemoryInstrumentation*); 91 89 92 protected: 90 93 static void weakDOMObjectCallback(v8::Persistent<v8::Value> v8Object, void* domObject); -
trunk/Source/WebCore/bindings/v8/IntrusiveDOMWrapperMap.h
r95901 r121658 33 33 34 34 #include "DOMDataStore.h" 35 #include "MemoryInstrumentation.h" 35 36 #include "V8Node.h" 36 37 … … 102 103 } 103 104 105 void reportMemoryUsage(MemoryInstrumentation* instrumentation) 106 { 107 for (Chunk* chunk = m_chunks; chunk; chunk = chunk->m_previous) 108 instrumentation->reportPointer(chunk, MemoryInstrumentation::Binding); 109 } 110 104 111 private: 105 112 struct Chunk { … … 177 184 } 178 185 186 virtual void reportMemoryUsage(MemoryInstrumentation* instrumentation) OVERRIDE 187 { 188 instrumentation->reportPointer(this, MemoryInstrumentation::Binding); 189 m_table.reportMemoryUsage(instrumentation); 190 } 191 179 192 private: 180 193 static int const numberOfEntries = (1 << 10) - 1; -
trunk/Source/WebCore/bindings/v8/ScriptProfiler.cpp
r121144 r121658 34 34 35 35 #include "BindingVisitors.h" 36 #include "MemoryInstrumentation.h" 36 37 #include "RetainedDOMInfo.h" 37 38 #include "ScriptObject.h" … … 220 221 } 221 222 223 void ScriptProfiler::collectBindingMemoryInfo(MemoryInstrumentation* instrumentation) 224 { 225 V8BindingPerIsolateData* data = V8BindingPerIsolateData::current(); 226 if (!data) 227 return; 228 data->reportMemoryUsage(instrumentation); 229 } 230 222 231 size_t ScriptProfiler::profilerSnapshotsSize() 223 232 { -
trunk/Source/WebCore/bindings/v8/ScriptProfiler.h
r121144 r121658 43 43 class ExternalArrayVisitor; 44 44 class ExternalStringVisitor; 45 class MemoryInstrumentation; 45 46 class NodeWrapperVisitor; 46 47 class Page; … … 82 83 static void visitExternalStrings(ExternalStringVisitor*); 83 84 static void visitExternalArrays(ExternalArrayVisitor*); 85 static void collectBindingMemoryInfo(MemoryInstrumentation*); 84 86 static size_t profilerSnapshotsSize(); 85 87 }; -
trunk/Source/WebCore/bindings/v8/V8Binding.cpp
r121538 r121658 35 35 #include "DOMStringList.h" 36 36 #include "Element.h" 37 #include "MemoryInstrumentation.h" 37 38 #include "PlatformString.h" 38 39 #include "QualifiedName.h" … … 90 91 } 91 92 92 93 void V8BindingPerIsolateData::reportMemoryUsage(MemoryInstrumentation* instrumentation) 94 { 95 instrumentation->reportPointer(this, MemoryInstrumentation::Binding); 96 instrumentation->reportHashMap(m_rawTemplates, MemoryInstrumentation::Binding); 97 instrumentation->reportHashMap(m_templates, MemoryInstrumentation::Binding); 98 m_stringCache.reportMemoryUsage(instrumentation); 99 100 for (size_t i = 0; i < m_domDataList.size(); i++) 101 m_domDataList[i]->reportMemoryUsage(instrumentation); 102 } 93 103 94 104 // WebCoreStringResource is a helper class for v8ExternalString. It is used … … 577 587 return toStringTemplate; 578 588 } 589 590 void StringCache::reportMemoryUsage(MemoryInstrumentation* instrumentation) 591 { 592 instrumentation->reportHashMap(m_stringCache, MemoryInstrumentation::Binding); 593 } 579 594 580 595 PassRefPtr<DOMStringList> v8ValueToWebCoreDOMStringList(v8::Handle<v8::Value> value) -
trunk/Source/WebCore/bindings/v8/V8Binding.h
r121554 r121658 50 50 class EventTarget; 51 51 class ExternalStringVisitor; 52 class MemoryInstrumentation; 52 53 53 54 // FIXME: Remove V8Binding. … … 78 79 79 80 void remove(StringImpl*); 81 82 void reportMemoryUsage(MemoryInstrumentation*); 80 83 81 84 private: … … 214 217 215 218 GCEventData& gcEventData() { return m_gcEventData; } 219 220 void reportMemoryUsage(MemoryInstrumentation*); 216 221 217 222 private: -
trunk/Source/WebCore/bindings/v8/V8DOMMap.h
r115495 r121658 32 32 #define V8DOMMap_h 33 33 34 #include "MemoryInstrumentation.h" 34 35 #include <wtf/HashMap.h> 35 36 #include <wtf/OwnPtr.h> … … 39 40 class DOMDataStore; 40 41 class Node; 42 class MemoryInstrumentation; 41 43 42 44 template <class KeyType, class ValueType> class AbstractWeakReferenceMap { … … 62 64 63 65 v8::WeakReferenceCallback weakReferenceCallback() { return m_weakReferenceCallback; } 66 67 virtual void reportMemoryUsage(MemoryInstrumentation*) = 0; 68 64 69 private: 65 70 v8::WeakReferenceCallback m_weakReferenceCallback; … … 130 135 } 131 136 137 virtual void reportMemoryUsage(MemoryInstrumentation* instrumentation) OVERRIDE 138 { 139 instrumentation->reportHashMap(m_map, MemoryInstrumentation::Binding); 140 } 141 132 142 protected: 133 143 HashMap<KeyType*, ValueType*> m_map; -
trunk/Source/WebCore/dom/MemoryInstrumentation.h
r121530 r121658 48 48 DOM, 49 49 CSS, 50 Binding, 50 51 LastTypeEntry 51 52 }; … … 60 61 countObjectSize(objectType, sizeof(T)); 61 62 } 63 template <typename HashMapType> void reportHashMap(const HashMapType&, ObjectType); 62 64 63 65 private: … … 140 142 } 141 143 144 145 template<typename HashMapType> 146 void MemoryInstrumentation::reportHashMap(const HashMapType& hashMap, ObjectType objectType) 147 { 148 size_t size = sizeof(HashMapType) + hashMap.capacity() * sizeof(typename HashMapType::ValueType); 149 countObjectSize(objectType, size); 150 } 151 142 152 } // namespace WebCore 143 153 -
trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp
r121530 r121658 91 91 static const char domTreeDOM[] = "DOMTreeDOM"; 92 92 static const char domTreeCSS[] = "DOMTreeCSS"; 93 static const char domTreeBinding[] = "DOMTreeBinding"; 93 94 } 94 95 … … 448 449 addMemoryBlockFor(domChildren.get(), m_totalSizes[DOM], MemoryBlockName::domTreeDOM); 449 450 addMemoryBlockFor(domChildren.get(), m_totalSizes[CSS], MemoryBlockName::domTreeCSS); 451 addMemoryBlockFor(domChildren.get(), m_totalSizes[Binding], MemoryBlockName::domTreeBinding); 450 452 451 453 RefPtr<InspectorMemoryBlock> dom = InspectorMemoryBlock::create().setName(MemoryBlockName::dom); … … 493 495 } 494 496 497 void visitBindings() 498 { 499 ScriptProfiler::collectBindingMemoryInfo(&m_domMemoryUsage); 500 } 501 495 502 PassRefPtr<InspectorMemoryBlock> dumpStatistics() { return m_domMemoryUsage.dumpStatistics(); } 496 503 … … 512 519 domTreesIterator.visitNode(doc); 513 520 } 521 522 domTreesIterator.visitBindings(); 514 523 515 524 return domTreesIterator.dumpStatistics();
Note: See TracChangeset
for help on using the changeset viewer.