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

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

Issue 2210263002: [heap] Improve size profiling for ArrayBuffer tracking (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Added tests and some more fixes Created 4 years, 4 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
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 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 // disposal. We use it to flush inline caches. 838 // disposal. We use it to flush inline caches.
839 int global_ic_age() { return global_ic_age_; } 839 int global_ic_age() { return global_ic_age_; }
840 840
841 void AgeInlineCaches() { 841 void AgeInlineCaches() {
842 global_ic_age_ = (global_ic_age_ + 1) & SharedFunctionInfo::ICAgeBits::kMax; 842 global_ic_age_ = (global_ic_age_ + 1) & SharedFunctionInfo::ICAgeBits::kMax;
843 } 843 }
844 844
845 int64_t external_memory() { return external_memory_; } 845 int64_t external_memory() { return external_memory_; }
846 void update_external_memory(int64_t delta) { external_memory_ += delta; } 846 void update_external_memory(int64_t delta) { external_memory_ += delta; }
847 847
848 void update_external_memory_concurrently_freed(intptr_t freed) {
849 external_memory_concurrently_freed_.Increment(freed);
850 }
851
852 void account_external_memory_concurrently_freed() {
853 external_memory_ -= external_memory_concurrently_freed_.Value();
854 external_memory_concurrently_freed_.SetValue(0);
855 }
856
857 void DeoptMarkedAllocationSites(); 848 void DeoptMarkedAllocationSites();
858 849
859 bool DeoptMaybeTenuredAllocationSites() { 850 bool DeoptMaybeTenuredAllocationSites() {
860 return new_space_.IsAtMaximumCapacity() && maximum_size_scavenges_ == 0; 851 return new_space_.IsAtMaximumCapacity() && maximum_size_scavenges_ == 0;
861 } 852 }
862 853
863 void AddWeakNewSpaceObjectToCodeDependency(Handle<HeapObject> obj, 854 void AddWeakNewSpaceObjectToCodeDependency(Handle<HeapObject> obj,
864 Handle<WeakCell> code); 855 Handle<WeakCell> code);
865 856
866 void AddWeakObjectToCodeDependency(Handle<HeapObject> obj, 857 void AddWeakObjectToCodeDependency(Handle<HeapObject> obj,
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
1417 inline void RemoveAllocationSitePretenuringFeedback(AllocationSite* site); 1408 inline void RemoveAllocationSitePretenuringFeedback(AllocationSite* site);
1418 1409
1419 // Merges local pretenuring feedback into the global one. Note that this 1410 // Merges local pretenuring feedback into the global one. Note that this
1420 // method needs to be called after evacuation, as allocation sites may be 1411 // method needs to be called after evacuation, as allocation sites may be
1421 // evacuated and this method resolves forward pointers accordingly. 1412 // evacuated and this method resolves forward pointers accordingly.
1422 void MergeAllocationSitePretenuringFeedback( 1413 void MergeAllocationSitePretenuringFeedback(
1423 const base::HashMap& local_pretenuring_feedback); 1414 const base::HashMap& local_pretenuring_feedback);
1424 1415
1425 // ============================================================================= 1416 // =============================================================================
1426 1417
1418 ArrayBufferTracker* array_buffer_tracker() { return array_buffer_tracker_; }
Hannes Payer (out of office) 2016/08/05 12:14:13 Move this one to the ArrayBuffer tracking section.
Michael Lippautz 2016/08/08 08:34:46 Done.
1419
1427 #ifdef VERIFY_HEAP 1420 #ifdef VERIFY_HEAP
1428 // Verify the heap is in its normal state before or after a GC. 1421 // Verify the heap is in its normal state before or after a GC.
1429 void Verify(); 1422 void Verify();
1430 #endif 1423 #endif
1431 1424
1432 #ifdef DEBUG 1425 #ifdef DEBUG
1433 void set_allocation_timeout(int timeout) { allocation_timeout_ = timeout; } 1426 void set_allocation_timeout(int timeout) { allocation_timeout_ = timeout; }
1434 1427
1435 void TracePathToObjectFrom(Object* target, Object* root); 1428 void TracePathToObjectFrom(Object* target, Object* root);
1436 void TracePathToObject(Object* target); 1429 void TracePathToObject(Object* target);
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
2024 2017
2025 // The amount of external memory registered through the API. 2018 // The amount of external memory registered through the API.
2026 int64_t external_memory_; 2019 int64_t external_memory_;
2027 2020
2028 // The limit when to trigger memory pressure from the API. 2021 // The limit when to trigger memory pressure from the API.
2029 int64_t external_memory_limit_; 2022 int64_t external_memory_limit_;
2030 2023
2031 // Caches the amount of external memory registered at the last MC. 2024 // Caches the amount of external memory registered at the last MC.
2032 int64_t external_memory_at_last_mark_compact_; 2025 int64_t external_memory_at_last_mark_compact_;
2033 2026
2034 // The amount of memory that has been freed concurrently.
2035 base::AtomicNumber<intptr_t> external_memory_concurrently_freed_;
2036
2037 // This can be calculated directly from a pointer to the heap; however, it is 2027 // This can be calculated directly from a pointer to the heap; however, it is
2038 // more expedient to get at the isolate directly from within Heap methods. 2028 // more expedient to get at the isolate directly from within Heap methods.
2039 Isolate* isolate_; 2029 Isolate* isolate_;
2040 2030
2041 Object* roots_[kRootListLength]; 2031 Object* roots_[kRootListLength];
2042 2032
2043 size_t code_range_size_; 2033 size_t code_range_size_;
2044 int max_semi_space_size_; 2034 int max_semi_space_size_;
2045 int initial_semispace_size_; 2035 int initial_semispace_size_;
2046 intptr_t max_old_generation_size_; 2036 intptr_t max_old_generation_size_;
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
2272 bool deserialization_complete_; 2262 bool deserialization_complete_;
2273 2263
2274 StrongRootsList* strong_roots_list_; 2264 StrongRootsList* strong_roots_list_;
2275 2265
2276 // The depth of HeapIterator nestings. 2266 // The depth of HeapIterator nestings.
2277 int heap_iterator_depth_; 2267 int heap_iterator_depth_;
2278 2268
2279 // Used for testing purposes. 2269 // Used for testing purposes.
2280 bool force_oom_; 2270 bool force_oom_;
2281 2271
2272 ArrayBufferTracker* array_buffer_tracker_;
Hannes Payer (out of office) 2016/08/05 12:14:14 We usually add comments to all variables in heap.h
Michael Lippautz 2016/08/08 08:34:46 That's not really true, but done ;)
2273
2282 // Classes in "heap" can be friends. 2274 // Classes in "heap" can be friends.
2283 friend class AlwaysAllocateScope; 2275 friend class AlwaysAllocateScope;
2284 friend class GCCallbacksScope; 2276 friend class GCCallbacksScope;
2285 friend class GCTracer; 2277 friend class GCTracer;
2286 friend class HeapIterator; 2278 friend class HeapIterator;
2287 friend class IdleScavengeObserver; 2279 friend class IdleScavengeObserver;
2288 friend class IncrementalMarking; 2280 friend class IncrementalMarking;
2289 friend class IteratePromotedObjectsVisitor; 2281 friend class IteratePromotedObjectsVisitor;
2290 friend class MarkCompactCollector; 2282 friend class MarkCompactCollector;
2291 friend class MarkCompactMarkingVisitor; 2283 friend class MarkCompactMarkingVisitor;
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
2698 friend class LargeObjectSpace; 2690 friend class LargeObjectSpace;
2699 friend class NewSpace; 2691 friend class NewSpace;
2700 friend class PagedSpace; 2692 friend class PagedSpace;
2701 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); 2693 DISALLOW_COPY_AND_ASSIGN(AllocationObserver);
2702 }; 2694 };
2703 2695
2704 } // namespace internal 2696 } // namespace internal
2705 } // namespace v8 2697 } // namespace v8
2706 2698
2707 #endif // V8_HEAP_HEAP_H_ 2699 #endif // V8_HEAP_HEAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698