Revision: 25147
Author: [email protected]
Date: Wed Nov 5 12:35:19 2014 UTC
Log: Use compiler barrier instead of memory barrier for
release/acquire atomic operations on mac.
BUG=
[email protected]
Review URL: https://codereview.chromium.org/694703003
https://code.google.com/p/v8/source/detail?r=25147
Modified:
/branches/bleeding_edge/src/base/atomicops_internals_mac.h
=======================================
--- /branches/bleeding_edge/src/base/atomicops_internals_mac.h Thu Jun 5
12:14:47 2014 UTC
+++ /branches/bleeding_edge/src/base/atomicops_internals_mac.h Wed Nov 5
12:35:19 2014 UTC
@@ -11,6 +11,20 @@
namespace v8 {
namespace base {
+
+#define ATOMICOPS_COMPILER_BARRIER() __asm__
__volatile__("" : : : "memory")
+
+inline void MemoryBarrier() { OSMemoryBarrier(); }
+
+inline void AcquireMemoryBarrier() {
+// On x86 processors, loads already have acquire semantics, so
+// there is no need to put a full barrier here.
+#if V8_HOST_ARCH_IA32 || V8_HOST_ARCH_X64
+ ATOMICOPS_COMPILER_BARRIER();
+#else
+ MemoryBarrier();
+#endif
+}
inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
Atomic32 old_value,
@@ -45,10 +59,6 @@
Atomic32 increment) {
return OSAtomicAdd32Barrier(increment, const_cast<Atomic32*>(ptr));
}
-
-inline void MemoryBarrier() {
- OSMemoryBarrier();
-}
inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
Atomic32 old_value,
@@ -98,7 +108,7 @@
inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
Atomic32 value = *ptr;
- MemoryBarrier();
+ AcquireMemoryBarrier();
return value;
}
@@ -188,7 +198,7 @@
inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) {
Atomic64 value = *ptr;
- MemoryBarrier();
+ AcquireMemoryBarrier();
return value;
}
@@ -199,6 +209,7 @@
#endif // defined(__LP64__)
+#undef ATOMICOPS_COMPILER_BARRIER
} } // namespace v8::base
#endif // V8_BASE_ATOMICOPS_INTERNALS_MAC_H_
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.