diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-12 14:27:29 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-13 09:35:20 +0000 |
commit | c30a6232df03e1efbd9f3b226777b07e087a1122 (patch) | |
tree | e992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/v8/src/zone/accounting-allocator.h | |
parent | 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff) | |
download | qtwebengine-chromium-85-based.tar.gz |
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/v8/src/zone/accounting-allocator.h')
-rw-r--r-- | chromium/v8/src/zone/accounting-allocator.h | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/chromium/v8/src/zone/accounting-allocator.h b/chromium/v8/src/zone/accounting-allocator.h index 69a649e75ea..bd2590df35d 100644 --- a/chromium/v8/src/zone/accounting-allocator.h +++ b/chromium/v8/src/zone/accounting-allocator.h @@ -8,6 +8,7 @@ #include <atomic> #include "src/base/macros.h" +#include "src/logging/tracing-flags.h" namespace v8 { namespace internal { @@ -21,11 +22,11 @@ class V8_EXPORT_PRIVATE AccountingAllocator { virtual ~AccountingAllocator(); // Allocates a new segment. Returns nullptr on failed allocation. - virtual Segment* AllocateSegment(size_t bytes); + Segment* AllocateSegment(size_t bytes); // Return unneeded segments to either insert them into the pool or release // them if the pool is already full or memory pressure is high. - virtual void ReturnSegment(Segment* memory); + void ReturnSegment(Segment* memory); size_t GetCurrentMemoryUsage() const { return current_memory_usage_.load(std::memory_order_relaxed); @@ -35,8 +36,25 @@ class V8_EXPORT_PRIVATE AccountingAllocator { return max_memory_usage_.load(std::memory_order_relaxed); } - virtual void ZoneCreation(const Zone* zone) {} - virtual void ZoneDestruction(const Zone* zone) {} + void TraceZoneCreation(const Zone* zone) { + if (V8_LIKELY(!TracingFlags::is_zone_stats_enabled())) return; + TraceZoneCreationImpl(zone); + } + + void TraceZoneDestruction(const Zone* zone) { + if (V8_LIKELY(!TracingFlags::is_zone_stats_enabled())) return; + TraceZoneDestructionImpl(zone); + } + + void TraceAllocateSegment(Segment* segment) { + if (V8_LIKELY(!TracingFlags::is_zone_stats_enabled())) return; + TraceAllocateSegmentImpl(segment); + } + + protected: + virtual void TraceZoneCreationImpl(const Zone* zone) {} + virtual void TraceZoneDestructionImpl(const Zone* zone) {} + virtual void TraceAllocateSegmentImpl(Segment* segment) {} private: std::atomic<size_t> current_memory_usage_{0}; |