Title: [124115] trunk/Source/WTF
- Revision
- 124115
- Author
- commit-qu...@webkit.org
- Date
- 2012-07-30 16:53:20 -0700 (Mon, 30 Jul 2012)
Log Message
atomicDecrement() never reach 0 on Android so no deref() will be called
https://bugs.webkit.org/show_bug.cgi?id=92635
Patch by Wei James <james....@intel.com> on 2012-07-30
Reviewed by Adam Barth.
With Android NDK 7b and later, __atomic_dec() is implemented by
__sync_fetch_and_sub(), which will result in that atomicDecrement()
returns the old value instead of new one.
* wtf/Atomics.h:
(WTF):
(WTF::atomicIncrement):
(WTF::atomicDecrement):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (124114 => 124115)
--- trunk/Source/WTF/ChangeLog 2012-07-30 23:34:20 UTC (rev 124114)
+++ trunk/Source/WTF/ChangeLog 2012-07-30 23:53:20 UTC (rev 124115)
@@ -1,3 +1,19 @@
+2012-07-30 Wei James <james....@intel.com>
+
+ atomicDecrement() never reach 0 on Android so no deref() will be called
+ https://bugs.webkit.org/show_bug.cgi?id=92635
+
+ Reviewed by Adam Barth.
+
+ With Android NDK 7b and later, __atomic_dec() is implemented by
+ __sync_fetch_and_sub(), which will result in that atomicDecrement()
+ returns the old value instead of new one.
+
+ * wtf/Atomics.h:
+ (WTF):
+ (WTF::atomicIncrement):
+ (WTF::atomicDecrement):
+
2012-07-30 Patrick Gansterer <par...@webkit.org>
Add function to calculate the day in year from a date
Modified: trunk/Source/WTF/wtf/Atomics.h (124114 => 124115)
--- trunk/Source/WTF/wtf/Atomics.h 2012-07-30 23:34:20 UTC (rev 124114)
+++ trunk/Source/WTF/wtf/Atomics.h 2012-07-30 23:53:20 UTC (rev 124115)
@@ -108,8 +108,9 @@
#elif OS(ANDROID)
#define WTF_USE_LOCKFREE_THREADSAFEREFCOUNTED 1
-inline int atomicIncrement(int volatile* addend) { return __atomic_inc(addend); }
-inline int atomicDecrement(int volatile* addend) { return __atomic_dec(addend); }
+// Note, __atomic_{inc, dec}() return the previous value of addend's content.
+inline int atomicIncrement(int volatile* addend) { return __atomic_inc(addend) + 1; }
+inline int atomicDecrement(int volatile* addend) { return __atomic_dec(addend) - 1; }
#elif COMPILER(GCC) && !CPU(SPARC64) // sizeof(_Atomic_word) != sizeof(int) on sparc64 gcc
#define WTF_USE_LOCKFREE_THREADSAFEREFCOUNTED 1
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes