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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // Posts a timer task that will call NotifyTimer after the given delay. | 123 // Posts a timer task that will call NotifyTimer after the given delay. |
124 void ScheduleTimer(double delay_ms); | 124 void ScheduleTimer(double delay_ms); |
125 void TearDown(); | 125 void TearDown(); |
126 static const int kLongDelayMs; | 126 static const int kLongDelayMs; |
127 static const int kShortDelayMs; | 127 static const int kShortDelayMs; |
128 static const int kWatchdogDelayMs; | 128 static const int kWatchdogDelayMs; |
129 static const int kMaxNumberOfGCs; | 129 static const int kMaxNumberOfGCs; |
130 | 130 |
131 Heap* heap() { return heap_; } | 131 Heap* heap() { return heap_; } |
132 | 132 |
| 133 bool ShouldGrowHeapSlowly() { |
| 134 return state_.action == kDone && state_.started_gcs > 0; |
| 135 } |
| 136 |
133 private: | 137 private: |
134 class TimerTask : public v8::internal::CancelableTask { | 138 class TimerTask : public v8::internal::CancelableTask { |
135 public: | 139 public: |
136 explicit TimerTask(MemoryReducer* memory_reducer); | 140 explicit TimerTask(MemoryReducer* memory_reducer); |
137 | 141 |
138 private: | 142 private: |
139 // v8::internal::CancelableTask overrides. | 143 // v8::internal::CancelableTask overrides. |
140 void RunInternal() override; | 144 void RunInternal() override; |
141 MemoryReducer* memory_reducer_; | 145 MemoryReducer* memory_reducer_; |
142 DISALLOW_COPY_AND_ASSIGN(TimerTask); | 146 DISALLOW_COPY_AND_ASSIGN(TimerTask); |
143 }; | 147 }; |
144 | 148 |
145 void NotifyTimer(const Event& event); | 149 void NotifyTimer(const Event& event); |
146 | 150 |
147 static bool WatchdogGC(const State& state, const Event& event); | 151 static bool WatchdogGC(const State& state, const Event& event); |
148 | 152 |
149 Heap* heap_; | 153 Heap* heap_; |
150 State state_; | 154 State state_; |
151 DISALLOW_COPY_AND_ASSIGN(MemoryReducer); | 155 DISALLOW_COPY_AND_ASSIGN(MemoryReducer); |
152 }; | 156 }; |
153 | 157 |
154 } // namespace internal | 158 } // namespace internal |
155 } // namespace v8 | 159 } // namespace v8 |
156 | 160 |
157 #endif // V8_HEAP_memory_reducer_H | 161 #endif // V8_HEAP_memory_reducer_H |
OLD | NEW |