Bug 699796 - Note objects holding JSScript as roots in the CC. r=igor.

--HG--
extra : rebase_source : 68ef72cd709aed89ee6a1cc30bd6079d3e1ddf3d
This commit is contained in:
Peter Van der Beken 2011-11-07 13:57:46 +01:00
Родитель be29e3d8a0
Коммит 728e26c68b
3 изменённых файлов: 12 добавлений и 15 удалений

Просмотреть файл

@ -469,13 +469,11 @@ CheckParticipatesInCycleCollection(PRUint32 aLangID, void *aThing,
{
Closure *closure = static_cast<Closure*>(aClosure);
if (!closure->cycleCollectionEnabled &&
closure->cycleCollectionEnabled =
aLangID == nsIProgrammingLanguage::JAVASCRIPT &&
js_GetGCThingTraceKind(aThing) == JSTRACE_OBJECT) {
closure->cycleCollectionEnabled =
xpc::ParticipatesInCycleCollection(closure->cx,
static_cast<JSObject*>(aThing));
}
AddToCCKind(js_GetGCThingTraceKind(aThing)) &&
xpc::ParticipatesInCycleCollection(closure->cx,
static_cast<js::gc::Cell*>(aThing));
}
static JSDHashOperator
@ -485,7 +483,6 @@ NoteJSHolder(JSDHashTable *table, JSDHashEntryHdr *hdr, uint32 number,
ObjectHolder* entry = reinterpret_cast<ObjectHolder*>(hdr);
Closure *closure = static_cast<Closure*>(arg);
closure->cycleCollectionEnabled = false;
entry->tracer->Trace(entry->holder, CheckParticipatesInCycleCollection,
closure);
if (!closure->cycleCollectionEnabled)

Просмотреть файл

@ -418,14 +418,6 @@ nsXPConnect::GarbageCollect()
return NS_OK;
}
// JSTRACE_XML can recursively hold on to more JSTRACE_XML objects, adding it to
// the cycle collector avoids stack overflow.
inline bool
AddToCCKind(JSGCTraceKind kind)
{
return kind == JSTRACE_OBJECT || kind == JSTRACE_XML || kind == JSTRACE_SCRIPT;
}
#ifdef DEBUG_CC
struct NoteJSRootTracer : public JSTracer
{

Просмотреть файл

@ -455,6 +455,14 @@ private:
// returned as function call result values they are not addref'd. Exceptions
// to this rule are noted explicitly.
// JSTRACE_XML can recursively hold on to more JSTRACE_XML objects, adding it to
// the cycle collector avoids stack overflow.
inline bool
AddToCCKind(JSGCTraceKind kind)
{
return kind == JSTRACE_OBJECT || kind == JSTRACE_XML || kind == JSTRACE_SCRIPT;
}
const bool OBJ_IS_GLOBAL = true;
const bool OBJ_IS_NOT_GLOBAL = false;