Bug 1585921 - Remove GCPtrHasher which is invalid, and replace with HeapPtrHasher r=sfink

Differential Revision: https://phabricator.services.mozilla.com/D48544

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jon Coppeard 2019-10-09 10:30:02 +00:00
parent f88eca81a5
commit 89ee604716

View File

@ -933,10 +933,10 @@ struct MovableCellHasher<WeakHeapPtr<T>> {
static void rekey(Key& k, const Key& newKey) { k.unsafeSet(newKey); }
};
/* Useful for hashtables with a GCPtr as key. */
/* Useful for hashtables with a HeapPtr as key. */
template <class T>
struct GCPtrHasher {
typedef GCPtr<T> Key;
struct HeapPtrHasher {
typedef HeapPtr<T> Key;
typedef T Lookup;
static HashNumber hash(Lookup obj) { return DefaultHasher<T>::hash(obj); }
@ -986,14 +986,18 @@ class MOZ_STACK_CLASS StackGCCellPtr {
namespace mozilla {
/* Specialized hashing policy for GCPtrs. */
template <class T>
struct DefaultHasher<js::GCPtr<T>> : js::GCPtrHasher<T> {};
struct DefaultHasher<js::HeapPtr<T>> : js::HeapPtrHasher<T> {};
template <class T>
struct DefaultHasher<js::GCPtr<T>> {
// Not implemented. GCPtr can't be used as a hash table key because it has a
// post barrier but doesn't support relocation.
};
template <class T>
struct DefaultHasher<js::PreBarriered<T>> : js::PreBarrieredHasher<T> {};
/* Specialized hashing policy for WeakHeapPtrs. */
template <class T>
struct DefaultHasher<js::WeakHeapPtr<T>> : js::WeakHeapPtrHasher<T> {};