зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1046945 - Move ExposeGCThingToActiveJS to js::gc:: and use the typed wrappers instead; r=jonco
This commit is contained in:
Родитель
a3e32e545e
Коммит
286271bc44
|
@ -437,6 +437,37 @@ class JS_PUBLIC_API(AutoCheckCannotGC) : public AutoAssertOnGC
|
|||
extern JS_FRIEND_API(bool)
|
||||
UnmarkGrayGCThingRecursively(void *thing, JSGCTraceKind kind);
|
||||
|
||||
} /* namespace JS */
|
||||
|
||||
namespace js {
|
||||
namespace gc {
|
||||
|
||||
static MOZ_ALWAYS_INLINE void
|
||||
ExposeGCThingToActiveJS(void *thing, JSGCTraceKind kind)
|
||||
{
|
||||
MOZ_ASSERT(kind != JSTRACE_SHAPE);
|
||||
|
||||
JS::shadow::Runtime *rt = GetGCThingRuntime(thing);
|
||||
#ifdef JSGC_GENERATIONAL
|
||||
/*
|
||||
* GC things residing in the nursery cannot be gray: they have no mark bits.
|
||||
* All live objects in the nursery are moved to tenured at the beginning of
|
||||
* each GC slice, so the gray marker never sees nursery things.
|
||||
*/
|
||||
if (IsInsideNursery((Cell *)thing))
|
||||
return;
|
||||
#endif
|
||||
if (JS::IsIncrementalBarrierNeededOnTenuredGCThing(rt, thing, kind))
|
||||
JS::IncrementalReferenceBarrier(thing, kind);
|
||||
else if (JS::GCThingIsMarkedGray(thing))
|
||||
JS::UnmarkGrayGCThingRecursively(thing, kind);
|
||||
}
|
||||
|
||||
} /* namespace gc */
|
||||
} /* namespace js */
|
||||
|
||||
namespace JS {
|
||||
|
||||
/*
|
||||
* This should be called when an object that is marked gray is exposed to the JS
|
||||
* engine (by handing it to running JS code or writing it into live JS
|
||||
|
@ -444,30 +475,15 @@ UnmarkGrayGCThingRecursively(void *thing, JSGCTraceKind kind);
|
|||
* we conservatively mark the object black.
|
||||
*/
|
||||
static MOZ_ALWAYS_INLINE void
|
||||
ExposeGCThingToActiveJS(void *thing, JSGCTraceKind kind)
|
||||
ExposeObjectToActiveJS(JSObject *obj)
|
||||
{
|
||||
MOZ_ASSERT(kind != JSTRACE_SHAPE);
|
||||
|
||||
shadow::Runtime *rt = js::gc::GetGCThingRuntime(thing);
|
||||
#ifdef JSGC_GENERATIONAL
|
||||
/*
|
||||
* GC things residing in the nursery cannot be gray: they have no mark bits.
|
||||
* All live objects in the nursery are moved to tenured at the beginning of
|
||||
* each GC slice, so the gray marker never sees nursery things.
|
||||
*/
|
||||
if (js::gc::IsInsideNursery((js::gc::Cell *)thing))
|
||||
return;
|
||||
#endif
|
||||
if (IsIncrementalBarrierNeededOnTenuredGCThing(rt, thing, kind))
|
||||
IncrementalReferenceBarrier(thing, kind);
|
||||
else if (GCThingIsMarkedGray(thing))
|
||||
UnmarkGrayGCThingRecursively(thing, kind);
|
||||
js::gc::ExposeGCThingToActiveJS(obj, JSTRACE_OBJECT);
|
||||
}
|
||||
|
||||
static MOZ_ALWAYS_INLINE void
|
||||
ExposeObjectToActiveJS(JSObject *obj)
|
||||
ExposeScriptToActiveJS(JSScript *script)
|
||||
{
|
||||
ExposeGCThingToActiveJS(obj, JSTRACE_OBJECT);
|
||||
js::gc::ExposeGCThingToActiveJS(script, JSTRACE_SCRIPT);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1353,7 +1353,7 @@ static MOZ_ALWAYS_INLINE void
|
|||
ExposeValueToActiveJS(const Value &v)
|
||||
{
|
||||
if (v.isMarkable())
|
||||
ExposeGCThingToActiveJS(v.toGCThing(), v.gcKind());
|
||||
js::gc::ExposeGCThingToActiveJS(v.toGCThing(), v.gcKind());
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
|
|
@ -89,7 +89,7 @@ WatchpointMap::unwatch(JSObject *obj, jsid id,
|
|||
if (closurep) {
|
||||
// Read barrier to prevent an incorrectly gray closure from escaping the
|
||||
// watchpoint. See the comment before UnmarkGrayChildren in gc/Marking.cpp
|
||||
JS::ExposeGCThingToActiveJS(p->value().closure, JSTRACE_OBJECT);
|
||||
JS::ExposeObjectToActiveJS(p->value().closure);
|
||||
*closurep = p->value().closure;
|
||||
}
|
||||
map.remove(p);
|
||||
|
@ -137,7 +137,7 @@ WatchpointMap::triggerWatchpoint(JSContext *cx, HandleObject obj, HandleId id, M
|
|||
|
||||
// Read barrier to prevent an incorrectly gray closure from escaping the
|
||||
// watchpoint. See the comment before UnmarkGrayChildren in gc/Marking.cpp
|
||||
JS::ExposeGCThingToActiveJS(closure, JSTRACE_OBJECT);
|
||||
JS::ExposeObjectToActiveJS(closure);
|
||||
|
||||
/* Call the handler. */
|
||||
return handler(cx, obj, id, old, vp.address(), closure);
|
||||
|
|
|
@ -2874,7 +2874,7 @@ Debugger::findAllGlobals(JSContext *cx, unsigned argc, Value *vp)
|
|||
* marked gray by XPConnect. Since we're now exposing it to JS code,
|
||||
* we need to mark it black.
|
||||
*/
|
||||
JS::ExposeGCThingToActiveJS(global, JSTRACE_OBJECT);
|
||||
JS::ExposeObjectToActiveJS(global);
|
||||
|
||||
RootedValue globalValue(cx, ObjectValue(*global));
|
||||
if (!dbg->wrapDebuggeeValue(cx, &globalValue))
|
||||
|
|
|
@ -193,7 +193,7 @@ inline JSScript *
|
|||
xpc_UnmarkGrayScript(JSScript *script)
|
||||
{
|
||||
if (script)
|
||||
JS::ExposeGCThingToActiveJS(script, JSTRACE_SCRIPT);
|
||||
JS::ExposeScriptToActiveJS(script);
|
||||
|
||||
return script;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче