/* static */ bool MovableCellHasher<T>::match(const Key& k, const Lookup& l) { // Return true if both are null or false if only one is null. if (!k) return !l; if (!l) return false; MOZ_ASSERT(k); MOZ_ASSERT(l); MOZ_ASSERT(CurrentThreadCanAccessZone(l->zoneFromAnyThread()) || l->zoneFromAnyThread()->isSelfHostingZone()); Zone* zone = k->zoneFromAnyThread(); if (zone != l->zoneFromAnyThread()) return false; MOZ_ASSERT(zone->hasUniqueId(k)); MOZ_ASSERT(zone->hasUniqueId(l)); // Since both already have a uid (from hash), the get is infallible. return zone->getUniqueIdInfallible(k) == zone->getUniqueIdInfallible(l); }
/* static */ bool MovableCellHasher<T>::match(const Key& k, const Lookup& l) { // Return true if both are null or false if only one is null. if (!k) return !l; if (!l) return false; MOZ_ASSERT(k); MOZ_ASSERT(l); MOZ_ASSERT(CurrentThreadCanAccessZone(l->zoneFromAnyThread()) || l->zoneFromAnyThread()->isSelfHostingZone()); Zone* zone = k->zoneFromAnyThread(); if (zone != l->zoneFromAnyThread()) return false; #ifdef DEBUG // Incremental table sweeping means that existing table entries may no // longer have unique IDs. We fail the match in that case and the entry is // removed from the table later on. if (!zone->hasUniqueId(k)) { Key key = k; MOZ_ASSERT(IsAboutToBeFinalizedUnbarriered(&key)); } MOZ_ASSERT(zone->hasUniqueId(l)); #endif uint64_t keyId; if (!zone->maybeGetUniqueId(k, &keyId)) { // Key is dead and cannot match lookup which must be live. return false; } return keyId == zone->getUniqueIdInfallible(l); }