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 "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/heap/spaces.h" | 9 #include "src/heap/spaces.h" |
10 #include "src/heap/store-buffer.h" | 10 #include "src/heap/store-buffer.h" |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 | 314 |
315 | 315 |
316 // Defined in isolate.h. | 316 // Defined in isolate.h. |
317 class ThreadLocalTop; | 317 class ThreadLocalTop; |
318 | 318 |
319 | 319 |
320 // ------------------------------------------------------------------------- | 320 // ------------------------------------------------------------------------- |
321 // Mark-Compact collector | 321 // Mark-Compact collector |
322 class MarkCompactCollector { | 322 class MarkCompactCollector { |
323 public: | 323 public: |
| 324 class Evacuator; |
| 325 |
324 enum IterationMode { | 326 enum IterationMode { |
325 kKeepMarking, | 327 kKeepMarking, |
326 kClearMarkbits, | 328 kClearMarkbits, |
327 }; | 329 }; |
328 | 330 |
329 static void Initialize(); | 331 static void Initialize(); |
330 | 332 |
331 void SetUp(); | 333 void SetUp(); |
332 | 334 |
333 void TearDown(); | 335 void TearDown(); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 return free_list_old_space_; | 499 return free_list_old_space_; |
498 } | 500 } |
499 base::SmartPointer<FreeList>& free_list_code_space() { | 501 base::SmartPointer<FreeList>& free_list_code_space() { |
500 return free_list_code_space_; | 502 return free_list_code_space_; |
501 } | 503 } |
502 base::SmartPointer<FreeList>& free_list_map_space() { | 504 base::SmartPointer<FreeList>& free_list_map_space() { |
503 return free_list_map_space_; | 505 return free_list_map_space_; |
504 } | 506 } |
505 | 507 |
506 private: | 508 private: |
507 class CompactionTask; | |
508 class EvacuateNewSpaceVisitor; | 509 class EvacuateNewSpaceVisitor; |
509 class EvacuateOldSpaceVisitor; | 510 class EvacuateOldSpaceVisitor; |
510 class EvacuateVisitorBase; | 511 class EvacuateVisitorBase; |
511 class Evacuator; | |
512 class HeapObjectVisitor; | 512 class HeapObjectVisitor; |
513 class SweeperTask; | 513 class SweeperTask; |
514 | 514 |
515 typedef std::vector<Page*> SweepingList; | 515 typedef std::vector<Page*> SweepingList; |
516 | 516 |
517 explicit MarkCompactCollector(Heap* heap); | 517 explicit MarkCompactCollector(Heap* heap); |
518 | 518 |
519 bool WillBeDeoptimized(Code* code); | 519 bool WillBeDeoptimized(Code* code); |
520 void ClearInvalidRememberedSetSlots(); | 520 void ClearInvalidRememberedSetSlots(); |
521 | 521 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 void SweepSpaces(); | 697 void SweepSpaces(); |
698 | 698 |
699 void EvacuateNewSpacePrologue(); | 699 void EvacuateNewSpacePrologue(); |
700 void EvacuateNewSpaceEpilogue(); | 700 void EvacuateNewSpaceEpilogue(); |
701 | 701 |
702 void EvacuatePagesInParallel(); | 702 void EvacuatePagesInParallel(); |
703 | 703 |
704 // The number of parallel compaction tasks, including the main thread. | 704 // The number of parallel compaction tasks, including the main thread. |
705 int NumberOfParallelCompactionTasks(int pages, intptr_t live_bytes); | 705 int NumberOfParallelCompactionTasks(int pages, intptr_t live_bytes); |
706 | 706 |
707 void StartParallelCompaction(Evacuator** evacuators, int len); | |
708 void WaitUntilCompactionCompleted(Evacuator** evacuators, int len); | |
709 | |
710 void EvacuateNewSpaceAndCandidates(); | 707 void EvacuateNewSpaceAndCandidates(); |
711 | 708 |
712 void UpdatePointersAfterEvacuation(); | 709 void UpdatePointersAfterEvacuation(); |
713 | 710 |
714 // Iterates through all live objects on a page using marking information. | 711 // Iterates through all live objects on a page using marking information. |
715 // Returns whether all objects have successfully been visited. | 712 // Returns whether all objects have successfully been visited. |
716 bool VisitLiveObjects(MemoryChunk* page, HeapObjectVisitor* visitor, | 713 bool VisitLiveObjects(MemoryChunk* page, HeapObjectVisitor* visitor, |
717 IterationMode mode); | 714 IterationMode mode); |
718 | 715 |
719 void VisitLiveObjectsBody(Page* page, ObjectVisitor* visitor); | 716 void VisitLiveObjectsBody(Page* page, ObjectVisitor* visitor); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 private: | 862 private: |
866 MarkCompactCollector* collector_; | 863 MarkCompactCollector* collector_; |
867 }; | 864 }; |
868 | 865 |
869 | 866 |
870 const char* AllocationSpaceName(AllocationSpace space); | 867 const char* AllocationSpaceName(AllocationSpace space); |
871 } // namespace internal | 868 } // namespace internal |
872 } // namespace v8 | 869 } // namespace v8 |
873 | 870 |
874 #endif // V8_HEAP_MARK_COMPACT_H_ | 871 #endif // V8_HEAP_MARK_COMPACT_H_ |
OLD | NEW |