Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: src/heap/mark-compact.h

Issue 1470253002: [heap] Refactor evacuation for young and old gen into visitors. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: don't check for WAS_SWEPT, as we never sweep newspace pages Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/heap/mark-compact.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 320
321 321
322 // Defined in isolate.h. 322 // Defined in isolate.h.
323 class ThreadLocalTop; 323 class ThreadLocalTop;
324 324
325 325
326 // ------------------------------------------------------------------------- 326 // -------------------------------------------------------------------------
327 // Mark-Compact collector 327 // Mark-Compact collector
328 class MarkCompactCollector { 328 class MarkCompactCollector {
329 public: 329 public:
330 enum IterationMode {
331 kKeepMarking,
332 kClearMarkbits,
333 };
334
335 class EvacuateNewSpaceVisitor;
336 class EvacuateOldSpaceVisitor;
337 class HeapObjectVisitor;
338
330 static void Initialize(); 339 static void Initialize();
331 340
332 void SetUp(); 341 void SetUp();
333 342
334 void TearDown(); 343 void TearDown();
335 344
336 void CollectEvacuationCandidates(PagedSpace* space); 345 void CollectEvacuationCandidates(PagedSpace* space);
337 346
338 void AddEvacuationCandidate(Page* p); 347 void AddEvacuationCandidate(Page* p);
339 348
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 // After: Live objects are unmarked, non-live regions have been added to 705 // After: Live objects are unmarked, non-live regions have been added to
697 // their space's free list. Active eden semispace is compacted by 706 // their space's free list. Active eden semispace is compacted by
698 // evacuation. 707 // evacuation.
699 // 708 //
700 709
701 // If we are not compacting the heap, we simply sweep the spaces except 710 // If we are not compacting the heap, we simply sweep the spaces except
702 // for the large object space, clearing mark bits and adding unmarked 711 // for the large object space, clearing mark bits and adding unmarked
703 // regions to each space's free list. 712 // regions to each space's free list.
704 void SweepSpaces(); 713 void SweepSpaces();
705 714
706 int DiscoverAndEvacuateBlackObjectsOnPage(NewSpace* new_space, 715 // Iterates through all live objects on a page using marking information.
707 NewSpacePage* p); 716 // Returns whether all objects have successfully been visited.
717 bool IterateLiveObjectsOnPage(MemoryChunk* page, HeapObjectVisitor* visitor,
718 IterationMode mode);
708 719
709 void EvacuateNewSpace(); 720 void EvacuateNewSpace();
710 721
711 bool EvacuateLiveObjectsFromPage(Page* p, PagedSpace* target_space,
712 SlotsBuffer** evacuation_slots_buffer);
713
714 void AddEvacuationSlotsBufferSynchronized( 722 void AddEvacuationSlotsBufferSynchronized(
715 SlotsBuffer* evacuation_slots_buffer); 723 SlotsBuffer* evacuation_slots_buffer);
716 724
717 void EvacuatePages(CompactionSpaceCollection* compaction_spaces, 725 void EvacuatePages(CompactionSpaceCollection* compaction_spaces,
718 SlotsBuffer** evacuation_slots_buffer); 726 SlotsBuffer** evacuation_slots_buffer);
719 727
720 void EvacuatePagesInParallel(); 728 void EvacuatePagesInParallel();
721 729
722 // The number of parallel compaction tasks, including the main thread. 730 // The number of parallel compaction tasks, including the main thread.
723 int NumberOfParallelCompactionTasks(); 731 int NumberOfParallelCompactionTasks();
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 private: 869 private:
862 MarkCompactCollector* collector_; 870 MarkCompactCollector* collector_;
863 }; 871 };
864 872
865 873
866 const char* AllocationSpaceName(AllocationSpace space); 874 const char* AllocationSpaceName(AllocationSpace space);
867 } // namespace internal 875 } // namespace internal
868 } // namespace v8 876 } // namespace v8
869 877
870 #endif // V8_HEAP_MARK_COMPACT_H_ 878 #endif // V8_HEAP_MARK_COMPACT_H_
OLDNEW
« no previous file with comments | « no previous file | src/heap/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698