Bug 1301496 - Simplify runtime check when tracing helper threads r=terrence a=decoder

This commit is contained in:
Jon Coppeard 2016-09-22 13:02:40 +01:00
parent 65d765221c
commit 1295093170
7 changed files with 22 additions and 3 deletions

View file

@ -0,0 +1,7 @@
if (helperThreadCount() == 0)
quit();
startgc(1, 'shrinking');
offThreadCompileScript("");
// Adapted from randomly chosen test: js/src/jit-test/tests/parser/bug-1263355-13.js
gczeal(9);
newGlobal();

View file

@ -188,6 +188,12 @@ CompileRuntime::setMinorGCShouldCancelIonCompilations()
runtime()->gc.storeBuffer.setShouldCancelIonCompilations(); runtime()->gc.storeBuffer.setShouldCancelIonCompilations();
} }
bool
CompileRuntime::runtimeMatches(JSRuntime* rt)
{
return rt == runtime();
}
Zone* Zone*
CompileZone::zone() CompileZone::zone()
{ {

View file

@ -86,6 +86,8 @@ class CompileRuntime
const Nursery& gcNursery(); const Nursery& gcNursery();
void setMinorGCShouldCancelIonCompilations(); void setMinorGCShouldCancelIonCompilations();
bool runtimeMatches(JSRuntime* rt);
}; };
class CompileZone class CompileZone

View file

@ -14622,7 +14622,7 @@ IonBuilder::convertToBoolean(MDefinition* input)
void void
IonBuilder::trace(JSTracer* trc) IonBuilder::trace(JSTracer* trc)
{ {
if (script_->zoneFromAnyThread()->runtimeFromAnyThread() != trc->runtime()) if (!compartment->runtime()->runtimeMatches(trc->runtime()))
return; return;
TraceManuallyBarrieredEdge(trc, &script_, "IonBuiler::script_"); TraceManuallyBarrieredEdge(trc, &script_, "IonBuiler::script_");

View file

@ -162,6 +162,10 @@ class ExclusiveContext : public ContextFriendFields,
return options_; return options_;
} }
bool runtimeMatches(JSRuntime* rt) const {
return runtime_ == rt;
}
protected: protected:
js::gc::ArenaLists* arenas_; js::gc::ArenaLists* arenas_;

View file

@ -345,7 +345,7 @@ ParseTask::~ParseTask()
void void
ParseTask::trace(JSTracer* trc) ParseTask::trace(JSTracer* trc)
{ {
if (exclusiveContextGlobal->zoneFromAnyThread()->runtimeFromAnyThread() != trc->runtime()) if (!cx->runtimeMatches(trc->runtime()))
return; return;
TraceManuallyBarrieredEdge(trc, &exclusiveContextGlobal, "ParseTask::exclusiveContextGlobal"); TraceManuallyBarrieredEdge(trc, &exclusiveContextGlobal, "ParseTask::exclusiveContextGlobal");

View file

@ -568,7 +568,7 @@ struct ParseTask
bool finish(JSContext* cx); bool finish(JSContext* cx);
bool runtimeMatches(JSRuntime* rt) { bool runtimeMatches(JSRuntime* rt) {
return exclusiveContextGlobal->runtimeFromAnyThread() == rt; return cx->runtimeMatches(rt);
} }
virtual ~ParseTask(); virtual ~ParseTask();