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