changeset 35:5899faf625d4

Added a forceGC() function to the global TCB object.
author Atul Varma <varmaa@toolness.com>
date Mon, 22 Jun 2009 15:40:46 -0700
parents afca92a2e72e
children be05a91e7b0a
files spidermonkey-playground.cpp
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/spidermonkey-playground.cpp	Mon Jun 22 15:33:18 2009 -0700
+++ b/spidermonkey-playground.cpp	Mon Jun 22 15:40:46 2009 -0700
@@ -80,6 +80,15 @@
   return JS_TRUE;
 }
 
+// This native JS function forces garbage collection.
+
+static JSBool forceGC(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
+                      jsval *rval)
+{
+  JS_GC(cx);
+  return JS_TRUE;
+}
+
 // This native JS function is an implementation of the SecurableModule
 // require() function.  For more information, see:
 //
@@ -368,6 +377,7 @@
   JS_FS("lookupProperty", lookupProperty, 2, 0, 0),
   JS_FS("functionInfo",   functionInfo,   1, 0, 0),
   JS_FS("enumerate",      enumerate,      1, 0, 0),
+  JS_FS("forceGC",        forceGC,        0, 0, 0),
   JS_FS_END
 };