Bug 1447964 - Improve CurrentThreadCanAccessZone() check r=jandem

This commit is contained in:
Jon Coppeard 2018-03-22 18:24:32 +00:00
Родитель 1747f82987
Коммит 076cbcc6be
2 изменённых файлов: 6 добавлений и 5 удалений

Просмотреть файл

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

Просмотреть файл

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