Bug 1717565 - Small refactoring of Zone::sweepEphemeronTablesAfterMinorGC r=jonco

Differential Revision: https://phabricator.services.mozilla.com/D118432
This commit is contained in:
Steve Fink 2021-08-02 18:20:15 +00:00
Родитель 63410ff0f6
Коммит a61d4002c9
1 изменённых файлов: 9 добавлений и 10 удалений

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

@ -291,26 +291,25 @@ void Zone::sweepEphemeronTablesAfterMinorGC() {
continue;
}
// Key been moved. The value is an array of <map,key> pairs; update all
// keys in that array.
// Key been moved. The value is an array of <color,cell> pairs; update all
// cells in that array.
EphemeronEdgeVector& entries = r.front().value;
SweepEphemeronEdgesWhileMinorSweeping(entries);
// Live (moved) nursery cell. Append entries to gcEphemeronEdges.
auto* entry = gcEphemeronEdges().get(key);
EphemeronEdgeTable& tenuredEdges = gcEphemeronEdges();
auto* entry = tenuredEdges.get(key);
if (!entry) {
if (!gcEphemeronEdges().put(key, gc::EphemeronEdgeVector())) {
if (!tenuredEdges.put(key, gc::EphemeronEdgeVector())) {
AutoEnterOOMUnsafeRegion oomUnsafe;
oomUnsafe.crash("Failed to tenure weak keys entry");
}
entry = gcEphemeronEdges().get(key);
entry = tenuredEdges.get(key);
}
for (auto& markable : entries) {
if (!entry->value.append(markable)) {
AutoEnterOOMUnsafeRegion oomUnsafe;
oomUnsafe.crash("Failed to tenure weak keys entry");
}
if (!entry->value.appendAll(entries)) {
AutoEnterOOMUnsafeRegion oomUnsafe;
oomUnsafe.crash("Failed to tenure weak keys entry");
}
// If the key has a delegate, then it will map to a WeakKeyEntryVector