Commit 89ee6047 authored by Jon Coppeard's avatar Jon Coppeard
Browse files

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
parent f88eca81
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -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> {};