diff --git a/mozilla/js/src/jslock.c b/mozilla/js/src/jslock.c index acd13c3ca9b..9dc5cc3c88d 100644 --- a/mozilla/js/src/jslock.c +++ b/mozilla/js/src/jslock.c @@ -99,6 +99,21 @@ js_CompareAndSwap(jsword *w, jsword ov, jsword nv) } } +#elif defined(XP_MACOSX) || defined(DARWIN) + +#include + +static JS_INLINE int +js_CompareAndSwap(jsword *w, jsword ov, jsword nv) +{ + // Details on these functions available in the manpage for atomic +#if JS_BYTES_PER_WORD == 8 && JS_BYTES_PER_LONG != 8 + return OSAtomicCompareAndSwap64Barrier(ov, nv, (int64_t*) w); +#else + return OSAtomicCompareAndSwap32Barrier(ov, nv, (int32_t*) w); +#endif +} + #elif defined(__GNUC__) && defined(__i386__) /* Note: This fails on 386 cpus, cmpxchgl is a >= 486 instruction */