Bug 995607 - Fix an AutoDebugModeInvalidation issue. r=shu

This commit is contained in:
Jan de Mooij 2014-04-15 18:22:52 +02:00
parent dce7d5daf6
commit ac7e4a2dea

View File

@ -3016,9 +3016,6 @@ AutoDebugModeInvalidation::~AutoDebugModeInvalidation()
if (needInvalidation_ == NoNeed)
return;
// Invalidate the stack if any compartments toggled from on->off, because
// we allow scripts to be on stack when turning off debug mode.
bool invalidateStack = needInvalidation_ == ToggledOff;
Zone *zone = zone_ ? zone_ : comp_->zone();
JSRuntime *rt = zone->runtimeFromMainThread();
FreeOp *fop = rt->defaultFreeOp();
@ -3030,31 +3027,24 @@ AutoDebugModeInvalidation::~AutoDebugModeInvalidation()
StopAllOffThreadCompilations(comp);
}
if (invalidateStack) {
jit::MarkActiveBaselineScripts(zone);
jit::MarkActiveBaselineScripts(zone);
for (JitActivationIterator iter(rt); !iter.done(); ++iter) {
JSCompartment *comp = iter.activation()->compartment();
if ((comp_ && comp_ == comp) ||
(zone_ && zone_ == comp->zone() && comp->principals))
{
IonContext ictx(CompileRuntime::get(rt));
AutoFlushCache afc("AutoDebugModeInvalidation", rt->jitRuntime());
IonSpew(IonSpew_Invalidate, "Invalidating frames for debug mode toggle");
InvalidateActivation(fop, iter.jitTop(), true);
}
for (JitActivationIterator iter(rt); !iter.done(); ++iter) {
JSCompartment *comp = iter.activation()->compartment();
if ((comp_ && comp_ == comp) || (zone_ && zone_ == comp->zone())) {
IonContext ictx(CompileRuntime::get(rt));
AutoFlushCache afc("AutoDebugModeInvalidation", rt->jitRuntime());
IonSpew(IonSpew_Invalidate, "Invalidating frames for debug mode toggle");
InvalidateActivation(fop, iter.jitTop(), true);
}
}
for (gc::CellIter i(zone, gc::FINALIZE_SCRIPT); !i.done(); i.next()) {
JSScript *script = i.get<JSScript>();
if ((comp_ && script->compartment() == comp_) ||
(zone_ && script->compartment()->principals))
{
if ((comp_ && script->compartment() == comp_) || zone_) {
FinishInvalidation<SequentialExecution>(fop, script);
FinishInvalidation<ParallelExecution>(fop, script);
FinishDiscardBaselineScript(fop, script);
// script->clearAnalysis();
script->resetUseCount();
} else if (script->hasBaselineScript()) {
script->baselineScript()->resetActive();