Changeset 114698 in webkit for trunk/Source/JavaScriptCore/heap/Heap.cpp
- Timestamp:
- Apr 19, 2012, 5:05:37 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/heap/Heap.cpp
r114511 r114698 314 314 , m_minBytesPerCycle(heapSizeForHint(heapSize)) 315 315 , m_lastFullGCSize(0) 316 , m_highWaterMark(m_minBytesPerCycle) 316 , m_bytesAllocatedLimit(m_minBytesPerCycle) 317 , m_bytesAllocated(0) 317 318 , m_operationInProgress(NoOperation) 318 319 , m_objectSpace(this) … … 466 467 // collecting more frequently as long as it stays alive. 467 468 468 addToWaterMark(cost); 469 didAllocate(cost); 470 if (shouldCollect()) 471 collect(DoNotSweep); 469 472 } 470 473 … … 849 852 } 850 853 851 // To avoid pathological GC churn in large heaps, we set the allocation high 852 // water mark to be proportional to the current size of the heap. The exact 853 // proportion is a bit arbitrary. A 2X multiplier gives a 1:1 (heap size : 854 // To avoid pathological GC churn in large heaps, we set the new allocation 855 // limit to be the current size of the heap. This heuristic 856 // is a bit arbitrary. Using the current size of the heap after this 857 // collection gives us a 2X multiplier, which is a 1:1 (heap size : 854 858 // new bytes allocated) proportion, and seems to work well in benchmarks. 855 859 size_t newSize = size(); 856 size_t proportionalBytes = 2 * newSize;857 860 if (fullGC) { 858 861 m_lastFullGCSize = newSize; 859 m_highWaterMark = max(proportionalBytes, m_minBytesPerCycle); 860 } 862 m_bytesAllocatedLimit = max(newSize, m_minBytesPerCycle); 863 } 864 m_bytesAllocated = 0; 861 865 double lastGCEndTime = WTF::currentTime(); 862 866 m_lastGCLength = lastGCEndTime - lastGCStartTime; … … 885 889 { 886 890 return m_activityCallback.get(); 891 } 892 893 void Heap::didAllocate(size_t bytes) 894 { 895 m_activityCallback->didAllocate(m_bytesAllocated); 896 m_bytesAllocated += bytes; 887 897 } 888 898
Note:
See TracChangeset
for help on using the changeset viewer.