Index: src/atomicops_internals_mac.h |
diff --git a/src/atomicops_internals_x86_macosx.h b/src/atomicops_internals_mac.h |
similarity index 63% |
rename from src/atomicops_internals_x86_macosx.h |
rename to src/atomicops_internals_mac.h |
index bfb02b3851f2cdb422bbb7431d16cc6fdfb1a1fa..4bd0c09bdfd4032970597540ac8f96a8156de2ad 100644 |
--- a/src/atomicops_internals_x86_macosx.h |
+++ b/src/atomicops_internals_mac.h |
@@ -27,8 +27,8 @@ |
// This file is an internal atomic implementation, use atomicops.h instead. |
-#ifndef V8_ATOMICOPS_INTERNALS_X86_MACOSX_H_ |
-#define V8_ATOMICOPS_INTERNALS_X86_MACOSX_H_ |
+#ifndef V8_ATOMICOPS_INTERNALS_MAC_H_ |
+#define V8_ATOMICOPS_INTERNALS_MAC_H_ |
#include <libkern/OSAtomic.h> |
@@ -65,7 +65,7 @@ inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr, |
} |
inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr, |
- Atomic32 increment) { |
+ Atomic32 increment) { |
return OSAtomicAdd32Barrier(increment, const_cast<Atomic32*>(ptr)); |
} |
@@ -132,7 +132,7 @@ inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr, |
Atomic64 prev_value; |
do { |
if (OSAtomicCompareAndSwap64(old_value, new_value, |
- const_cast<Atomic64*>(ptr))) { |
+ reinterpret_cast<volatile int64_t*>(ptr))) { |
return old_value; |
} |
prev_value = *ptr; |
@@ -146,18 +146,19 @@ inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr, |
do { |
old_value = *ptr; |
} while (!OSAtomicCompareAndSwap64(old_value, new_value, |
- const_cast<Atomic64*>(ptr))); |
+ reinterpret_cast<volatile int64_t*>(ptr))); |
return old_value; |
} |
inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr, |
Atomic64 increment) { |
- return OSAtomicAdd64(increment, const_cast<Atomic64*>(ptr)); |
+ return OSAtomicAdd64(increment, reinterpret_cast<volatile int64_t*>(ptr)); |
} |
inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr, |
Atomic64 increment) { |
- return OSAtomicAdd64Barrier(increment, const_cast<Atomic64*>(ptr)); |
+ return OSAtomicAdd64Barrier(increment, |
+ reinterpret_cast<volatile int64_t*>(ptr)); |
} |
inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr, |
@@ -165,8 +166,8 @@ inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr, |
Atomic64 new_value) { |
Atomic64 prev_value; |
do { |
- if (OSAtomicCompareAndSwap64Barrier(old_value, new_value, |
- const_cast<Atomic64*>(ptr))) { |
+ if (OSAtomicCompareAndSwap64Barrier( |
+ old_value, new_value, reinterpret_cast<volatile int64_t*>(ptr))) { |
return old_value; |
} |
prev_value = *ptr; |
@@ -213,89 +214,6 @@ inline Atomic64 Release_Load(volatile const Atomic64* ptr) { |
#endif // defined(__LP64__) |
-// MacOS uses long for intptr_t, AtomicWord and Atomic32 are always different |
-// on the Mac, even when they are the same size. We need to explicitly cast |
-// from AtomicWord to Atomic32/64 to implement the AtomicWord interface. |
-#ifdef __LP64__ |
-#define AtomicWordCastType Atomic64 |
-#else |
-#define AtomicWordCastType Atomic32 |
-#endif |
- |
-inline AtomicWord NoBarrier_CompareAndSwap(volatile AtomicWord* ptr, |
- AtomicWord old_value, |
- AtomicWord new_value) { |
- return NoBarrier_CompareAndSwap( |
- reinterpret_cast<volatile AtomicWordCastType*>(ptr), |
- old_value, new_value); |
-} |
- |
-inline AtomicWord NoBarrier_AtomicExchange(volatile AtomicWord* ptr, |
- AtomicWord new_value) { |
- return NoBarrier_AtomicExchange( |
- reinterpret_cast<volatile AtomicWordCastType*>(ptr), new_value); |
-} |
- |
-inline AtomicWord NoBarrier_AtomicIncrement(volatile AtomicWord* ptr, |
- AtomicWord increment) { |
- return NoBarrier_AtomicIncrement( |
- reinterpret_cast<volatile AtomicWordCastType*>(ptr), increment); |
-} |
- |
-inline AtomicWord Barrier_AtomicIncrement(volatile AtomicWord* ptr, |
- AtomicWord increment) { |
- return Barrier_AtomicIncrement( |
- reinterpret_cast<volatile AtomicWordCastType*>(ptr), increment); |
-} |
- |
-inline AtomicWord Acquire_CompareAndSwap(volatile AtomicWord* ptr, |
- AtomicWord old_value, |
- AtomicWord new_value) { |
- return v8::internal::Acquire_CompareAndSwap( |
- reinterpret_cast<volatile AtomicWordCastType*>(ptr), |
- old_value, new_value); |
-} |
- |
-inline AtomicWord Release_CompareAndSwap(volatile AtomicWord* ptr, |
- AtomicWord old_value, |
- AtomicWord new_value) { |
- return v8::internal::Release_CompareAndSwap( |
- reinterpret_cast<volatile AtomicWordCastType*>(ptr), |
- old_value, new_value); |
-} |
- |
-inline void NoBarrier_Store(volatile AtomicWord* ptr, AtomicWord value) { |
- NoBarrier_Store( |
- reinterpret_cast<volatile AtomicWordCastType*>(ptr), value); |
-} |
- |
-inline void Acquire_Store(volatile AtomicWord* ptr, AtomicWord value) { |
- return v8::internal::Acquire_Store( |
- reinterpret_cast<volatile AtomicWordCastType*>(ptr), value); |
-} |
- |
-inline void Release_Store(volatile AtomicWord* ptr, AtomicWord value) { |
- return v8::internal::Release_Store( |
- reinterpret_cast<volatile AtomicWordCastType*>(ptr), value); |
-} |
- |
-inline AtomicWord NoBarrier_Load(volatile const AtomicWord* ptr) { |
- return NoBarrier_Load( |
- reinterpret_cast<volatile const AtomicWordCastType*>(ptr)); |
-} |
- |
-inline AtomicWord Acquire_Load(volatile const AtomicWord* ptr) { |
- return v8::internal::Acquire_Load( |
- reinterpret_cast<volatile const AtomicWordCastType*>(ptr)); |
-} |
- |
-inline AtomicWord Release_Load(volatile const AtomicWord* ptr) { |
- return v8::internal::Release_Load( |
- reinterpret_cast<volatile const AtomicWordCastType*>(ptr)); |
-} |
- |
-#undef AtomicWordCastType |
- |
} } // namespace v8::internal |
-#endif // V8_ATOMICOPS_INTERNALS_X86_MACOSX_H_ |
+#endif // V8_ATOMICOPS_INTERNALS_MAC_H_ |