Bug 780274 - Remove & Invalidate pending compilation when sweeping. r=bhackett

This commit is contained in:
Nicolas B. Pierron 2012-08-09 19:43:47 +02:00
Родитель 194848904e
Коммит 54a5d22a53
3 изменённых файлов: 45 добавлений и 4 удалений

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

@ -481,6 +481,8 @@ JSCompartment::discardJitCode(FreeOp *fop)
*/
script->resetUseCount();
}
types.sweepCompilerOutputs(fop);
}
#endif /* JS_METHODJIT */
@ -573,10 +575,6 @@ JSCompartment::sweep(FreeOp *fop, bool releaseTypes)
{
gcstats::AutoPhase ap2(rt->gcStats, gcstats::PHASE_FREE_TI_ARENA);
rt->freeLifoAlloc.transferFrom(&oldAlloc);
if (types.constrainedOutputs) {
fop->delete_(types.constrainedOutputs);
types.constrainedOutputs = NULL;
}
}
}

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

@ -5660,6 +5660,48 @@ TypeCompartment::sweep(FreeOp *fop)
pendingArray = NULL;
pendingCapacity = 0;
sweepCompilerOutputs(fop);
}
void
TypeCompartment::sweepCompilerOutputs(FreeOp *fop)
{
if (constrainedOutputs) {
bool isCompiling = compiledInfo.outputIndex != RecompileInfo::NoCompilerRunning;
if (isCompiling && !compartment()->activeAnalysis)
{
#if DEBUG
for (unsigned i = 0; i < constrainedOutputs->length(); i++) {
CompilerOutput &co = (*constrainedOutputs)[i];
JS_ASSERT(!co.isValid());
}
#endif
fop->delete_(constrainedOutputs);
constrainedOutputs = NULL;
} else {
// A Compilation is running and the AutoEnterCompilation class has
// captured an index into the constrained outputs vector and
// potentially created multiple types with this index. Instead, we
// invalidate all compilations except the one running now.
size_t len = constrainedOutputs->length();
if (isCompiling) {
len--;
JS_ASSERT(compiledInfo.outputIndex == len);
}
for (unsigned i = 0; i < len; i++) {
CompilerOutput &co = (*constrainedOutputs)[i];
JS_ASSERT(!co.isValid());
co.invalidate();
}
}
}
if (pendingRecompiles) {
fop->delete_(pendingRecompiles);
pendingRecompiles = NULL;
}
}
void

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

@ -1160,6 +1160,7 @@ struct TypeCompartment
void markSetsUnknown(JSContext *cx, TypeObject *obj);
void sweep(FreeOp *fop);
void sweepCompilerOutputs(FreeOp *fop);
void finalizeObjects();
};