5#ifndef INCLUDE_CPPGC_INTERNAL_CAGED_HEAP_LOCAL_DATA_H_
6#define INCLUDE_CPPGC_INTERNAL_CAGED_HEAP_LOCAL_DATA_H_
22#if defined(CPPGC_YOUNG_GENERATION)
29 static constexpr size_t kRequiredSize = 1 * api_constants::kMB;
31 api_constants::kAllocationGranularity;
34 enum class Age : uint8_t { kOld, kYoung, kMixed };
36 static constexpr size_t kCardSizeInBytes =
40 void SetAge(uintptr_t cage_offset, Age age) {
41 table_[card(cage_offset)] = age;
43 V8_INLINE Age GetAge(uintptr_t cage_offset)
const {
44 return table_[card(cage_offset)];
47 void Reset(PageAllocator* allocator);
50 V8_INLINE size_t card(uintptr_t offset)
const {
51 constexpr size_t kGranularityBits =
52 __builtin_ctz(
static_cast<uint32_t
>(kCardSizeInBytes));
53 const size_t entry = offset >> kGranularityBits;
58 std::array<Age, kRequiredSize> table_;
62 "Size of AgeTable is 1MB");
71#if defined(CPPGC_YOUNG_GENERATION)
#define CPPGC_DCHECK(condition)
constexpr size_t kAllocationGranularity
CagedHeapLocalData(HeapBase &, PageAllocator &)
bool is_incremental_marking_in_progress