зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1633625 - move performance.mozMemory -> performance.mozMemory.gc to match the JS shell, and because performance.mozMemory.mallocBytes is deceptive when it only refers to GC-controlled malloc bytes r=jonco,smaug
Differential Revision: https://phabricator.services.mozilla.com/D74447
This commit is contained in:
Родитель
cf78a3d737
Коммит
35e5881162
|
@ -86,10 +86,17 @@ PerformanceMainThread::~PerformanceMainThread() {
|
|||
void PerformanceMainThread::GetMozMemory(JSContext* aCx,
|
||||
JS::MutableHandle<JSObject*> aObj) {
|
||||
if (!mMozMemory) {
|
||||
mMozMemory = js::gc::NewMemoryInfoObject(aCx);
|
||||
if (mMozMemory) {
|
||||
mozilla::HoldJSObjects(this);
|
||||
JS::Rooted<JSObject*> mozMemoryObj(aCx, JS_NewPlainObject(aCx));
|
||||
JS::Rooted<JSObject*> gcMemoryObj(aCx, js::gc::NewMemoryInfoObject(aCx));
|
||||
if (!mozMemoryObj || !gcMemoryObj) {
|
||||
MOZ_CRASH("out of memory creating performance.mozMemory");
|
||||
}
|
||||
if (!JS_DefineProperty(aCx, mozMemoryObj, "gc", gcMemoryObj,
|
||||
JSPROP_ENUMERATE)) {
|
||||
MOZ_CRASH("out of memory creating performance.mozMemory");
|
||||
}
|
||||
mMozMemory = mozMemoryObj;
|
||||
mozilla::HoldJSObjects(this);
|
||||
}
|
||||
|
||||
aObj.set(mMozMemory);
|
||||
|
|
|
@ -125,12 +125,12 @@ class FrameHistory {
|
|||
var idx = sampleIndex % this._numSamples;
|
||||
this.delays[idx] = delay;
|
||||
if (features.trackingSizes) {
|
||||
this.gcBytes[idx] = performance.mozMemory.gcBytes;
|
||||
this.gcBytes[idx] = performance.mozMemory.gc.gcBytes;
|
||||
}
|
||||
if (features.showingGCs) {
|
||||
this.gcs[idx] = performance.mozMemory.gcNumber;
|
||||
this.minorGCs[idx] = performance.mozMemory.minorGCCount;
|
||||
this.majorGCs[idx] = performance.mozMemory.majorGCCount;
|
||||
this.gcs[idx] = performance.mozMemory.gc.gcNumber;
|
||||
this.minorGCs[idx] = performance.mozMemory.gc.minorGCCount;
|
||||
this.majorGCs[idx] = performance.mozMemory.gc.majorGCCount;
|
||||
|
||||
// Previous versions lacking sliceCount will fall back to
|
||||
// assuming any GC activity was a major GC slice, even though
|
||||
|
@ -139,7 +139,7 @@ class FrameHistory {
|
|||
// field, it is common to load the gc-ubench index.html with
|
||||
// different browser versions.
|
||||
this.slices[idx] =
|
||||
performance.mozMemory.sliceCount || performance.mozMemory.gcNumber;
|
||||
performance.mozMemory.gc.sliceCount || performance.mozMemory.gc.gcNumber;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -245,10 +245,10 @@ LatencyGraph.prototype.draw = function() {
|
|||
|
||||
function MemoryGraph(ctx) {
|
||||
Graph.call(this, ctx);
|
||||
this.worstEver = this.bestEver = performance.mozMemory.zone.gcBytes;
|
||||
this.worstEver = this.bestEver = performance.mozMemory.gc.zone.gcBytes;
|
||||
this.limit = Math.max(
|
||||
this.worstEver,
|
||||
performance.mozMemory.zone.gcAllocTrigger
|
||||
performance.mozMemory.gc.zone.gcAllocTrigger
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -311,7 +311,7 @@ MemoryGraph.prototype.draw = function() {
|
|||
this.worstEver = worst;
|
||||
this.limit = Math.max(
|
||||
this.worstEver,
|
||||
performance.mozMemory.zone.gcAllocTrigger
|
||||
performance.mozMemory.gc.zone.gcAllocTrigger
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -322,8 +322,8 @@ MemoryGraph.prototype.draw = function() {
|
|||
"#cc1111"
|
||||
);
|
||||
this.drawHBar(
|
||||
performance.mozMemory.zone.gcAllocTrigger,
|
||||
`${format_bytes(performance.mozMemory.zone.gcAllocTrigger)} trigger`,
|
||||
performance.mozMemory.gc.zone.gcAllocTrigger,
|
||||
`${format_bytes(performance.mozMemory.gc.zone.gcAllocTrigger)} trigger`,
|
||||
"#cc11cc"
|
||||
);
|
||||
|
||||
|
@ -500,7 +500,7 @@ function onload() {
|
|||
var canvas = document.getElementById("graph");
|
||||
latencyGraph = new LatencyGraph(canvas.getContext("2d"));
|
||||
|
||||
if (!performance.mozMemory) {
|
||||
if (!performance.mozMemory || !performance.mozMemory.gc) {
|
||||
document.getElementById("memgraph-disabled").style.display = "block";
|
||||
document.getElementById("track-sizes-div").style.display = "none";
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче