Bug 1506733 - (part 2) Refactor how the NurseryDecomitter finishes r=jonco

This refactoring is required for the next change.

Differential Revision: https://phabricator.services.mozilla.com/D35590

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Paul Bone 2019-07-05 13:18:09 +00:00
parent 070151d46c
commit 112005db9e
2 changed files with 12 additions and 9 deletions

View File

@ -108,13 +108,9 @@ void js::NurseryDecommitTask::queueChunk(
queue = chunk;
}
Chunk* js::NurseryDecommitTask::popChunk() {
AutoLockHelperThreadState lock;
Chunk* js::NurseryDecommitTask::popChunk(
const AutoLockHelperThreadState& lock) {
if (!queue) {
// We call setFinishing here while we have the lock that checks for work,
// rather than in run's loop.
setFinishing(lock);
return nullptr;
}
@ -128,8 +124,15 @@ Chunk* js::NurseryDecommitTask::popChunk() {
void js::NurseryDecommitTask::run() {
Chunk* chunk;
while ((chunk = popChunk())) {
decommitChunk(chunk);
{
AutoLockHelperThreadState lock;
while ((chunk = popChunk(lock))) {
AutoUnlockHelperThreadState unlock(lock);
decommitChunk(chunk);
}
setFinishing(lock);
}
}

View File

@ -85,7 +85,7 @@ class NurseryDecommitTask : public GCParallelTaskHelper<NurseryDecommitTask> {
// Use the next pointers in Chunk::info to form a singly-linked list.
MainThreadOrGCTaskData<gc::Chunk*> queue;
gc::Chunk* popChunk();
gc::Chunk* popChunk(const AutoLockHelperThreadState& lock);
};
class TenuringTracer : public JSTracer {