1240 {
1241 if (!represents_canonical_set_) {
1242 return;
1243 }
1244
1245
1246
1247 using ZoneCanonicalSet =
1248 HashTable<typename SetType::Traits, 0, 0, GrowableArrayStorageTraits>;
1249
1250
1251 intptr_t required_capacity = 0;
1254 required_capacity++;
1255 }
1256 }
1257
1258
1259 const intptr_t kSpareCapacity = 32;
1260 required_capacity = static_cast<intptr_t>(
1261 static_cast<double>(required_capacity + kSpareCapacity) /
1263
1264 intptr_t num_occupied = 0;
1265
1266
1267
1268 ZoneCanonicalSet
table(
1269 s->zone(), HashTables::New<ZoneCanonicalSet>(required_capacity));
1270 HandleType& element = HandleType::Handle(
s->zone());
1273 element ^= ptr;
1274 intptr_t entry = -1;
1275 const bool present =
table.FindKeyOrDeletedOrUnused(element, &entry);
1277 table.InsertKey(entry, element);
1278 } else {
1280 }
1281 }
1282
1283 const auto prefix_length = num_occupied;
1284
1285
1286 auto& arr =
table.Release();
1287 intptr_t last_occupied = ZoneCanonicalSet::kFirstKeyIndex - 1;
1288 for (intptr_t
i = ZoneCanonicalSet::kFirstKeyIndex,
length = arr.Length();
1290 ObjectPtr v = arr.At(
i);
1291 ASSERT(v != ZoneCanonicalSet::DeletedMarker().ptr());
1292 if (v != ZoneCanonicalSet::UnusedMarker().ptr()) {
1293 const intptr_t unused_run_length = (
i - 1) - last_occupied;
1294 gaps_.
Add(unused_run_length);
1295 objects_[num_occupied++] =
static_cast<PointerType
>(v);
1297 }
1298 }
1301 table_length_ = arr.Length();
1302 }
GrowableArray< PointerType > objects_
virtual bool IsInCanonicalSet(Serializer *s, PointerType ptr)
static constexpr double kMaxLoadFactor