Bug 1207696 Part 10f - Coordinate with snapshot mechanism in JS helper threads, r=fitzgen.

--HG--
extra : rebase_source : a33dce8cf5463a5894ff35496d4bc7926e172223
This commit is contained in:
Brian Hackett 2018-07-23 14:48:27 +00:00
Родитель ecc6572b9d
Коммит 3f7d790be0
2 изменённых файлов: 22 добавлений и 0 удалений

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

@ -2302,6 +2302,13 @@ GlobalHelperThreadState::trace(JSTracer* trc)
parseTask->trace(trc);
}
/* static */ void
HelperThread::WakeupAll()
{
AutoLockHelperThreadState lock;
HelperThreadState().notifyAll(GlobalHelperThreadState::PRODUCER, lock);
}
void
JSContext::setHelperThread(HelperThread* thread)
{
@ -2395,6 +2402,19 @@ HelperThread::threadLoop()
const TaskSpec* task = findHighestPriorityTask(lock);
if (!task) {
if (mozilla::recordreplay::IsRecordingOrReplaying()) {
// Unlock the helper thread state lock before potentially
// blocking while the main thread waits for all threads to
// become idle. Otherwise we would need to see if we need to
// block at every point where a helper thread acquires the
// helper thread state lock.
{
AutoUnlockHelperThreadState unlock(lock);
mozilla::recordreplay::MaybeWaitForCheckpointSave();
}
mozilla::recordreplay::NotifyUnrecordedWait(WakeupAll);
}
HelperThreadState().wait(lock, GlobalHelperThreadState::PRODUCER);
continue;
}

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

@ -414,6 +414,8 @@ struct HelperThread
static void ThreadMain(void* arg);
void threadLoop();
static void WakeupAll();
void ensureRegisteredWithProfiler();
void unregisterWithProfilerIfNeeded();