Bug 1165912 - Ensure HelperThread().ionLazyLinkList() is only used from the main thread. r=h4writer

This commit is contained in:
Nicolas B. Pierron 2015-06-17 12:01:34 +02:00
parent 49250a54bc
commit e4ebac4d5c
2 changed files with 6 additions and 3 deletions

View File

@ -464,8 +464,10 @@ jit::FinishOffThreadBuilder(JSContext* cx, IonBuilder* builder)
// Clean the references to the pending IonBuilder, if we just finished it.
if (builder->script()->hasIonScript() && builder->script()->pendingIonBuilder() == builder)
builder->script()->setPendingIonBuilder(cx, nullptr);
// If the builder is still in one of the helper thread list, then remove it.
if (builder->isInList())
builder->remove();
builder->removeFrom(HelperThreadState().ionLazyLinkList());
// Clear the recompiling flag of the old ionScript, since we continue to
// use the old ionScript if recompiling fails.
@ -579,7 +581,7 @@ jit::LazyLinkTopActivation(JSContext* cx)
OnIonCompilationInfo info(builder->alloc().lifoAlloc());
// Remove from pending.
builder->remove();
builder->removeFrom(HelperThreadState().ionLazyLinkList());
{
AutoEnterAnalysis enterTypes(cx);

View File

@ -146,7 +146,8 @@ class GlobalHelperThreadState
return ionFinishedList_;
}
IonBuilderList& ionLazyLinkList() {
MOZ_ASSERT(isLocked());
MOZ_ASSERT(TlsPerThreadData.get()->runtimeFromMainThread(),
"Should only be mutated by the main thread.");
return ionLazyLinkList_;
}