Index: base/atomicops.h |
diff --git a/base/atomicops.h b/base/atomicops.h |
index 84be8c04bc00e57ebbd701c803d2b3c24a314723..f6fad828d74460437de2a9fe70012b784f7c291c 100644 |
--- a/base/atomicops.h |
+++ b/base/atomicops.h |
@@ -30,6 +30,7 @@ |
#include <stdint.h> |
+#include "base/base_export.h" |
#include "build/build_config.h" |
#if defined(OS_WIN) && defined(ARCH_CPU_64_BITS) |
@@ -137,9 +138,36 @@ Atomic64 Release_Load(volatile const Atomic64* ptr); |
} // namespace subtle |
} // namespace base |
+// The following x86 CPU features are used in atomicops_internals_x86_gcc.h, but |
+// this file is duplicated inside of Chrome: protobuf and tcmalloc rely on the |
+// struct being present at link time. Some parts of Chrome can currently use the |
+// portable interface whereas others still use GCC one. The include guards are |
+// the same as in atomicops_internals_x86_gcc.cc. |
+#if defined(__i386__) || defined(__x86_64__) |
+// This struct is not part of the public API of this module; clients may not |
+// use it. (However, it's exported via BASE_EXPORT because clients implicitly |
+// do use it at link time by inlining these functions.) |
+// Features of this x86. Values may not be correct before main() is run, |
+// but are set conservatively. |
+struct AtomicOps_x86CPUFeatureStruct { |
+ bool has_amd_lock_mb_bug; // Processor has AMD memory-barrier bug; do lfence |
+ // after acquire compare-and-swap. |
+ // The following fields are unused by Chrome's base implementation but are |
+ // still used by copies of the same code in other parts of the code base. This |
+ // causes an ODR violation, and the other code is likely reading invalid |
+ // memory. |
+ // TODO(jfb) Delete these fields once the rest of the Chrome code base doesn't |
+ // depend on them. |
+ bool has_sse2; // Processor has SSE2. |
+ bool has_cmpxchg16b; // Processor supports cmpxchg16b instructi |
+}; |
+BASE_EXPORT extern struct AtomicOps_x86CPUFeatureStruct |
+ AtomicOps_Internalx86CPUFeatures; |
+#endif |
+ |
// Include our platform specific implementation. |
-#if defined(THREAD_SANITIZER) |
-#include "base/atomicops_internals_tsan.h" |
Dmitry Vyukov
2014/10/08 08:05:44
__cplusplus is not necessary defined under tsan
It
|
+#if defined(__cplusplus) && (__cplusplus >= 201103L) // C++11 |
+#include "base/atomicops_internals_portable.h" |
#elif defined(OS_WIN) && defined(COMPILER_MSVC) && defined(ARCH_CPU_X86_FAMILY) |
#include "base/atomicops_internals_x86_msvc.h" |
#elif defined(OS_MACOSX) |