Issue #316 - Make the memory GC performance object conditional (WIP)

This was only added for GCubench and likely interfering with building
without devtools-server.
This commit is contained in:
wolfbeast 2020-02-20 12:00:26 +01:00 committed by Roy Tam
commit 1e553d0e73
11 changed files with 36 additions and 0 deletions

View file

@ -741,7 +741,9 @@ class GCRuntime
void removeBlackRootsTracer(JSTraceDataOp traceOp, void* data);
void setMaxMallocBytes(size_t value);
#ifdef MOZ_DEVTOOLS_SERVER
int32_t getMallocBytes() const { return mallocBytesUntilGC; }
#endif
void resetMallocBytes();
bool isTooMuchMalloc() const { return mallocBytesUntilGC <= 0; }
void updateMallocCounter(JS::Zone* zone, size_t nbytes);

View file

@ -505,7 +505,10 @@ js::Nursery::collect(JSRuntime* rt, JS::gcreason::Reason reason)
if (!isEnabled())
return;
#ifdef MOZ_DEVTOOLS_SERVER
// No need to obsessively track this without devtools
rt->gc.incMinorGcNumber();
#endif
rt->gc.stats.beginNurseryCollection(reason);
TraceMinorGCStart();

View file

@ -6776,6 +6776,7 @@ js::gc::NextCellUniqueId(JSRuntime* rt)
return rt->gc.nextCellUniqueId();
}
#ifdef MOZ_DEVTOOLS_SERVER
namespace js {
namespace gc {
namespace MemInfo {
@ -7032,6 +7033,7 @@ AutoEmptyNursery::AutoEmptyNursery(JSRuntime *rt)
} /* namespace gc */
} /* namespace js */
#endif
#ifdef DEBUG
void

View file

@ -1357,8 +1357,10 @@ class ZoneList
ZoneList& operator=(const ZoneList& other) = delete;
};
#ifdef MOZ_DEVTOOLS_SERVER
JSObject*
NewMemoryStatisticsObject(JSContext* cx);
#endif
struct MOZ_RAII AutoAssertNoNurseryAlloc
{

View file

@ -7090,6 +7090,7 @@ NewGlobalObject(JSContext* cx, JS::CompartmentOptions& options,
if (!DefineOS(cx, glob, fuzzingSafe, &gOutFile, &gErrFile))
return nullptr;
#ifdef MOZ_DEVTOOLS_SERVER
RootedObject performanceObj(cx, JS_NewObject(cx, nullptr));
if (!performanceObj)
return nullptr;
@ -7105,6 +7106,7 @@ NewGlobalObject(JSContext* cx, JS::CompartmentOptions& options,
return nullptr;
if (!JS_DefineProperty(cx, mozMemoryObj, "gc", gcObj, JSPROP_ENUMERATE))
return nullptr;
#endif
/* Initialize FakeDOMObject. */
static const js::DOMCallbacks DOMcallbacks = {