зеркало из https://github.com/mozilla/gecko-dev.git
bug 465032 - operationCount as the first field in JSContext. r=brendan
This commit is contained in:
Родитель
7a0edfd766
Коммит
221bf7e84f
|
@ -277,7 +277,7 @@ js_NewContext(JSRuntime *rt, size_t stackChunkSize)
|
|||
}
|
||||
JS_WAIT_CONDVAR(rt->stateChange, JS_NO_TIMEOUT);
|
||||
}
|
||||
JS_APPEND_LINK(&cx->links, &rt->contextList);
|
||||
JS_APPEND_LINK(&cx->link, &rt->contextList);
|
||||
JS_UNLOCK_GC(rt);
|
||||
|
||||
/*
|
||||
|
@ -391,7 +391,7 @@ js_DestroyContext(JSContext *cx, JSDestroyContextMode mode)
|
|||
/* Remove cx from context list first. */
|
||||
JS_LOCK_GC(rt);
|
||||
JS_ASSERT(rt->state == JSRTS_UP || rt->state == JSRTS_LAUNCHING);
|
||||
JS_REMOVE_LINK(&cx->links);
|
||||
JS_REMOVE_LINK(&cx->link);
|
||||
last = (rt->contextList.next == &rt->contextList);
|
||||
if (last)
|
||||
rt->state = JSRTS_LANDING;
|
||||
|
@ -519,7 +519,7 @@ js_ValidContextPointer(JSRuntime *rt, JSContext *cx)
|
|||
JSCList *cl;
|
||||
|
||||
for (cl = rt->contextList.next; cl != &rt->contextList; cl = cl->next) {
|
||||
if (cl == &cx->links)
|
||||
if (cl == &cx->link)
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_RUNTIME_METER(rt, deadContexts);
|
||||
|
@ -533,8 +533,8 @@ js_ContextIterator(JSRuntime *rt, JSBool unlocked, JSContext **iterp)
|
|||
|
||||
if (unlocked)
|
||||
JS_LOCK_GC(rt);
|
||||
cx = (JSContext *) (cx ? cx->links.next : rt->contextList.next);
|
||||
if (&cx->links == &rt->contextList)
|
||||
cx = js_ContextFromLinkField(cx ? cx->link.next : rt->contextList.next);
|
||||
if (&cx->link == &rt->contextList)
|
||||
cx = NULL;
|
||||
*iterp = cx;
|
||||
if (unlocked)
|
||||
|
|
|
@ -734,15 +734,15 @@ JS_STATIC_ASSERT(sizeof(JSTempValueUnion) == sizeof(void *));
|
|||
#define JSRESOLVE_INFER 0xffff /* infer bits from current bytecode */
|
||||
|
||||
struct JSContext {
|
||||
/* JSRuntime contextList linkage. */
|
||||
JSCList links;
|
||||
|
||||
/*
|
||||
* Operation count. It is declared early in the structure as a frequently
|
||||
* accessed field.
|
||||
* Operation count. It is declared as the first field in the struct to
|
||||
* ensure the fastest possible access.
|
||||
*/
|
||||
int32 operationCount;
|
||||
|
||||
/* JSRuntime contextList linkage. */
|
||||
JSCList link;
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
/*
|
||||
* Bit-set formed from binary exponentials of the XML_* tiny-ids defined
|
||||
|
@ -1047,6 +1047,13 @@ js_DestroyContext(JSContext *cx, JSDestroyContextMode mode);
|
|||
extern JSBool
|
||||
js_ValidContextPointer(JSRuntime *rt, JSContext *cx);
|
||||
|
||||
static JS_INLINE JSContext *
|
||||
js_ContextFromLinkField(JSCList *link)
|
||||
{
|
||||
JS_ASSERT(link);
|
||||
return (JSContext *) ((uint8 *) link - offsetof(JSContext, link));
|
||||
}
|
||||
|
||||
/*
|
||||
* If unlocked, acquire and release rt->gcLock around *iterp update; otherwise
|
||||
* the caller must be holding rt->gcLock.
|
||||
|
|
Загрузка…
Ссылка в новой задаче