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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/heap/gc-idle-time-handler.cc » ('j') | src/heap/gc-idle-time-handler.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_HEAP_GC_IDLE_TIME_HANDLER_H_ 5 #ifndef V8_HEAP_GC_IDLE_TIME_HANDLER_H_
6 #define V8_HEAP_GC_IDLE_TIME_HANDLER_H_ 6 #define V8_HEAP_GC_IDLE_TIME_HANDLER_H_
7 7
8 #include "src/globals.h" 8 #include "src/globals.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 12
13 enum GCIdleTimeActionType {
14 DO_NOTHING,
15 DO_INCREMENTAL_MARKING,
16 DO_SCAVENGE,
17 DO_FULL_GC
18 };
19
20
21 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.
22 static GCIdleTimeAction Nothing() {
23 GCIdleTimeAction result;
24 result.type = DO_NOTHING;
25 result.parameter = 0;
26 return result;
27 }
28 static GCIdleTimeAction IncrementalMarking(intptr_t step_size) {
29 GCIdleTimeAction result;
30 result.type = DO_INCREMENTAL_MARKING;
31 result.parameter = step_size;
32 return result;
33 }
34 static GCIdleTimeAction Scavenge() {
35 GCIdleTimeAction result;
36 result.type = DO_SCAVENGE;
37 result.parameter = 0;
38 return result;
39 }
40 static GCIdleTimeAction FullGC() {
41 GCIdleTimeAction result;
42 result.type = DO_FULL_GC;
43 result.parameter = 0;
44 return result;
45 }
46
47 GCIdleTimeActionType type;
48 intptr_t parameter;
49 };
50
51 class GCTracer;
52
13 // The idle time handler makes decisions about which garbage collection 53 // The idle time handler makes decisions about which garbage collection
14 // operations are executing during IdleNotification. 54 // operations are executing during IdleNotification.
15 class GCIdleTimeHandler { 55 class GCIdleTimeHandler {
16 public: 56 public:
17 static intptr_t EstimateMarkingStepSize(
18 int idle_time_in_ms, intptr_t marking_speed_in_bytes_per_ms);
19
20 // If we haven't recorded any incremental marking events yet, we carefully 57 // If we haven't recorded any incremental marking events yet, we carefully
21 // mark with a conservative lower bound for the marking speed. 58 // mark with a conservative lower bound for the marking speed.
22 static const intptr_t kInitialConservativeMarkingSpeed = 100 * KB; 59 static const intptr_t kInitialConservativeMarkingSpeed = 100 * KB;
23 60
24 // We have to make sure that we finish the IdleNotification before 61 // We have to make sure that we finish the IdleNotification before
25 // idle_time_in_ms. Hence, we conservatively prune our workload estimate. 62 // idle_time_in_ms. Hence, we conservatively prune our workload estimate.
26 static const double kConservativeTimeRatio; 63 static const double kConservativeTimeRatio;
27 64
65 GCIdleTimeHandler()
66 : mark_sweeps_since_idle_round_started_(0),
67 scavenges_since_last_idle_round_(0) {}
68
69 GCIdleTimeAction Compute(int idle_time_in_ms, int contexts_disposed,
70 intptr_t size_of_objects,
71 bool incremental_marking_stopped,
72 GCTracer* gc_tracer);
73
74 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.
75 if (mark_sweeps_since_idle_round_started_ < kMaxMarkSweepsInIdleRound) {
76 ++mark_sweeps_since_idle_round_started_;
77 if (mark_sweeps_since_idle_round_started_ == kMaxMarkSweepsInIdleRound) {
78 scavenges_since_last_idle_round_ = 0;
79 }
80 }
81 }
82
83 void NotifyScavenge() { ++scavenges_since_last_idle_round_; }
84
85 static intptr_t EstimateMarkingStepSize(
86 int idle_time_in_ms, intptr_t mark_sweep_speed_in_bytes_per_ms);
87
88 static int EstimateMarkSweepTime(intptr_t size_of_objects,
89 intptr_t mark_sweep_speed_in_bytes_per_ms);
90
28 private: 91 private:
92 void StartIdleRound() { mark_sweeps_since_idle_round_started_ = 0; }
93 bool IsIdleRoundFinished() {
94 return mark_sweeps_since_idle_round_started_ == kMaxMarkSweepsInIdleRound;
95 }
96 bool EnoughGarbageSinceLastIdleRound() {
97 return scavenges_since_last_idle_round_ >= kIdleScavengeThreshold;
98 }
99
100 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.
101 static const int kIdleScavengeThreshold = 5;
102 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
103 int scavenges_since_last_idle_round_;
104
29 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler); 105 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler);
30 }; 106 };
31 107
32 } // namespace internal 108 } // namespace internal
33 } // namespace v8 109 } // namespace v8
34 110
35 #endif // V8_HEAP_GC_IDLE_TIME_HANDLER_H_ 111 #endif // V8_HEAP_GC_IDLE_TIME_HANDLER_H_
OLDNEW
« 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