| Index: src/heap/gc-idle-time-handler.h
|
| diff --git a/src/heap/gc-idle-time-handler.h b/src/heap/gc-idle-time-handler.h
|
| index e76178b7e676b547dcddf4d4b0e5b0d83f23cde4..efa4869956e3f7c5f7f22a6ad2c05f65de443779 100644
|
| --- a/src/heap/gc-idle-time-handler.h
|
| +++ b/src/heap/gc-idle-time-handler.h
|
| @@ -151,18 +151,24 @@ class GCIdleTimeHandler {
|
| // the kDone mode.
|
| static const int kMaxIdleMarkCompacts = 3;
|
|
|
| - // The number of mutator GCs before transitioning to the kReduceLatency mode.
|
| - static const int kGCsBeforeMutatorIsActive = 7;
|
| + // The number of mutator MarkCompact GCs before transitioning to the
|
| + // kReduceLatency mode.
|
| + static const int kMarkCompactsBeforeMutatorIsActive = 1;
|
|
|
| // Mutator is considered idle if
|
| - // 1) there is an idle notification with time >= kLargeLongIdleTime,
|
| - // 2) or there are kLongIdleNotificationsBeforeMutatorIsIdle idle
|
| - // notifications
|
| - // with time >= kMinLongIdleTime and without any mutator GC in between.
|
| + // 1) there are N idle notification with time >= kMinBackgroundIdleTime,
|
| + // 2) or there are M idle notifications with time >= kMinLongIdleTime
|
| + // without any mutator GC in between.
|
| + // Where N = kBackgroundIdleNotificationsBeforeMutatorIsIdle,
|
| + // M = kLongIdleNotificationsBeforeMutatorIsIdle
|
| static const int kMinLongIdleTime = kMaxFrameRenderingIdleTime + 1;
|
| - static const int kLargeLongIdleTime = 900;
|
| - static const int kLongIdleNotificationsBeforeMutatorIsIdle = 600;
|
| -
|
| + static const int kMinBackgroundIdleTime = 900;
|
| + static const int kBackgroundIdleNotificationsBeforeMutatorIsIdle = 2;
|
| + static const int kLongIdleNotificationsBeforeMutatorIsIdle = 50;
|
| + // Number of times we will return a Nothing action in the current mode
|
| + // despite having idle time available before we returning a Done action to
|
| + // ensure we don't keep scheduling idle tasks and making no progress.
|
| + static const int kMaxNoProgressIdleTimesPerMode = 10;
|
|
|
| class HeapState {
|
| public:
|
| @@ -189,6 +195,8 @@ class GCIdleTimeHandler {
|
| mark_compacts_(0),
|
| scavenges_(0),
|
| long_idle_notifications_(0),
|
| + background_idle_notifications_(0),
|
| + idle_times_which_made_no_progress_per_mode_(0),
|
| mode_(kReduceLatency) {}
|
|
|
| GCIdleTimeAction Compute(double idle_time_in_ms, HeapState heap_state);
|
| @@ -232,19 +240,26 @@ class GCIdleTimeHandler {
|
|
|
| private:
|
| bool IsMutatorActive(int contexts_disposed, int gcs);
|
| - bool IsMutatorIdle(int long_idle_notifications, int gcs);
|
| + bool IsMutatorIdle(int long_idle_notifications,
|
| + int background_idle_notifications, int gcs);
|
| void UpdateCounters(double idle_time_in_ms);
|
| void ResetCounters();
|
| Mode NextMode(const HeapState& heap_state);
|
| GCIdleTimeAction Action(double idle_time_in_ms, const HeapState& heap_state,
|
| bool reduce_memory);
|
| + GCIdleTimeAction NothingOrDone();
|
|
|
| int idle_mark_compacts_;
|
| int mark_compacts_;
|
| int scavenges_;
|
| - // The number of long idle notifications with no mutator GC happening
|
| + // The number of long idle notifications with no GC happening
|
| // between the notifications.
|
| int long_idle_notifications_;
|
| + // The number of background idle notifications with no GC happening
|
| + // between the notifications.
|
| + int background_idle_notifications_;
|
| + // Idle notifications with no progress in the current mode.
|
| + int idle_times_which_made_no_progress_per_mode_;
|
|
|
| Mode mode_;
|
|
|
|
|