Bug 353962. Use OSAtomic on Darwin for JS thinlocks. r/a=brendan

git-svn-id: svn://10.0.0.236/trunk@242943 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
sayrer%gmail.com
2008-01-12 07:16:14 +00:00
parent acff473efd
commit be75ca4915

View File

@@ -99,6 +99,21 @@ js_CompareAndSwap(jsword *w, jsword ov, jsword nv)
}
}
#elif defined(XP_MACOSX) || defined(DARWIN)
#include <libkern/OSAtomic.h>
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 */