5#ifndef V8_ZONE_ACCOUNTING_ALLOCATOR_H_
6#define V8_ZONE_ACCOUNTING_ALLOCATOR_H_
18class BoundedPageAllocator;
35 Segment* AllocateSegment(
size_t bytes,
bool supports_compression);
39 void ReturnSegment(
Segment* memory,
bool supports_compression);
42 return current_memory_usage_.load(std::memory_order_relaxed);
46 return max_memory_usage_.load(std::memory_order_relaxed);
50 if (
V8_LIKELY(!TracingFlags::is_zone_stats_enabled()))
return;
51 TraceZoneCreationImpl(zone);
55 if (
V8_LIKELY(!TracingFlags::is_zone_stats_enabled()))
return;
56 TraceZoneDestructionImpl(zone);
60 if (
V8_LIKELY(!TracingFlags::is_zone_stats_enabled()))
return;
61 TraceAllocateSegmentImpl(segment);
70 std::atomic<size_t> current_memory_usage_{0};
71 std::atomic<size_t> max_memory_usage_{0};
AccountingAllocator(const AccountingAllocator &)=delete
virtual void TraceZoneDestructionImpl(const Zone *zone)
virtual void TraceAllocateSegmentImpl(Segment *segment)
virtual void TraceZoneCreationImpl(const Zone *zone)
std::unique_ptr< base::BoundedPageAllocator > bounded_page_allocator_
void TraceZoneDestruction(const Zone *zone)
void TraceAllocateSegment(Segment *segment)
virtual ~AccountingAllocator()
void TraceZoneCreation(const Zone *zone)
size_t GetCurrentMemoryUsage() const
AccountingAllocator & operator=(const AccountingAllocator &)=delete
size_t GetMaxMemoryUsage() const
std::unique_ptr< VirtualMemory > reserved_area_
#define V8_EXPORT_PRIVATE
#define V8_LIKELY(condition)