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

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

Issue 1352453004: Perform scavenge in idle tasks. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years, 3 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 | « src/heap/gc-idle-time-handler.h ('k') | src/heap/heap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f836a062849319c9ee9e1759774fbab087994e04..f77c015bf5bef1530e062e91b8f74dd280905b07 100644
--- a/src/heap/gc-idle-time-handler.cc
+++ b/src/heap/gc-idle-time-handler.cc
@@ -32,9 +32,6 @@ void GCIdleTimeAction::Print() {
PrintF("; finalized marking");
}
break;
- case DO_SCAVENGE:
- PrintF("scavenge");
- break;
case DO_FULL_GC:
PrintF("full GC");
break;
@@ -53,11 +50,6 @@ void GCIdleTimeHeapState::Print() {
mark_compact_speed_in_bytes_per_ms);
PrintF("incremental_marking_speed=%" V8_PTR_PREFIX "d ",
incremental_marking_speed_in_bytes_per_ms);
- PrintF("scavenge_speed=%" V8_PTR_PREFIX "d ", scavenge_speed_in_bytes_per_ms);
- PrintF("new_space_size=%" V8_PTR_PREFIX "d ", used_new_space_size);
- PrintF("new_space_capacity=%" V8_PTR_PREFIX "d ", new_space_capacity);
- PrintF("new_space_allocation_throughput=%" V8_PTR_PREFIX "d ",
- new_space_allocation_throughput_in_bytes_per_ms);
}
@@ -107,79 +99,6 @@ size_t GCIdleTimeHandler::EstimateFinalIncrementalMarkCompactTime(
}
-bool GCIdleTimeHandler::ShouldDoScavenge(
- size_t idle_time_in_ms, size_t new_space_size, size_t used_new_space_size,
- size_t scavenge_speed_in_bytes_per_ms,
- size_t new_space_allocation_throughput_in_bytes_per_ms) {
- if (idle_time_in_ms >= kMinBackgroundIdleTime) {
- // It is better to do full GC for the background tab.
- return false;
- }
-
- // Calculates how much memory are we able to scavenge in
- // kMaxFrameRenderingIdleTime ms. If scavenge_speed_in_bytes_per_ms is 0 we
- // will take care of this later.
- size_t idle_new_space_allocation_limit =
- kMaxFrameRenderingIdleTime * scavenge_speed_in_bytes_per_ms;
-
- // If the limit is larger than the new space size, then scavenging used to be
- // really fast. We can take advantage of the whole new space.
- if (idle_new_space_allocation_limit > new_space_size) {
- idle_new_space_allocation_limit = new_space_size;
- }
-
- // We do not know the allocation throughput before the first scavenge.
- // TODO(hpayer): Estimate allocation throughput before the first scavenge.
- if (new_space_allocation_throughput_in_bytes_per_ms > 0) {
- // We have to trigger scavenge before we reach the end of new space.
- size_t adjust_limit = new_space_allocation_throughput_in_bytes_per_ms *
- kTimeUntilNextIdleEvent;
- if (adjust_limit > idle_new_space_allocation_limit) {
- idle_new_space_allocation_limit = 0;
- } else {
- idle_new_space_allocation_limit -= adjust_limit;
- }
- }
-
- // The allocated new space limit to trigger a scavange has to be at least
- // kMinimumNewSpaceSizeToPerformScavenge.
- if (idle_new_space_allocation_limit < kMinimumNewSpaceSizeToPerformScavenge) {
- idle_new_space_allocation_limit = kMinimumNewSpaceSizeToPerformScavenge;
- }
-
- // Set an initial scavenge speed if it is unknown.
- if (scavenge_speed_in_bytes_per_ms == 0) {
- scavenge_speed_in_bytes_per_ms = kInitialConservativeScavengeSpeed;
- }
-
- // We apply a max factor to the new space size to make sure that a slowly
- // allocating application still leaves enough of wiggle room to schedule a
- // scavenge.
- size_t max_limit;
- const double kMaxNewSpaceSizeFactorLongIdleTimes = 0.5;
- const double kMaxNewSpaceSizeFactorShortIdleTimes = 0.8;
- if (idle_time_in_ms > kMaxFrameRenderingIdleTime) {
- max_limit = static_cast<size_t>(new_space_size *
- kMaxNewSpaceSizeFactorLongIdleTimes);
- } else {
- max_limit = static_cast<size_t>(new_space_size *
- kMaxNewSpaceSizeFactorShortIdleTimes);
- }
- idle_new_space_allocation_limit =
- Min(idle_new_space_allocation_limit, max_limit);
-
- // We perform a scavenge if we are over the idle new space limit and
- // a scavenge fits into the given idle time bucket.
- if (idle_new_space_allocation_limit <= used_new_space_size) {
- if (used_new_space_size / scavenge_speed_in_bytes_per_ms <=
- idle_time_in_ms) {
- return true;
- }
- }
- return false;
-}
-
-
bool GCIdleTimeHandler::ShouldDoMarkCompact(
size_t idle_time_in_ms, size_t size_of_objects,
size_t mark_compact_speed_in_bytes_per_ms) {
@@ -259,14 +178,6 @@ GCIdleTimeAction GCIdleTimeHandler::Compute(double idle_time_in_ms,
return NothingOrDone(idle_time_in_ms);
}
- if (ShouldDoScavenge(
- static_cast<size_t>(idle_time_in_ms), heap_state.new_space_capacity,
- heap_state.used_new_space_size,
- heap_state.scavenge_speed_in_bytes_per_ms,
- heap_state.new_space_allocation_throughput_in_bytes_per_ms)) {
- return GCIdleTimeAction::Scavenge();
- }
-
if (!FLAG_incremental_marking || heap_state.incremental_marking_stopped) {
return GCIdleTimeAction::Done();
}
« no previous file with comments | « src/heap/gc-idle-time-handler.h ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698