OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 14 matching lines...) Expand all Loading... |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 | 28 |
29 // This file is an internal atomic implementation for compiler-based | 29 // This file is an internal atomic implementation for compiler-based |
30 // ThreadSanitizer. Use base/atomicops.h instead. | 30 // ThreadSanitizer. Use base/atomicops.h instead. |
31 | 31 |
32 #ifndef V8_ATOMICOPS_INTERNALS_TSAN_H_ | 32 #ifndef V8_ATOMICOPS_INTERNALS_TSAN_H_ |
33 #define V8_ATOMICOPS_INTERNALS_TSAN_H_ | 33 #define V8_ATOMICOPS_INTERNALS_TSAN_H_ |
34 | 34 |
| 35 namespace v8 { |
| 36 namespace internal { |
| 37 |
| 38 #ifndef TSAN_INTERFACE_ATOMIC_H |
| 39 #define TSAN_INTERFACE_ATOMIC_H |
| 40 |
35 // This struct is not part of the public API of this module; clients may not | 41 // This struct is not part of the public API of this module; clients may not |
36 // use it. (However, it's exported via BASE_EXPORT because clients implicitly | 42 // use it. (However, it's exported via BASE_EXPORT because clients implicitly |
37 // do use it at link time by inlining these functions.) | 43 // do use it at link time by inlining these functions.) |
38 // Features of this x86. Values may not be correct before main() is run, | 44 // Features of this x86. Values may not be correct before main() is run, |
39 // but are set conservatively. | 45 // but are set conservatively. |
40 struct AtomicOps_x86CPUFeatureStruct { | 46 struct AtomicOps_x86CPUFeatureStruct { |
41 bool has_amd_lock_mb_bug; // Processor has AMD memory-barrier bug; do lfence | 47 bool has_amd_lock_mb_bug; // Processor has AMD memory-barrier bug; do lfence |
42 // after acquire compare-and-swap. | 48 // after acquire compare-and-swap. |
43 bool has_sse2; // Processor has SSE2. | 49 bool has_sse2; // Processor has SSE2. |
44 }; | 50 }; |
45 extern struct AtomicOps_x86CPUFeatureStruct | 51 extern struct AtomicOps_x86CPUFeatureStruct |
46 AtomicOps_Internalx86CPUFeatures; | 52 AtomicOps_Internalx86CPUFeatures; |
47 | 53 |
48 #define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory") | 54 #define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory") |
49 | 55 |
50 namespace v8 { | |
51 namespace internal { | |
52 | |
53 #ifndef TSAN_INTERFACE_ATOMIC_H | |
54 #define TSAN_INTERFACE_ATOMIC_H | |
55 | |
56 #ifdef __cplusplus | 56 #ifdef __cplusplus |
57 extern "C" { | 57 extern "C" { |
58 #endif | 58 #endif |
59 | 59 |
60 typedef char __tsan_atomic8; | 60 typedef char __tsan_atomic8; |
61 typedef short __tsan_atomic16; // NOLINT | 61 typedef short __tsan_atomic16; // NOLINT |
62 typedef int __tsan_atomic32; | 62 typedef int __tsan_atomic32; |
63 typedef long __tsan_atomic64; // NOLINT | 63 typedef long __tsan_atomic64; // NOLINT |
64 | 64 |
65 #if defined(__SIZEOF_INT128__) \ | 65 #if defined(__SIZEOF_INT128__) \ |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 inline void MemoryBarrier() { | 391 inline void MemoryBarrier() { |
392 __tsan_atomic_thread_fence(__tsan_memory_order_seq_cst); | 392 __tsan_atomic_thread_fence(__tsan_memory_order_seq_cst); |
393 } | 393 } |
394 | 394 |
395 } // namespace internal | 395 } // namespace internal |
396 } // namespace v8 | 396 } // namespace v8 |
397 | 397 |
398 #undef ATOMICOPS_COMPILER_BARRIER | 398 #undef ATOMICOPS_COMPILER_BARRIER |
399 | 399 |
400 #endif // V8_ATOMICOPS_INTERNALS_TSAN_H_ | 400 #endif // V8_ATOMICOPS_INTERNALS_TSAN_H_ |
OLD | NEW |