Bug 1623957 - Part 15: Replace mozilla::RemoveReference with std::remove_reference. r=jwalden
authorAndré Bargull <andre.bargull@gmail.com>
Sat, 21 Mar 2020 14:28:59 +0000
changeset 519999 150ae4897b766cbc8a893c71bc12ac5a8c42a404
parent 519998 5e7a6d158bc84f9b9094231afa25c58cf901486e
child 520000 8ac78029b63659f12b16474c4e00efa31564cae7
push id37237
push useraiakab@mozilla.com
push dateSat, 21 Mar 2020 21:28:09 +0000
treeherdermozilla-central@a1bea41f99f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwalden
bugs1623957
milestone76.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 1623957 - Part 15: Replace mozilla::RemoveReference with std::remove_reference. r=jwalden Differential Revision: https://phabricator.services.mozilla.com/D67663
js/public/GCVariant.h
js/src/gc/HashUtil.h
js/src/gc/Statistics.cpp
js/src/jit/CodeGenerator.cpp
js/src/threading/Thread.h
--- a/js/public/GCVariant.h
+++ b/js/public/GCVariant.h
@@ -4,16 +4,18 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef js_GCVariant_h
 #define js_GCVariant_h
 
 #include "mozilla/Variant.h"
 
+#include <type_traits>
+
 #include "js/GCPolicyAPI.h"
 #include "js/RootingAPI.h"
 #include "js/TracingAPI.h"
 
 namespace JS {
 
 // These template specializations allow Variant to be used inside GC wrappers.
 //
@@ -109,18 +111,17 @@ struct GCPolicy<mozilla::Variant<Ts...>>
 
   static void trace(JSTracer* trc, mozilla::Variant<Ts...>* v,
                     const char* name) {
     Impl::trace(trc, v, name);
   }
 
   static bool isValid(const mozilla::Variant<Ts...>& v) {
     return v.match([](auto& v) {
-      return GCPolicy<
-          typename mozilla::RemoveReference<decltype(v)>::Type>::isValid(v);
+      return GCPolicy<std::remove_reference_t<decltype(v)>>::isValid(v);
     });
   }
 };
 
 }  // namespace JS
 
 namespace js {
 
--- a/js/src/gc/HashUtil.h
+++ b/js/src/gc/HashUtil.h
@@ -2,16 +2,18 @@
  * vim: set ts=8 sts=2 et sw=2 tw=80:
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef gc_HashUtil_h
 #define gc_HashUtil_h
 
+#include <type_traits>
+
 #include "gc/Zone.h"
 #include "vm/JSContext.h"
 
 namespace js {
 
 /*
  * Used to add entries to a js::HashMap or HashSet where the key depends on a GC
  * thing that may be moved by generational or compacting GC between the call to
@@ -69,16 +71,15 @@ struct DependentAddPtr {
   DependentAddPtr() = delete;
   DependentAddPtr(const DependentAddPtr&) = delete;
   DependentAddPtr& operator=(const DependentAddPtr&) = delete;
 };
 
 template <typename T, typename Lookup>
 inline auto MakeDependentAddPtr(const JSContext* cx, T& table,
                                 const Lookup& lookup) {
-  using Ptr =
-      DependentAddPtr<typename mozilla::RemoveReference<decltype(table)>::Type>;
+  using Ptr = DependentAddPtr<std::remove_reference_t<decltype(table)>>;
   return Ptr(cx, table, lookup);
 }
 
 }  // namespace js
 
 #endif
--- a/js/src/gc/Statistics.cpp
+++ b/js/src/gc/Statistics.cpp
@@ -782,18 +782,17 @@ Statistics::Statistics(GCRuntime* gc)
   }
 
   for (auto& stat : stats) {
     stat = 0;
   }
 
 #ifdef DEBUG
   for (const auto& duration : totalTimes_) {
-    using ElementType =
-        typename mozilla::RemoveReference<decltype(duration)>::Type;
+    using ElementType = std::remove_reference_t<decltype(duration)>;
     static_assert(!std::is_trivially_constructible<ElementType>::value,
                   "Statistics::Statistics will only initialize "
                   "totalTimes_'s elements if their default constructor is "
                   "non-trivial");
     MOZ_ASSERT(duration.IsZero(),
                "totalTimes_ default-initialization should have "
                "default-initialized every element of totalTimes_ to zero");
   }
--- a/js/src/jit/CodeGenerator.cpp
+++ b/js/src/jit/CodeGenerator.cpp
@@ -397,17 +397,17 @@ class ArgSeq<> {
 #ifdef DEBUG
   static constexpr size_t numArgs = 0;
 #endif
 };
 
 template <typename HeadType, typename... TailTypes>
 class ArgSeq<HeadType, TailTypes...> : public ArgSeq<TailTypes...> {
  private:
-  using RawHeadType = typename mozilla::RemoveReference<HeadType>::Type;
+  using RawHeadType = std::remove_reference_t<HeadType>;
   RawHeadType head_;
 
  public:
   template <typename ProvidedHead, typename... ProvidedTail>
   explicit ArgSeq(ProvidedHead&& head, ProvidedTail&&... tail)
       : ArgSeq<TailTypes...>(std::forward<ProvidedTail>(tail)...),
         head_(std::forward<ProvidedHead>(head)) {}
 
--- a/js/src/threading/Thread.h
+++ b/js/src/threading/Thread.h
@@ -53,23 +53,22 @@ class Thread {
       return *this;
     }
     size_t stackSize() const { return stackSize_; }
   };
 
   // Create a Thread in an initially unjoinable state. A thread of execution can
   // be created for this Thread by calling |init|. Some of the thread's
   // properties may be controlled by passing options to this constructor.
-  template <
-      typename O = Options,
-      // SFINAE to make sure we don't try and treat functors for the other
-      // constructor as an Options and vice versa.
-      typename NonConstO = typename mozilla::RemoveConst<O>::Type,
-      typename DerefO = typename mozilla::RemoveReference<NonConstO>::Type,
-      typename = std::enable_if_t<std::is_same_v<DerefO, Options>>>
+  template <typename O = Options,
+            // SFINAE to make sure we don't try and treat functors for the other
+            // constructor as an Options and vice versa.
+            typename NonConstO = typename mozilla::RemoveConst<O>::Type,
+            typename DerefO = std::remove_reference_t<NonConstO>,
+            typename = std::enable_if_t<std::is_same_v<DerefO, Options>>>
   explicit Thread(O&& options = Options())
       : id_(ThreadId()), options_(std::forward<O>(options)) {
     MOZ_ASSERT(isInitialized());
   }
 
   // Start a thread of execution at functor |f| with parameters |args|. This
   // method will return false if thread creation fails. This Thread must not
   // already have been created. Note that the arguments must be either POD or