 Chromium Code Reviews
 Chromium Code Reviews Issue 8519002:
  Start incremental marking on idle notification.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
    
  
    Issue 8519002:
  Start incremental marking on idle notification.  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge| Index: src/heap.h | 
| diff --git a/src/heap.h b/src/heap.h | 
| index f488b8cda276316df11e6df8b3e645a533c8b111..3ed717c4aa435f894b9ac4bbdf5f3735a42e0c79 100644 | 
| --- a/src/heap.h | 
| +++ b/src/heap.h | 
| @@ -1427,6 +1427,10 @@ class Heap { | 
| // The roots that have an index less than this are always in old space. | 
| static const int kOldSpaceRoots = 0x20; | 
| + bool idle_notification_will_schedule_next_gc() { | 
| + return idle_notification_will_schedule_next_gc_; | 
| + } | 
| + | 
| private: | 
| Heap(); | 
| @@ -1752,6 +1756,23 @@ class Heap { | 
| void SelectScavengingVisitorsTable(); | 
| + bool WorthStartingGCWhenIdle() { | 
| + if (contexts_disposed_ > 0) { | 
| + return true; | 
| + } | 
| + if (number_idle_notifications_ < kMaxIdleCount) { | 
| + return incremental_marking()->WorthActivating(); | 
| + } | 
| + if (gc_count_ - last_idle_notification_gc_count_ > kGCsBetweenCleanup) { | 
| + return incremental_marking()->WorthActivating() && | 
| + NextGCIsLikelyToBeFull(); | 
| + } | 
| + return false; | 
| + } | 
| + | 
| + // Returns true if no more GC work is left. | 
| + bool IdleGlobalGC(); | 
| + | 
| static const int kInitialSymbolTableSize = 2048; | 
| static const int kInitialEvalCacheSize = 64; | 
| @@ -1777,9 +1798,18 @@ class Heap { | 
| IncrementalMarking incremental_marking_; | 
| + static const int kIdlesBeforeScavenge = 4; | 
| + static const int kIdlesBeforeMarkSweep = 7; | 
| + static const int kIdlesBeforeMarkCompact = 8; | 
| + static const int kMaxIdleCount = kIdlesBeforeMarkCompact + 1; | 
| 
Erik Corry
2011/11/10 15:06:55
The name kMaxIdleCount no longer makes much sense.
 
ulan
2011/11/11 13:27:26
Now I don't use this constant in the new IdleNotif
 | 
| + static const unsigned int kGCsBetweenCleanup = 4; | 
| 
Erik Corry
2011/11/10 15:06:55
I suggest kScavengesBeforeFullGC for this one.
 
ulan
2011/11/11 13:27:26
Ditto.
 | 
| + | 
| int number_idle_notifications_; | 
| unsigned int last_idle_notification_gc_count_; | 
| bool last_idle_notification_gc_count_init_; | 
| + bool idle_notification_will_schedule_next_gc_; | 
| + double last_idle_notification_timestamp_; | 
| + | 
| // Shared state read by the scavenge collector and set by ScavengeObject. | 
| PromotionQueue promotion_queue_; |