зеркало из https://github.com/mozilla/gecko-dev.git
Implement js_CompareAndSwap for GCC x86 (Linux, FreeBSD etc). This gives us fast thin locks on linux.
bug 20357, r=brendan a=brendan
This commit is contained in:
Родитель
52cc67de92
Коммит
919d491e71
|
@ -93,6 +93,24 @@ js_CompareAndSwap(jsword *w, jsword ov, jsword nv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#elif defined(__GNUC__) && defined(__i386__) && !defined(NSPR_LOCK)
|
||||||
|
|
||||||
|
/* Note: This fails on 386 cpus, cmpxchgl is a >= 486 instruction */
|
||||||
|
JS_INLINE int
|
||||||
|
js_CompareAndSwap(jsword *w, jsword ov, jsword nv)
|
||||||
|
{
|
||||||
|
unsigned int res;
|
||||||
|
|
||||||
|
__asm__ __volatile__ (
|
||||||
|
"lock cmpxchgl %2, (%1)\n"
|
||||||
|
"sete %%al\n"
|
||||||
|
"andl $1, %%eax\n"
|
||||||
|
: "=a" (res)
|
||||||
|
: "r" (w), "r" (nv), "a" (ov)
|
||||||
|
: "cc", "memory");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
#elif defined(SOLARIS) && defined(sparc) && !defined(NSPR_LOCK)
|
#elif defined(SOLARIS) && defined(sparc) && !defined(NSPR_LOCK)
|
||||||
|
|
||||||
#ifndef ULTRA_SPARC
|
#ifndef ULTRA_SPARC
|
||||||
|
|
|
@ -159,7 +159,8 @@ extern JSBool js_IsScopeLocked(JSScope *scope);
|
||||||
JS_LOCK_RUNTIME_VOID(_rt, e); \
|
JS_LOCK_RUNTIME_VOID(_rt, e); \
|
||||||
JS_END_MACRO
|
JS_END_MACRO
|
||||||
|
|
||||||
#if defined(JS_USE_ONLY_NSPR_LOCKS) || !(defined(_WIN32) || defined(SOLARIS) || defined(AIX))
|
#if defined(JS_USE_ONLY_NSPR_LOCKS) || \
|
||||||
|
!( (defined(_WIN32) && defined(_M_IX86)) || defined(SOLARIS) || defined(AIX) || (defined(__GNUC__) && defined(__i386__)) )
|
||||||
|
|
||||||
#undef JS_LOCK0
|
#undef JS_LOCK0
|
||||||
#undef JS_UNLOCK0
|
#undef JS_UNLOCK0
|
||||||
|
|
Загрузка…
Ссылка в новой задаче