5#ifndef V8_HEAP_CPPGC_CAGED_HEAP_H_
6#define V8_HEAP_CPPGC_CAGED_HEAP_H_
29 template <
typename RetType = u
intptr_t>
31 static_assert(std::numeric_limits<RetType>::max() >=
32 (api_constants::kCagedHeapMaxReservationSize - 1),
33 "The return type should be large enough");
34 return reinterpret_cast<uintptr_t
>(address) &
35 (api_constants::kCagedHeapReservationAlignment - 1);
39 return reinterpret_cast<uintptr_t
>(address) &
40 ~(api_constants::kCagedHeapReservationAlignment - 1);
43 static void InitializeIfNeeded(
PageAllocator& platform_allocator,
44 size_t desired_heap_size);
46 static void CommitAgeTable(
PageAllocator& platform_allocator);
55 return *page_bounded_allocator_;
60 reinterpret_cast<void*
>(CagedHeapBase::GetBase()));
61 return reinterpret_cast<void*
>(BaseFromAddress(address)) ==
62 reserved_area_.address();
65 void*
base()
const {
return reserved_area_.address(); }
69 friend class testing::TestWithHeap;
72 size_t desired_heap_size);
CagedHeap & operator=(const CagedHeap &)=delete
std::unique_ptr< AllocatorType > page_bounded_allocator_
AllocatorType & page_allocator()
bool IsOnHeap(const void *address) const
CagedHeap(const CagedHeap &)=delete
const AllocatorType & page_allocator() const
static uintptr_t BaseFromAddress(const void *address)
static CagedHeap * instance_
const VirtualMemory reserved_area_
static RetType OffsetFromAddress(const void *address)
#define DCHECK_EQ(v1, v2)
#define V8_EXPORT_PRIVATE