зеркало из https://github.com/mozilla/pjs.git
Bug 331545 - "Use _InterlockedCompareExchange for js_CompareAndSwap" [p=mmoy@yahoo.com (Michael Moy) r+a1.9=brendan a=blocking1.9+]
This commit is contained in:
Родитель
a16fa8c1be
Коммит
fd8047f2a8
|
@ -85,20 +85,23 @@ js_UnlockGlobal(void *id)
|
|||
/* Exclude Alpha NT. */
|
||||
#if defined(_WIN32) && defined(_M_IX86)
|
||||
#pragma warning( disable : 4035 )
|
||||
#pragma intrinsic(_InterlockedCompareExchange)
|
||||
|
||||
static JS_INLINE int
|
||||
js_CompareAndSwap(jsword *w, jsword ov, jsword nv)
|
||||
js_CompareAndSwapHelper(jsword *w, jsword ov, jsword nv)
|
||||
{
|
||||
_InterlockedCompareExchange(w, nv, ov);
|
||||
__asm {
|
||||
mov eax, ov
|
||||
mov ecx, nv
|
||||
mov ebx, w
|
||||
lock cmpxchg [ebx], ecx
|
||||
sete al
|
||||
and eax, 1h
|
||||
}
|
||||
}
|
||||
|
||||
static JS_INLINE int
|
||||
js_CompareAndSwapHelper(jsword *w, jsword ov, jsword nv)
|
||||
{
|
||||
return (js_CompareAndSwapHelper(w, ov, nv) & 1);
|
||||
}
|
||||
|
||||
#elif defined(XP_MACOSX) || defined(DARWIN)
|
||||
|
||||
#include <libkern/OSAtomic.h>
|
||||
|
|
Загрузка…
Ссылка в новой задаче