changeset 59:ab600a5e6516

sort of fixed the /gc-roots method.
author Atul Varma <varmaa@toolness.com>
date Wed, 24 Jun 2009 22:10:57 -0700
parents 0b66a265df13
children 4bafda49e56e
files memory_profiler.cpp
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/memory_profiler.cpp	Wed Jun 24 21:15:45 2009 -0700
+++ b/memory_profiler.cpp	Wed Jun 24 22:10:57 2009 -0700
@@ -120,7 +120,12 @@
 static intN rootMapFun(void *rp, const char *name, void *data)
 {
   jsval **currIndex = (jsval **) data;
-  **currIndex = INT_TO_JSVAL((unsigned int) rp);
+
+  // TODO: This will only work if the gcthing is a pointer to a JSObject
+  // pointer.
+
+  JSObject **obj = (JSObject **) rp;
+  **currIndex = INT_TO_JSVAL((unsigned int) *obj);
   *currIndex++;
   return JS_MAP_GCROOT_NEXT;
 }