diff --git a/js/src/jscompartment.cpp b/js/src/jscompartment.cpp index dd23e01383b..35592428010 100644 --- a/js/src/jscompartment.cpp +++ b/js/src/jscompartment.cpp @@ -491,7 +491,7 @@ JSCompartment::markTypes(JSTracer *trc) } void -JSCompartment::discardJitCode(FreeOp *fop, bool discardConstraints) +JSCompartment::discardJitCode(FreeOp *fop) { #ifdef JS_METHODJIT @@ -527,7 +527,7 @@ JSCompartment::discardJitCode(FreeOp *fop, bool discardConstraints) script->resetUseCount(); } - types.sweepCompilerOutputs(fop, discardConstraints); + types.sweepCompilerOutputs(fop); } #endif /* JS_METHODJIT */ @@ -547,7 +547,7 @@ JSCompartment::sweep(FreeOp *fop, bool releaseTypes) { { gcstats::AutoPhase ap(rt->gcStats, gcstats::PHASE_SWEEP_DISCARD_CODE); - discardJitCode(fop, !activeAnalysis && !gcPreserveCode); + discardJitCode(fop); } /* This function includes itself in PHASE_SWEEP_TABLES. */ @@ -581,7 +581,6 @@ JSCompartment::sweep(FreeOp *fop, bool releaseTypes) } if (!activeAnalysis && !gcPreserveCode) { - JS_ASSERT(!types.constrainedOutputs); gcstats::AutoPhase ap(rt->gcStats, gcstats::PHASE_DISCARD_ANALYSIS); /* diff --git a/js/src/jscompartment.h b/js/src/jscompartment.h index 9422ee8e506..0fa4993dec0 100644 --- a/js/src/jscompartment.h +++ b/js/src/jscompartment.h @@ -347,7 +347,7 @@ struct JSCompartment void mark(JSTracer *trc); void markTypes(JSTracer *trc); - void discardJitCode(js::FreeOp *fop, bool discardConstraints); + void discardJitCode(js::FreeOp *fop); bool isDiscardingJitCode(JSTracer *trc); void sweep(js::FreeOp *fop, bool releaseTypes); void sweepCrossCompartmentWrappers(); diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index 09c6ededab3..e133346ea1e 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -3351,7 +3351,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(), false); + c->discardJitCode(rt->defaultFreeOp()); } } diff --git a/js/src/jsinfer.cpp b/js/src/jsinfer.cpp index 55094b78888..e33258f9b34 100644 --- a/js/src/jsinfer.cpp +++ b/js/src/jsinfer.cpp @@ -5849,16 +5849,16 @@ TypeCompartment::sweep(FreeOp *fop) pendingArray = NULL; pendingCapacity = 0; - sweepCompilerOutputs(fop, true); + sweepCompilerOutputs(fop); } void -TypeCompartment::sweepCompilerOutputs(FreeOp *fop, bool discardConstraints) +TypeCompartment::sweepCompilerOutputs(FreeOp *fop) { if (constrainedOutputs) { bool isCompiling = compiledInfo.outputIndex != RecompileInfo::NoCompilerRunning; - if (discardConstraints) { - JS_ASSERT(!isCompiling); + if (isCompiling && !compartment()->activeAnalysis) + { #if DEBUG for (unsigned i = 0; i < constrainedOutputs->length(); i++) { CompilerOutput &co = (*constrainedOutputs)[i]; @@ -5869,9 +5869,10 @@ TypeCompartment::sweepCompilerOutputs(FreeOp *fop, bool discardConstraints) fop->delete_(constrainedOutputs); constrainedOutputs = NULL; } else { - // Constraints have captured an index to the constrained outputs - // vector. Thus, we invalidate all compilations except the one - // which is potentially running now. + // 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(); for (unsigned i = 0; i < len; i++) { if (i != compiledInfo.outputIndex) { diff --git a/js/src/jsinfer.h b/js/src/jsinfer.h index a746cc6db32..b39eb1cd139 100644 --- a/js/src/jsinfer.h +++ b/js/src/jsinfer.h @@ -1180,7 +1180,7 @@ struct TypeCompartment void markSetsUnknown(JSContext *cx, TypeObject *obj); void sweep(FreeOp *fop); - void sweepCompilerOutputs(FreeOp *fop, bool discardConstraints); + void sweepCompilerOutputs(FreeOp *fop); void finalizeObjects(); }; diff --git a/js/src/jsinferinlines.h b/js/src/jsinferinlines.h index 7bd7bf1ee38..4361480cd49 100644 --- a/js/src/jsinferinlines.h +++ b/js/src/jsinferinlines.h @@ -336,7 +336,6 @@ struct AutoEnterCompilation info(cx->compartment->types.compiledInfo), mode(mode) { - JS_ASSERT(cx->compartment->activeAnalysis); JS_ASSERT(info.outputIndex == RecompileInfo::NoCompilerRunning); }