Index: src/atomicops_internals_x86_msvc.h |
diff --git a/src/atomicops_internals_x86_msvc.h b/src/atomicops_internals_x86_msvc.h |
index fcf6a65107747bcdc5906118b7afe342f480a995..ad9cf9d80bbf2804f9e853876c7dbb1f619cba95 100644 |
--- a/src/atomicops_internals_x86_msvc.h |
+++ b/src/atomicops_internals_x86_msvc.h |
@@ -33,6 +33,15 @@ |
#include "checks.h" |
#include "win32-headers.h" |
+#if 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 { |
@@ -70,8 +79,13 @@ inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr, |
#error "We require at least vs2005 for MemoryBarrier" |
#endif |
inline void MemoryBarrier() { |
+#if defined(V8_HOST_ARCH_64_BIT) |
+ // See #undef and note at the top of this file. |
+ __faststorefence(); |
+#else |
// We use MemoryBarrier from WinNT.h |
::MemoryBarrier(); |
+#endif |
} |
inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr, |