зеркало из https://github.com/mozilla/gecko-dev.git
Bug 353962. Use OSAtomic on Darwin for JS thinlocks. r/a=brendan
This commit is contained in:
Родитель
3f33f45d2a
Коммит
83a63cb101
|
@ -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 */
|
||||
|
|
Загрузка…
Ссылка в новой задаче