Bug 1857841 - pt 7. Also amortise VirtualAlloc in SplitRun() r=glandium

Differential Revision: https://phabricator.services.mozilla.com/D195515
This commit is contained in:
Paul Bone 2024-03-19 01:42:43 +00:00
Родитель 2e587031ab
Коммит 709bdf9e73
1 изменённых файлов: 14 добавлений и 0 удалений

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

@ -2653,6 +2653,20 @@ bool arena_t::SplitRun(arena_run_t* aRun, size_t aSize, bool aLarge,
(CHUNK_MAP_FRESH | CHUNK_MAP_MADVISED)) == 0);
}
// Consider committing more pages to amortise calls to VirtualAlloc.
// This only makes sense at the edge of our run hence the if condition
// here.
if (i + j == need_pages) {
size_t extra_commit = ExtraCommitPages(j, rem_pages);
for (; i + j < need_pages + extra_commit &&
(chunk->map[run_ind + i + j].bits &
CHUNK_MAP_MADVISED_OR_DECOMMITTED);
j++) {
MOZ_ASSERT((chunk->map[run_ind + i + j].bits &
(CHUNK_MAP_FRESH | CHUNK_MAP_MADVISED)) == 0);
}
}
if (!pages_commit(
(void*)(uintptr_t(chunk) + ((run_ind + i) << gPageSize2Pow)),
j << gPageSize2Pow)) {