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

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

Issue 492763002: Move idle notification handling to GCIdleTimeHandler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Undo more changes Created 6 years, 4 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') | src/heap/gc-idle-time-handler.cc » ('J')
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 cf43b9b0700c0340d855616f0cd8be3ef6b0cf3a..77443d891f30e102fa292c5169b06c004d7b8784 100644
--- a/src/heap/gc-idle-time-handler.h
+++ b/src/heap/gc-idle-time-handler.h
@@ -10,13 +10,50 @@
namespace v8 {
namespace internal {
+enum GCIdleTimeActionType {
+ DO_NOTHING,
+ DO_INCREMENTAL_MARKING,
+ DO_SCAVENGE,
+ DO_FULL_GC
+};
+
+
+struct GCIdleTimeAction {
Hannes Payer (out of office) 2014/08/20 18:24:11 According to the style guide, this should be a cla
ulan 2014/08/21 08:45:19 Done.
+ static GCIdleTimeAction Nothing() {
+ GCIdleTimeAction result;
+ result.type = DO_NOTHING;
+ result.parameter = 0;
+ return result;
+ }
+ static GCIdleTimeAction IncrementalMarking(intptr_t step_size) {
+ GCIdleTimeAction result;
+ result.type = DO_INCREMENTAL_MARKING;
+ result.parameter = step_size;
+ return result;
+ }
+ static GCIdleTimeAction Scavenge() {
+ GCIdleTimeAction result;
+ result.type = DO_SCAVENGE;
+ result.parameter = 0;
+ return result;
+ }
+ static GCIdleTimeAction FullGC() {
+ GCIdleTimeAction result;
+ result.type = DO_FULL_GC;
+ result.parameter = 0;
+ return result;
+ }
+
+ GCIdleTimeActionType type;
+ intptr_t parameter;
+};
+
+class GCTracer;
+
// The idle time handler makes decisions about which garbage collection
// operations are executing during IdleNotification.
class GCIdleTimeHandler {
public:
- static intptr_t EstimateMarkingStepSize(
- int idle_time_in_ms, intptr_t marking_speed_in_bytes_per_ms);
-
// If we haven't recorded any incremental marking events yet, we carefully
// mark with a conservative lower bound for the marking speed.
static const intptr_t kInitialConservativeMarkingSpeed = 100 * KB;
@@ -25,7 +62,46 @@ class GCIdleTimeHandler {
// idle_time_in_ms. Hence, we conservatively prune our workload estimate.
static const double kConservativeTimeRatio;
+ GCIdleTimeHandler()
+ : mark_sweeps_since_idle_round_started_(0),
+ scavenges_since_last_idle_round_(0) {}
+
+ GCIdleTimeAction Compute(int idle_time_in_ms, int contexts_disposed,
+ intptr_t size_of_objects,
+ bool incremental_marking_stopped,
+ GCTracer* gc_tracer);
+
+ void NotifyIdleFullGC() {
Hannes Payer (out of office) 2014/08/20 18:24:11 In the gc tracer we refer to the event as mark com
ulan 2014/08/21 08:45:19 Done.
+ if (mark_sweeps_since_idle_round_started_ < kMaxMarkSweepsInIdleRound) {
+ ++mark_sweeps_since_idle_round_started_;
+ if (mark_sweeps_since_idle_round_started_ == kMaxMarkSweepsInIdleRound) {
+ scavenges_since_last_idle_round_ = 0;
+ }
+ }
+ }
+
+ void NotifyScavenge() { ++scavenges_since_last_idle_round_; }
+
+ static intptr_t EstimateMarkingStepSize(
+ int idle_time_in_ms, intptr_t mark_sweep_speed_in_bytes_per_ms);
+
+ static int EstimateMarkSweepTime(intptr_t size_of_objects,
+ intptr_t mark_sweep_speed_in_bytes_per_ms);
+
private:
+ void StartIdleRound() { mark_sweeps_since_idle_round_started_ = 0; }
+ bool IsIdleRoundFinished() {
+ return mark_sweeps_since_idle_round_started_ == kMaxMarkSweepsInIdleRound;
+ }
+ bool EnoughGarbageSinceLastIdleRound() {
+ return scavenges_since_last_idle_round_ >= kIdleScavengeThreshold;
+ }
+
+ static const int kMaxMarkSweepsInIdleRound = 7;
Hannes Payer (out of office) 2014/08/20 18:24:11 kMaxMarkSweepsInIdleRound -> kMaxMarkCompactsInIdl
ulan 2014/08/21 08:45:19 Done.
+ static const int kIdleScavengeThreshold = 5;
+ int mark_sweeps_since_idle_round_started_;
Hannes Payer (out of office) 2014/08/20 18:24:11 mark_sweeps_since_idle_round_started_ -> mark_comp
+ int scavenges_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') | src/heap/gc-idle-time-handler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698