Chromium Code Reviews| Index: src/heap.cc |
| =================================================================== |
| --- src/heap.cc (revision 2150) |
| +++ src/heap.cc (working copy) |
| @@ -79,9 +79,9 @@ |
| // semispace_size_ should be a power of 2 and old_generation_size_ should be |
| // a multiple of Page::kPageSize. |
| -int Heap::semispace_size_ = 2*MB; |
| +int Heap::semispace_size_ = 8*MB; |
| int Heap::old_generation_size_ = 512*MB; |
| -int Heap::initial_semispace_size_ = 256*KB; |
| +int Heap::initial_semispace_size_ = 512*KB; |
| GCCallback Heap::global_gc_prologue_callback_ = NULL; |
| GCCallback Heap::global_gc_epilogue_callback_ = NULL; |
| @@ -90,9 +90,8 @@ |
| // ConfigureHeap. |
| int Heap::young_generation_size_ = 0; // Will be 2 * semispace_size_. |
| -// Double the new space after this many scavenge collections. |
| -int Heap::new_space_growth_limit_ = 8; |
| -int Heap::scavenge_count_ = 0; |
| +int Heap::survived_since_last_expansion_ = 0; |
| + |
| Heap::HeapState Heap::gc_state_ = NOT_IN_GC; |
| int Heap::mc_count_ = 0; |
| @@ -421,7 +420,7 @@ |
| old_gen_promotion_limit_ = |
| old_gen_size + Max(kMinimumPromotionLimit, old_gen_size / 3); |
| old_gen_allocation_limit_ = |
| - old_gen_size + Max(kMinimumAllocationLimit, old_gen_size / 3); |
| + old_gen_size + Max(kMinimumAllocationLimit, old_gen_size / 2); |
| old_gen_exhausted_ = false; |
| // If we have used the mark-compact collector to collect the new |
| @@ -624,16 +623,17 @@ |
| // Implements Cheney's copying algorithm |
| LOG(ResourceEvent("scavenge", "begin")); |
| - scavenge_count_++; |
| + // Used for updating survived_since_last_expansion_ at function end. |
| + int survived_watermark = PromotedSpaceSize(); |
| + |
| if (new_space_.Capacity() < new_space_.MaximumCapacity() && |
| - scavenge_count_ > new_space_growth_limit_) { |
| - // Double the size of the new space, and double the limit. The next |
| - // doubling attempt will occur after the current new_space_growth_limit_ |
| - // more collections. |
| + survived_since_last_expansion_ > new_space_.Capacity()) { |
| + // Double the size of new space if there is room to grow and enough |
| + // data has survived scavenge since the last expansion. |
| // TODO(1240712): NewSpace::Double has a return value which is |
| // ignored here. |
| new_space_.Double(); |
| - new_space_growth_limit_ *= 2; |
| + survived_since_last_expansion_ = 0; |
| } |
| // Flip the semispaces. After flipping, to space is empty, from space has |
| @@ -737,6 +737,10 @@ |
| // Set age mark. |
| new_space_.set_age_mark(new_space_.top()); |
| + // Update how much has survivived scavenge. |
|
Kasper Lund
2009/06/12 11:04:45
survivived -> survived
|
| + survived_since_last_expansion_ += |
| + PromotedSpaceSize() + new_space_.Size() - survived_watermark; |
|
Kasper Lund
2009/06/12 11:04:45
Maybe reorder these to make it (crystal) clear tha
|
| + |
| LOG(ResourceEvent("scavenge", "end")); |
| gc_state_ = NOT_IN_GC; |