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_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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 class PagedSpace; | 335 class PagedSpace; |
336 class Scavenger; | 336 class Scavenger; |
337 class ScavengeJob; | 337 class ScavengeJob; |
338 class Space; | 338 class Space; |
339 class StoreBuffer; | 339 class StoreBuffer; |
340 class TracePossibleWrapperReporter; | 340 class TracePossibleWrapperReporter; |
341 class WeakObjectRetainer; | 341 class WeakObjectRetainer; |
342 | 342 |
343 typedef void (*ObjectSlotCallback)(HeapObject** from, HeapObject* to); | 343 typedef void (*ObjectSlotCallback)(HeapObject** from, HeapObject* to); |
344 | 344 |
345 enum PromotionMode { PROMOTE_MARKED, DEFAULT_PROMOTION }; | |
346 | |
347 enum ArrayStorageAllocationMode { | 345 enum ArrayStorageAllocationMode { |
348 DONT_INITIALIZE_ARRAY_ELEMENTS, | 346 DONT_INITIALIZE_ARRAY_ELEMENTS, |
349 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE | 347 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE |
350 }; | 348 }; |
351 | 349 |
352 enum class ClearRecordedSlots { kYes, kNo }; | 350 enum class ClearRecordedSlots { kYes, kNo }; |
353 | 351 |
354 enum class ClearBlackArea { kYes, kNo }; | 352 enum class ClearBlackArea { kYes, kNo }; |
355 | 353 |
356 enum class GarbageCollectionReason { | 354 enum class GarbageCollectionReason { |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 | 826 |
829 void RecordStats(HeapStats* stats, bool take_snapshot = false); | 827 void RecordStats(HeapStats* stats, bool take_snapshot = false); |
830 | 828 |
831 // Check new space expansion criteria and expand semispaces if it was hit. | 829 // Check new space expansion criteria and expand semispaces if it was hit. |
832 void CheckNewSpaceExpansionCriteria(); | 830 void CheckNewSpaceExpansionCriteria(); |
833 | 831 |
834 void VisitExternalResources(v8::ExternalResourceVisitor* visitor); | 832 void VisitExternalResources(v8::ExternalResourceVisitor* visitor); |
835 | 833 |
836 // An object should be promoted if the object has survived a | 834 // An object should be promoted if the object has survived a |
837 // scavenge operation. | 835 // scavenge operation. |
838 template <PromotionMode promotion_mode> | |
839 inline bool ShouldBePromoted(Address old_address, int object_size); | 836 inline bool ShouldBePromoted(Address old_address, int object_size); |
840 | 837 |
841 inline PromotionMode CurrentPromotionMode(); | |
842 | |
843 void ClearNormalizedMapCaches(); | 838 void ClearNormalizedMapCaches(); |
844 | 839 |
845 void IncrementDeferredCount(v8::Isolate::UseCounterFeature feature); | 840 void IncrementDeferredCount(v8::Isolate::UseCounterFeature feature); |
846 | 841 |
847 // Completely clear the Instanceof cache (to stop it keeping objects alive | 842 // Completely clear the Instanceof cache (to stop it keeping objects alive |
848 // around a GC). | 843 // around a GC). |
849 inline void CompletelyClearInstanceofCache(); | 844 inline void CompletelyClearInstanceofCache(); |
850 | 845 |
851 inline uint32_t HashSeed(); | 846 inline uint32_t HashSeed(); |
852 | 847 |
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1771 // Performs a major collection in the whole heap. | 1766 // Performs a major collection in the whole heap. |
1772 void MarkCompact(); | 1767 void MarkCompact(); |
1773 | 1768 |
1774 // Code to be run before and after mark-compact. | 1769 // Code to be run before and after mark-compact. |
1775 void MarkCompactPrologue(); | 1770 void MarkCompactPrologue(); |
1776 void MarkCompactEpilogue(); | 1771 void MarkCompactEpilogue(); |
1777 | 1772 |
1778 // Performs a minor collection in new generation. | 1773 // Performs a minor collection in new generation. |
1779 void Scavenge(); | 1774 void Scavenge(); |
1780 | 1775 |
1781 Address DoScavenge(ObjectVisitor* scavenge_visitor, Address new_space_front, | 1776 Address DoScavenge(ObjectVisitor* scavenge_visitor, Address new_space_front); |
1782 PromotionMode promotion_mode); | |
1783 | 1777 |
1784 void UpdateNewSpaceReferencesInExternalStringTable( | 1778 void UpdateNewSpaceReferencesInExternalStringTable( |
1785 ExternalStringTableUpdaterCallback updater_func); | 1779 ExternalStringTableUpdaterCallback updater_func); |
1786 | 1780 |
1787 void UpdateReferencesInExternalStringTable( | 1781 void UpdateReferencesInExternalStringTable( |
1788 ExternalStringTableUpdaterCallback updater_func); | 1782 ExternalStringTableUpdaterCallback updater_func); |
1789 | 1783 |
1790 void ProcessAllWeakReferences(WeakObjectRetainer* retainer); | 1784 void ProcessAllWeakReferences(WeakObjectRetainer* retainer); |
1791 void ProcessYoungWeakReferences(WeakObjectRetainer* retainer); | 1785 void ProcessYoungWeakReferences(WeakObjectRetainer* retainer); |
1792 void ProcessNativeContexts(WeakObjectRetainer* retainer); | 1786 void ProcessNativeContexts(WeakObjectRetainer* retainer); |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2638 } | 2632 } |
2639 | 2633 |
2640 private: | 2634 private: |
2641 Heap* heap_; | 2635 Heap* heap_; |
2642 }; | 2636 }; |
2643 | 2637 |
2644 } // namespace internal | 2638 } // namespace internal |
2645 } // namespace v8 | 2639 } // namespace v8 |
2646 | 2640 |
2647 #endif // V8_HEAP_HEAP_H_ | 2641 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |