Bug 1512042 - Try using SegmentedVector for gray root buffers r=pbone

This commit is contained in:
Jon Coppeard 2019-01-28 10:23:35 +00:00
Родитель f210ca9791
Коммит 0746e98005
4 изменённых файлов: 12 добавлений и 9 удалений

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

@ -5003,7 +5003,7 @@ void GCRuntime::getNextSweepGroup() {
zone->setNeedsIncrementalBarrier(false);
zone->changeGCState(Zone::MarkBlackOnly, Zone::NoGC);
zone->arenas.unmarkPreMarkedFreeCells();
zone->gcGrayRoots().clearAndFree();
zone->gcGrayRoots().Clear();
}
for (SweepGroupCompartmentsIter comp(rt); !comp.done(); comp.next()) {

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

@ -2716,7 +2716,7 @@ void GCMarker::checkZone(void* p) {
size_t GCMarker::sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const {
size_t size = stack.sizeOfExcludingThis(mallocSizeOf);
for (ZonesIter zone(runtime(), WithAtoms); !zone.done(); zone.next()) {
size += zone->gcGrayRoots().sizeOfExcludingThis(mallocSizeOf);
size += zone->gcGrayRoots().SizeOfExcludingThis(mallocSizeOf);
}
return size;
}

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

@ -506,7 +506,7 @@ void js::gc::GCRuntime::bufferGrayRoots() {
// and the zone's buffers have been cleared.
MOZ_ASSERT(grayBufferState == GrayBufferState::Unused);
for (GCZonesIter zone(rt); !zone.done(); zone.next()) {
MOZ_ASSERT(zone->gcGrayRoots().empty());
MOZ_ASSERT(zone->gcGrayRoots().IsEmpty());
}
BufferGrayRootsTracer grayBufferer(rt);
@ -542,7 +542,7 @@ inline void BufferGrayRootsTracer::bufferRoot(T* thing) {
// incremental GCs (when we do gray root buffering).
SetMaybeAliveFlag(thing);
if (!zone->gcGrayRoots().append(tenured)) {
if (!zone->gcGrayRoots().Append(tenured)) {
bufferingGrayRootsFailed = true;
}
}
@ -553,12 +553,12 @@ void GCRuntime::markBufferedGrayRoots(JS::Zone* zone) {
MOZ_ASSERT(zone->isGCMarkingBlackAndGray() || zone->isGCCompacting());
auto& roots = zone->gcGrayRoots();
if (roots.empty()) {
if (roots.IsEmpty()) {
return;
}
for (size_t i = 0; i < roots.length(); i++) {
Cell* cell = roots[i];
for (auto iter = roots.Iter(); !iter.Done(); iter.Next()) {
Cell* cell = iter.Get();
// Bug 1203273: Check for bad pointers on OSX and output diagnostics.
#if defined(XP_DARWIN) && defined(MOZ_DIAGNOSTIC_ASSERT_ENABLED)
@ -583,7 +583,7 @@ void GCRuntime::resetBufferedGrayRoots() const {
grayBufferState != GrayBufferState::Okay,
"Do not clear the gray buffers unless we are Failed or becoming Unused");
for (GCZonesIter zone(rt); !zone.done(); zone.next()) {
zone->gcGrayRoots().clearAndFree();
zone->gcGrayRoots().Clear();
}
}

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

@ -9,6 +9,7 @@
#include "mozilla/Atomics.h"
#include "mozilla/HashFunctions.h"
#include "mozilla/SegmentedVector.h"
#include "gc/FindSCCs.h"
#include "js/GCHashTable.h"
@ -375,7 +376,9 @@ class Zone : public JS::shadow::Zone,
CompartmentVector& compartments() { return compartments_.ref(); }
// This zone's gray roots.
typedef js::Vector<js::gc::Cell*, 0, js::SystemAllocPolicy> GrayRootVector;
using GrayRootVector = mozilla::SegmentedVector<js::gc::Cell*,
1024 * sizeof(js::gc::Cell*),
js::SystemAllocPolicy>;
private:
js::ZoneOrGCTaskData<GrayRootVector> gcGrayRoots_;