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

Side by Side Diff: src/heap/heap.h

Issue 2493803002: [heap] Add basic infrastructure for Minor Mark-Compact collector (Closed)
Patch Set: Addressed comment Created 4 years, 1 month 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 | « src/heap/gc-tracer.cc ('k') | src/heap/heap.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_HEAP_H_ 5 #ifndef V8_HEAP_HEAP_H_
6 #define V8_HEAP_HEAP_H_ 6 #define V8_HEAP_HEAP_H_
7 7
8 #include <cmath> 8 #include <cmath>
9 #include <map> 9 #include <map>
10 10
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 return true; 677 return true;
678 #else 678 #else
679 #ifdef VERIFY_HEAP 679 #ifdef VERIFY_HEAP
680 return FLAG_verify_heap; 680 return FLAG_verify_heap;
681 #else 681 #else
682 return false; 682 return false;
683 #endif 683 #endif
684 #endif 684 #endif
685 } 685 }
686 686
687 static inline bool IsYoungGenerationCollector(GarbageCollector collector) {
688 return collector == SCAVENGER || collector == MINOR_MARK_COMPACTOR;
689 }
690
691 static inline GarbageCollector YoungGenerationCollector() {
692 return (FLAG_minor_mc) ? MINOR_MARK_COMPACTOR : SCAVENGER;
693 }
694
695 static inline const char* CollectorName(GarbageCollector collector) {
696 switch (collector) {
697 case SCAVENGER:
698 return "Scavenger";
699 case MARK_COMPACTOR:
700 return "Mark-Compact";
701 case MINOR_MARK_COMPACTOR:
702 return "Minor Mark-Compact";
703 }
704 return "Unknown collector";
705 }
706
687 V8_EXPORT_PRIVATE static double HeapGrowingFactor(double gc_speed, 707 V8_EXPORT_PRIVATE static double HeapGrowingFactor(double gc_speed,
688 double mutator_speed); 708 double mutator_speed);
689 709
690 // Copy block of memory from src to dst. Size of block should be aligned 710 // Copy block of memory from src to dst. Size of block should be aligned
691 // by pointer size. 711 // by pointer size.
692 static inline void CopyBlock(Address dst, Address src, int byte_size); 712 static inline void CopyBlock(Address dst, Address src, int byte_size);
693 713
694 // Determines a static visitor id based on the given {map} that can then be 714 // Determines a static visitor id based on the given {map} that can then be
695 // stored on the map to facilitate fast dispatch for {StaticVisitorBase}. 715 // stored on the map to facilitate fast dispatch for {StaticVisitorBase}.
696 static int GetStaticVisitorIdForMap(Map* map); 716 static int GetStaticVisitorIdForMap(Map* map);
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
1766 // Actual GC. ================================================================ 1786 // Actual GC. ================================================================
1767 // =========================================================================== 1787 // ===========================================================================
1768 1788
1769 // Code that should be run before and after each GC. Includes some 1789 // Code that should be run before and after each GC. Includes some
1770 // reporting/verification activities when compiled with DEBUG set. 1790 // reporting/verification activities when compiled with DEBUG set.
1771 void GarbageCollectionPrologue(); 1791 void GarbageCollectionPrologue();
1772 void GarbageCollectionEpilogue(); 1792 void GarbageCollectionEpilogue();
1773 1793
1774 // Performs a major collection in the whole heap. 1794 // Performs a major collection in the whole heap.
1775 void MarkCompact(); 1795 void MarkCompact();
1796 // Performs a minor collection of just the young generation.
1797 void MinorMarkCompact();
1776 1798
1777 // Code to be run before and after mark-compact. 1799 // Code to be run before and after mark-compact.
1778 void MarkCompactPrologue(); 1800 void MarkCompactPrologue();
1779 void MarkCompactEpilogue(); 1801 void MarkCompactEpilogue();
1780 1802
1781 // Performs a minor collection in new generation. 1803 // Performs a minor collection in new generation.
1782 void Scavenge(); 1804 void Scavenge();
1783 1805
1784 Address DoScavenge(ObjectVisitor* scavenge_visitor, Address new_space_front); 1806 Address DoScavenge(ObjectVisitor* scavenge_visitor, Address new_space_front);
1785 1807
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
2628 friend class LargeObjectSpace; 2650 friend class LargeObjectSpace;
2629 friend class NewSpace; 2651 friend class NewSpace;
2630 friend class PagedSpace; 2652 friend class PagedSpace;
2631 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); 2653 DISALLOW_COPY_AND_ASSIGN(AllocationObserver);
2632 }; 2654 };
2633 2655
2634 } // namespace internal 2656 } // namespace internal
2635 } // namespace v8 2657 } // namespace v8
2636 2658
2637 #endif // V8_HEAP_HEAP_H_ 2659 #endif // V8_HEAP_HEAP_H_
OLDNEW
« no previous file with comments | « src/heap/gc-tracer.cc ('k') | src/heap/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698