mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1180763 - Part 1: Add the size of the tenured object to the tenure promotions log entry; r=sfink
This commit is contained in:
parent
741a23f13c
commit
38b909f9c6
@ -140,6 +140,7 @@ Zone::logPromotionsToTenured()
|
||||
return;
|
||||
|
||||
auto now = JS_GetCurrentEmbedderTime();
|
||||
JSRuntime* rt = runtimeFromAnyThread();
|
||||
|
||||
for (auto** dbgp = dbgs->begin(); dbgp != dbgs->end(); dbgp++) {
|
||||
if (!(*dbgp)->isEnabled() || !(*dbgp)->isTrackingTenurePromotions())
|
||||
@ -147,7 +148,7 @@ Zone::logPromotionsToTenured()
|
||||
|
||||
for (auto range = awaitingTenureLogging.all(); !range.empty(); range.popFront()) {
|
||||
if ((*dbgp)->isDebuggee(range.front()->compartment()))
|
||||
(*dbgp)->logTenurePromotion(*range.front(), now);
|
||||
(*dbgp)->logTenurePromotion(rt, *range.front(), now);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1701,10 +1701,18 @@ Debugger::isDebuggee(const JSCompartment* compartment) const
|
||||
return compartment->isDebuggee() && debuggees.has(compartment->maybeGlobal());
|
||||
}
|
||||
|
||||
Debugger::TenurePromotionsEntry::TenurePromotionsEntry(JSRuntime* rt, JSObject& obj, double when)
|
||||
: className(obj.getClass()->name),
|
||||
when(when),
|
||||
frame(getObjectAllocationSite(obj)),
|
||||
size(JS::ubi::Node(&obj).size(rt->debuggerMallocSizeOf))
|
||||
{ }
|
||||
|
||||
|
||||
void
|
||||
Debugger::logTenurePromotion(JSObject& obj, double when)
|
||||
Debugger::logTenurePromotion(JSRuntime* rt, JSObject& obj, double when)
|
||||
{
|
||||
auto* entry = js_new<TenurePromotionsEntry>(obj, when);
|
||||
auto* entry = js_new<TenurePromotionsEntry>(rt, obj, when);
|
||||
if (!entry)
|
||||
CrashAtUnhandlableOOM("Debugger::logTenurePromotion");
|
||||
|
||||
|
@ -269,7 +269,7 @@ class Debugger : private mozilla::LinkedListElement<Debugger>
|
||||
return enabled;
|
||||
}
|
||||
|
||||
void logTenurePromotion(JSObject& obj, double when);
|
||||
void logTenurePromotion(JSRuntime* rt, JSObject& obj, double when);
|
||||
static JSObject* getObjectAllocationSite(JSObject& obj);
|
||||
|
||||
private:
|
||||
@ -286,15 +286,12 @@ class Debugger : private mozilla::LinkedListElement<Debugger>
|
||||
|
||||
struct TenurePromotionsEntry : public mozilla::LinkedListElement<TenurePromotionsEntry>
|
||||
{
|
||||
TenurePromotionsEntry(JSObject& obj, double when)
|
||||
: className(obj.getClass()->name),
|
||||
when(when),
|
||||
frame(getObjectAllocationSite(obj))
|
||||
{ }
|
||||
TenurePromotionsEntry(JSRuntime* rt, JSObject& obj, double when);
|
||||
|
||||
const char* className;
|
||||
double when;
|
||||
RelocatablePtrObject frame;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
using TenurePromotionsLog = mozilla::LinkedList<TenurePromotionsEntry>;
|
||||
|
@ -387,6 +387,10 @@ DebuggerMemory::drainTenurePromotionsLog(JSContext* cx, unsigned argc, Value* vp
|
||||
if (!DefineProperty(cx, obj, cx->names().class_, classNameValue))
|
||||
return false;
|
||||
|
||||
RootedValue sizeValue(cx, NumberValue(entry->size));
|
||||
if (!DefineProperty(cx, obj, cx->names().size, sizeValue))
|
||||
return false;
|
||||
|
||||
result->setDenseElement(i, ObjectValue(*obj));
|
||||
|
||||
// Pop the front queue entry, and delete it immediately, so that
|
||||
|
Loading…
Reference in New Issue
Block a user