| 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 { 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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 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 | 
| 780   // An object should be promoted if the object has survived a | 779   // An object should be promoted if the object has survived a | 
| 781   // scavenge operation. | 780   // scavenge operation. | 
|  | 781   template <PromotionMode promotion_mode> | 
| 782   inline bool ShouldBePromoted(Address old_address, int object_size); | 782   inline bool ShouldBePromoted(Address old_address, int object_size); | 
| 783 | 783 | 
|  | 784   inline PromotionMode CurrentPromotionMode(); | 
|  | 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). | 
| 792   inline void CompletelyClearInstanceofCache(); | 794   inline void CompletelyClearInstanceofCache(); | 
| 793 | 795 | 
| (...skipping 897 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 | 
| 1701   Address DoScavenge(ObjectVisitor* scavenge_visitor, Address new_space_front); | 1703   Address DoScavenge(ObjectVisitor* scavenge_visitor, Address new_space_front, | 
|  | 1704                      PromotionMode promotion_mode); | 
| 1702 | 1705 | 
| 1703   void UpdateNewSpaceReferencesInExternalStringTable( | 1706   void UpdateNewSpaceReferencesInExternalStringTable( | 
| 1704       ExternalStringTableUpdaterCallback updater_func); | 1707       ExternalStringTableUpdaterCallback updater_func); | 
| 1705 | 1708 | 
| 1706   void UpdateReferencesInExternalStringTable( | 1709   void UpdateReferencesInExternalStringTable( | 
| 1707       ExternalStringTableUpdaterCallback updater_func); | 1710       ExternalStringTableUpdaterCallback updater_func); | 
| 1708 | 1711 | 
| 1709   void ProcessAllWeakReferences(WeakObjectRetainer* retainer); | 1712   void ProcessAllWeakReferences(WeakObjectRetainer* retainer); | 
| 1710   void ProcessYoungWeakReferences(WeakObjectRetainer* retainer); | 1713   void ProcessYoungWeakReferences(WeakObjectRetainer* retainer); | 
| 1711   void ProcessNativeContexts(WeakObjectRetainer* retainer); | 1714   void ProcessNativeContexts(WeakObjectRetainer* retainer); | 
| (...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2659   friend class LargeObjectSpace; | 2662   friend class LargeObjectSpace; | 
| 2660   friend class NewSpace; | 2663   friend class NewSpace; | 
| 2661   friend class PagedSpace; | 2664   friend class PagedSpace; | 
| 2662   DISALLOW_COPY_AND_ASSIGN(AllocationObserver); | 2665   DISALLOW_COPY_AND_ASSIGN(AllocationObserver); | 
| 2663 }; | 2666 }; | 
| 2664 | 2667 | 
| 2665 }  // namespace internal | 2668 }  // namespace internal | 
| 2666 }  // namespace v8 | 2669 }  // namespace v8 | 
| 2667 | 2670 | 
| 2668 #endif  // V8_HEAP_HEAP_H_ | 2671 #endif  // V8_HEAP_HEAP_H_ | 
| OLD | NEW | 
|---|