Index: src/atomicops.h |
diff --git a/src/atomicops.h b/src/atomicops.h |
index d7d4df6763f791d54caa996627a69f49a591eb36..aa2b22f141aa738d5e342d76c808c72cb25881ca 100644 |
--- a/src/atomicops.h |
+++ b/src/atomicops.h |
@@ -51,6 +51,15 @@ |
#include "../include/v8.h" |
#include "globals.h" |
+#if defined(_WIN32) && defined(V8_HOST_ARCH_64_BIT) |
+// windows.h #defines this (only on x64). This causes problems because the |
+// public API also uses MemoryBarrier at the public name for this fence. So, on |
+// X64, undef it, and call its documented |
+// (http://msdn.microsoft.com/en-us/library/windows/desktop/ms684208.aspx) |
+// implementation directly. |
+#undef MemoryBarrier |
+#endif |
+ |
namespace v8 { |
namespace internal { |
@@ -58,9 +67,7 @@ typedef int32_t Atomic32; |
#ifdef V8_HOST_ARCH_64_BIT |
// We need to be able to go between Atomic64 and AtomicWord implicitly. This |
// means Atomic64 and AtomicWord should be the same type on 64-bit. |
-#if defined(__ILP32__) || defined(__APPLE__) |
-// MacOS is an exception to the implicit conversion rule above, |
-// because it uses long for intptr_t. |
+#if defined(__ILP32__) |
typedef int64_t Atomic64; |
#else |
typedef intptr_t Atomic64; |
@@ -69,11 +76,7 @@ typedef intptr_t Atomic64; |
// Use AtomicWord for a machine-sized pointer. It will use the Atomic32 or |
// Atomic64 routines below, depending on your architecture. |
-#if defined(__OpenBSD__) && defined(__i386__) |
-typedef Atomic32 AtomicWord; |
-#else |
typedef intptr_t AtomicWord; |
-#endif |
// Atomically execute: |
// result = *ptr; |
@@ -155,18 +158,24 @@ Atomic64 Release_Load(volatile const Atomic64* ptr); |
#include "atomicops_internals_tsan.h" |
#elif defined(_MSC_VER) && (V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64) |
#include "atomicops_internals_x86_msvc.h" |
-#elif defined(__APPLE__) && (V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64) |
-#include "atomicops_internals_x86_macosx.h" |
-#elif defined(__GNUC__) && (V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64) |
-#include "atomicops_internals_x86_gcc.h" |
+#elif defined(__APPLE__) |
+#include "atomicops_internals_mac.h" |
#elif defined(__GNUC__) && V8_HOST_ARCH_A64 |
#include "atomicops_internals_a64_gcc.h" |
#elif defined(__GNUC__) && V8_HOST_ARCH_ARM |
#include "atomicops_internals_arm_gcc.h" |
+#elif defined(__GNUC__) && (V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64) |
+#include "atomicops_internals_x86_gcc.h" |
#elif defined(__GNUC__) && V8_HOST_ARCH_MIPS |
#include "atomicops_internals_mips_gcc.h" |
#else |
#error "Atomic operations are not supported on your platform" |
#endif |
+// On some platforms we need additional declarations to make |
+// AtomicWord compatible with our other Atomic* types. |
+#if defined(__APPLE__) || defined(__OpenBSD__) |
+#include "atomicops_internals_atomicword_compat.h" |
+#endif |
+ |
#endif // V8_ATOMICOPS_H_ |