Lines Matching refs:index
53 for (int index = start; index < capacity_; index++) {
54 if (keys_[index] == address) return index; // Found.
55 if (keys_[index] == not_mapped) return -1; // Not found.
57 for (int index = 0; index < start; index++) {
58 if (keys_[index] == address) return index; // Found.
59 if (keys_[index] == not_mapped) return -1; // Not found.
78 int index = start;
80 if (keys_[index] == address) return {index, true}; // Found.
81 if (keys_[index] == not_mapped) { // Free entry.
84 keys_[index] = address;
85 return {index, false};
87 index = (index + 1) & mask_;
89 DCHECK_NE(index, start);
93 bool IdentityMapBase::DeleteIndex(int index, uintptr_t* deleted_value) {
94 if (deleted_value != nullptr) *deleted_value = values_[index];
96 DCHECK_NE(keys_[index], not_mapped);
97 keys_[index] = not_mapped;
98 values_[index] = 0;
109 int next_index = index;
116 if (index < next_index) {
117 if (index < expected_index && expected_index <= next_index) continue;
119 DCHECK_GT(index, next_index);
120 if (index < expected_index || expected_index <= next_index) continue;
123 DCHECK_EQ(not_mapped, keys_[index]);
124 DCHECK_EQ(values_[index], 0);
125 std::swap(keys_[index], keys_[next_index]);
126 std::swap(values_[index], values_[next_index]);
127 index = next_index;
135 int index = ScanKeysFor(key, hash);
136 if (index < 0 && gc_counter_ != heap_->gc_count()) {
139 index = ScanKeysFor(key, hash);
141 return index;
147 int index = ScanKeysFor(key, hash);
149 if (index < 0) {
152 std::tie(index, already_exists) = InsertKey(key, hash);
156 DCHECK_GE(index, 0);
157 return {index, already_exists};
187 int index = Lookup(key);
188 return index >= 0 ? &values_[index] : nullptr;
216 int index;
218 std::tie(index, already_exists) = InsertKey(key, Hash(key));
220 return &values_[index];
229 int index = Lookup(key);
230 if (index < 0) return false; // No entry found.
231 return DeleteIndex(index, deleted_value);
234 Address IdentityMapBase::KeyAtIndex(int index) const {
235 DCHECK_LE(0, index);
236 DCHECK_LT(index, capacity_);
237 DCHECK_NE(keys_[index], ReadOnlyRoots(heap_).not_mapped_symbol().ptr());
238 CHECK(is_iterable()); // Must be iterable to access by index;
239 return keys_[index];
242 IdentityMapBase::RawEntry IdentityMapBase::EntryAtIndex(int index) const {
243 DCHECK_LE(0, index);
244 DCHECK_LT(index, capacity_);
245 DCHECK_NE(keys_[index], ReadOnlyRoots(heap_).not_mapped_symbol().ptr());
246 CHECK(is_iterable()); // Must be iterable to access by index;
247 return &values_[index];
250 int IdentityMapBase::NextIndex(int index) const {
251 DCHECK_LE(-1, index);
252 DCHECK_LE(index, capacity_);
253 CHECK(is_iterable()); // Must be iterable to access by index;
255 for (++index; index < capacity_; ++index) {
256 if (keys_[index] != not_mapped) {
257 return index;
290 int index = InsertKey(pair.first, Hash(pair.first)).first;
291 DCHECK_GE(index, 0);
292 values_[index] = pair.second;
317 int index = InsertKey(old_keys[i], Hash(old_keys[i])).first;
318 DCHECK_GE(index, 0);
319 values_[index] = old_values[i];