| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 | 5 |
| 6 // This file is an internal atomic implementation for compiler-based | 6 // This file is an internal atomic implementation for compiler-based |
| 7 // ThreadSanitizer. Use base/atomicops.h instead. | 7 // ThreadSanitizer. Use base/atomicops.h instead. |
| 8 | 8 |
| 9 #ifndef V8_BASE_ATOMICOPS_INTERNALS_TSAN_H_ | 9 #ifndef V8_BASE_ATOMICOPS_INTERNALS_TSAN_H_ |
| 10 #define V8_BASE_ATOMICOPS_INTERNALS_TSAN_H_ | 10 #define V8_BASE_ATOMICOPS_INTERNALS_TSAN_H_ |
| 11 | 11 |
| 12 namespace v8 { | 12 namespace v8 { |
| 13 namespace base { | 13 namespace base { |
| 14 | 14 |
| 15 #ifndef TSAN_INTERFACE_ATOMIC_H | 15 #ifndef TSAN_INTERFACE_ATOMIC_H |
| 16 #define TSAN_INTERFACE_ATOMIC_H | 16 #define TSAN_INTERFACE_ATOMIC_H |
| 17 | 17 |
| 18 // This struct is not part of the public API of this module; clients may not | 18 // This struct is not part of the public API of this module; clients may not |
| 19 // use it. (However, it's exported via BASE_EXPORT because clients implicitly | 19 // use it. (However, it's exported via BASE_EXPORT because clients implicitly |
| 20 // do use it at link time by inlining these functions.) | 20 // do use it at link time by inlining these functions.) |
| 21 // Features of this x86. Values may not be correct before main() is run, | 21 // Features of this x86. Values may not be correct before main() is run, |
| 22 // but are set conservatively. | 22 // but are set conservatively. |
| 23 struct AtomicOps_x86CPUFeatureStruct { | 23 struct AtomicOps_x86CPUFeatureStruct { |
| 24 bool has_amd_lock_mb_bug; // Processor has AMD memory-barrier bug; do lfence | 24 bool has_amd_lock_mb_bug; // Processor has AMD memory-barrier bug; do lfence |
| 25 // after acquire compare-and-swap. | 25 // after acquire compare-and-swap. |
| 26 #if !defined(__SSE2__) |
| 26 bool has_sse2; // Processor has SSE2. | 27 bool has_sse2; // Processor has SSE2. |
| 28 #endif |
| 27 }; | 29 }; |
| 28 extern struct AtomicOps_x86CPUFeatureStruct | 30 extern struct AtomicOps_x86CPUFeatureStruct |
| 29 AtomicOps_Internalx86CPUFeatures; | 31 AtomicOps_Internalx86CPUFeatures; |
| 30 | 32 |
| 31 #define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory") | 33 #define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory") |
| 32 | 34 |
| 33 extern "C" { | 35 extern "C" { |
| 34 typedef char __tsan_atomic8; | 36 typedef char __tsan_atomic8; |
| 35 typedef short __tsan_atomic16; // NOLINT | 37 typedef short __tsan_atomic16; // NOLINT |
| 36 typedef int __tsan_atomic32; | 38 typedef int __tsan_atomic32; |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 inline void MemoryBarrier() { | 372 inline void MemoryBarrier() { |
| 371 __tsan_atomic_thread_fence(__tsan_memory_order_seq_cst); | 373 __tsan_atomic_thread_fence(__tsan_memory_order_seq_cst); |
| 372 } | 374 } |
| 373 | 375 |
| 374 } // namespace base | 376 } // namespace base |
| 375 } // namespace v8 | 377 } // namespace v8 |
| 376 | 378 |
| 377 #undef ATOMICOPS_COMPILER_BARRIER | 379 #undef ATOMICOPS_COMPILER_BARRIER |
| 378 | 380 |
| 379 #endif // V8_BASE_ATOMICOPS_INTERNALS_TSAN_H_ | 381 #endif // V8_BASE_ATOMICOPS_INTERNALS_TSAN_H_ |
| OLD | NEW |