mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backout 27a5ca4a5e74883481ff4fb1bd330d6af41312c9 (Bug 1224038) for bustage on a CLOSED TREE.
This commit is contained in:
parent
10d3bf6e88
commit
119aa31dcb
@ -123,7 +123,11 @@ MovableCellHasher<T>::hash(const Lookup& l)
|
||||
MOZ_ASSERT(CurrentThreadCanAccessZone(l->zoneFromAnyThread()) ||
|
||||
l->zoneFromAnyThread()->isSelfHostingZone());
|
||||
|
||||
return l->zoneFromAnyThread()->getHashCodeInfallible(l);
|
||||
HashNumber hn;
|
||||
AutoEnterOOMUnsafeRegion oomUnsafe;
|
||||
if (!l->zoneFromAnyThread()->getHashCode(l, &hn))
|
||||
oomUnsafe.crash("failed to get a stable hash code");
|
||||
return hn;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -148,7 +152,10 @@ MovableCellHasher<T>::match(const Key& k, const Lookup& l)
|
||||
MOZ_ASSERT(zone->hasUniqueId(l));
|
||||
|
||||
// Since both already have a uid (from hash), the get is infallible.
|
||||
return zone->getUniqueIdInfallible(k) == zone->getUniqueIdInfallible(l);
|
||||
uint64_t uidK, uidL;
|
||||
MOZ_ALWAYS_TRUE(zone->getUniqueId(k, &uidK));
|
||||
MOZ_ALWAYS_TRUE(zone->getUniqueId(l, &uidL));
|
||||
return uidK == uidL;
|
||||
}
|
||||
|
||||
template struct MovableCellHasher<JSObject*>;
|
||||
|
@ -359,16 +359,12 @@ struct Zone : public JS::shadow::Zone,
|
||||
|
||||
mozilla::DebugOnly<unsigned> gcLastZoneGroupIndex;
|
||||
|
||||
static js::HashNumber UniqueIdToHash(uint64_t uid) {
|
||||
return js::HashNumber(uid >> 32) ^ js::HashNumber(uid & 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
// Creates a HashNumber based on getUniqueId. Returns false on OOM.
|
||||
bool getHashCode(js::gc::Cell* cell, js::HashNumber* hashp) {
|
||||
uint64_t uid;
|
||||
if (!getUniqueId(cell, &uid))
|
||||
return false;
|
||||
*hashp = UniqueIdToHash(uid);
|
||||
*hashp = js::HashNumber(uid >> 32) ^ js::HashNumber(uid & 0xFFFFFFFF);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -393,19 +389,10 @@ struct Zone : public JS::shadow::Zone,
|
||||
// If the cell was in the nursery, hopefully unlikely, then we need to
|
||||
// tell the nursery about it so that it can sweep the uid if the thing
|
||||
// does not get tenured.
|
||||
return runtimeFromAnyThread()->gc.nursery.addedUniqueIdToCell(cell);
|
||||
}
|
||||
|
||||
js::HashNumber getHashCodeInfallible(js::gc::Cell* cell) {
|
||||
return UniqueIdToHash(getUniqueIdInfallible(cell));
|
||||
}
|
||||
|
||||
uint64_t getUniqueIdInfallible(js::gc::Cell* cell) {
|
||||
uint64_t uid;
|
||||
js::AutoEnterOOMUnsafeRegion oomUnsafe;
|
||||
if (!getUniqueId(cell, &uid))
|
||||
oomUnsafe.crash("failed to allocate uid");
|
||||
return uid;
|
||||
if (!runtimeFromAnyThread()->gc.nursery.addedUniqueIdToCell(cell))
|
||||
oomUnsafe.crash("failed to allocate tracking data for a nursery uid");
|
||||
return true;
|
||||
}
|
||||
|
||||
// Return true if this cell has a UID associated with it.
|
||||
|
Loading…
Reference in New Issue
Block a user