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

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

Issue 573943004: Use allocation throughput to estimate next scavenge event in idle notification. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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/gc-idle-time-handler-unittest.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.cc
diff --git a/src/heap/gc-idle-time-handler.cc b/src/heap/gc-idle-time-handler.cc
index 068ff3364ab701fe1f83139570c9345648c1611b..8cce929b399d41a564a7d4a65d12504565198a1c 100644
--- a/src/heap/gc-idle-time-handler.cc
+++ b/src/heap/gc-idle-time-handler.cc
@@ -80,6 +80,18 @@ size_t GCIdleTimeHandler::EstimateScavengeTime(
}
+bool GCIdleTimeHandler::ScavangeMayHappenSoon(
+ size_t available_new_space_memory,
+ size_t new_space_allocation_throughput_in_bytes_per_ms) {
+ if (available_new_space_memory <=
+ new_space_allocation_throughput_in_bytes_per_ms *
+ kMaxFrameRenderingIdleTime) {
+ return true;
+ }
+ return false;
+}
+
+
// The following logic is implemented by the controller:
// (1) If the new space is almost full and we can effort a Scavenge, then a
// Scavenge is performed.
@@ -98,7 +110,9 @@ size_t GCIdleTimeHandler::EstimateScavengeTime(
// that this currently may trigger a full garbage collection.
GCIdleTimeAction GCIdleTimeHandler::Compute(size_t idle_time_in_ms,
HeapState heap_state) {
- if (heap_state.available_new_space_memory < kNewSpaceAlmostFullTreshold &&
+ if (ScavangeMayHappenSoon(
+ heap_state.available_new_space_memory,
+ heap_state.new_space_allocation_throughput_in_bytes_per_ms) &&
idle_time_in_ms >=
EstimateScavengeTime(heap_state.new_space_capacity,
heap_state.scavenge_speed_in_bytes_per_ms)) {
« no previous file with comments | « src/heap/gc-idle-time-handler.h ('k') | src/heap/gc-idle-time-handler-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698