mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 17:23:59 +00:00
Add cx->lastAtom, a long overdue addition to the per-context GC root set (196461, r=shaver).
This commit is contained in:
parent
2a28a97e95
commit
73a99565bc
@ -1518,6 +1518,7 @@ JS_ClearNewbornRoots(JSContext *cx)
|
|||||||
|
|
||||||
for (i = 0; i < GCX_NTYPES; i++)
|
for (i = 0; i < GCX_NTYPES; i++)
|
||||||
cx->newborn[i] = NULL;
|
cx->newborn[i] = NULL;
|
||||||
|
cx->lastAtom = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "jshash.h" /* Added by JSIFY */
|
#include "jshash.h" /* Added by JSIFY */
|
||||||
|
@ -459,6 +459,7 @@ js_AtomizeHashedKey(JSContext *cx, jsval key, JSHashNumber keyHash, uintN flags)
|
|||||||
|
|
||||||
atom = (JSAtom *)he;
|
atom = (JSAtom *)he;
|
||||||
atom->flags |= flags;
|
atom->flags |= flags;
|
||||||
|
cx->lastAtom = atom;
|
||||||
out:
|
out:
|
||||||
JS_UNLOCK(&state->lock,cx);
|
JS_UNLOCK(&state->lock,cx);
|
||||||
return atom;
|
return atom;
|
||||||
@ -549,6 +550,7 @@ js_AtomizeDouble(JSContext *cx, jsdouble d, uintN flags)
|
|||||||
|
|
||||||
atom = (JSAtom *)he;
|
atom = (JSAtom *)he;
|
||||||
atom->flags |= flags;
|
atom->flags |= flags;
|
||||||
|
cx->lastAtom = atom;
|
||||||
out:
|
out:
|
||||||
JS_UNLOCK(&state->lock,cx);
|
JS_UNLOCK(&state->lock,cx);
|
||||||
return atom;
|
return atom;
|
||||||
@ -611,6 +613,7 @@ js_AtomizeString(JSContext *cx, JSString *str, uintN flags)
|
|||||||
|
|
||||||
atom = (JSAtom *)he;
|
atom = (JSAtom *)he;
|
||||||
atom->flags |= flags & (ATOM_PINNED | ATOM_INTERNED);
|
atom->flags |= flags & (ATOM_PINNED | ATOM_INTERNED);
|
||||||
|
cx->lastAtom = atom;
|
||||||
out:
|
out:
|
||||||
JS_UNLOCK(&state->lock,cx);
|
JS_UNLOCK(&state->lock,cx);
|
||||||
return atom;
|
return atom;
|
||||||
|
@ -317,6 +317,9 @@ struct JSContext {
|
|||||||
/* Most recently created things by type, members of the GC's root set. */
|
/* Most recently created things by type, members of the GC's root set. */
|
||||||
JSGCThing *newborn[GCX_NTYPES];
|
JSGCThing *newborn[GCX_NTYPES];
|
||||||
|
|
||||||
|
/* Atom root for the last-looked-up atom on this context. */
|
||||||
|
JSAtom *lastAtom;
|
||||||
|
|
||||||
/* Regular expression class statics (XXX not shared globally). */
|
/* Regular expression class statics (XXX not shared globally). */
|
||||||
JSRegExpStatics regExpStatics;
|
JSRegExpStatics regExpStatics;
|
||||||
|
|
||||||
|
@ -759,7 +759,7 @@ gc_dump_thing(JSGCThing *thing, uint8 flags, GCMarkNode *prev, FILE *fp)
|
|||||||
? NULL
|
? NULL
|
||||||
: JSVAL_TO_PRIVATE(privateValue);
|
: JSVAL_TO_PRIVATE(privateValue);
|
||||||
const char *className = gc_object_class_name(thing);
|
const char *className = gc_object_class_name(thing);
|
||||||
fprintf(fp, "object %08p %s", privateThing, className);
|
fprintf(fp, "object %8p %s", privateThing, className);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GCX_DOUBLE:
|
case GCX_DOUBLE:
|
||||||
@ -989,6 +989,7 @@ js_ForceGC(JSContext *cx, uintN gcflags)
|
|||||||
|
|
||||||
for (i = 0; i < GCX_NTYPES; i++)
|
for (i = 0; i < GCX_NTYPES; i++)
|
||||||
cx->newborn[i] = NULL;
|
cx->newborn[i] = NULL;
|
||||||
|
cx->lastAtom = NULL;
|
||||||
cx->runtime->gcPoke = JS_TRUE;
|
cx->runtime->gcPoke = JS_TRUE;
|
||||||
js_GC(cx, gcflags);
|
js_GC(cx, gcflags);
|
||||||
JS_ArenaFinish();
|
JS_ArenaFinish();
|
||||||
@ -1261,6 +1262,8 @@ restart:
|
|||||||
NULL);
|
NULL);
|
||||||
for (i = GCX_EXTERNAL_STRING; i < GCX_NTYPES; i++)
|
for (i = GCX_EXTERNAL_STRING; i < GCX_NTYPES; i++)
|
||||||
GC_MARK(cx, acx->newborn[i], "newborn external string", NULL);
|
GC_MARK(cx, acx->newborn[i], "newborn external string", NULL);
|
||||||
|
if (acx->lastAtom)
|
||||||
|
GC_MARK_ATOM(cx, acx->lastAtom, NULL);
|
||||||
#if JS_HAS_EXCEPTIONS
|
#if JS_HAS_EXCEPTIONS
|
||||||
if (acx->throwing && JSVAL_IS_GCTHING(acx->exception))
|
if (acx->throwing && JSVAL_IS_GCTHING(acx->exception))
|
||||||
GC_MARK(cx, JSVAL_TO_GCTHING(acx->exception), "exception", NULL);
|
GC_MARK(cx, JSVAL_TO_GCTHING(acx->exception), "exception", NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user