Bug 1188208 - Fix more constructors in js; r=jorendorff
authorEhsan Akhgari <ehsan@mozilla.com>
Mon, 27 Jul 2015 21:15:34 -0400
changeset 287187 186ef16834789be5d1a68118061748c608bb55b7
parent 287186 f4243a6cbfeaaa8f8d518bb8e5f9112eb174a281
child 287188 3e78fb4512a68ea7eedfe0102b56c63ada8b9235
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1188208
milestone42.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 1188208 - Fix more constructors in js; r=jorendorff
js/public/RootingAPI.h
js/public/UbiNode.h
js/src/jsapi.h
--- a/js/public/RootingAPI.h
+++ b/js/public/RootingAPI.h
@@ -379,18 +379,18 @@ class TenuredHeap : public js::HeapBase<
 template <typename T>
 class MOZ_NONHEAP_CLASS Handle : public js::HandleBase<T>
 {
     friend class JS::MutableHandle<T>;
 
   public:
     /* Creates a handle from a handle of a type convertible to T. */
     template <typename S>
-    Handle(Handle<S> handle,
-           typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy = 0)
+    MOZ_IMPLICIT Handle(Handle<S> handle,
+                        typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy = 0)
     {
         static_assert(sizeof(Handle<T>) == sizeof(T*),
                       "Handle must be binary compatible with T*.");
         ptr = reinterpret_cast<const T*>(handle.address());
     }
 
     MOZ_IMPLICIT Handle(decltype(nullptr)) {
         static_assert(mozilla::IsPointer<T>::value,
@@ -423,29 +423,29 @@ class MOZ_NONHEAP_CLASS Handle : public 
     }
 
     /*
      * Construct a handle from an explicitly rooted location. This is the
      * normal way to create a handle, and normally happens implicitly.
      */
     template <typename S>
     inline
-    Handle(const Rooted<S>& root,
-           typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy = 0);
+    MOZ_IMPLICIT Handle(const Rooted<S>& root,
+                        typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy = 0);
 
     template <typename S>
     inline
-    Handle(const PersistentRooted<S>& root,
-           typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy = 0);
+    MOZ_IMPLICIT Handle(const PersistentRooted<S>& root,
+                        typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy = 0);
 
     /* Construct a read only handle from a mutable handle. */
     template <typename S>
     inline
-    Handle(MutableHandle<S>& root,
-           typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy = 0);
+    MOZ_IMPLICIT Handle(MutableHandle<S>& root,
+                        typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type dummy = 0);
 
     DECLARE_POINTER_COMPARISON_OPS(T);
     DECLARE_POINTER_CONSTREF_OPS(T);
     DECLARE_NONPOINTER_ACCESSOR_METHODS(*ptr);
 
   private:
     Handle() {}
     DELETE_ASSIGNMENT_OPS(Handle, T);
@@ -787,26 +787,26 @@ class HandleBase<JSObject*>
 };
 
 /* Interface substitute for Rooted<T> which does not root the variable's memory. */
 template <typename T>
 class FakeRooted : public RootedBase<T>
 {
   public:
     template <typename CX>
-    FakeRooted(CX* cx
-               MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
+    explicit FakeRooted(CX* cx
+                        MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
       : ptr(GCMethods<T>::initial())
     {
         MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     }
 
     template <typename CX>
-    FakeRooted(CX* cx, T initial
-               MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
+    explicit FakeRooted(CX* cx, T initial
+                        MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
       : ptr(initial)
     {
         MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     }
 
     DECLARE_POINTER_COMPARISON_OPS(T);
     DECLARE_POINTER_CONSTREF_OPS(T);
     DECLARE_POINTER_ASSIGN_OPS(FakeRooted, T);
--- a/js/public/UbiNode.h
+++ b/js/public/UbiNode.h
@@ -301,28 +301,28 @@ class Node {
         Concrete<T>::construct(base(), ptr);
     }
     struct ConstructFunctor;
 
   public:
     Node() { construct<void>(nullptr); }
 
     template<typename T>
-    Node(T* ptr) {
+    MOZ_IMPLICIT Node(T* ptr) {
         construct(ptr);
     }
     template<typename T>
     Node& operator=(T* ptr) {
         construct(ptr);
         return *this;
     }
 
     // We can construct and assign from rooted forms of pointers.
     template<typename T>
-    Node(const Rooted<T*>& root) {
+    MOZ_IMPLICIT Node(const Rooted<T*>& root) {
         construct(root.get());
     }
     template<typename T>
     Node& operator=(const Rooted<T*>& root) {
         construct(root.get());
         return *this;
     }
 
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -520,17 +520,17 @@ class HandleValueArray
 
   public:
     explicit HandleValueArray(const RootedValue& value) : length_(1), elements_(value.address()) {}
 
     MOZ_IMPLICIT HandleValueArray(const AutoValueVector& values)
       : length_(values.length()), elements_(values.begin()) {}
 
     template <size_t N>
-    HandleValueArray(const AutoValueArray<N>& values) : length_(N), elements_(values.begin()) {}
+    MOZ_IMPLICIT HandleValueArray(const AutoValueArray<N>& values) : length_(N), elements_(values.begin()) {}
 
     /* CallArgs must already be rooted somewhere up the stack. */
     MOZ_IMPLICIT HandleValueArray(const JS::CallArgs& args) : length_(args.length()), elements_(args.array()) {}
 
     /* Use with care! Only call this if the data is guaranteed to be marked. */
     static HandleValueArray fromMarkedLocation(size_t len, const Value* elements) {
         return HandleValueArray(len, elements);
     }