#ifndef V8_BASE_ATOMIC_UTILS_H_
#define V8_BASE_ATOMIC_UTILS_H_
#include <limits.h>
#include <atomic>
#include <type_traits>
#include "src/base/atomicops.h"
#include "src/base/macros.h"
namespace v8 {
namespace base {
template <typename T>
class AtomicValue { … };
template <typename TAtomicStorageType>
class AsAtomicImpl { … };
AsAtomic8;
AsAtomic16;
AsAtomic32;
AsAtomicWord;
template <int Width>
struct AtomicTypeFromByteWidth { … };
template <>
struct AtomicTypeFromByteWidth<1> { … };
template <>
struct AtomicTypeFromByteWidth<2> { … };
template <>
struct AtomicTypeFromByteWidth<4> { … };
#if V8_HOST_ARCH_64_BIT
template <>
struct AtomicTypeFromByteWidth<8> { … };
#endif
template <typename TAtomicStorageType>
class AsAtomicPointerImpl : public AsAtomicImpl<TAtomicStorageType> { … };
AsAtomicPointer;
template <typename T,
typename = typename std::enable_if<std::is_unsigned<T>::value>::type>
inline void CheckedIncrement(
std::atomic<T>* number, T amount,
std::memory_order order = std::memory_order_seq_cst) { … }
template <typename T,
typename = typename std::enable_if<std::is_unsigned<T>::value>::type>
inline void CheckedDecrement(
std::atomic<T>* number, T amount,
std::memory_order order = std::memory_order_seq_cst) { … }
template <typename T>
V8_INLINE std::atomic<T>* AsAtomicPtr(T* t) { … }
template <typename T>
V8_INLINE const std::atomic<T>* AsAtomicPtr(const T* t) { … }
}
}
#endif