Bug 1585921 - Remove GCPtrHasher which is invalid, and replace with HeapPtrHasher r=sfink
authorJon Coppeard <jcoppeard@mozilla.com>
Wed, 09 Oct 2019 10:30:02 +0000
changeset 496940 754da41ac0f741d3a701b1866325f97ae21a5ef0
parent 496939 bfbd9f2b907ccddc9303223e90ff0bd0d7a533aa
child 496941 ef6ba5cf5d2d2fcaf7be813b31d8c84939dbf8b1
push id36671
push usershindli@mozilla.com
push dateWed, 09 Oct 2019 16:04:03 +0000
treeherdermozilla-central@0efb4f268d16 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1585921
milestone71.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1585921 - Remove GCPtrHasher which is invalid, and replace with HeapPtrHasher r=sfink Differential Revision: https://phabricator.services.mozilla.com/D48544
js/src/gc/Barrier.h
--- a/js/src/gc/Barrier.h
+++ b/js/src/gc/Barrier.h
@@ -928,20 +928,20 @@ struct MovableCellHasher<WeakHeapPtr<T>>
     return MovableCellHasher<T>::hash(l);
   }
   static bool match(const Key& k, const Lookup& l) {
     return MovableCellHasher<T>::match(k.unbarrieredGet(), l);
   }
   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); }
   static bool match(const Key& k, Lookup l) { return k.get() == l; }
   static void rekey(Key& k, const Key& newKey) { k.unsafeSet(newKey); }
 };
 
 template <class T>
@@ -981,24 +981,28 @@ class MOZ_STACK_CLASS StackGCCellPtr {
 
   JS::GCCellPtr get() const { return ptr_; }
 };
 
 }  // namespace js
 
 namespace mozilla {
 
-/* Specialized hashing policy for GCPtrs. */
+template <class T>
+struct DefaultHasher<js::HeapPtr<T>> : js::HeapPtrHasher<T> {};
+
 template <class T>
-struct DefaultHasher<js::GCPtr<T>> : js::GCPtrHasher<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> {};
 
 }  // namespace mozilla
 
 namespace js {
 
 class ArrayObject;