Changeset 38849 in webkit for trunk/JavaScriptCore/runtime
- Timestamp:
- Nov 29, 2008, 11:09:50 PM (16 years ago)
- Location:
- trunk/JavaScriptCore/runtime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
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.