Bug 1157963 - Don't delazify functions about to be finalized. (r=jimb)

This commit is contained in:
Shu-yu Guo 2015-04-28 01:44:22 -07:00
Родитель c61fadcb41
Коммит 5e37047fdc
1 изменённых файлов: 19 добавлений и 10 удалений

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

@ -758,7 +758,17 @@ CreateLazyScriptsForCompartment(JSContext* cx)
// clones. See bug 1105306.
for (gc::ZoneCellIter i(cx->zone(), JSFunction::FinalizeKind); !i.done(); i.next()) {
JSObject* obj = i.get<JSObject>();
if (obj->compartment() == cx->compartment() && obj->is<JSFunction>()) {
// Sweeping is incremental; take care to not delazify functions that
// are about to be finalized. GC things referenced by objects that are
// about to be finalized (e.g., in slots) may already be freed.
if (gc::IsAboutToBeFinalizedUnbarriered(&obj) ||
obj->compartment() != cx->compartment() ||
!obj->is<JSFunction>())
{
continue;
}
JSFunction* fun = &obj->as<JSFunction>();
if (fun->isInterpretedLazy()) {
LazyScript* lazy = fun->lazyScriptOrNull();
@ -770,7 +780,6 @@ CreateLazyScriptsForCompartment(JSContext* cx)
}
}
}
}
// Create scripts for each lazy function, updating the list of functions to
// process with any newly exposed inner functions in created scripts.