30 #ifndef V8_ATOMICOPS_INTERNALS_X86_MACOSX_H_
31 #define V8_ATOMICOPS_INTERNALS_X86_MACOSX_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 const_cast<Atomic64*>(ptr))) {
139 }
while (prev_value == old_value);
144 Atomic64 new_value) {
148 }
while (!OSAtomicCompareAndSwap64(old_value, new_value,
149 const_cast<Atomic64*>(ptr)));
154 Atomic64 increment) {
155 return OSAtomicAdd64(increment, const_cast<Atomic64*>(ptr));
159 Atomic64 increment) {
160 return OSAtomicAdd64Barrier(increment, const_cast<Atomic64*>(ptr));
165 Atomic64 new_value) {
168 if (OSAtomicCompareAndSwap64Barrier(old_value, new_value,
169 const_cast<Atomic64*>(ptr))) {
173 }
while (prev_value == old_value);
179 Atomic64 new_value) {
189 inline void Acquire_Store(
volatile Atomic64* ptr, Atomic64 value) {
194 inline void Release_Store(
volatile Atomic64* ptr, Atomic64 value) {
203 inline Atomic64
Acquire_Load(
volatile const Atomic64* ptr) {
204 Atomic64 value = *ptr;
209 inline Atomic64
Release_Load(
volatile const Atomic64* ptr) {
214 #endif // defined(__LP64__)
220 #define AtomicWordCastType Atomic64
222 #define AtomicWordCastType Atomic32
229 reinterpret_cast<volatile AtomicWordCastType*>(ptr),
230 old_value, new_value);
236 reinterpret_cast<volatile AtomicWordCastType*>(ptr), new_value);
242 reinterpret_cast<volatile AtomicWordCastType*>(ptr), increment);
248 reinterpret_cast<volatile AtomicWordCastType*>(ptr), increment);
255 reinterpret_cast<volatile AtomicWordCastType*>(ptr),
256 old_value, new_value);
263 reinterpret_cast<volatile AtomicWordCastType*>(ptr),
264 old_value, new_value);
269 reinterpret_cast<volatile AtomicWordCastType*>(ptr), value);
274 reinterpret_cast<volatile AtomicWordCastType*>(ptr), value);
279 reinterpret_cast<volatile AtomicWordCastType*>(ptr), value);
284 reinterpret_cast<volatile const AtomicWordCastType*>(ptr));
289 reinterpret_cast<volatile const AtomicWordCastType*>(ptr));
294 reinterpret_cast<volatile const AtomicWordCastType*>(ptr));
297 #undef AtomicWordCastType
301 #endif // V8_ATOMICOPS_INTERNALS_X86_MACOSX_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)