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

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

Issue 1023153002: Limit rate of full garbage collections triggered by idle notification. Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
Index: src/heap/gc-idle-time-handler.cc
diff --git a/src/heap/gc-idle-time-handler.cc b/src/heap/gc-idle-time-handler.cc
index c74b46ea9b6d126b0770df551a830593198d63ef..8b8f306b7ffbd6d84167872562670b222e6f45e0 100644
--- a/src/heap/gc-idle-time-handler.cc
+++ b/src/heap/gc-idle-time-handler.cc
@@ -17,6 +17,7 @@ const int GCIdleTimeHandler::kMaxMarkCompactsInIdleRound = 7;
const int GCIdleTimeHandler::kIdleScavengeThreshold = 5;
const double GCIdleTimeHandler::kHighContextDisposalRate = 100;
const size_t GCIdleTimeHandler::kMinTimeForOverApproximatingWeakClosureInMs = 1;
+const double GCIdleTimeHandler::kMinMillisecondsInBetweenMarkCompact = 1000;
void GCIdleTimeAction::Print() {
@@ -152,10 +153,15 @@ bool GCIdleTimeHandler::ShouldDoScavenge(
bool GCIdleTimeHandler::ShouldDoMarkCompact(
size_t idle_time_in_ms, size_t size_of_objects,
- size_t mark_compact_speed_in_bytes_per_ms) {
- return idle_time_in_ms >=
- EstimateMarkCompactTime(size_of_objects,
- mark_compact_speed_in_bytes_per_ms);
+ size_t mark_compact_speed_in_bytes_per_ms, double last_mark_compact_time,
+ double current_time) {
+ bool mark_compact_rate_high =
+ current_time <
+ last_mark_compact_time + kMinMillisecondsInBetweenMarkCompact;
jochen (gone - plz use gerrit) 2015/03/20 12:41:52 you're adding seconds + milliseconds here as far a
Hannes Payer (out of office) 2015/03/20 14:20:39 yeah, found it when I run the experiment. already
+ return !mark_compact_rate_high &&
+ idle_time_in_ms >=
+ EstimateMarkCompactTime(size_of_objects,
+ mark_compact_speed_in_bytes_per_ms);
}
@@ -204,6 +210,7 @@ GCIdleTimeAction GCIdleTimeHandler::Compute(double idle_time_in_ms,
HeapState heap_state) {
if (static_cast<int>(idle_time_in_ms) <= 0) {
if (heap_state.contexts_disposed > 0) {
+ printf("start idle round, contexts disposed\n");
jochen (gone - plz use gerrit) 2015/03/20 12:41:52 debug code?
Hannes Payer (out of office) 2015/03/20 14:20:39 Done.
StartIdleRound();
}
if (heap_state.incremental_marking_stopped) {
@@ -226,6 +233,7 @@ GCIdleTimeAction GCIdleTimeHandler::Compute(double idle_time_in_ms,
if (IsMarkCompactIdleRoundFinished()) {
if (EnoughGarbageSinceLastIdleRound()) {
+ printf("start idle round, enough garbage\n");
StartIdleRound();
} else {
return GCIdleTimeAction::Done();
@@ -233,9 +241,10 @@ GCIdleTimeAction GCIdleTimeHandler::Compute(double idle_time_in_ms,
}
if (heap_state.incremental_marking_stopped) {
- if (ShouldDoMarkCompact(static_cast<size_t>(idle_time_in_ms),
- heap_state.size_of_objects,
- heap_state.mark_compact_speed_in_bytes_per_ms)) {
+ if (ShouldDoMarkCompact(
+ static_cast<size_t>(idle_time_in_ms), heap_state.size_of_objects,
+ heap_state.mark_compact_speed_in_bytes_per_ms,
+ heap_state.last_mark_compact_time, heap_state.current_time)) {
// If there are no more than two GCs left in this idle round and we are
// allowed to do a full GC, then make those GCs full in order to compact
// the code space.

Powered by Google App Engine
This is Rietveld 408576698