| 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_MARK_COMPACT_H_ | 5 #ifndef V8_HEAP_MARK_COMPACT_H_ |
| 6 #define V8_HEAP_MARK_COMPACT_H_ | 6 #define V8_HEAP_MARK_COMPACT_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 // ------------------------------------------------------------------------- | 399 // ------------------------------------------------------------------------- |
| 400 // Mark-Compact collector | 400 // Mark-Compact collector |
| 401 class MarkCompactCollector { | 401 class MarkCompactCollector { |
| 402 public: | 402 public: |
| 403 class Evacuator; | 403 class Evacuator; |
| 404 | 404 |
| 405 class Sweeper { | 405 class Sweeper { |
| 406 public: | 406 public: |
| 407 class SweeperTask; | 407 class SweeperTask; |
| 408 | 408 |
| 409 enum SweepingMode { SWEEP_ONLY, SWEEP_AND_VISIT_LIVE_OBJECTS }; | |
| 410 enum SkipListRebuildingMode { REBUILD_SKIP_LIST, IGNORE_SKIP_LIST }; | |
| 411 enum FreeListRebuildingMode { REBUILD_FREE_LIST, IGNORE_FREE_LIST }; | 409 enum FreeListRebuildingMode { REBUILD_FREE_LIST, IGNORE_FREE_LIST }; |
| 412 enum FreeSpaceTreatmentMode { IGNORE_FREE_SPACE, ZAP_FREE_SPACE }; | 410 enum FreeSpaceTreatmentMode { IGNORE_FREE_SPACE, ZAP_FREE_SPACE }; |
| 413 enum SweepingParallelism { SWEEP_ON_MAIN_THREAD, SWEEP_IN_PARALLEL }; | |
| 414 | 411 |
| 415 typedef std::deque<Page*> SweepingList; | 412 typedef std::deque<Page*> SweepingList; |
| 416 typedef List<Page*> SweptList; | 413 typedef List<Page*> SweptList; |
| 417 | 414 |
| 418 template <SweepingMode sweeping_mode, SweepingParallelism parallelism, | 415 static int RawSweep(Page* p, FreeListRebuildingMode free_list_mode, |
| 419 SkipListRebuildingMode skip_list_mode, | 416 FreeSpaceTreatmentMode free_space_mode); |
| 420 FreeListRebuildingMode free_list_mode, | |
| 421 FreeSpaceTreatmentMode free_space_mode> | |
| 422 static int RawSweep(PagedSpace* space, Page* p, ObjectVisitor* v); | |
| 423 | 417 |
| 424 explicit Sweeper(Heap* heap) | 418 explicit Sweeper(Heap* heap) |
| 425 : heap_(heap), | 419 : heap_(heap), |
| 426 pending_sweeper_tasks_semaphore_(0), | 420 pending_sweeper_tasks_semaphore_(0), |
| 427 sweeping_in_progress_(false), | 421 sweeping_in_progress_(false), |
| 428 late_pages_(false), | 422 late_pages_(false), |
| 429 num_sweeping_tasks_(0) {} | 423 num_sweeping_tasks_(0) {} |
| 430 | 424 |
| 431 bool sweeping_in_progress() { return sweeping_in_progress_; } | 425 bool sweeping_in_progress() { return sweeping_in_progress_; } |
| 432 bool contains_late_pages() { return late_pages_; } | 426 bool contains_late_pages() { return late_pages_; } |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 private: | 886 private: |
| 893 MarkCompactCollector* collector_; | 887 MarkCompactCollector* collector_; |
| 894 }; | 888 }; |
| 895 | 889 |
| 896 | 890 |
| 897 const char* AllocationSpaceName(AllocationSpace space); | 891 const char* AllocationSpaceName(AllocationSpace space); |
| 898 } // namespace internal | 892 } // namespace internal |
| 899 } // namespace v8 | 893 } // namespace v8 |
| 900 | 894 |
| 901 #endif // V8_HEAP_MARK_COMPACT_H_ | 895 #endif // V8_HEAP_MARK_COMPACT_H_ |
| OLD | NEW |