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