Mercurial > spidermonkey-playground
changeset 63:4910bc49a182
set GC Zeal to 2 and fixed some bugs exposed by it.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Thu, 25 Jun 2009 11:39:32 -0700 |
parents | 03078138a4cd |
children | 6a7e87cd1588 |
files | memory_profiler.cpp memory_profiler_server.js pavement.py server_socket.cpp spidermonkey-playground.cpp |
diffstat | 5 files changed, 23 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/memory_profiler.cpp Thu Jun 25 10:48:47 2009 -0700 +++ b/memory_profiler.cpp Thu Jun 25 11:39:32 2009 -0700 @@ -145,6 +145,11 @@ } } + if (numObjectChildren != currChild) { + JS_ReportError(cx, "Assertion failure, numObjectChildren != currChild"); + return JS_FALSE; + } + JSObject *children = JS_NewArrayObject(cx, numObjectChildren, childrenVals); if (children == NULL) { JS_ReportOutOfMemory(cx); @@ -227,6 +232,7 @@ if (JS_DHASH_ENTRY_IS_BUSY((JSDHashEntryHdr *)entry)) { JSObject *info = JS_NewObject(cx, NULL, NULL, NULL); + *rval = OBJECT_TO_JSVAL(info); JSObject *target = (JSObject *) id; JSContext *targetCx = tracingState.tracer.context; @@ -364,6 +370,10 @@ JS_BeginRequest(serverCx); +#ifdef DEBUG + JS_SetGCZeal(serverCx, 2); +#endif + JSObject *serverGlobal = JS_NewObject(serverCx, &global_class, NULL, NULL); if (serverGlobal == NULL) {
--- a/memory_profiler_server.js Thu Jun 25 10:48:47 2009 -0700 +++ b/memory_profiler_server.js Thu Jun 25 11:39:32 2009 -0700 @@ -1,3 +1,6 @@ +// This is just a test to exercise the code a bit. +JSON.stringify(getObjectInfo(getGCRoots()[0])); + var socket = new ServerSocket(); var PORT = 8080;
--- a/pavement.py Thu Jun 25 10:48:47 2009 -0700 +++ b/pavement.py Thu Jun 25 11:39:32 2009 -0700 @@ -14,6 +14,8 @@ cmdline = ["g++", "-o", "spidermonkey-playground", "-I%s" % incdir, "-L.", + "-g", # produce output for gdb + "-DDEBUG", "spidermonkey-playground.cpp", "wrapper.cpp", "server_socket.cpp",
--- a/server_socket.cpp Thu Jun 25 10:48:47 2009 -0700 +++ b/server_socket.cpp Thu Jun 25 11:39:32 2009 -0700 @@ -265,6 +265,8 @@ static JSBool createWithFd(JSContext *cx, jsval *rval, PRFileDesc *fd) { + JSAutoLocalRootScope autoScope(cx); + JSObject *object = JS_NewObject( cx, &sServerSocket_JSClass,
--- a/spidermonkey-playground.cpp Thu Jun 25 10:48:47 2009 -0700 +++ b/spidermonkey-playground.cpp Thu Jun 25 11:39:32 2009 -0700 @@ -229,6 +229,8 @@ static JSBool stack(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { + JSAutoLocalRootScope autoScope(cx); + JSStackFrame *iterator = NULL; JSStackFrame *frame; JSObject *prevFrameInfo = NULL; @@ -413,6 +415,10 @@ JS_BeginRequest(tcb_cx); +#ifdef DEBUG + JS_SetGCZeal(tcb_cx, 2); +#endif + /* Create the TCB's global object. */ tcb_global = JS_NewObject(tcb_cx, &global_class, NULL, NULL); if (tcb_global == NULL)