Bug 1447964 - Improve CurrentThreadCanAccessZone() check r=jandem

This commit is contained in:
Jon Coppeard 2018-03-22 18:24:32 +00:00
parent 1747f82987
commit 076cbcc6be
2 changed files with 6 additions and 5 deletions

View File

@ -1497,7 +1497,7 @@ LeaveParseTaskZone(JSRuntime* rt, ParseTask* task)
{ {
// Mark the zone as no longer in use by a helper thread, and available // Mark the zone as no longer in use by a helper thread, and available
// to be collected by the GC. // to be collected by the GC.
rt->clearUsedByHelperThread(task->parseGlobal->zone()); rt->clearUsedByHelperThread(task->parseGlobal->zoneFromAnyThread());
} }
ParseTask* ParseTask*

View File

@ -914,11 +914,12 @@ js::CurrentThreadCanAccessRuntime(const JSRuntime* rt)
bool bool
js::CurrentThreadCanAccessZone(Zone* zone) js::CurrentThreadCanAccessZone(Zone* zone)
{ {
if (CurrentThreadCanAccessRuntime(zone->runtime_)) // Helper thread zones can only be used by their owning thread.
return true; if (zone->usedByHelperThread())
return zone->group()->ownedByCurrentThread();
// Only zones marked for use by a helper thread can be used off thread. // Other zones can only be accessed by the runtime's active context.
return zone->usedByHelperThread() && zone->group()->ownedByCurrentThread(); return CurrentThreadCanAccessRuntime(zone->runtime_);
} }
#ifdef DEBUG #ifdef DEBUG