| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file is an internal atomic implementation, use atomicops.h instead. | 5 // This file is an internal atomic implementation, use atomicops.h instead. |
| 6 | 6 |
| 7 #ifndef V8_ATOMICOPS_INTERNALS_MAC_H_ | 7 #ifndef V8_BASE_ATOMICOPS_INTERNALS_MAC_H_ |
| 8 #define V8_ATOMICOPS_INTERNALS_MAC_H_ | 8 #define V8_BASE_ATOMICOPS_INTERNALS_MAC_H_ |
| 9 | 9 |
| 10 #include <libkern/OSAtomic.h> | 10 #include <libkern/OSAtomic.h> |
| 11 | 11 |
| 12 namespace v8 { | 12 namespace v8 { |
| 13 namespace internal { | 13 namespace base { |
| 14 | 14 |
| 15 inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr, | 15 inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr, |
| 16 Atomic32 old_value, | 16 Atomic32 old_value, |
| 17 Atomic32 new_value) { | 17 Atomic32 new_value) { |
| 18 Atomic32 prev_value; | 18 Atomic32 prev_value; |
| 19 do { | 19 do { |
| 20 if (OSAtomicCompareAndSwap32(old_value, new_value, | 20 if (OSAtomicCompareAndSwap32(old_value, new_value, |
| 21 const_cast<Atomic32*>(ptr))) { | 21 const_cast<Atomic32*>(ptr))) { |
| 22 return old_value; | 22 return old_value; |
| 23 } | 23 } |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 return value; | 192 return value; |
| 193 } | 193 } |
| 194 | 194 |
| 195 inline Atomic64 Release_Load(volatile const Atomic64* ptr) { | 195 inline Atomic64 Release_Load(volatile const Atomic64* ptr) { |
| 196 MemoryBarrier(); | 196 MemoryBarrier(); |
| 197 return *ptr; | 197 return *ptr; |
| 198 } | 198 } |
| 199 | 199 |
| 200 #endif // defined(__LP64__) | 200 #endif // defined(__LP64__) |
| 201 | 201 |
| 202 } } // namespace v8::internal | 202 } } // namespace v8::base |
| 203 | 203 |
| 204 #endif // V8_ATOMICOPS_INTERNALS_MAC_H_ | 204 #endif // V8_BASE_ATOMICOPS_INTERNALS_MAC_H_ |
| OLD | NEW |