Chromium Code Reviews| Index: src/heap/heap.cc |
| diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
| index 2ac5146c46d0cf06c6f00f2bbea878a0015db66b..11700db88ea74a0eabb756f27f1cfb4d0e6dcadd 100644 |
| --- a/src/heap/heap.cc |
| +++ b/src/heap/heap.cc |
| @@ -54,6 +54,7 @@ |
| namespace v8 { |
| namespace internal { |
| +static const intptr_t kDefaultMaxOldGenSize = 700ul * (kPointerSize / 4) * MB; |
|
Hannes Payer (out of office)
2015/03/25 14:30:06
Please define the constant next to the other heap
Erik Corry Chromium.org
2015/03/25 15:16:06
Done.
|
| Heap::Heap() |
| : amount_of_external_allocated_memory_(0), |
| @@ -66,7 +67,7 @@ Heap::Heap() |
| max_semi_space_size_(8 * (kPointerSize / 4) * MB), |
| initial_semispace_size_(Page::kPageSize), |
| target_semispace_size_(Page::kPageSize), |
| - max_old_generation_size_(700ul * (kPointerSize / 4) * MB), |
| + max_old_generation_size_(kDefaultMaxOldGenSize), |
| initial_old_generation_size_(max_old_generation_size_ / |
| kInitalOldGenerationLimitFactor), |
| old_generation_size_configured_(false), |
| @@ -103,6 +104,7 @@ Heap::Heap() |
| allocation_timeout_(0), |
| #endif // DEBUG |
| old_generation_allocation_limit_(initial_old_generation_size_), |
| + old_generation_committed_memory_limit_(kDefaultMaxOldGenSize >> 1), |
|
Hannes Payer (out of office)
2015/03/25 14:30:06
why not set it to initial_old_generation_size_?
Erik Corry Chromium.org
2015/03/25 15:16:06
This is "halfway from here to the limit", which is
|
| old_gen_exhausted_(false), |
| inline_allocation_disabled_(false), |
| store_buffer_rebuilder_(store_buffer()), |
| @@ -860,7 +862,7 @@ bool Heap::CollectGarbage(GarbageCollector collector, const char* gc_reason, |
| } |
| if (collector == MARK_COMPACTOR && |
| - !mark_compact_collector()->abort_incremental_marking() && |
| + !mark_compact_collector()->incremental_marking_abort_requested() && |
| !incremental_marking()->IsStopped() && |
| !incremental_marking()->should_hurry() && |
| FLAG_incremental_marking_steps) { |
| @@ -903,8 +905,9 @@ bool Heap::CollectGarbage(GarbageCollector collector, const char* gc_reason, |
| // Start incremental marking for the next cycle. The heap snapshot |
| // generator needs incremental marking to stay off after it aborted. |
| - if (!mark_compact_collector()->abort_incremental_marking() && |
| - WorthActivatingIncrementalMarking()) { |
| + if (!mark_compact_collector()->incremental_marking_abort_requested() && |
| + incremental_marking()->IsStopped() && |
| + incremental_marking()->ShouldActivate()) { |
| incremental_marking()->Start(); |
| } |
| @@ -1161,8 +1164,7 @@ bool Heap::PerformGarbageCollection( |
| // Temporarily set the limit for case when PostGarbageCollectionProcessing |
| // allocates and triggers GC. The real limit is set at after |
| // PostGarbageCollectionProcessing. |
| - old_generation_allocation_limit_ = |
| - OldGenerationAllocationLimit(PromotedSpaceSizeOfObjects(), 0); |
| + SetOldGenerationAllocationLimit(PromotedSpaceSizeOfObjects(), 0); |
| old_gen_exhausted_ = false; |
| old_generation_size_configured_ = true; |
| } else { |
| @@ -1196,8 +1198,8 @@ bool Heap::PerformGarbageCollection( |
| // Register the amount of external allocated memory. |
| amount_of_external_allocated_memory_at_last_global_gc_ = |
| amount_of_external_allocated_memory_; |
| - old_generation_allocation_limit_ = OldGenerationAllocationLimit( |
| - PromotedSpaceSizeOfObjects(), freed_global_handles); |
| + SetOldGenerationAllocationLimit(PromotedSpaceSizeOfObjects(), |
| + freed_global_handles); |
| // We finished a marking cycle. We can uncommit the marking deque until |
| // we start marking again. |
| mark_compact_collector_.UncommitMarkingDeque(); |
| @@ -4574,12 +4576,6 @@ bool Heap::TryFinalizeIdleIncrementalMarking( |
| } |
| -bool Heap::WorthActivatingIncrementalMarking() { |
| - return incremental_marking()->IsStopped() && |
| - incremental_marking()->WorthActivating() && NextGCIsLikelyToBeFull(); |
| -} |
| - |
| - |
| static double MonotonicallyIncreasingTimeInMs() { |
| return V8::GetCurrentPlatform()->MonotonicallyIncreasingTime() * |
| static_cast<double>(base::Time::kMillisecondsPerSecond); |
| @@ -5231,8 +5227,8 @@ int64_t Heap::PromotedExternalMemorySize() { |
| } |
| -intptr_t Heap::OldGenerationAllocationLimit(intptr_t old_gen_size, |
| - int freed_global_handles) { |
| +void Heap::SetOldGenerationAllocationLimit(intptr_t old_gen_size, |
| + int freed_global_handles) { |
| const int kMaxHandles = 1000; |
| const int kMinHandles = 100; |
| double min_factor = 1.1; |
| @@ -5266,9 +5262,16 @@ intptr_t Heap::OldGenerationAllocationLimit(intptr_t old_gen_size, |
| intptr_t limit = static_cast<intptr_t>(old_gen_size * factor); |
| limit = Max(limit, kMinimumOldGenerationAllocationLimit); |
| - limit += new_space_.Capacity(); |
| - intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2; |
| - return Min(limit, halfway_to_the_max); |
| + |
| + old_generation_allocation_limit_ = limit + new_space_.Capacity(); |
| + old_generation_committed_memory_limit_ = |
| + CommittedOldGenerationMemory() / 2 + max_old_generation_size_ / 2; |
| + |
| + if (FLAG_trace_gc) { |
|
Hannes Payer (out of office)
2015/03/25 14:30:05
We may want to print that behind a different flag
Erik Corry Chromium.org
2015/03/25 15:16:06
I'd like to keep this one, but I put the other one
|
| + PrintF("Next GC at %.1f (%.1f) -> %.1f (%.1f)\n", old_gen_size * 1.0 / MB, |
| + CommittedOldGenerationMemory() * 1.0 / MB, limit * 1.0 / MB, |
| + old_generation_committed_memory_limit_ * 1.0 / MB); |
| + } |
| } |