Chromium Code Reviews| 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 296 class HeapObjectsFilter; | 296 class HeapObjectsFilter; |
| 297 class HeapStats; | 297 class HeapStats; |
| 298 class HistogramTimer; | 298 class HistogramTimer; |
| 299 class Isolate; | 299 class Isolate; |
| 300 class MemoryReducer; | 300 class MemoryReducer; |
| 301 class ObjectStats; | 301 class ObjectStats; |
| 302 class Scavenger; | 302 class Scavenger; |
| 303 class ScavengeJob; | 303 class ScavengeJob; |
| 304 class WeakObjectRetainer; | 304 class WeakObjectRetainer; |
| 305 | 305 |
| 306 enum PromotionMode { FORCE_PROMOTION, DEFAULT_PROMOTION }; | 306 enum PromotionMode { FORCE_PROMOTION, PROMOTE_MARKED, DEFAULT_PROMOTION }; |
| 307 | 307 |
| 308 typedef void (*ObjectSlotCallback)(HeapObject** from, HeapObject* to, | 308 typedef void (*ObjectSlotCallback)(HeapObject** from, HeapObject* to); |
| 309 PromotionMode mode); | |
| 310 | 309 |
| 311 // A queue of objects promoted during scavenge. Each object is accompanied | 310 // A queue of objects promoted during scavenge. Each object is accompanied |
| 312 // by it's size to avoid dereferencing a map pointer for scanning. | 311 // by it's size to avoid dereferencing a map pointer for scanning. |
| 313 // The last page in to-space is used for the promotion queue. On conflict | 312 // The last page in to-space is used for the promotion queue. On conflict |
| 314 // during scavenge, the promotion queue is allocated externally and all | 313 // during scavenge, the promotion queue is allocated externally and all |
| 315 // entries are copied to the external queue. | 314 // entries are copied to the external queue. |
| 316 class PromotionQueue { | 315 class PromotionQueue { |
| 317 public: | 316 public: |
| 318 explicit PromotionQueue(Heap* heap) | 317 explicit PromotionQueue(Heap* heap) |
| 319 : front_(NULL), | 318 : front_(NULL), |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 770 | 769 |
| 771 if (PromotedTotalSize() >= adjusted_allocation_limit) return true; | 770 if (PromotedTotalSize() >= adjusted_allocation_limit) return true; |
| 772 | 771 |
| 773 if (HighMemoryPressure()) return true; | 772 if (HighMemoryPressure()) return true; |
| 774 | 773 |
| 775 return false; | 774 return false; |
| 776 } | 775 } |
| 777 | 776 |
| 778 void VisitExternalResources(v8::ExternalResourceVisitor* visitor); | 777 void VisitExternalResources(v8::ExternalResourceVisitor* visitor); |
| 779 | 778 |
| 779 inline PromotionMode CurrentPromotionMode(); | |
|
ulan
2016/05/30 14:07:28
Not used anymore?
| |
| 780 | |
| 780 // An object should be promoted if the object has survived a | 781 // An object should be promoted if the object has survived a |
| 781 // scavenge operation. | 782 // scavenge operation. |
| 783 template <PromotionMode promotion_mode> | |
| 782 inline bool ShouldBePromoted(Address old_address, int object_size); | 784 inline bool ShouldBePromoted(Address old_address, int object_size); |
| 783 | 785 |
| 784 void ClearNormalizedMapCaches(); | 786 void ClearNormalizedMapCaches(); |
| 785 | 787 |
| 786 void IncrementDeferredCount(v8::Isolate::UseCounterFeature feature); | 788 void IncrementDeferredCount(v8::Isolate::UseCounterFeature feature); |
| 787 | 789 |
| 788 inline bool OldGenerationAllocationLimitReached(); | 790 inline bool OldGenerationAllocationLimitReached(); |
| 789 | 791 |
| 790 // Completely clear the Instanceof cache (to stop it keeping objects alive | 792 // Completely clear the Instanceof cache (to stop it keeping objects alive |
| 791 // around a GC). | 793 // around a GC). |
| (...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1691 // Performs a major collection in the whole heap. | 1693 // Performs a major collection in the whole heap. |
| 1692 void MarkCompact(); | 1694 void MarkCompact(); |
| 1693 | 1695 |
| 1694 // Code to be run before and after mark-compact. | 1696 // Code to be run before and after mark-compact. |
| 1695 void MarkCompactPrologue(); | 1697 void MarkCompactPrologue(); |
| 1696 void MarkCompactEpilogue(); | 1698 void MarkCompactEpilogue(); |
| 1697 | 1699 |
| 1698 // Performs a minor collection in new generation. | 1700 // Performs a minor collection in new generation. |
| 1699 void Scavenge(); | 1701 void Scavenge(); |
| 1700 | 1702 |
| 1703 template <PromotionMode promotion_mode> | |
| 1704 void Scavenge(); | |
| 1705 | |
| 1706 template <PromotionMode promotion_mode> | |
| 1701 Address DoScavenge(ObjectVisitor* scavenge_visitor, Address new_space_front); | 1707 Address DoScavenge(ObjectVisitor* scavenge_visitor, Address new_space_front); |
| 1702 | 1708 |
| 1703 void UpdateNewSpaceReferencesInExternalStringTable( | 1709 void UpdateNewSpaceReferencesInExternalStringTable( |
| 1704 ExternalStringTableUpdaterCallback updater_func); | 1710 ExternalStringTableUpdaterCallback updater_func); |
| 1705 | 1711 |
| 1706 void UpdateReferencesInExternalStringTable( | 1712 void UpdateReferencesInExternalStringTable( |
| 1707 ExternalStringTableUpdaterCallback updater_func); | 1713 ExternalStringTableUpdaterCallback updater_func); |
| 1708 | 1714 |
| 1709 void ProcessAllWeakReferences(WeakObjectRetainer* retainer); | 1715 void ProcessAllWeakReferences(WeakObjectRetainer* retainer); |
| 1710 void ProcessYoungWeakReferences(WeakObjectRetainer* retainer); | 1716 void ProcessYoungWeakReferences(WeakObjectRetainer* retainer); |
| (...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2659 friend class LargeObjectSpace; | 2665 friend class LargeObjectSpace; |
| 2660 friend class NewSpace; | 2666 friend class NewSpace; |
| 2661 friend class PagedSpace; | 2667 friend class PagedSpace; |
| 2662 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); | 2668 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); |
| 2663 }; | 2669 }; |
| 2664 | 2670 |
| 2665 } // namespace internal | 2671 } // namespace internal |
| 2666 } // namespace v8 | 2672 } // namespace v8 |
| 2667 | 2673 |
| 2668 #endif // V8_HEAP_HEAP_H_ | 2674 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |