It is very useful to have the numbers of each object types in the JS statistics.
Created attachment 439639 [details] PATCH
Added memoryUsageStatistics() to jsc. Input: function dump(values, indent = '') { for (const key in values) { const value = values[key]; if (typeof value === 'object') { print(`${indent}${key}:`); dump(value, indent + ' '); } else print(`${indent}${key}: ${value}`); } } dump(memoryUsageStatistics()); Output: heapSize: 0 heapCapacity: 344064 extraMemorySize: 0 objectCount: 0 protectedObjectCount: 44 protectedGlobalObjectCount: 0 objectTypeCounts: JSProxy: 1 Promise: 1 Callee: 2 Atomics: 1 ...
Comment on attachment 439639 [details] PATCH I think this is fine. r=me
Comment on attachment 439639 [details] PATCH View in context: https://bugs.webkit.org/attachment.cgi?id=439639&action=review > Source/JavaScriptCore/API/JSBase.cpp:208 > + JSObject* objectTypeCounts = constructEmptyObject(globalObject); I think you could do `constructEmptyObject(vm, globalObject->nullPrototypeObjectStructure())` since this object is just holding key-value pairs and doesn't need access to the Object prototype. > Source/JavaScriptCore/API/JSBasePrivate.h:74 > + objectTypeCounts: object which has kind as key and its number as value for each GC objects I think something like "object with HeapCell kinds as keys and their current counts as values" would be clearer.
Created attachment 439672 [details] PATCH
Thanks Ross.
Committed r283286 (242313@main): <https://commits.webkit.org/242313@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 439672 [details].
<rdar://problem/83696026>