wire up memory reporter
authorMike Shaver <shaver@mozilla.org>
Wed, 05 Jan 2011 11:21:34 -0800
changeset 59853 6df0d209b91c5d83fb999ea5d289f645845364d0
parent 59852 532e6e72dc9ce131af508dd71d51718670f8e49e
child 59854 3841147809206fd53e9470e10e3510406e2133ab
push id3
push usershaver@mozilla.com
push dateWed, 05 Jan 2011 19:21:53 +0000
milestone2.0b9pre
wire up memory reporter
js/src/xpconnect/src/xpcjsruntime.cpp
--- a/js/src/xpconnect/src/xpcjsruntime.cpp
+++ b/js/src/xpconnect/src/xpcjsruntime.cpp
@@ -1192,20 +1192,34 @@ protected:
 static XPConnectGCChunkAllocator gXPCJSChunkAllocator;
 
 NS_MEMORY_REPORTER_IMPLEMENT(XPConnectJSRuntimeGCChunks,
                              "xpconnect/js/gcchunks",
                              "Memory in use by main JS Runtime GC chunks",
                              XPConnectGCChunkAllocator::GetGCChunkBytesInUse,
                              &gXPCJSChunkAllocator)
 
+/* FIXME: use API provided by bug 623271 */
+#include "jscntxt.h"
+
+static PRInt64
+GetJSMethodJitCodeMemoryInUse(void *data)
+{
+    JSRuntime *rt = nsXPConnect::GetRuntimeInstance()->GetJSRuntime();
+#ifdef JS_METHODJIT
+    return rt->mjitCodeSize;
+#else
+    return 0;
+#endif
+}
+
 NS_MEMORY_REPORTER_IMPLEMENT(XPConnectJSMethodJitCode,
                              "xpconnect/js/mjit-code",
                              "Memory in use by method-jit for compiled code",
-                             GetJSMethodJITCodeMemoryInUse,
+                             GetJSMethodJitCodeMemoryInUse,
                              NULL)
 
 XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect)
  : mXPConnect(aXPConnect),
    mJSRuntime(nsnull),
    mWrappedJSMap(JSObject2WrappedJSMap::newMap(XPC_JS_MAP_SIZE)),
    mWrappedJSClassMap(IID2WrappedJSClassMap::newMap(XPC_JS_CLASS_MAP_SIZE)),
    mIID2NativeInterfaceMap(IID2NativeInterfaceMap::newMap(XPC_NATIVE_INTERFACE_MAP_SIZE)),