Chromium Code Reviews| Index: src/heap.cc |
| diff --git a/src/heap.cc b/src/heap.cc |
| index 6295788f0af9a2f4d1e772143ff684362b568d75..20e37034988236b9e748109a51756149f10a166d 100644 |
| --- a/src/heap.cc |
| +++ b/src/heap.cc |
| @@ -688,12 +688,18 @@ void Heap::UpdateSurvivalRateTrend(int start_new_space_size) { |
| (static_cast<double>(young_survivors_after_last_gc_) * 100) / |
| start_new_space_size; |
| - if (survival_rate > kYoungSurvivalRateThreshold) { |
| + if (survival_rate > kYoungSurvivalRateHighThreshold) { |
| high_survival_rate_period_length_++; |
| } else { |
| high_survival_rate_period_length_ = 0; |
| } |
| + if (survival_rate < kYoungSurvivalRateLowThreshold) { |
| + low_survival_rate_period_length_++; |
| + } else { |
| + low_survival_rate_period_length_ = 0; |
| + } |
| + |
| double survival_rate_diff = survival_rate_ - survival_rate; |
| if (survival_rate_diff > kYoungSurvivalRateAllowedDeviation) { |
| @@ -753,32 +759,6 @@ bool Heap::PerformGarbageCollection(GarbageCollector collector, |
| UpdateSurvivalRateTrend(start_new_space_size); |
| - if (!new_space_high_promotion_mode_active_ && |
| - new_space_.Capacity() == new_space_.MaximumCapacity() && |
| - IsStableOrIncreasingSurvivalTrend() && |
| - IsHighSurvivalRate()) { |
| - // Stable high survival rates even though young generation is at |
| - // maximum capacity indicates that most objects will be promoted. |
| - // To decrease scavenger pauses and final mark-sweep pauses, we |
| - // have to limit maximal capacity of the young generation. |
| - new_space_high_promotion_mode_active_ = true; |
| - if (FLAG_trace_gc) { |
| - PrintF("Limited new space size due to high promotion rate: %d MB\n", |
| - new_space_.InitialCapacity() / MB); |
| - } |
| - } else if (new_space_high_promotion_mode_active_ && |
| - IsDecreasingSurvivalTrend() && |
| - !IsHighSurvivalRate()) { |
| - // Decreasing low survival rates might indicate that the above high |
| - // promotion mode is over and we should allow the young generation |
| - // to grow again. |
| - new_space_high_promotion_mode_active_ = false; |
| - if (FLAG_trace_gc) { |
| - PrintF("Unlimited new space size due to low promotion rate: %d MB\n", |
| - new_space_.MaximumCapacity() / MB); |
| - } |
| - } |
| - |
| size_of_old_gen_at_last_old_space_gc_ = PromotedSpaceSize(); |
| if (high_survival_rate_during_scavenges && |
| @@ -808,6 +788,32 @@ bool Heap::PerformGarbageCollection(GarbageCollector collector, |
| UpdateSurvivalRateTrend(start_new_space_size); |
| } |
| + if (!new_space_high_promotion_mode_active_ && |
| + new_space_.Capacity() == new_space_.MaximumCapacity() && |
| + IsStableOrIncreasingSurvivalTrend() && |
| + IsHighSurvivalRate()) { |
| + // Stable high survival rates even though young generation is at |
| + // maximum capacity indicates that most objects will be promoted. |
| + // To decrease scavenger pauses and final mark-sweep pauses, we |
| + // have to limit maximal capacity of the young generation. |
| + new_space_high_promotion_mode_active_ = true; |
| + if (FLAG_trace_gc) { |
| + PrintF("Limited new space size due to high promotion rate: %d MB\n", |
| + new_space_.InitialCapacity() / MB); |
| + } |
| + } else if (new_space_high_promotion_mode_active_ && |
| + IsStableOrDecreasingSurvivalTrend() && |
| + IsLowSurvivalRate()) { |
| + // Decreasing low survival rates might indicate that the above high |
| + // promotion mode is over and we should allow the young generation |
| + // to grow again. |
| + new_space_high_promotion_mode_active_ = false; |
| + if (FLAG_trace_gc) { |
| + PrintF("Unlimited new space size due to low promotion rate: %d MB\n", |
| + new_space_.MaximumCapacity() / MB); |
| + } |
| + } |
| + |
| if (new_space_high_promotion_mode_active_ && |
| new_space_.Capacity() > new_space_.InitialCapacity()) { |
| new_space_.Shrink(); |
| @@ -5404,12 +5410,12 @@ void Heap::RecordStats(HeapStats* stats, bool take_snapshot) { |
| intptr_t Heap::PromotedSpaceSize() { |
|
Vyacheslav Egorov (Chromium)
2012/01/16 12:36:11
Size->SizeOfObjects for consistency.
Michael Starzinger
2012/01/17 11:56:26
Done. Other NewGC heuristics are tuned for the ori
|
| - return old_pointer_space_->Size() |
| - + old_data_space_->Size() |
| - + code_space_->Size() |
| - + map_space_->Size() |
| - + cell_space_->Size() |
| - + lo_space_->Size(); |
| + return old_pointer_space_->SizeOfObjects() |
| + + old_data_space_->SizeOfObjects() |
| + + code_space_->SizeOfObjects() |
| + + map_space_->SizeOfObjects() |
| + + cell_space_->SizeOfObjects() |
| + + lo_space_->SizeOfObjects(); |
| } |