| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_INCREMENTAL_MARKING_H_ | 5 #ifndef V8_HEAP_INCREMENTAL_MARKING_H_ |
| 6 #define V8_HEAP_INCREMENTAL_MARKING_H_ | 6 #define V8_HEAP_INCREMENTAL_MARKING_H_ |
| 7 | 7 |
| 8 #include "src/cancelable-task.h" | 8 #include "src/cancelable-task.h" |
| 9 #include "src/execution.h" | 9 #include "src/execution.h" |
| 10 #include "src/heap/heap.h" | 10 #include "src/heap/heap.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 class V8_EXPORT_PRIVATE IncrementalMarking { | 25 class V8_EXPORT_PRIVATE IncrementalMarking { |
| 26 public: | 26 public: |
| 27 enum State { STOPPED, SWEEPING, MARKING, COMPLETE }; | 27 enum State { STOPPED, SWEEPING, MARKING, COMPLETE }; |
| 28 | 28 |
| 29 enum CompletionAction { GC_VIA_STACK_GUARD, NO_GC_VIA_STACK_GUARD }; | 29 enum CompletionAction { GC_VIA_STACK_GUARD, NO_GC_VIA_STACK_GUARD }; |
| 30 | 30 |
| 31 enum ForceCompletionAction { FORCE_COMPLETION, DO_NOT_FORCE_COMPLETION }; | 31 enum ForceCompletionAction { FORCE_COMPLETION, DO_NOT_FORCE_COMPLETION }; |
| 32 | 32 |
| 33 enum GCRequestType { NONE, COMPLETE_MARKING, FINALIZATION }; | 33 enum GCRequestType { NONE, COMPLETE_MARKING, FINALIZATION }; |
| 34 | 34 |
| 35 class PauseBlackAllocationScope { |
| 36 public: |
| 37 explicit PauseBlackAllocationScope(IncrementalMarking* marking) |
| 38 : marking_(marking), paused_(false) { |
| 39 if (marking_->black_allocation()) { |
| 40 paused_ = true; |
| 41 marking_->PauseBlackAllocation(); |
| 42 } |
| 43 } |
| 44 |
| 45 ~PauseBlackAllocationScope() { |
| 46 if (paused_) { |
| 47 marking_->StartBlackAllocation(); |
| 48 } |
| 49 } |
| 50 |
| 51 private: |
| 52 IncrementalMarking* marking_; |
| 53 bool paused_; |
| 54 }; |
| 55 |
| 35 static void Initialize(); | 56 static void Initialize(); |
| 36 | 57 |
| 37 explicit IncrementalMarking(Heap* heap); | 58 explicit IncrementalMarking(Heap* heap); |
| 38 | 59 |
| 39 MarkingState marking_state(HeapObject* object) const { | 60 MarkingState marking_state(HeapObject* object) const { |
| 40 return MarkingState::Internal(object); | 61 return MarkingState::Internal(object); |
| 41 } | 62 } |
| 42 | 63 |
| 43 MarkingState marking_state(MemoryChunk* chunk) const { | 64 MarkingState marking_state(MemoryChunk* chunk) const { |
| 44 return MarkingState::Internal(chunk); | 65 return MarkingState::Internal(chunk); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 268 |
| 248 private: | 269 private: |
| 249 IncrementalMarking& incremental_marking_; | 270 IncrementalMarking& incremental_marking_; |
| 250 }; | 271 }; |
| 251 | 272 |
| 252 int64_t SpaceLeftInOldSpace(); | 273 int64_t SpaceLeftInOldSpace(); |
| 253 | 274 |
| 254 void StartMarking(); | 275 void StartMarking(); |
| 255 | 276 |
| 256 void StartBlackAllocation(); | 277 void StartBlackAllocation(); |
| 278 void PauseBlackAllocation(); |
| 257 void FinishBlackAllocation(); | 279 void FinishBlackAllocation(); |
| 258 | 280 |
| 259 void MarkRoots(); | 281 void MarkRoots(); |
| 260 void ProcessWeakCells(); | 282 void ProcessWeakCells(); |
| 261 // Retain dying maps for <FLAG_retain_maps_for_n_gc> garbage collections to | 283 // Retain dying maps for <FLAG_retain_maps_for_n_gc> garbage collections to |
| 262 // increase chances of reusing of map transition tree in future. | 284 // increase chances of reusing of map transition tree in future. |
| 263 void RetainMaps(); | 285 void RetainMaps(); |
| 264 | 286 |
| 265 void ActivateIncrementalWriteBarrier(PagedSpace* space); | 287 void ActivateIncrementalWriteBarrier(PagedSpace* space); |
| 266 static void ActivateIncrementalWriteBarrier(NewSpace* space); | 288 static void ActivateIncrementalWriteBarrier(NewSpace* space); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 | 339 |
| 318 Observer new_generation_observer_; | 340 Observer new_generation_observer_; |
| 319 Observer old_generation_observer_; | 341 Observer old_generation_observer_; |
| 320 | 342 |
| 321 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking); | 343 DISALLOW_IMPLICIT_CONSTRUCTORS(IncrementalMarking); |
| 322 }; | 344 }; |
| 323 } // namespace internal | 345 } // namespace internal |
| 324 } // namespace v8 | 346 } // namespace v8 |
| 325 | 347 |
| 326 #endif // V8_HEAP_INCREMENTAL_MARKING_H_ | 348 #endif // V8_HEAP_INCREMENTAL_MARKING_H_ |
| OLD | NEW |