OLD | NEW |
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 { | 13 enum GCIdleTimeActionType { |
14 DONE, | 14 DONE, |
15 DO_NOTHING, | 15 DO_NOTHING, |
16 DO_INCREMENTAL_MARKING, | 16 DO_INCREMENTAL_STEP, |
17 DO_SCAVENGE, | 17 DO_SCAVENGE, |
18 DO_FULL_GC, | 18 DO_FULL_GC, |
19 DO_FINALIZE_SWEEPING | |
20 }; | 19 }; |
21 | 20 |
22 | 21 |
23 class GCIdleTimeAction { | 22 class GCIdleTimeAction { |
24 public: | 23 public: |
25 static GCIdleTimeAction Done() { | 24 static GCIdleTimeAction Done() { |
26 GCIdleTimeAction result; | 25 GCIdleTimeAction result; |
27 result.type = DONE; | 26 result.type = DONE; |
28 result.parameter = 0; | |
29 result.additional_work = false; | 27 result.additional_work = false; |
30 return result; | 28 return result; |
31 } | 29 } |
32 | 30 |
33 static GCIdleTimeAction Nothing() { | 31 static GCIdleTimeAction Nothing() { |
34 GCIdleTimeAction result; | 32 GCIdleTimeAction result; |
35 result.type = DO_NOTHING; | 33 result.type = DO_NOTHING; |
36 result.parameter = 0; | |
37 result.additional_work = false; | 34 result.additional_work = false; |
38 return result; | 35 return result; |
39 } | 36 } |
40 | 37 |
41 static GCIdleTimeAction IncrementalMarking(intptr_t step_size) { | 38 static GCIdleTimeAction IncrementalStep() { |
42 GCIdleTimeAction result; | 39 GCIdleTimeAction result; |
43 result.type = DO_INCREMENTAL_MARKING; | 40 result.type = DO_INCREMENTAL_STEP; |
44 result.parameter = step_size; | |
45 result.additional_work = false; | 41 result.additional_work = false; |
46 return result; | 42 return result; |
47 } | 43 } |
48 | 44 |
49 static GCIdleTimeAction Scavenge() { | 45 static GCIdleTimeAction Scavenge() { |
50 GCIdleTimeAction result; | 46 GCIdleTimeAction result; |
51 result.type = DO_SCAVENGE; | 47 result.type = DO_SCAVENGE; |
52 result.parameter = 0; | |
53 result.additional_work = false; | 48 result.additional_work = false; |
54 return result; | 49 return result; |
55 } | 50 } |
56 | 51 |
57 static GCIdleTimeAction FullGC() { | 52 static GCIdleTimeAction FullGC() { |
58 GCIdleTimeAction result; | 53 GCIdleTimeAction result; |
59 result.type = DO_FULL_GC; | 54 result.type = DO_FULL_GC; |
60 result.parameter = 0; | |
61 result.additional_work = false; | 55 result.additional_work = false; |
62 return result; | 56 return result; |
63 } | 57 } |
64 | |
65 static GCIdleTimeAction FinalizeSweeping() { | |
66 GCIdleTimeAction result; | |
67 result.type = DO_FINALIZE_SWEEPING; | |
68 result.parameter = 0; | |
69 result.additional_work = false; | |
70 return result; | |
71 } | |
72 | 58 |
73 void Print(); | 59 void Print(); |
74 | 60 |
75 GCIdleTimeActionType type; | 61 GCIdleTimeActionType type; |
76 intptr_t parameter; | |
77 bool additional_work; | 62 bool additional_work; |
78 }; | 63 }; |
79 | 64 |
80 | 65 |
81 class GCTracer; | 66 class GCTracer; |
82 | 67 |
83 // The idle time handler makes decisions about which garbage collection | 68 // The idle time handler makes decisions about which garbage collection |
84 // operations are executing during IdleNotification. | 69 // operations are executing during IdleNotification. |
85 class GCIdleTimeHandler { | 70 class GCIdleTimeHandler { |
86 public: | 71 public: |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 // Idle notifications with no progress. | 192 // Idle notifications with no progress. |
208 int idle_times_which_made_no_progress_; | 193 int idle_times_which_made_no_progress_; |
209 | 194 |
210 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler); | 195 DISALLOW_COPY_AND_ASSIGN(GCIdleTimeHandler); |
211 }; | 196 }; |
212 | 197 |
213 } // namespace internal | 198 } // namespace internal |
214 } // namespace v8 | 199 } // namespace v8 |
215 | 200 |
216 #endif // V8_HEAP_GC_IDLE_TIME_HANDLER_H_ | 201 #endif // V8_HEAP_GC_IDLE_TIME_HANDLER_H_ |
OLD | NEW |