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 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 } | 813 } |
814 | 814 |
815 int64_t amount_of_external_allocated_memory() { | 815 int64_t amount_of_external_allocated_memory() { |
816 return amount_of_external_allocated_memory_; | 816 return amount_of_external_allocated_memory_; |
817 } | 817 } |
818 | 818 |
819 void update_amount_of_external_allocated_memory(int64_t delta) { | 819 void update_amount_of_external_allocated_memory(int64_t delta) { |
820 amount_of_external_allocated_memory_ += delta; | 820 amount_of_external_allocated_memory_ += delta; |
821 } | 821 } |
822 | 822 |
823 void update_amount_of_external_allocated_freed_memory(intptr_t freed) { | |
824 amount_of_external_allocated_memory_freed_.Increment(freed); | |
825 } | |
826 | |
827 void account_amount_of_external_allocated_freed_memory() { | |
828 amount_of_external_allocated_memory_ -= | |
829 amount_of_external_allocated_memory_freed_.Value(); | |
830 amount_of_external_allocated_memory_freed_.SetValue(0); | |
831 } | |
832 | |
833 void DeoptMarkedAllocationSites(); | 823 void DeoptMarkedAllocationSites(); |
834 | 824 |
835 bool DeoptMaybeTenuredAllocationSites() { | 825 bool DeoptMaybeTenuredAllocationSites() { |
836 return new_space_.IsAtMaximumCapacity() && maximum_size_scavenges_ == 0; | 826 return new_space_.IsAtMaximumCapacity() && maximum_size_scavenges_ == 0; |
837 } | 827 } |
838 | 828 |
839 void AddWeakObjectToCodeDependency(Handle<HeapObject> obj, | 829 void AddWeakObjectToCodeDependency(Handle<HeapObject> obj, |
840 Handle<DependentCode> dep); | 830 Handle<DependentCode> dep); |
841 | 831 |
842 DependentCode* LookupWeakObjectToCodeDependency(Handle<HeapObject> obj); | 832 DependentCode* LookupWeakObjectToCodeDependency(Handle<HeapObject> obj); |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1357 int allocation_size, | 1347 int allocation_size, |
1358 AllocationAlignment alignment); | 1348 AllocationAlignment alignment); |
1359 | 1349 |
1360 // =========================================================================== | 1350 // =========================================================================== |
1361 // ArrayBuffer tracking. ===================================================== | 1351 // ArrayBuffer tracking. ===================================================== |
1362 // =========================================================================== | 1352 // =========================================================================== |
1363 | 1353 |
1364 void RegisterNewArrayBuffer(JSArrayBuffer* buffer); | 1354 void RegisterNewArrayBuffer(JSArrayBuffer* buffer); |
1365 void UnregisterArrayBuffer(JSArrayBuffer* buffer); | 1355 void UnregisterArrayBuffer(JSArrayBuffer* buffer); |
1366 | 1356 |
| 1357 inline ArrayBufferTracker* array_buffer_tracker() { |
| 1358 return array_buffer_tracker_; |
| 1359 } |
| 1360 |
1367 // =========================================================================== | 1361 // =========================================================================== |
1368 // Allocation site tracking. ================================================= | 1362 // Allocation site tracking. ================================================= |
1369 // =========================================================================== | 1363 // =========================================================================== |
1370 | 1364 |
1371 // Updates the AllocationSite of a given {object}. If the global prenuring | 1365 // Updates the AllocationSite of a given {object}. If the global prenuring |
1372 // storage is passed as {pretenuring_feedback} the memento found count on | 1366 // storage is passed as {pretenuring_feedback} the memento found count on |
1373 // the corresponding allocation site is immediately updated and an entry | 1367 // the corresponding allocation site is immediately updated and an entry |
1374 // in the hash map is created. Otherwise the entry (including a the count | 1368 // in the hash map is created. Otherwise the entry (including a the count |
1375 // value) is cached on the local pretenuring feedback. | 1369 // value) is cached on the local pretenuring feedback. |
1376 template <UpdateAllocationSiteMode mode> | 1370 template <UpdateAllocationSiteMode mode> |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1993 | 1987 |
1994 void set_force_oom(bool value) { force_oom_ = value; } | 1988 void set_force_oom(bool value) { force_oom_ = value; } |
1995 | 1989 |
1996 // The amount of external memory registered through the API kept alive | 1990 // The amount of external memory registered through the API kept alive |
1997 // by global handles | 1991 // by global handles |
1998 int64_t amount_of_external_allocated_memory_; | 1992 int64_t amount_of_external_allocated_memory_; |
1999 | 1993 |
2000 // Caches the amount of external memory registered at the last global gc. | 1994 // Caches the amount of external memory registered at the last global gc. |
2001 int64_t amount_of_external_allocated_memory_at_last_global_gc_; | 1995 int64_t amount_of_external_allocated_memory_at_last_global_gc_; |
2002 | 1996 |
2003 base::AtomicNumber<intptr_t> amount_of_external_allocated_memory_freed_; | |
2004 | |
2005 // This can be calculated directly from a pointer to the heap; however, it is | 1997 // This can be calculated directly from a pointer to the heap; however, it is |
2006 // more expedient to get at the isolate directly from within Heap methods. | 1998 // more expedient to get at the isolate directly from within Heap methods. |
2007 Isolate* isolate_; | 1999 Isolate* isolate_; |
2008 | 2000 |
2009 Object* roots_[kRootListLength]; | 2001 Object* roots_[kRootListLength]; |
2010 | 2002 |
2011 size_t code_range_size_; | 2003 size_t code_range_size_; |
2012 int max_semi_space_size_; | 2004 int max_semi_space_size_; |
2013 int initial_semispace_size_; | 2005 int initial_semispace_size_; |
2014 intptr_t max_old_generation_size_; | 2006 intptr_t max_old_generation_size_; |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2233 ExternalStringTable external_string_table_; | 2225 ExternalStringTable external_string_table_; |
2234 | 2226 |
2235 base::Mutex relocation_mutex_; | 2227 base::Mutex relocation_mutex_; |
2236 | 2228 |
2237 int gc_callbacks_depth_; | 2229 int gc_callbacks_depth_; |
2238 | 2230 |
2239 bool deserialization_complete_; | 2231 bool deserialization_complete_; |
2240 | 2232 |
2241 StrongRootsList* strong_roots_list_; | 2233 StrongRootsList* strong_roots_list_; |
2242 | 2234 |
| 2235 ArrayBufferTracker* array_buffer_tracker_; |
| 2236 |
2243 // The depth of HeapIterator nestings. | 2237 // The depth of HeapIterator nestings. |
2244 int heap_iterator_depth_; | 2238 int heap_iterator_depth_; |
2245 | 2239 |
2246 // Used for testing purposes. | 2240 // Used for testing purposes. |
2247 bool force_oom_; | 2241 bool force_oom_; |
2248 | 2242 |
2249 // Classes in "heap" can be friends. | 2243 // Classes in "heap" can be friends. |
2250 friend class AlwaysAllocateScope; | 2244 friend class AlwaysAllocateScope; |
2251 friend class GCCallbacksScope; | 2245 friend class GCCallbacksScope; |
2252 friend class GCTracer; | 2246 friend class GCTracer; |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2665 friend class LargeObjectSpace; | 2659 friend class LargeObjectSpace; |
2666 friend class NewSpace; | 2660 friend class NewSpace; |
2667 friend class PagedSpace; | 2661 friend class PagedSpace; |
2668 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); | 2662 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); |
2669 }; | 2663 }; |
2670 | 2664 |
2671 } // namespace internal | 2665 } // namespace internal |
2672 } // namespace v8 | 2666 } // namespace v8 |
2673 | 2667 |
2674 #endif // V8_HEAP_HEAP_H_ | 2668 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |