Backed out changeset 5b2dab72041e (bug 1046945) for crashes.

CLOSED TREE
This commit is contained in:
Ryan VanderMeulen 2014-08-01 15:09:13 -04:00
parent 2ce902103d
commit 8c4943c123
5 changed files with 24 additions and 40 deletions

View File

@ -437,37 +437,6 @@ 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
@ -475,15 +444,30 @@ namespace JS {
* we conservatively mark the object black.
*/
static MOZ_ALWAYS_INLINE void
ExposeObjectToActiveJS(JSObject *obj)
ExposeGCThingToActiveJS(void *thing, JSGCTraceKind kind)
{
js::gc::ExposeGCThingToActiveJS(obj, JSTRACE_OBJECT);
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);
}
static MOZ_ALWAYS_INLINE void
ExposeScriptToActiveJS(JSScript *script)
ExposeObjectToActiveJS(JSObject *obj)
{
js::gc::ExposeGCThingToActiveJS(script, JSTRACE_SCRIPT);
ExposeGCThingToActiveJS(obj, JSTRACE_OBJECT);
}
/*

View File

@ -1353,7 +1353,7 @@ static MOZ_ALWAYS_INLINE void
ExposeValueToActiveJS(const Value &v)
{
if (v.isMarkable())
js::gc::ExposeGCThingToActiveJS(v.toGCThing(), v.gcKind());
ExposeGCThingToActiveJS(v.toGCThing(), v.gcKind());
}
/************************************************************************/

View File

@ -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::ExposeObjectToActiveJS(p->value().closure);
JS::ExposeGCThingToActiveJS(p->value().closure, JSTRACE_OBJECT);
*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::ExposeObjectToActiveJS(closure);
JS::ExposeGCThingToActiveJS(closure, JSTRACE_OBJECT);
/* Call the handler. */
return handler(cx, obj, id, old, vp.address(), closure);

View File

@ -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::ExposeObjectToActiveJS(global);
JS::ExposeGCThingToActiveJS(global, JSTRACE_OBJECT);
RootedValue globalValue(cx, ObjectValue(*global));
if (!dbg->wrapDebuggeeValue(cx, &globalValue))

View File

@ -193,7 +193,7 @@ inline JSScript *
xpc_UnmarkGrayScript(JSScript *script)
{
if (script)
JS::ExposeScriptToActiveJS(script);
JS::ExposeGCThingToActiveJS(script, JSTRACE_SCRIPT);
return script;
}