Title: [139921] trunk/Source/WTF
Revision
139921
Author
[email protected]
Date
2013-01-16 13:52:08 -0800 (Wed, 16 Jan 2013)

Log Message

Use GCC's implementation of atomicIncrement/Decrement on Mac
https://bugs.webkit.org/show_bug.cgi?id=106976

Reviewed by Filip Pizlo.

* wtf/Atomics.h:
GCC and LLVM have builtin for atomic ADD and SUB: __sync_add_and_fetch,
__sync_sub_and_fetch.

Using them let the compiler just generate the atomic operations inline
instead of generating a function call to LibC. It also simplify the
code a bit.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (139920 => 139921)


--- trunk/Source/WTF/ChangeLog	2013-01-16 21:50:05 UTC (rev 139920)
+++ trunk/Source/WTF/ChangeLog	2013-01-16 21:52:08 UTC (rev 139921)
@@ -1,3 +1,18 @@
+2013-01-16  Benjamin Poulain  <[email protected]>
+
+        Use GCC's implementation of atomicIncrement/Decrement on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=106976
+
+        Reviewed by Filip Pizlo.
+
+        * wtf/Atomics.h:
+        GCC and LLVM have builtin for atomic ADD and SUB: __sync_add_and_fetch,
+        __sync_sub_and_fetch.
+
+        Using them let the compiler just generate the atomic operations inline
+        instead of generating a function call to LibC. It also simplify the
+        code a bit.
+
 2013-01-15  Adam Barth  <[email protected]>
 
         Generalize DocumentWeakReference into WTF::WeakPtr

Modified: trunk/Source/WTF/wtf/Atomics.h (139920 => 139921)


--- trunk/Source/WTF/wtf/Atomics.h	2013-01-16 21:50:05 UTC (rev 139920)
+++ trunk/Source/WTF/wtf/Atomics.h	2013-01-16 21:52:08 UTC (rev 139921)
@@ -65,19 +65,11 @@
 
 #if OS(WINDOWS)
 #include <windows.h>
-#elif OS(DARWIN)
-#include <libkern/OSAtomic.h>
 #elif OS(QNX)
 #include <atomic.h>
 #elif OS(ANDROID)
 #include <sys/atomics.h>
-#elif COMPILER(GCC)
-#if ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2))) && !defined(__LSB_VERSION__)
-#include <ext/atomicity.h>
-#else
-#include <bits/atomicity.h>
 #endif
-#endif
 
 namespace WTF {
 
@@ -92,15 +84,6 @@
 inline int atomicDecrement(int volatile* addend) { return InterlockedDecrement(reinterpret_cast<long volatile*>(addend)); }
 #endif
 
-#elif OS(DARWIN)
-#define WTF_USE_LOCKFREE_THREADSAFEREFCOUNTED 1
-
-inline int atomicIncrement(int volatile* addend) { return OSAtomicIncrement32Barrier(const_cast<int*>(addend)); }
-inline int atomicDecrement(int volatile* addend) { return OSAtomicDecrement32Barrier(const_cast<int*>(addend)); }
-
-inline int64_t atomicIncrement(int64_t volatile* addend) { return OSAtomicIncrement64Barrier(const_cast<int64_t*>(addend)); }
-inline int64_t atomicDecrement(int64_t volatile* addend) { return OSAtomicDecrement64Barrier(const_cast<int64_t*>(addend)); }
-
 #elif OS(QNX)
 #define WTF_USE_LOCKFREE_THREADSAFEREFCOUNTED 1
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to