51 uint32_t hash)
const {
55 if (
keys_[index] == address)
return {
index,
true};
56 if (
keys_[index] == not_mapped)
return {
index,
false};
58 for (
int index = 0; index <
start; index++) {
59 if (
keys_[index] == address)
return {
index,
true};
60 if (
keys_[index] == not_mapped)
return {
index,
false};
86 if (
keys_[index] == address)
return {
index,
true};
87 if (
keys_[index] == not_mapped) {
91 return {
index,
false};
93 index = (index + 1) &
mask_;
101 if (deleted_value !=
nullptr) *deleted_value =
values_[
index];
116 int next_index =
index;
118 next_index = (next_index + 1) &
mask_;
120 if (
key == not_mapped)
break;
123 if (index < next_index) {
124 if (index < expected_index && expected_index <= next_index)
continue;
127 if (index < expected_index || expected_index <= next_index)
continue;
151 return found ?
index : -1;
161 if (!already_exists) {
180 return {
index, already_exists};
185 return static_cast<uint32_t
>(
hasher_(address));
200 return {&
values_[lookup_result.first], lookup_result.second};
211 if (
size_ == 0)
return nullptr;
253 if (
size_ == 0)
return false;
255 if (index < 0)
return false;
281 if (
keys_[index] != not_mapped) {
294 std::vector<std::pair<Address, uintptr_t>> reinsert;
300 if (
keys_[
i] == not_mapped) {
306 reinsert.push_back(std::pair<Address, uintptr_t>(
keys_[
i],
values_[
i]));
315 for (
auto pair : reinsert) {
329 uintptr_t* old_values =
values_;
340 for (
int i = 0;
i < old_capacity;
i++) {
341 if (old_keys[
i] == not_mapped)
continue;
HeapState gc_state() const
void UpdateStrongRoots(StrongRootsEntry *entry, FullObjectSlot start, FullObjectSlot end)
StrongRootsEntry * RegisterStrongRoots(const char *label, FullObjectSlot start, FullObjectSlot end)
void UnregisterStrongRoots(StrongRootsEntry *entry)
bool DeleteEntry(Address key, uintptr_t *deleted_value)
uint32_t Hash(Address address) const
int Lookup(Address key) const
virtual void DeletePointerArray(uintptr_t *array, size_t length)=0
void Resize(int new_capacity)
virtual uintptr_t * NewPointerArray(size_t length, uintptr_t value)=0
RawEntry FindEntry(Address key) const
std::pair< int, bool > LookupOrInsert(Address key)
IdentityMapFindResult< uintptr_t > FindOrInsertEntry(Address key)
int NextIndex(int index) const
Address KeyAtIndex(int index) const
std::pair< int, bool > InsertKey(Address address, uint32_t hash)
bool DeleteIndex(int index, uintptr_t *deleted_value)
RawEntry EntryAtIndex(int index) const
std::pair< int, bool > ScanKeysFor(Address address, uint32_t hash) const
virtual ~IdentityMapBase()
base::hash< uintptr_t > hasher_
StrongRootsEntry * strong_roots_entry_
RawEntry InsertEntry(Address key)
static const int kResizeFactor
static const int kInitialIdentityMapSize
#define DCHECK_LE(v1, v2)
#define DCHECK_NOT_NULL(val)
#define DCHECK_NE(v1, v2)
#define CHECK_NE(lhs, rhs)
#define DCHECK_GE(v1, v2)
#define DCHECK(condition)
#define DCHECK_LT(v1, v2)
#define DCHECK_EQ(v1, v2)
#define DCHECK_GT(v1, v2)