author | André Bargull <andre.bargull@gmail.com> |
Sat, 21 Mar 2020 14:20:17 +0000 | |
changeset 519990 | 680f4f1018e65fd996606e21aa81861df786c548 |
parent 519989 | 4e839607dda0e2d12a6f4297f5e57bf7f7b44da6 |
child 519991 | c6427d6143d941135fedc5276e1e576dccbb00dd |
push id | 37237 |
push user | aiakab@mozilla.com |
push date | Sat, 21 Mar 2020 21:28:09 +0000 |
treeherder | mozilla-central@a1bea41f99f4 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jwalden |
bugs | 1623957 |
milestone | 76.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
|
--- a/js/public/RootingAPI.h +++ b/js/public/RootingAPI.h @@ -579,20 +579,19 @@ template <typename T> class MOZ_NONHEAP_CLASS Handle : public js::HandleBase<T, Handle<T>> { friend class MutableHandle<T>; public: using ElementType = T; /* Creates a handle from a handle of a type convertible to T. */ template <typename S> - MOZ_IMPLICIT 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<std::is_convertible_v<S, T>, + 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, "nullptr_t overload not valid for non-pointer types"); @@ -624,31 +623,31 @@ 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 MOZ_IMPLICIT Handle( const Rooted<S>& root, - typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type - dummy = 0); + typename mozilla::EnableIf<std::is_convertible_v<S, T>, int>::Type dummy = + 0); template <typename S> inline MOZ_IMPLICIT Handle( const PersistentRooted<S>& root, - typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type - dummy = 0); + typename mozilla::EnableIf<std::is_convertible_v<S, T>, int>::Type dummy = + 0); /* Construct a read only handle from a mutable handle. */ template <typename S> inline MOZ_IMPLICIT Handle( MutableHandle<S>& root, - typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type - dummy = 0); + typename mozilla::EnableIf<std::is_convertible_v<S, T>, int>::Type dummy = + 0); DECLARE_POINTER_CONSTREF_OPS(T); DECLARE_NONPOINTER_ACCESSOR_METHODS(*ptr); private: Handle() = default; DELETE_ASSIGNMENT_OPS(Handle, T); @@ -1238,36 +1237,33 @@ class HandleBase<JSObject*, Container> } /* namespace js */ namespace JS { template <typename T> template <typename S> inline Handle<T>::Handle( const Rooted<S>& root, - typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type - dummy) { + typename mozilla::EnableIf<std::is_convertible_v<S, T>, int>::Type dummy) { ptr = reinterpret_cast<const T*>(root.address()); } template <typename T> template <typename S> inline Handle<T>::Handle( const PersistentRooted<S>& root, - typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type - dummy) { + typename mozilla::EnableIf<std::is_convertible_v<S, T>, int>::Type dummy) { ptr = reinterpret_cast<const T*>(root.address()); } template <typename T> template <typename S> inline Handle<T>::Handle( MutableHandle<S>& root, - typename mozilla::EnableIf<mozilla::IsConvertible<S, T>::value, int>::Type - dummy) { + typename mozilla::EnableIf<std::is_convertible_v<S, T>, int>::Type dummy) { ptr = reinterpret_cast<const T*>(root.address()); } template <typename T> inline MutableHandle<T>::MutableHandle(Rooted<T>* root) { static_assert(sizeof(MutableHandle<T>) == sizeof(T*), "MutableHandle must be binary compatible with T*."); ptr = root->address();
--- a/js/public/Utility.h +++ b/js/public/Utility.h @@ -11,16 +11,17 @@ #include "mozilla/Atomics.h" #include "mozilla/Attributes.h" #include "mozilla/Compiler.h" #include "mozilla/TemplateLib.h" #include "mozilla/UniquePtr.h" #include <stdlib.h> #include <string.h> +#include <type_traits> #include <utility> #include "jstypes.h" #include "mozmemory.h" /* The public JS engine namespace. */ namespace JS {} @@ -632,18 +633,18 @@ namespace JS { template <typename T> struct DeletePolicy { constexpr DeletePolicy() = default; template <typename U> MOZ_IMPLICIT DeletePolicy( DeletePolicy<U> other, - typename mozilla::EnableIf<mozilla::IsConvertible<U*, T*>::value, - int>::Type dummy = 0) {} + typename mozilla::EnableIf<std::is_convertible_v<U*, T*>, int>::Type + dummy = 0) {} void operator()(const T* ptr) { js_delete(const_cast<T*>(ptr)); } }; struct FreePolicy { void operator()(const void* ptr) { js_free(const_cast<void*>(ptr)); } };
--- a/js/src/gc/Allocator.cpp +++ b/js/src/gc/Allocator.cpp @@ -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/. */ #include "gc/Allocator.h" #include "mozilla/DebugOnly.h" #include "mozilla/TimeStamp.h" +#include <type_traits> + #include "gc/GCInternals.h" #include "gc/GCLock.h" #include "gc/GCTrace.h" #include "gc/Nursery.h" #include "jit/JitRealm.h" #include "threading/CpuCount.h" #include "util/Poison.h" #include "vm/JSContext.h" @@ -178,17 +180,17 @@ JSString* GCRuntime::tryNewNurseryString cx->nursery().allocateString(cx->zone(), thingSize, kind)); } } return nullptr; } template <typename StringAllocT, AllowGC allowGC /* = CanGC */> StringAllocT* js::AllocateStringImpl(JSContext* cx, InitialHeap heap) { - static_assert(mozilla::IsConvertible<StringAllocT*, JSString*>::value, + static_assert(std::is_convertible_v<StringAllocT*, JSString*>, "must be JSString derived"); AllocKind kind = MapTypeToFinalizeKind<StringAllocT>::kind; size_t size = sizeof(StringAllocT); MOZ_ASSERT(size == Arena::thingSize(kind)); MOZ_ASSERT(size == sizeof(JSString) || size == sizeof(JSFatInlineString)); // Off-thread alloc cannot trigger GC or make runtime assertions. @@ -308,17 +310,17 @@ template JS::BigInt* js::AllocateBigInt< InitialHeap heap); \ template type* js::AllocateStringImpl<type, CanGC>(JSContext * cx, \ InitialHeap heap); FOR_EACH_NURSERY_STRING_ALLOCKIND(DECL_ALLOCATOR_INSTANCES) #undef DECL_ALLOCATOR_INSTANCES template <typename T, AllowGC allowGC /* = CanGC */> T* js::Allocate(JSContext* cx) { - static_assert(!mozilla::IsConvertible<T*, JSObject*>::value, + static_assert(!std::is_convertible_v<T*, JSObject*>, "must not be JSObject derived"); static_assert( sizeof(T) >= MinCellSize, "All allocations must be at least the allocator-imposed minimum size."); AllocKind kind = MapTypeToFinalizeKind<T>::kind; size_t thingSize = sizeof(T); MOZ_ASSERT(thingSize == Arena::thingSize(kind));
--- a/js/src/gc/Zone.cpp +++ b/js/src/gc/Zone.cpp @@ -1,16 +1,18 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- * 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/. */ #include "gc/Zone-inl.h" +#include <type_traits> + #include "gc/FreeOp.h" #include "gc/GCLock.h" #include "gc/Policy.h" #include "gc/PublicIterators.h" #include "jit/BaselineIC.h" #include "jit/BaselineJIT.h" #include "jit/Ion.h" #include "jit/JitRealm.h" @@ -778,17 +780,17 @@ void ZoneList::clear() { } JS_PUBLIC_API void JS::shadow::RegisterWeakCache( JS::Zone* zone, detail::WeakCacheBase* cachep) { zone->registerWeakCache(cachep); } void Zone::traceScriptTableRoots(JSTracer* trc) { - static_assert(mozilla::IsConvertible<BaseScript*, gc::TenuredCell*>::value, + static_assert(std::is_convertible_v<BaseScript*, gc::TenuredCell*>, "BaseScript must not be nursery-allocated for script-table " "tracing to work"); // Performance optimization: the script-table keys are JSScripts, which // cannot be in the nursery, so we can skip this tracing if we are only in a // minor collection. We static-assert this fact above. if (JS::RuntimeHeapIsMinorCollecting()) { return;
--- a/js/src/jit/JitAllocPolicy.h +++ b/js/src/jit/JitAllocPolicy.h @@ -5,19 +5,19 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef jit_JitAllocPolicy_h #define jit_JitAllocPolicy_h #include "mozilla/Attributes.h" #include "mozilla/GuardObjects.h" #include "mozilla/OperatorNewExtensions.h" -#include "mozilla/TypeTraits.h" #include <algorithm> +#include <type_traits> #include <utility> #include "ds/LifoAlloc.h" #include "jit/InlineList.h" #include "jit/JitContext.h" #include "vm/JSContext.h" namespace js { @@ -147,23 +147,23 @@ struct TempObject { TempAllocator::Fallible view) noexcept(true) { return view.alloc.allocate(nbytes); } inline void* operator new(size_t nbytes, TempAllocator& alloc) { return alloc.allocateInfallible(nbytes); } template <class T> inline void* operator new(size_t nbytes, T* pos) { - static_assert(mozilla::IsConvertible<T*, TempObject*>::value, + static_assert(std::is_convertible_v<T*, TempObject*>, "Placement new argument type must inherit from TempObject"); return pos; } template <class T> inline void* operator new(size_t nbytes, mozilla::NotNullTag, T* pos) { - static_assert(mozilla::IsConvertible<T*, TempObject*>::value, + static_assert(std::is_convertible_v<T*, TempObject*>, "Placement new argument type must inherit from TempObject"); MOZ_ASSERT(pos); return pos; } }; template <typename T> class TempObjectPool {