Bug 783464 - Fix condition for removing the constrained output vector. r=bhackett

This commit is contained in:
Nicolas B. Pierron 2012-08-22 16:05:08 -07:00
parent acc10ae0ea
commit 55e8e7cccc
6 changed files with 15 additions and 16 deletions

View File

@ -446,7 +446,7 @@ JSCompartment::markTypes(JSTracer *trc)
}
void
JSCompartment::discardJitCode(FreeOp *fop)
JSCompartment::discardJitCode(FreeOp *fop, bool discardConstraints)
{
#ifdef JS_METHODJIT
@ -484,7 +484,7 @@ JSCompartment::discardJitCode(FreeOp *fop)
script->resetUseCount();
}
types.sweepCompilerOutputs(fop);
types.sweepCompilerOutputs(fop, discardConstraints);
}
#endif /* JS_METHODJIT */
@ -504,7 +504,7 @@ JSCompartment::sweep(FreeOp *fop, bool releaseTypes)
{
{
gcstats::AutoPhase ap(rt->gcStats, gcstats::PHASE_SWEEP_DISCARD_CODE);
discardJitCode(fop);
discardJitCode(fop, !activeAnalysis && !gcPreserveCode);
}
/* This function includes itself in PHASE_SWEEP_TABLES. */
@ -533,6 +533,7 @@ JSCompartment::sweep(FreeOp *fop, bool releaseTypes)
}
if (!activeAnalysis && !gcPreserveCode) {
JS_ASSERT(!types.constrainedOutputs);
gcstats::AutoPhase ap(rt->gcStats, gcstats::PHASE_DISCARD_ANALYSIS);
/*

View File

@ -340,7 +340,7 @@ struct JSCompartment
bool wrap(JSContext *cx, js::AutoIdVector &props);
void markTypes(JSTracer *trc);
void discardJitCode(js::FreeOp *fop);
void discardJitCode(js::FreeOp *fop, bool discardConstraints);
bool isDiscardingJitCode(JSTracer *trc);
void sweep(js::FreeOp *fop, bool releaseTypes);
void sweepCrossCompartmentWrappers();

View File

@ -3282,7 +3282,7 @@ BeginMarkPhase(JSRuntime *rt)
if (rt->gcIsIncremental) {
for (GCCompartmentsIter c(rt); !c.done(); c.next()) {
gcstats::AutoPhase ap(rt->gcStats, gcstats::PHASE_MARK_DISCARD_CODE);
c->discardJitCode(rt->defaultFreeOp());
c->discardJitCode(rt->defaultFreeOp(), false);
}
}

View File

@ -5971,17 +5971,16 @@ TypeCompartment::sweep(FreeOp *fop)
pendingArray = NULL;
pendingCapacity = 0;
sweepCompilerOutputs(fop);
sweepCompilerOutputs(fop, true);
}
void
TypeCompartment::sweepCompilerOutputs(FreeOp *fop)
TypeCompartment::sweepCompilerOutputs(FreeOp *fop, bool discardConstraints)
{
if (constrainedOutputs) {
bool isCompiling = compiledInfo.outputIndex != RecompileInfo::NoCompilerRunning;
if (isCompiling && !compartment()->activeAnalysis)
{
if (discardConstraints) {
JS_ASSERT(!isCompiling);
#if DEBUG
for (unsigned i = 0; i < constrainedOutputs->length(); i++) {
CompilerOutput &co = (*constrainedOutputs)[i];
@ -5991,10 +5990,9 @@ TypeCompartment::sweepCompilerOutputs(FreeOp *fop)
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.
// Constraints have captured an index to the constrained outputs
// vector. Thus, we invalidate all compilations except the one
// which is potentially running now.
size_t len = constrainedOutputs->length();
if (isCompiling) {
len--;

View File

@ -29,7 +29,6 @@ namespace js {
class CallObject;
namespace mjit {
struct JITScript;
}
@ -1263,7 +1262,7 @@ struct TypeCompartment
void markSetsUnknown(JSContext *cx, TypeObject *obj);
void sweep(FreeOp *fop);
void sweepCompilerOutputs(FreeOp *fop);
void sweepCompilerOutputs(FreeOp *fop, bool discardConstraints);
void maybePurgeAnalysis(JSContext *cx, bool force = false);

View File

@ -291,6 +291,7 @@ struct AutoEnterCompilation
: cx(cx),
info(cx->compartment->types.compiledInfo)
{
JS_ASSERT(cx->compartment->activeAnalysis);
JS_ASSERT(info.outputIndex == RecompileInfo::NoCompilerRunning);
}