Changeset 92217 in webkit
- Timestamp:
- Aug 2, 2011 12:57:06 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r92210 r92217 1 2011-08-02 Filip Pizlo <fpizlo@apple.com> 2 3 JSC does a GC even when the heap still has free pages 4 https://bugs.webkit.org/show_bug.cgi?id=65445 5 6 Reviewed by Oliver Hunt. 7 8 If the high watermark is not reached, then we allocate new blocks as 9 before. If the current watermark does reach (or exceed) the high 10 watermark, then we check if there is a block on the free block pool. 11 If there is, we simply allocation from it. If there isn't, we 12 invoke a collectin as before. This effectively couples the elastic 13 scavenging to the collector's decision function. That is, if an 14 application rapidly varies its heap usage (sometimes using more and 15 sometimes less) then the collector will not thrash as it used to. 16 But if heap usage drops and stays low then the scavenger thread and 17 the GC will eventually reach a kind of consensus: the GC will set 18 the watermark low because of low heap usage, and the scavenger thread 19 will steadily eliminate pages from the free page pool, until the size 20 of the free pool is below the high watermark. 21 22 On command-line, this is neutral on SunSpider and Kraken and a 3% win 23 on V8. In browser, this is a 1% win on V8 and neutral on the other 24 two. 25 26 * heap/Heap.cpp: 27 (JSC::Heap::allocateSlowCase): 28 (JSC::Heap::allocateBlock): 29 * heap/Heap.h: 30 1 31 2011-08-02 Jeff Miller <jeffm@apple.com> 2 32 -
trunk/Source/JavaScriptCore/heap/Heap.cpp
r92084 r92217 405 405 return result; 406 406 407 if (m_newSpace.waterMark() < m_newSpace.highWaterMark() || !m_isSafeToCollect) { 408 m_newSpace.addBlock(sizeClass, allocateBlock(sizeClass.cellSize)); 407 AllocationEffort allocationEffort; 408 409 if (m_newSpace.waterMark() < m_newSpace.highWaterMark() || !m_isSafeToCollect) 410 allocationEffort = AllocationMustSucceed; 411 else 412 allocationEffort = AllocationCanFail; 413 414 MarkedBlock* block = allocateBlock(sizeClass.cellSize, allocationEffort); 415 if (block) { 416 m_newSpace.addBlock(sizeClass, block); 409 417 void* result = tryAllocate(sizeClass); 410 418 ASSERT(result); … … 421 429 ASSERT(m_newSpace.waterMark() < m_newSpace.highWaterMark()); 422 430 423 m_newSpace.addBlock(sizeClass, allocateBlock(sizeClass.cellSize ));431 m_newSpace.addBlock(sizeClass, allocateBlock(sizeClass.cellSize, AllocationMustSucceed)); 424 432 425 433 result = tryAllocate(sizeClass); … … 695 703 } 696 704 697 MarkedBlock* Heap::allocateBlock(size_t cellSize )705 MarkedBlock* Heap::allocateBlock(size_t cellSize, Heap::AllocationEffort allocationEffort) 698 706 { 699 707 MarkedBlock* block; 700 708 701 709 #if !ENABLE(LAZY_BLOCK_FREEING) 710 if (allocationEffort == AllocationCanFail) 711 return 0; 712 702 713 block = MarkedBlock::create(this, cellSize); 703 714 #else … … 713 724 if (block) 714 725 block->initForCellSize(cellSize); 726 else if (allocationEffort == AllocationCanFail) 727 return 0; 715 728 else 716 729 block = MarkedBlock::create(this, cellSize); -
trunk/Source/JavaScriptCore/heap/Heap.h
r92084 r92217 125 125 static const size_t minExtraCost = 256; 126 126 static const size_t maxExtraCost = 1024 * 1024; 127 128 enum AllocationEffort { AllocationMustSucceed, AllocationCanFail }; 127 129 128 130 bool isValidAllocation(size_t); … … 131 133 void resetAllocator(); 132 134 133 MarkedBlock* allocateBlock(size_t cellSize );135 MarkedBlock* allocateBlock(size_t cellSize, AllocationEffort); 134 136 void freeBlocks(MarkedBlock*); 135 137
Note: See TracChangeset
for help on using the changeset viewer.