Bug 526793 - Add gczeal() function to xpcshell. r=mrbkap
authorJosh Matthews <josh@joshmatthews.net>
Thu, 18 Mar 2010 13:05:22 +1300
changeset 40301 fb40471645ea874820e483d70a019e4d9ed4a9d2
parent 40300 86ec439689768e2da8becd8ee517abba955ce657
child 40302 0f500b25076fb042ea769397b8e63c8a6da955c3
push id12610
push userrsayre@mozilla.com
push dateMon, 05 Apr 2010 17:26:41 +0000
treeherdermozilla-central@1942c0b4e101 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs526793
milestone1.9.3a3pre
Bug 526793 - Add gczeal() function to xpcshell. r=mrbkap
js/src/xpconnect/shell/xpcshell.cpp
--- a/js/src/xpconnect/shell/xpcshell.cpp
+++ b/js/src/xpconnect/shell/xpcshell.cpp
@@ -548,16 +548,29 @@ GC(JSContext *cx, JSObject *obj, uintN a
 #endif
            );
 #ifdef JS_GCMETER
     js_DumpGCStats(rt, stdout);
 #endif
     return JS_TRUE;
 }
 
+#ifdef JS_GC_ZEAL
+static JSBool
+GCZeal(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+{
+    uint32 zeal;
+    if (!JS_ValueToECMAUint32(cx, argv[0], &zeal))
+        return JS_FALSE;
+
+    JS_SetGCZeal(cx, (PRUint8)zeal);
+    return JS_TRUE;
+}
+#endif
+
 #ifdef DEBUG
 
 static JSBool
 DumpHeap(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
 {
     char *fileName = NULL;
     void* startThing = NULL;
     uint32 startTraceKind = 0;
@@ -751,16 +764,19 @@ static JSFunctionSpec glob_functions[] =
     {"readline",        ReadLine,       1,0,0},
     {"load",            Load,           1,0,0},
     {"quit",            Quit,           0,0,0},
     {"version",         Version,        1,0,0},
     {"build",           BuildDate,      0,0,0},
     {"dumpXPC",         DumpXPC,        1,0,0},
     {"dump",            Dump,           1,0,0},
     {"gc",              GC,             0,0,0},
+#ifdef JS_GC_ZEAL
+    {"gczeal",          GCZeal,         1,0,0},
+#endif
     {"clear",           Clear,          1,0,0},
     {"options",         Options,        0,0,0},
 #ifdef DEBUG
     {"dumpHeap",        DumpHeap,       5,0,0},
 #endif
 #ifdef MOZ_SHARK
     {"startShark",      js_StartShark,      0,0,0},
     {"stopShark",       js_StopShark,       0,0,0},