Bug 1500247 - Make GCHash{Map,Set} inherit annotations from template params, r=jonco
authorSteve Fink <sfink@mozilla.com>
Fri, 14 Dec 2018 09:48:09 -0800
changeset 458986 2a8867abaa0f
parent 458985 f0e97add682c
child 458987 5e40a711ed0a
push id35553
push usershindli@mozilla.com
push dateThu, 14 Feb 2019 04:41:18 +0000
treeherdermozilla-central@f0ea53f47215 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1500247
milestone67.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 1500247 - Make GCHash{Map,Set} inherit annotations from template params, r=jonco
js/public/GCHashTable.h
js/public/SweepingAPI.h
--- a/js/public/GCHashTable.h
+++ b/js/public/GCHashTable.h
@@ -86,17 +86,17 @@ class GCHashMap : public js::HashMap<Key
     MOZ_ASSERT(this != &rhs, "self-move assignment is prohibited");
     Base::operator=(std::move(rhs));
   }
 
  private:
   // GCHashMap is not copyable or assignable
   GCHashMap(const GCHashMap& hm) = delete;
   GCHashMap& operator=(const GCHashMap& hm) = delete;
-};
+} MOZ_INHERIT_TYPE_ANNOTATIONS_FROM_TEMPLATE_ARGS;
 
 }  // namespace JS
 
 namespace js {
 
 // HashMap that supports rekeying.
 //
 // If your keys are pointers to something like JSObject that can be tenured or
@@ -127,17 +127,17 @@ class GCRekeyableHashMap : public JS::GC
   }
 
   // GCRekeyableHashMap is movable
   GCRekeyableHashMap(GCRekeyableHashMap&& rhs) : Base(std::move(rhs)) {}
   void operator=(GCRekeyableHashMap&& rhs) {
     MOZ_ASSERT(this != &rhs, "self-move assignment is prohibited");
     Base::operator=(std::move(rhs));
   }
-};
+} MOZ_INHERIT_TYPE_ANNOTATIONS_FROM_TEMPLATE_ARGS;
 
 template <typename Wrapper, typename... Args>
 class WrappedPtrOperations<JS::GCHashMap<Args...>, Wrapper> {
   using Map = JS::GCHashMap<Args...>;
   using Lookup = typename Map::Lookup;
 
   const Map& map() const { return static_cast<const Wrapper*>(this)->get(); }
 
@@ -258,17 +258,17 @@ class GCHashSet : public js::HashSet<T, 
     MOZ_ASSERT(this != &rhs, "self-move assignment is prohibited");
     Base::operator=(std::move(rhs));
   }
 
  private:
   // GCHashSet is not copyable or assignable
   GCHashSet(const GCHashSet& hs) = delete;
   GCHashSet& operator=(const GCHashSet& hs) = delete;
-};
+} MOZ_INHERIT_TYPE_ANNOTATIONS_FROM_TEMPLATE_ARGS;
 
 }  // namespace JS
 
 namespace js {
 
 template <typename Wrapper, typename... Args>
 class WrappedPtrOperations<JS::GCHashSet<Args...>, Wrapper> {
   using Set = JS::GCHashSet<Args...>;
@@ -528,17 +528,17 @@ class WeakCache<GCHashMap<Key, Value, Ha
   bool put(KeyInput&& k, ValueInput&& v) {
     return map.put(std::forward<KeyInput>(k), std::forward<ValueInput>(v));
   }
 
   template <typename KeyInput, typename ValueInput>
   bool putNew(KeyInput&& k, ValueInput&& v) {
     return map.putNew(std::forward<KeyInput>(k), std::forward<ValueInput>(v));
   }
-};
+} JS_HAZ_NON_GC_POINTER;
 
 // Specialize WeakCache for GCHashSet to provide a barriered set that does not
 // need to be swept immediately.
 template <typename T, typename HashPolicy, typename AllocPolicy>
 class WeakCache<GCHashSet<T, HashPolicy, AllocPolicy>>
     : protected detail::WeakCacheBase {
   using Set = GCHashSet<T, HashPolicy, AllocPolicy>;
   using Self = WeakCache<Set>;
@@ -713,13 +713,13 @@ class WeakCache<GCHashSet<T, HashPolicy,
   bool putNew(TInput&& t) {
     return set.putNew(std::forward<TInput>(t));
   }
 
   template <typename TInput>
   bool putNew(const Lookup& l, TInput&& t) {
     return set.putNew(l, std::forward<TInput>(t));
   }
-};
+} JS_HAZ_NON_GC_POINTER;
 
 }  // namespace JS
 
 #endif /* GCHashTable_h */
--- a/js/public/SweepingAPI.h
+++ b/js/public/SweepingAPI.h
@@ -69,13 +69,13 @@ class WeakCache : protected detail::Weak
   T& get() { return cache; }
 
   size_t sweep() override {
     GCPolicy<T>::sweep(&cache);
     return 0;
   }
 
   bool needsSweep() override { return cache.needsSweep(); }
-};
+} JS_HAZ_NON_GC_POINTER;
 
 }  // namespace JS
 
 #endif  // js_SweepingAPI_h