Skip to content
Permalink
Browse files
Roll out r223316.
Canonical link: https://commits.webkit.org/194670@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223617 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
aestes committed Oct 18, 2017
1 parent 21edf87 commit d923f7ceb9379be3d23ceee80c2936104be989bc
Showing 27 changed files with 172 additions and 169 deletions.
@@ -346,7 +346,7 @@ ALWAYS_INLINE Dependency nullDependency()
return 0;
}

template <typename T, std::enable_if_t<sizeof(T) == 8>* = nullptr>
template <typename T, typename std::enable_if<sizeof(T) == 8>::type* = nullptr>
ALWAYS_INLINE Dependency dependency(T value)
{
unsigned dependency;
@@ -379,7 +379,7 @@ ALWAYS_INLINE Dependency dependency(T value)

// FIXME: This code is almost identical to the other dependency() overload.
// https://bugs.webkit.org/show_bug.cgi?id=169405
template <typename T, std::enable_if_t<sizeof(T) == 4>* = nullptr>
template <typename T, typename std::enable_if<sizeof(T) == 4>::type* = nullptr>
ALWAYS_INLINE Dependency dependency(T value)
{
unsigned dependency;
@@ -400,13 +400,13 @@ ALWAYS_INLINE Dependency dependency(T value)
return dependency;
}

template <typename T, std::enable_if_t<sizeof(T) == 2>* = nullptr>
template <typename T, typename std::enable_if<sizeof(T) == 2>::type* = nullptr>
ALWAYS_INLINE Dependency dependency(T value)
{
return dependency(static_cast<uint32_t>(value));
}

template <typename T, std::enable_if_t<sizeof(T) == 1>* = nullptr>
template <typename T, typename std::enable_if<sizeof(T) == 1>::type* = nullptr>
ALWAYS_INLINE Dependency dependency(T value)
{
return dependency(static_cast<uint32_t>(value));
@@ -79,7 +79,7 @@ class CagedUniquePtr : public CagedPtr<kind, T> {
};

template<Gigacage::Kind kind, typename T>
class CagedUniquePtr<kind, T[], std::enable_if_t<std::is_trivially_destructible<T>::value>> : public CagedPtr<kind, T> {
class CagedUniquePtr<kind, T[], typename std::enable_if<std::is_trivially_destructible<T>::value>::type> : public CagedPtr<kind, T> {
public:
CagedUniquePtr() : CagedPtr<kind, T>() { }

@@ -130,7 +130,7 @@ class CagedUniquePtr<kind, T[], std::enable_if_t<std::is_trivially_destructible<
};

template<Gigacage::Kind kind, typename T>
class CagedUniquePtr<kind, T[], std::enable_if_t<!std::is_trivially_destructible<T>::value>> : public CagedPtr<kind, T> {
class CagedUniquePtr<kind, T[], typename std::enable_if<!std::is_trivially_destructible<T>::value>::type> : public CagedPtr<kind, T> {
public:
CagedUniquePtr() : CagedPtr<kind, T>() { }

@@ -143,7 +143,7 @@ template <typename Target, typename Source> struct BoundsChecker<Target, Source,
{
// When converting value to unsigned Source, value will become a big value if value is negative.
// Casted value will become bigger than Target::max as Source is bigger than Target.
return static_cast<std::make_unsigned_t<Source>>(value) <= std::numeric_limits<Target>::max();
return static_cast<typename std::make_unsigned<Source>::type>(value) <= std::numeric_limits<Target>::max();
}
};

@@ -37,7 +37,7 @@ class CompletionHandler<Out(In...)> {
public:
CompletionHandler() = default;

template<typename CallableType, class = std::enable_if_t<std::is_rvalue_reference<CallableType&&>::value>>
template<typename CallableType, class = typename std::enable_if<std::is_rvalue_reference<CallableType&&>::value>::type>
CompletionHandler(CallableType&& callable)
: m_function(WTFMove(callable))
{
@@ -38,13 +38,13 @@ class Function<Out(In...)> {
Function() = default;
Function(std::nullptr_t) { }

template<typename CallableType, class = std::enable_if_t<!(std::is_pointer<CallableType>::value && std::is_function<std::remove_pointer_t<CallableType>>::value) && std::is_rvalue_reference<CallableType&&>::value>>
template<typename CallableType, class = typename std::enable_if<!(std::is_pointer<CallableType>::value && std::is_function<typename std::remove_pointer<CallableType>::type>::value) && std::is_rvalue_reference<CallableType&&>::value>::type>
Function(CallableType&& callable)
: m_callableWrapper(std::make_unique<CallableWrapper<CallableType>>(WTFMove(callable)))
{
}

template<typename FunctionType, class = std::enable_if_t<std::is_pointer<FunctionType>::value && std::is_function<std::remove_pointer_t<FunctionType>>::value>>
template<typename FunctionType, class = typename std::enable_if<std::is_pointer<FunctionType>::value && std::is_function<typename std::remove_pointer<FunctionType>::type>::value>::type>
Function(FunctionType f)
: m_callableWrapper(std::make_unique<CallableWrapper<FunctionType>>(WTFMove(f)))
{
@@ -58,14 +58,14 @@ class Function<Out(In...)> {

explicit operator bool() const { return !!m_callableWrapper; }

template<typename CallableType, class = std::enable_if_t<!(std::is_pointer<CallableType>::value && std::is_function<std::remove_pointer_t<CallableType>>::value) && std::is_rvalue_reference<CallableType&&>::value>>
template<typename CallableType, class = typename std::enable_if<!(std::is_pointer<CallableType>::value && std::is_function<typename std::remove_pointer<CallableType>::type>::value) && std::is_rvalue_reference<CallableType&&>::value>::type>
Function& operator=(CallableType&& callable)
{
m_callableWrapper = std::make_unique<CallableWrapper<CallableType>>(WTFMove(callable));
return *this;
}

template<typename FunctionType, class = std::enable_if_t<std::is_pointer<FunctionType>::value && std::is_function<std::remove_pointer_t<FunctionType>>::value>>
template<typename FunctionType, class = typename std::enable_if<std::is_pointer<FunctionType>::value && std::is_function<typename std::remove_pointer<FunctionType>::type>::value>::type>
Function& operator=(FunctionType f)
{
m_callableWrapper = std::make_unique<CallableWrapper<FunctionType>>(WTFMove(f));
@@ -101,11 +101,11 @@ class HashCountedSet final {
void clear();

// Overloads for smart pointer keys that take the raw pointer type as the parameter.
template<typename V = ValueType> std::enable_if_t<IsSmartPtr<V>::value, iterator> find(typename GetPtrHelper<V>::PtrType);
template<typename V = ValueType> std::enable_if_t<IsSmartPtr<V>::value, const_iterator> find(typename GetPtrHelper<V>::PtrType) const;
template<typename V = ValueType> std::enable_if_t<IsSmartPtr<V>::value, bool> contains(typename GetPtrHelper<V>::PtrType) const;
template<typename V = ValueType> std::enable_if_t<IsSmartPtr<V>::value, unsigned> count(typename GetPtrHelper<V>::PtrType) const;
template<typename V = ValueType> std::enable_if_t<IsSmartPtr<V>::value, bool> remove(typename GetPtrHelper<V>::PtrType);
template<typename V = ValueType> typename std::enable_if<IsSmartPtr<V>::value, iterator>::type find(typename GetPtrHelper<V>::PtrType);
template<typename V = ValueType> typename std::enable_if<IsSmartPtr<V>::value, const_iterator>::type find(typename GetPtrHelper<V>::PtrType) const;
template<typename V = ValueType> typename std::enable_if<IsSmartPtr<V>::value, bool>::type contains(typename GetPtrHelper<V>::PtrType) const;
template<typename V = ValueType> typename std::enable_if<IsSmartPtr<V>::value, unsigned>::type count(typename GetPtrHelper<V>::PtrType) const;
template<typename V = ValueType> typename std::enable_if<IsSmartPtr<V>::value, bool>::type remove(typename GetPtrHelper<V>::PtrType);

private:
ImplType m_impl;
@@ -276,35 +276,35 @@ inline void HashCountedSet<Value, HashFunctions, Traits>::clear()

template<typename Value, typename HashFunctions, typename Traits>
template<typename V>
inline auto HashCountedSet<Value, HashFunctions, Traits>::find(typename GetPtrHelper<V>::PtrType value) -> std::enable_if_t<IsSmartPtr<V>::value, iterator>
inline auto HashCountedSet<Value, HashFunctions, Traits>::find(typename GetPtrHelper<V>::PtrType value) -> typename std::enable_if<IsSmartPtr<V>::value, iterator>::type
{
return m_impl.find(value);
}

template<typename Value, typename HashFunctions, typename Traits>
template<typename V>
inline auto HashCountedSet<Value, HashFunctions, Traits>::find(typename GetPtrHelper<V>::PtrType value) const -> std::enable_if_t<IsSmartPtr<V>::value, const_iterator>
inline auto HashCountedSet<Value, HashFunctions, Traits>::find(typename GetPtrHelper<V>::PtrType value) const -> typename std::enable_if<IsSmartPtr<V>::value, const_iterator>::type
{
return m_impl.find(value);
}

template<typename Value, typename HashFunctions, typename Traits>
template<typename V>
inline auto HashCountedSet<Value, HashFunctions, Traits>::contains(typename GetPtrHelper<V>::PtrType value) const -> std::enable_if_t<IsSmartPtr<V>::value, bool>
inline auto HashCountedSet<Value, HashFunctions, Traits>::contains(typename GetPtrHelper<V>::PtrType value) const -> typename std::enable_if<IsSmartPtr<V>::value, bool>::type
{
return m_impl.contains(value);
}

template<typename Value, typename HashFunctions, typename Traits>
template<typename V>
inline auto HashCountedSet<Value, HashFunctions, Traits>::count(typename GetPtrHelper<V>::PtrType value) const -> std::enable_if_t<IsSmartPtr<V>::value, unsigned>
inline auto HashCountedSet<Value, HashFunctions, Traits>::count(typename GetPtrHelper<V>::PtrType value) const -> typename std::enable_if<IsSmartPtr<V>::value, unsigned>::type
{
return m_impl.get(value);
}

template<typename Value, typename HashFunctions, typename Traits>
template<typename V>
inline auto HashCountedSet<Value, HashFunctions, Traits>::remove(typename GetPtrHelper<V>::PtrType value) -> std::enable_if_t<IsSmartPtr<V>::value, bool>
inline auto HashCountedSet<Value, HashFunctions, Traits>::remove(typename GetPtrHelper<V>::PtrType value) -> typename std::enable_if<IsSmartPtr<V>::value, bool>::type
{
return remove(find(value));
}
@@ -178,30 +178,30 @@ namespace WTF {
template<typename... Types>
struct TupleHash {
template<size_t I = 0>
static std::enable_if_t<I < sizeof...(Types) - 1, unsigned> hash(const std::tuple<Types...>& t)
static typename std::enable_if<I < sizeof...(Types) - 1, unsigned>::type hash(const std::tuple<Types...>& t)
{
using IthTupleElementType = std::tuple_element_t<I, typename std::tuple<Types...>>;
using IthTupleElementType = typename std::tuple_element<I, typename std::tuple<Types...>>::type;
return pairIntHash(DefaultHash<IthTupleElementType>::Hash::hash(std::get<I>(t)), hash<I + 1>(t));
}

template<size_t I = 0>
static std::enable_if_t<I == sizeof...(Types) - 1, unsigned> hash(const std::tuple<Types...>& t)
static typename std::enable_if<I == sizeof...(Types) - 1, unsigned>::type hash(const std::tuple<Types...>& t)
{
using IthTupleElementType = std::tuple_element_t<I, typename std::tuple<Types...>>;
using IthTupleElementType = typename std::tuple_element<I, typename std::tuple<Types...>>::type;
return DefaultHash<IthTupleElementType>::Hash::hash(std::get<I>(t));
}

template<size_t I = 0>
static std::enable_if_t<I < sizeof...(Types) - 1, bool> equal(const std::tuple<Types...>& a, const std::tuple<Types...>& b)
static typename std::enable_if<I < sizeof...(Types) - 1, bool>::type equal(const std::tuple<Types...>& a, const std::tuple<Types...>& b)
{
using IthTupleElementType = std::tuple_element_t<I, typename std::tuple<Types...>>;
using IthTupleElementType = typename std::tuple_element<I, typename std::tuple<Types...>>::type;
return DefaultHash<IthTupleElementType>::Hash::equal(std::get<I>(a), std::get<I>(b)) && equal<I + 1>(a, b);
}

template<size_t I = 0>
static std::enable_if_t<I == sizeof...(Types) - 1, bool> equal(const std::tuple<Types...>& a, const std::tuple<Types...>& b)
static typename std::enable_if<I == sizeof...(Types) - 1, bool>::type equal(const std::tuple<Types...>& a, const std::tuple<Types...>& b)
{
using IthTupleElementType = std::tuple_element_t<I, typename std::tuple<Types...>>;
using IthTupleElementType = typename std::tuple_element<I, typename std::tuple<Types...>>::type;
return DefaultHash<IthTupleElementType>::Hash::equal(std::get<I>(a), std::get<I>(b));
}

@@ -160,13 +160,13 @@ class HashMap final {
template<typename HashTranslator, typename K, typename V> AddResult add(K&&, V&&);

// Overloads for smart pointer keys that take the raw pointer type as the parameter.
template<typename K = KeyType> std::enable_if_t<IsSmartPtr<K>::value, iterator> find(typename GetPtrHelper<K>::PtrType);
template<typename K = KeyType> std::enable_if_t<IsSmartPtr<K>::value, const_iterator> find(typename GetPtrHelper<K>::PtrType) const;
template<typename K = KeyType> std::enable_if_t<IsSmartPtr<K>::value, bool> contains(typename GetPtrHelper<K>::PtrType) const;
template<typename K = KeyType> std::enable_if_t<IsSmartPtr<K>::value, MappedPeekType> inlineGet(typename GetPtrHelper<K>::PtrType) const;
template<typename K = KeyType> std::enable_if_t<IsSmartPtr<K>::value, MappedPeekType> get(typename GetPtrHelper<K>::PtrType) const;
template<typename K = KeyType> std::enable_if_t<IsSmartPtr<K>::value, bool> remove(typename GetPtrHelper<K>::PtrType);
template<typename K = KeyType> std::enable_if_t<IsSmartPtr<K>::value, MappedTakeType> take(typename GetPtrHelper<K>::PtrType);
template<typename K = KeyType> typename std::enable_if<IsSmartPtr<K>::value, iterator>::type find(typename GetPtrHelper<K>::PtrType);
template<typename K = KeyType> typename std::enable_if<IsSmartPtr<K>::value, const_iterator>::type find(typename GetPtrHelper<K>::PtrType) const;
template<typename K = KeyType> typename std::enable_if<IsSmartPtr<K>::value, bool>::type contains(typename GetPtrHelper<K>::PtrType) const;
template<typename K = KeyType> typename std::enable_if<IsSmartPtr<K>::value, MappedPeekType>::type inlineGet(typename GetPtrHelper<K>::PtrType) const;
template<typename K = KeyType> typename std::enable_if<IsSmartPtr<K>::value, MappedPeekType>::type get(typename GetPtrHelper<K>::PtrType) const;
template<typename K = KeyType> typename std::enable_if<IsSmartPtr<K>::value, bool>::type remove(typename GetPtrHelper<K>::PtrType);
template<typename K = KeyType> typename std::enable_if<IsSmartPtr<K>::value, MappedTakeType>::type take(typename GetPtrHelper<K>::PtrType);

void checkConsistency() const;

@@ -473,28 +473,28 @@ auto HashMap<T, U, V, W, MappedTraits>::take(const KeyType& key) -> MappedTakeTy

template<typename T, typename U, typename V, typename W, typename X>
template<typename K>
inline auto HashMap<T, U, V, W, X>::find(typename GetPtrHelper<K>::PtrType key) -> std::enable_if_t<IsSmartPtr<K>::value, iterator>
inline auto HashMap<T, U, V, W, X>::find(typename GetPtrHelper<K>::PtrType key) -> typename std::enable_if<IsSmartPtr<K>::value, iterator>::type
{
return m_impl.template find<HashMapTranslator<KeyValuePairTraits, HashFunctions>>(key);
}

template<typename T, typename U, typename V, typename W, typename X>
template<typename K>
inline auto HashMap<T, U, V, W, X>::find(typename GetPtrHelper<K>::PtrType key) const -> std::enable_if_t<IsSmartPtr<K>::value, const_iterator>
inline auto HashMap<T, U, V, W, X>::find(typename GetPtrHelper<K>::PtrType key) const -> typename std::enable_if<IsSmartPtr<K>::value, const_iterator>::type
{
return m_impl.template find<HashMapTranslator<KeyValuePairTraits, HashFunctions>>(key);
}

template<typename T, typename U, typename V, typename W, typename X>
template<typename K>
inline auto HashMap<T, U, V, W, X>::contains(typename GetPtrHelper<K>::PtrType key) const -> std::enable_if_t<IsSmartPtr<K>::value, bool>
inline auto HashMap<T, U, V, W, X>::contains(typename GetPtrHelper<K>::PtrType key) const -> typename std::enable_if<IsSmartPtr<K>::value, bool>::type
{
return m_impl.template contains<HashMapTranslator<KeyValuePairTraits, HashFunctions>>(key);
}

template<typename T, typename U, typename V, typename W, typename X>
template<typename K>
inline auto HashMap<T, U, V, W, X>::inlineGet(typename GetPtrHelper<K>::PtrType key) const -> std::enable_if_t<IsSmartPtr<K>::value, MappedPeekType>
inline auto HashMap<T, U, V, W, X>::inlineGet(typename GetPtrHelper<K>::PtrType key) const -> typename std::enable_if<IsSmartPtr<K>::value, MappedPeekType>::type
{
KeyValuePairType* entry = const_cast<HashTableType&>(m_impl).template inlineLookup<HashMapTranslator<KeyValuePairTraits, HashFunctions>>(key);
if (!entry)
@@ -504,21 +504,21 @@ inline auto HashMap<T, U, V, W, X>::inlineGet(typename GetPtrHelper<K>::PtrType

template<typename T, typename U, typename V, typename W, typename X>
template<typename K>
auto HashMap<T, U, V, W, X>::get(typename GetPtrHelper<K>::PtrType key) const -> std::enable_if_t<IsSmartPtr<K>::value, MappedPeekType>
auto HashMap<T, U, V, W, X>::get(typename GetPtrHelper<K>::PtrType key) const -> typename std::enable_if<IsSmartPtr<K>::value, MappedPeekType>::type
{
return inlineGet(key);
}

template<typename T, typename U, typename V, typename W, typename X>
template<typename K>
inline auto HashMap<T, U, V, W, X>::remove(typename GetPtrHelper<K>::PtrType key) -> std::enable_if_t<IsSmartPtr<K>::value, bool>
inline auto HashMap<T, U, V, W, X>::remove(typename GetPtrHelper<K>::PtrType key) -> typename std::enable_if<IsSmartPtr<K>::value, bool>::type
{
return remove(find(key));
}

template<typename T, typename U, typename V, typename W, typename X>
template<typename K>
inline auto HashMap<T, U, V, W, X>::take(typename GetPtrHelper<K>::PtrType key) -> std::enable_if_t<IsSmartPtr<K>::value, MappedTakeType>
inline auto HashMap<T, U, V, W, X>::take(typename GetPtrHelper<K>::PtrType key) -> typename std::enable_if<IsSmartPtr<K>::value, MappedTakeType>::type
{
iterator it = find(key);
if (it == end())

0 comments on commit d923f7c

Please sign in to comment.