Changeset 38849 in webkit for trunk/JavaScriptCore
- Timestamp:
- Nov 29, 2008, 11:09:50 PM (16 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r38848 r38849 1 2008-11-29 Antti Koivisto <[email protected]> 2 3 Reviewed by Dan Bernstein. 4 5 https://bugs.webkit.org/show_bug.cgi?id=22557 6 Add statistics for JavaScript GC heap. 7 8 * JavaScriptCore.exp: 9 * runtime/Collector.cpp: 10 (JSC::Heap::objectCount): 11 (JSC::addToStatistics): 12 (JSC::Heap::statistics): 13 * runtime/Collector.h: 14 1 15 2008-11-29 Antti Koivisto <[email protected]> 2 16 -
trunk/JavaScriptCore/JavaScriptCore.exp
r38844 r38849 170 170 __ZN3JSC4Heap26protectedGlobalObjectCountEv 171 171 __ZN3JSC4Heap4heapEPNS_7JSValueE 172 __ZN3JSC4Heap4sizeEv173 172 __ZN3JSC4Heap6isBusyEv 174 173 __ZN3JSC4Heap7collectEv … … 177 176 __ZN3JSC4Heap8allocateEm 178 177 __ZN3JSC4Heap9unprotectEPNS_7JSValueE 178 __ZN3JSC4Heap11objectCountEv 179 __ZNK3JSC4Heap10statisticsEv 179 180 __ZN3JSC4callEPNS_9ExecStateEPNS_7JSValueENS_8CallTypeERKNS_8CallDataES3_RKNS_7ArgListE 180 181 __ZN3JSC5equalEPKNS_7UString3RepES3_ -
trunk/JavaScriptCore/runtime/Collector.cpp
r38750 r38849 1005 1005 } 1006 1006 1007 size_t Heap:: size()1007 size_t Heap::objectCount() 1008 1008 { 1009 1009 return primaryHeap.numLiveObjects + numberHeap.numLiveObjects; 1010 } 1011 1012 template <HeapType heapType> 1013 static void addToStatistics(Heap::Statistics& statistics, const CollectorHeap& heap) 1014 { 1015 typedef HeapConstants<heapType> HC; 1016 for (size_t i = 0; i < heap.usedBlocks; ++i) { 1017 if (heap.blocks[i]) { 1018 statistics.size += BLOCK_SIZE; 1019 statistics.free += (HC::cellsPerBlock - heap.blocks[i]->usedCells) * HC::cellSize; 1020 } 1021 } 1022 } 1023 1024 Heap::Statistics Heap::statistics() const 1025 { 1026 Statistics statistics = { 0, 0 }; 1027 JSC::addToStatistics<PrimaryHeap>(statistics, primaryHeap); 1028 JSC::addToStatistics<NumberHeap>(statistics, numberHeap); 1029 return statistics; 1010 1030 } 1011 1031 -
trunk/JavaScriptCore/runtime/Collector.h
r38622 r38849 89 89 void reportExtraMemoryCost(size_t cost); 90 90 91 size_t size(); 91 size_t objectCount(); 92 struct Statistics { 93 size_t size; 94 size_t free; 95 }; 96 Statistics statistics() const; 92 97 93 98 void setGCProtectNeedsLocking();
Note:
See TracChangeset
for help on using the changeset viewer.