OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_memory_reducer_H | 5 #ifndef V8_HEAP_memory_reducer_H |
6 #define V8_HEAP_memory_reducer_H | 6 #define V8_HEAP_memory_reducer_H |
7 | 7 |
8 #include "include/v8-platform.h" | 8 #include "include/v8-platform.h" |
9 #include "src/base/macros.h" | 9 #include "src/base/macros.h" |
10 #include "src/cancelable-task.h" | 10 #include "src/cancelable-task.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 : action(action), | 89 : action(action), |
90 started_gcs(started_gcs), | 90 started_gcs(started_gcs), |
91 next_gc_start_ms(next_gc_start_ms), | 91 next_gc_start_ms(next_gc_start_ms), |
92 last_gc_time_ms(last_gc_time_ms) {} | 92 last_gc_time_ms(last_gc_time_ms) {} |
93 Action action; | 93 Action action; |
94 int started_gcs; | 94 int started_gcs; |
95 double next_gc_start_ms; | 95 double next_gc_start_ms; |
96 double last_gc_time_ms; | 96 double last_gc_time_ms; |
97 }; | 97 }; |
98 | 98 |
99 enum EventType { | 99 enum EventType { kTimer, kMarkCompact, kContextDisposed }; |
100 kTimer, | |
101 kMarkCompact, | |
102 kContextDisposed, | |
103 kBackgroundIdleNotification | |
104 }; | |
105 | 100 |
106 struct Event { | 101 struct Event { |
107 EventType type; | 102 EventType type; |
108 double time_ms; | 103 double time_ms; |
109 bool low_allocation_rate; | |
110 bool next_gc_likely_to_collect_more; | 104 bool next_gc_likely_to_collect_more; |
| 105 bool should_start_incremental_gc; |
111 bool can_start_incremental_gc; | 106 bool can_start_incremental_gc; |
112 }; | 107 }; |
113 | 108 |
114 explicit MemoryReducer(Heap* heap) | 109 explicit MemoryReducer(Heap* heap) |
115 : heap_(heap), state_(kDone, 0, 0.0, 0.0) {} | 110 : heap_(heap), state_(kDone, 0, 0.0, 0.0) {} |
116 // Callbacks. | 111 // Callbacks. |
117 void NotifyMarkCompact(const Event& event); | 112 void NotifyMarkCompact(const Event& event); |
118 void NotifyContextDisposed(const Event& event); | 113 void NotifyContextDisposed(const Event& event); |
119 void NotifyBackgroundIdleNotification(const Event& event); | 114 void NotifyBackgroundIdleNotification(const Event& event); |
120 // The step function that computes the next state from the current state and | 115 // The step function that computes the next state from the current state and |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 147 |
153 Heap* heap_; | 148 Heap* heap_; |
154 State state_; | 149 State state_; |
155 DISALLOW_COPY_AND_ASSIGN(MemoryReducer); | 150 DISALLOW_COPY_AND_ASSIGN(MemoryReducer); |
156 }; | 151 }; |
157 | 152 |
158 } // namespace internal | 153 } // namespace internal |
159 } // namespace v8 | 154 } // namespace v8 |
160 | 155 |
161 #endif // V8_HEAP_memory_reducer_H | 156 #endif // V8_HEAP_memory_reducer_H |
OLD | NEW |