js_SetupLocks(8, 16);
if (!js_SetupLocks(8, 16)) goto bad;
JS_NewRuntime(uint32 maxbytes){    JSRuntime *rt;#ifdef DEBUG    JS_BEGIN_MACRO    /*     * This code asserts that the numbers associated with the error names in     * jsmsg.def are monotonically increasing.  It uses values for the error     * names enumerated in jscntxt.c.  It's not a compiletime check, but it's     * better than nothing.     */    int errorNumber = 0;#define MSG_DEF(name, number, count, exception, format) \    JS_ASSERT(name == errorNumber++);#include "js.msg"#undef MSG_DEF    JS_END_MACRO;#endif /* DEBUG */    if (!js_InitStringGlobals())        return NULL;    rt = (JSRuntime *) malloc(sizeof(JSRuntime));    if (!rt)        return NULL;    /* Initialize infallibly first, so we can goto bad and JS_DestroyRuntime. */    memset(rt, 0, sizeof(JSRuntime));    JS_INIT_CLIST(&rt->contextList);    JS_INIT_CLIST(&rt->trapList);    JS_INIT_CLIST(&rt->watchPointList);    if (!js_InitGC(rt, maxbytes))        goto bad;#ifdef JS_THREADSAFE    rt->gcLock = JS_NEW_LOCK();    if (!rt->gcLock)        goto bad;    rt->gcDone = JS_NEW_CONDVAR(rt->gcLock);    if (!rt->gcDone)        goto bad;    rt->requestDone = JS_NEW_CONDVAR(rt->gcLock);    if (!rt->requestDone)        goto bad;    js_SetupLocks(8, 16);       /* this is asymmetric with JS_ShutDown. */    rt->rtLock = JS_NEW_LOCK();    if (!rt->rtLock)        goto bad;    rt->stateChange = JS_NEW_CONDVAR(rt->gcLock);    if (!rt->stateChange)        goto bad;    rt->setSlotLock = JS_NEW_LOCK();    if (!rt->setSlotLock)        goto bad;    rt->setSlotDone = JS_NEW_CONDVAR(rt->setSlotLock);    if (!rt->setSlotDone)        goto bad;    rt->scopeSharingDone = JS_NEW_CONDVAR(rt->gcLock);    if (!rt->scopeSharingDone)        goto bad;    rt->scopeSharingTodo = NO_SCOPE_SHARING_TODO;#endif    rt->propertyCache.empty = JS_TRUE;    if (!js_InitPropertyTree(rt))        goto bad;    return rt;bad:    JS_DestroyRuntime(rt);    return NULL;}