| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium 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 base/atomicops.h instead. | 5 // This file is an internal atomic implementation, use base/atomicops.h instead. |
| 6 | 6 |
| 7 #ifndef BASE_ATOMICOPS_INTERNALS_X86_GCC_H_ | 7 #ifndef BASE_ATOMICOPS_INTERNALS_X86_GCC_H_ |
| 8 #define BASE_ATOMICOPS_INTERNALS_X86_GCC_H_ | 8 #define BASE_ATOMICOPS_INTERNALS_X86_GCC_H_ |
| 9 | 9 |
| 10 // This struct is not part of the public API of this module; clients may not | 10 // This struct is not part of the public API of this module; clients may not |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 // for current AMD/Intel chips as of Jan 2008. | 231 // for current AMD/Intel chips as of Jan 2008. |
| 232 // See also Release_Store(), above. | 232 // See also Release_Store(), above. |
| 233 ATOMICOPS_COMPILER_BARRIER(); | 233 ATOMICOPS_COMPILER_BARRIER(); |
| 234 return value; | 234 return value; |
| 235 } | 235 } |
| 236 | 236 |
| 237 inline Atomic64 Release_Load(volatile const Atomic64* ptr) { | 237 inline Atomic64 Release_Load(volatile const Atomic64* ptr) { |
| 238 MemoryBarrier(); | 238 MemoryBarrier(); |
| 239 return *ptr; | 239 return *ptr; |
| 240 } | 240 } |
| 241 |
| 242 inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr, |
| 243 Atomic64 old_value, |
| 244 Atomic64 new_value) { |
| 245 Atomic64 x = NoBarrier_CompareAndSwap(ptr, old_value, new_value); |
| 246 if (AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug) { |
| 247 __asm__ __volatile__("lfence" : : : "memory"); |
| 248 } |
| 249 return x; |
| 250 } |
| 251 |
| 252 inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr, |
| 253 Atomic64 old_value, |
| 254 Atomic64 new_value) { |
| 255 return NoBarrier_CompareAndSwap(ptr, old_value, new_value); |
| 256 } |
| 257 |
| 241 #endif // defined(__x86_64__) | 258 #endif // defined(__x86_64__) |
| 242 | 259 |
| 243 } // namespace base::subtle | 260 } // namespace base::subtle |
| 244 } // namespace base | 261 } // namespace base |
| 245 | 262 |
| 246 #undef ATOMICOPS_COMPILER_BARRIER | 263 #undef ATOMICOPS_COMPILER_BARRIER |
| 247 | 264 |
| 248 #endif // BASE_ATOMICOPS_INTERNALS_X86_GCC_H_ | 265 #endif // BASE_ATOMICOPS_INTERNALS_X86_GCC_H_ |
| OLD | NEW |