Chromium Code Reviews| Index: src/heap.cc |
| diff --git a/src/heap.cc b/src/heap.cc |
| index 522861deda05e2a163861ac527be202631387441..945587f92fb4e63b301d846c4f2e648796c08ca7 100644 |
| --- a/src/heap.cc |
| +++ b/src/heap.cc |
| @@ -140,6 +140,7 @@ Heap::Heap() |
| store_buffer_(this), |
| marking_(this), |
| incremental_marking_(this), |
| + idle_work_(IDLE_INCREMENTAL_MARKING), |
| number_idle_notifications_(0), |
| last_idle_notification_gc_count_(0), |
| last_idle_notification_gc_count_init_(false), |
| @@ -4515,6 +4516,36 @@ void Heap::EnsureHeapIsIterable() { |
| bool Heap::IdleNotification() { |
| + switch (idle_work_) { |
| + case IDLE_INCREMENTAL_MARKING: |
| + if (IdleIncrementalMarking()) { |
| + idle_work_ = IDLE_GLOBAL_GC; |
| + } |
| + break; |
| + case IDLE_GLOBAL_GC: |
| + if (IdleGlobalGC()) { |
| + idle_work_ = IDLE_INCREMENTAL_MARKING; |
| + return true; |
| + } |
| + break; |
| + default: |
| + UNREACHABLE(); |
| + } |
| + return false; |
| +} |
| + |
| +bool Heap::IdleIncrementalMarking() { |
| + if (incremental_marking()->IsStopped()) { |
| + if (!incremental_marking()->WorthActivating()) { |
| + return true; |
| + } |
| + incremental_marking()->Start(); |
| + } |
| + incremental_marking()->Step(IncrementalMarking::kStepFakeAllocatedBytes); |
| + return incremental_marking()->IsComplete(); |
|
Vyacheslav Egorov (Chromium)
2011/10/12 07:41:00
when it's complete it makes sense to do a finishin
|
| +} |
| + |
| +bool Heap::IdleGlobalGC() { |
| static const int kIdlesBeforeScavenge = 4; |
| static const int kIdlesBeforeMarkSweep = 7; |
| static const int kIdlesBeforeMarkCompact = 8; |