30 #ifndef V8_ATOMICOPS_INTERNALS_MAC_H_
31 #define V8_ATOMICOPS_INTERNALS_MAC_H_
33 #include <libkern/OSAtomic.h>
43 if (OSAtomicCompareAndSwap32(old_value, new_value,
44 const_cast<Atomic32*>(ptr))) {
48 }
while (prev_value == old_value);
57 }
while (!OSAtomicCompareAndSwap32(old_value, new_value,
58 const_cast<Atomic32*>(ptr)));
64 return OSAtomicAdd32(increment, const_cast<Atomic32*>(ptr));
69 return OSAtomicAdd32Barrier(increment, const_cast<Atomic32*>(ptr));
81 if (OSAtomicCompareAndSwap32Barrier(old_value, new_value,
82 const_cast<Atomic32*>(ptr))) {
86 }
while (prev_value == old_value);
131 Atomic64 new_value) {
134 if (OSAtomicCompareAndSwap64(old_value, new_value,
135 reinterpret_cast<volatile int64_t*>(ptr))) {
139 }
while (prev_value == old_value);
144 Atomic64 new_value) {
148 }
while (!OSAtomicCompareAndSwap64(old_value, new_value,
149 reinterpret_cast<volatile int64_t*>(ptr)));
154 Atomic64 increment) {
155 return OSAtomicAdd64(increment, reinterpret_cast<volatile int64_t*>(ptr));
159 Atomic64 increment) {
160 return OSAtomicAdd64Barrier(increment,
161 reinterpret_cast<volatile int64_t*>(ptr));
166 Atomic64 new_value) {
169 if (OSAtomicCompareAndSwap64Barrier(
170 old_value, new_value, reinterpret_cast<volatile int64_t*>(ptr))) {
174 }
while (prev_value == old_value);
180 Atomic64 new_value) {
190 inline void Acquire_Store(
volatile Atomic64* ptr, Atomic64 value) {
195 inline void Release_Store(
volatile Atomic64* ptr, Atomic64 value) {
204 inline Atomic64
Acquire_Load(
volatile const Atomic64* ptr) {
205 Atomic64 value = *ptr;
210 inline Atomic64
Release_Load(
volatile const Atomic64* ptr) {
215 #endif // defined(__LP64__)
219 #endif // V8_ATOMICOPS_INTERNALS_MAC_H_
void Acquire_Store(volatile Atomic32 *ptr, Atomic32 value)
Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32 *ptr, Atomic32 old_value, Atomic32 new_value)
Atomic32 Release_CompareAndSwap(volatile Atomic32 *ptr, Atomic32 old_value, Atomic32 new_value)
void NoBarrier_Store(volatile Atomic32 *ptr, Atomic32 value)
Atomic32 NoBarrier_AtomicExchange(volatile Atomic32 *ptr, Atomic32 new_value)
Atomic32 Release_Load(volatile const Atomic32 *ptr)
Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32 *ptr, Atomic32 increment)
void Release_Store(volatile Atomic32 *ptr, Atomic32 value)
Atomic32 Barrier_AtomicIncrement(volatile Atomic32 *ptr, Atomic32 increment)
Atomic32 NoBarrier_Load(volatile const Atomic32 *ptr)
Atomic32 Acquire_Load(volatile const Atomic32 *ptr)
Atomic32 Acquire_CompareAndSwap(volatile Atomic32 *ptr, Atomic32 old_value, Atomic32 new_value)