Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: src/heap/heap.h

Issue 2026463002: Reland "[heap] Fine-grained JSArrayBuffer tracking" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: make ArrayBufferTracker AllStatic Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/array-buffer-tracker-inl.h ('k') | src/heap/heap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
823 void DeoptMarkedAllocationSites(); 833 void DeoptMarkedAllocationSites();
824 834
825 bool DeoptMaybeTenuredAllocationSites() { 835 bool DeoptMaybeTenuredAllocationSites() {
826 return new_space_.IsAtMaximumCapacity() && maximum_size_scavenges_ == 0; 836 return new_space_.IsAtMaximumCapacity() && maximum_size_scavenges_ == 0;
827 } 837 }
828 838
829 void AddWeakObjectToCodeDependency(Handle<HeapObject> obj, 839 void AddWeakObjectToCodeDependency(Handle<HeapObject> obj,
830 Handle<DependentCode> dep); 840 Handle<DependentCode> dep);
831 841
832 DependentCode* LookupWeakObjectToCodeDependency(Handle<HeapObject> obj); 842 DependentCode* LookupWeakObjectToCodeDependency(Handle<HeapObject> obj);
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 int allocation_size, 1357 int allocation_size,
1348 AllocationAlignment alignment); 1358 AllocationAlignment alignment);
1349 1359
1350 // =========================================================================== 1360 // ===========================================================================
1351 // ArrayBuffer tracking. ===================================================== 1361 // ArrayBuffer tracking. =====================================================
1352 // =========================================================================== 1362 // ===========================================================================
1353 1363
1354 void RegisterNewArrayBuffer(JSArrayBuffer* buffer); 1364 void RegisterNewArrayBuffer(JSArrayBuffer* buffer);
1355 void UnregisterArrayBuffer(JSArrayBuffer* buffer); 1365 void UnregisterArrayBuffer(JSArrayBuffer* buffer);
1356 1366
1357 inline ArrayBufferTracker* array_buffer_tracker() {
1358 return array_buffer_tracker_;
1359 }
1360
1361 // =========================================================================== 1367 // ===========================================================================
1362 // Allocation site tracking. ================================================= 1368 // Allocation site tracking. =================================================
1363 // =========================================================================== 1369 // ===========================================================================
1364 1370
1365 // Updates the AllocationSite of a given {object}. If the global prenuring 1371 // Updates the AllocationSite of a given {object}. If the global prenuring
1366 // storage is passed as {pretenuring_feedback} the memento found count on 1372 // storage is passed as {pretenuring_feedback} the memento found count on
1367 // the corresponding allocation site is immediately updated and an entry 1373 // the corresponding allocation site is immediately updated and an entry
1368 // in the hash map is created. Otherwise the entry (including a the count 1374 // in the hash map is created. Otherwise the entry (including a the count
1369 // value) is cached on the local pretenuring feedback. 1375 // value) is cached on the local pretenuring feedback.
1370 template <UpdateAllocationSiteMode mode> 1376 template <UpdateAllocationSiteMode mode>
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1987 1993
1988 void set_force_oom(bool value) { force_oom_ = value; } 1994 void set_force_oom(bool value) { force_oom_ = value; }
1989 1995
1990 // The amount of external memory registered through the API kept alive 1996 // The amount of external memory registered through the API kept alive
1991 // by global handles 1997 // by global handles
1992 int64_t amount_of_external_allocated_memory_; 1998 int64_t amount_of_external_allocated_memory_;
1993 1999
1994 // Caches the amount of external memory registered at the last global gc. 2000 // Caches the amount of external memory registered at the last global gc.
1995 int64_t amount_of_external_allocated_memory_at_last_global_gc_; 2001 int64_t amount_of_external_allocated_memory_at_last_global_gc_;
1996 2002
2003 base::AtomicNumber<intptr_t> amount_of_external_allocated_memory_freed_;
2004
1997 // This can be calculated directly from a pointer to the heap; however, it is 2005 // This can be calculated directly from a pointer to the heap; however, it is
1998 // more expedient to get at the isolate directly from within Heap methods. 2006 // more expedient to get at the isolate directly from within Heap methods.
1999 Isolate* isolate_; 2007 Isolate* isolate_;
2000 2008
2001 Object* roots_[kRootListLength]; 2009 Object* roots_[kRootListLength];
2002 2010
2003 size_t code_range_size_; 2011 size_t code_range_size_;
2004 int max_semi_space_size_; 2012 int max_semi_space_size_;
2005 int initial_semispace_size_; 2013 int initial_semispace_size_;
2006 intptr_t max_old_generation_size_; 2014 intptr_t max_old_generation_size_;
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
2225 ExternalStringTable external_string_table_; 2233 ExternalStringTable external_string_table_;
2226 2234
2227 base::Mutex relocation_mutex_; 2235 base::Mutex relocation_mutex_;
2228 2236
2229 int gc_callbacks_depth_; 2237 int gc_callbacks_depth_;
2230 2238
2231 bool deserialization_complete_; 2239 bool deserialization_complete_;
2232 2240
2233 StrongRootsList* strong_roots_list_; 2241 StrongRootsList* strong_roots_list_;
2234 2242
2235 ArrayBufferTracker* array_buffer_tracker_;
2236
2237 // The depth of HeapIterator nestings. 2243 // The depth of HeapIterator nestings.
2238 int heap_iterator_depth_; 2244 int heap_iterator_depth_;
2239 2245
2240 // Used for testing purposes. 2246 // Used for testing purposes.
2241 bool force_oom_; 2247 bool force_oom_;
2242 2248
2243 // Classes in "heap" can be friends. 2249 // Classes in "heap" can be friends.
2244 friend class AlwaysAllocateScope; 2250 friend class AlwaysAllocateScope;
2245 friend class GCCallbacksScope; 2251 friend class GCCallbacksScope;
2246 friend class GCTracer; 2252 friend class GCTracer;
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_
OLDNEW
« no previous file with comments | « src/heap/array-buffer-tracker-inl.h ('k') | src/heap/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698