mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-27 20:25:44 +00:00
Bug 1447964 - Improve CurrentThreadCanAccessZone() check r=jandem
This commit is contained in:
parent
1747f82987
commit
076cbcc6be
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user