Bug 1123237 - Part 3. Monitoring allocation and gc events in nursery and tenured heaps. r=terrence

Based on patch from Ting-Yuan Huang <laszio.bugzilla@gmail.com>
This commit is contained in:
Kan-Ru Chen 2015-05-08 11:13:51 +08:00
parent f62780fc85
commit 3b6ee3a50b
4 changed files with 14 additions and 1 deletions

View File

@ -571,6 +571,7 @@ class FreeList
}
head.checkSpan(thingSize);
JS_EXTRA_POISON(reinterpret_cast<void*>(thing), JS_ALLOCATED_TENURED_PATTERN, thingSize);
MemProfiler::SampleTenured(reinterpret_cast<void*>(thing), thingSize);
return reinterpret_cast<TenuredCell*>(thing);
}
};

View File

@ -2020,7 +2020,6 @@ js::TenuringTracer::moveToTenured(JSObject* src)
CrashAtUnhandlableOOM("Failed to allocate object while tenuring.");
}
JSObject* dst = reinterpret_cast<JSObject*>(t);
tenuredSize += moveObjectToTenured(dst, src, dstKind);
RelocationOverlay* overlay = RelocationOverlay::fromCell(src);
@ -2032,6 +2031,7 @@ js::TenuringTracer::moveToTenured(JSObject* src)
}
TracePromoteToTenured(src, dst);
MemProfiler::MoveNurseryToTenured(src, dst);
return dst;
}

View File

@ -235,6 +235,7 @@ js::Nursery::allocate(size_t size)
position_ = position() + size;
JS_EXTRA_POISON(thing, JS_ALLOCATED_NURSERY_PATTERN, size);
MemProfiler::SampleNursery(reinterpret_cast<void*>(thing), size);
return thing;
}
@ -675,6 +676,7 @@ js::Nursery::sweep()
/* Set current start position for isEmpty checks. */
currentStart_ = position();
MemProfiler::SweepNursery(runtime());
}
void

View File

@ -490,6 +490,14 @@ Arena::finalize(FreeOp* fop, AllocKind thingKind, size_t thingSize)
FreeSpan* newListTail = &newListHead;
size_t nmarked = 0;
if (MOZ_UNLIKELY(MemProfiler::enabled())) {
for (ArenaCellIterUnderFinalize i(&aheader); !i.done(); i.next()) {
T* t = i.get<T>();
if (t->asTenured().isMarked())
MemProfiler::MarkTenured(reinterpret_cast<void*>(t));
}
}
for (ArenaCellIterUnderFinalize i(&aheader); !i.done(); i.next()) {
T* t = i.get<T>();
if (t->asTenured().isMarked()) {
@ -3882,6 +3890,7 @@ GCRuntime::beginMarkPhase(JS::gcreason::Reason reason)
zone->arenas.purge();
}
MemProfiler::MarkTenuredStart(rt);
marker.start();
GCMarker* gcmarker = &marker;
@ -5538,6 +5547,7 @@ GCRuntime::finishCollection(JS::gcreason::Reason reason)
MOZ_ASSERT(marker.isDrained());
marker.stop();
clearBufferedGrayRoots();
MemProfiler::SweepTenured(rt);
uint64_t currentTime = PRMJ_Now();
schedulingState.updateHighFrequencyMode(lastGCTime, currentTime, tunables);