5#ifndef V8_OBJECTS_OFF_HEAP_HASH_TABLE_H_
6#define V8_OBJECTS_OFF_HEAP_HASH_TABLE_H_
67template <
typename Derived>
87 template <
typename... Args>
89 Derived* derived_this =
static_cast<Derived*
>(
this);
95 derived_this->Set(entry, std::forward<Args>(
args)...);
99 template <
typename... Args>
102 Derived* derived_this =
static_cast<Derived*
>(
this);
109 derived_this->Set(entry, std::forward<Args>(
args)...);
124 template <
typename IsolateT,
typename FindKey>
126 uint32_t hash)
const;
129 uint32_t hash)
const;
131 template <
typename IsolateT,
typename FindKey>
133 uint32_t hash)
const;
152 return InternalIndex((last.as_uint32() + number) & (size - 1));
158 number_of_additional_elements);
162 int number_of_additional_elements);
165 int at_least_space_for);
170 return (capacity *
sizeof(
Tagged_t) * Derived::kEntrySize) -
177 template <
typename Container,
size_t OffsetOfElementsInContainer>
178 static inline void*
Allocate(
int capacity);
180 static inline void Free(
void* container);
InternalIndex FindEntryOrInsertionEntry(IsolateT *isolate, FindKey key, uint32_t hash) const
static void * Allocate(int capacity)
int number_of_elements() const
InternalIndex FindEntry(IsolateT *isolate, FindKey key, uint32_t hash) const
static size_t GetSizeExcludingHeader(int capacity)
void RehashInto(PtrComprCageBase cage_base, Derived *new_table)
OffHeapHashTableBase(int capacity)
static constexpr Tagged< Smi > deleted_element()
bool HasSufficientCapacityToAdd(int number_of_additional_elements) const
void ElementsRemoved(int count)
void AddAt(PtrComprCageBase cage_base, InternalIndex entry, Args &&... args)
static void Free(void *container)
int number_of_deleted_elements_
void OverwriteDeletedAt(PtrComprCageBase cage_base, InternalIndex entry, Args &&... args)
bool ShouldResizeToAdd(int number_of_additional_elements, int *new_capacity)
size_t GetSizeExcludingHeader() const
void IterateElements(Root root, RootVisitor *visitor)
static int ComputeCapacity(int at_least_space_for)
static InternalIndex FirstProbe(uint32_t hash, uint32_t size)
static int ComputeCapacityWithShrink(int current_capacity, int at_least_space_for)
static InternalIndex NextProbe(InternalIndex last, uint32_t number, uint32_t size)
OffHeapObjectSlot slot(InternalIndex index, int offset=0) const
static bool IsKey(Tagged< Object > k)
static constexpr Tagged< Smi > empty_element()
InternalIndex FindInsertionEntry(PtrComprCageBase cage_base, uint32_t hash) const
int number_of_deleted_elements() const
static constexpr Tagged< Smi > FromInt(int value)
base::Vector< const DirectHandle< Object > > args
SlotTraits::TOffHeapObjectSlot OffHeapObjectSlot
#define DCHECK_LE(v1, v2)
#define DCHECK(condition)
#define DCHECK_LT(v1, v2)
#define DCHECK_EQ(v1, v2)