Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(485)

Unified Diff: src/heap/gc-idle-time-handler.h

Issue 1042483002: Ensure that GC idle notifications either make progress or stop requesting more GCs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: size_t -> int Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/heap/gc-idle-time-handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7b4da94611b18e5349b0c17b49c5145bc44c4d13..f953c87b3b81049345b2f23e15b451eb694c844d 100644
--- a/src/heap/gc-idle-time-handler.h
+++ b/src/heap/gc-idle-time-handler.h
@@ -138,6 +138,11 @@ class GCIdleTimeHandler {
static const size_t kMinTimeForOverApproximatingWeakClosureInMs;
+ // Number of times we will return a Nothing action per Idle round 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 kMaxNoProgressIdleTimesPerIdleRound = 10;
+
class HeapState {
public:
void Print();
@@ -160,7 +165,8 @@ class GCIdleTimeHandler {
GCIdleTimeHandler()
: mark_compacts_since_idle_round_started_(0),
- scavenges_since_last_idle_round_(0) {}
+ scavenges_since_last_idle_round_(0),
+ idle_times_which_made_no_progress_since_last_idle_round_(0) {}
GCIdleTimeAction Compute(double idle_time_in_ms, HeapState heap_state);
@@ -204,7 +210,12 @@ class GCIdleTimeHandler {
size_t new_space_allocation_throughput_in_bytes_per_ms);
private:
- void StartIdleRound() { mark_compacts_since_idle_round_started_ = 0; }
+ GCIdleTimeAction NothingOrDone();
+
+ void StartIdleRound() {
+ mark_compacts_since_idle_round_started_ = 0;
+ idle_times_which_made_no_progress_since_last_idle_round_ = 0;
+ }
bool IsMarkCompactIdleRoundFinished() {
return mark_compacts_since_idle_round_started_ ==
kMaxMarkCompactsInIdleRound;
@@ -215,6 +226,7 @@ class GCIdleTimeHandler {
int mark_compacts_since_idle_round_started_;
int scavenges_since_last_idle_round_;
+ int idle_times_which_made_no_progress_since_last_idle_round_;
DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler);
};
« no previous file with comments | « no previous file | src/heap/gc-idle-time-handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698