changeset 58:0b66a265df13

Fixed some bugs that raised assertions in debug builds of SpiderMonkey.
author Atul Varma <varmaa@toolness.com>
date Wed, 24 Jun 2009 21:15:45 -0700
parents 1fd63ee398dc
children ab600a5e6516
files memory_profiler.cpp pavement.py server_socket.cpp server_socket.h spidermonkey-playground.cpp
diffstat 5 files changed, 24 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/memory_profiler.cpp	Wed Jun 24 19:38:05 2009 -0700
+++ b/memory_profiler.cpp	Wed Jun 24 21:15:45 2009 -0700
@@ -284,7 +284,10 @@
   JS_SetVersion(serverCx, JSVERSION_LATEST);
   JS_SetErrorReporter(serverCx, reportError);
 
+  JS_BeginRequest(serverCx);
+
   JSObject *serverGlobal = JS_NewObject(serverCx, &global_class, NULL, NULL);
+
   if (serverGlobal == NULL) {
     JS_ReportError(cx, "Couldn't create server JS global.");
     return JS_FALSE;
@@ -324,6 +327,7 @@
 
   /* Cleanup. */
   JS_DHashTableFinish(&tracingState.visited);
+  JS_EndRequest(serverCx);
   JS_DestroyContext(serverCx);
   JS_DestroyRuntime(serverRuntime);
 
--- a/pavement.py	Wed Jun 24 19:38:05 2009 -0700
+++ b/pavement.py	Wed Jun 24 21:15:45 2009 -0700
@@ -6,7 +6,7 @@
 
 @task
 def auto(options):
-    objdir = os.path.join("..", "mozilla-stuff", "basic-firefox", "dist")
+    objdir = os.path.join("..", "mozilla-stuff", "debug-firefox", "dist")
     objdir = os.path.abspath(objdir)
     incdir = os.path.join(objdir, "include")
     libdir = os.path.join(objdir, "lib")
--- a/server_socket.cpp	Wed Jun 24 19:38:05 2009 -0700
+++ b/server_socket.cpp	Wed Jun 24 21:15:45 2009 -0700
@@ -45,7 +45,7 @@
   *fd = (PRFileDesc *) JS_GetInstancePrivate(
     cx,
     obj,
-    &sServerSocket_JSClass.base,
+    &sServerSocket_JSClass,
     NULL
     );
   if (*fd == NULL) {
@@ -66,27 +66,17 @@
   }
 }
 
-JSExtendedClass sServerSocket_JSClass = {
-  // JSClass (JSExtendedClass.base) initialization
-  { "SimpleSocket",
-    JSCLASS_IS_EXTENDED | JSCLASS_HAS_PRIVATE |
-    JSCLASS_HAS_RESERVED_SLOTS(0),
-    JS_PropertyStub,          JS_PropertyStub,
-    JS_PropertyStub,          JS_PropertyStub,
-    JS_EnumerateStub,         JS_ResolveStub,
-    JS_ConvertStub,           finalize,
-    NULL,                     NULL,
-    NULL,                     NULL,
-    NULL,                     NULL,
-    NULL,                     NULL
-  },
-  // JSExtendedClass initialization
-  NULL, // equality
-  NULL, // outerObject
-  NULL, // innerObject
-  NULL, // iterator
-  NULL, // wrapper
-  JSCLASS_NO_RESERVED_MEMBERS
+JSClass sServerSocket_JSClass = {
+  "SimpleSocket",
+  JSCLASS_HAS_PRIVATE,
+  JS_PropertyStub,          JS_PropertyStub,
+  JS_PropertyStub,          JS_PropertyStub,
+  JS_EnumerateStub,         JS_ResolveStub,
+  JS_ConvertStub,           finalize,
+  NULL,                     NULL,
+  NULL,                     NULL,
+  NULL,                     NULL,
+  NULL,                     NULL
 };
 
 static JSBool send(JSContext *cx, JSObject *obj, uintN argc,
@@ -277,7 +267,7 @@
 {
   JSObject *object = JS_NewObject(
     cx,
-    &sServerSocket_JSClass.base,
+    &sServerSocket_JSClass,
     NULL,
     NULL
     );
--- a/server_socket.h	Wed Jun 24 19:38:05 2009 -0700
+++ b/server_socket.h	Wed Jun 24 21:15:45 2009 -0700
@@ -36,6 +36,6 @@
 
 #include "jsapi.h"
 
-extern JSExtendedClass sServerSocket_JSClass;
+extern JSClass sServerSocket_JSClass;
 extern JSBool createServerSocket(JSContext *cx, JSObject *obj, uintN argc,
                                  jsval *argv, jsval *rval);
--- a/spidermonkey-playground.cpp	Wed Jun 24 19:38:05 2009 -0700
+++ b/spidermonkey-playground.cpp	Wed Jun 24 21:15:45 2009 -0700
@@ -411,12 +411,14 @@
   JS_SetOptions(tcb_cx, JSOPTION_VAROBJFIX);
   JS_SetVersion(tcb_cx, JSVERSION_LATEST);
 
+  JS_BeginRequest(tcb_cx);
+
   /* Create the TCB's global object. */
   tcb_global = JS_NewObject(tcb_cx, &global_class, NULL, NULL);
   if (tcb_global == NULL)
     return 1;
 
-  JS_AddNamedRoot(tcb_cx, tcb_global, "TCB Global");
+  JS_AddNamedRoot(tcb_cx, &tcb_global, "TCB Global");
 
   /* Populate the tcb_global object with the standard globals,
      like Object and Array. */
@@ -461,7 +463,8 @@
   }
 
   /* Cleanup. */
-  JS_RemoveRoot(tcb_cx, tcb_global);
+  JS_RemoveRoot(tcb_cx, &tcb_global);
+  JS_EndRequest(tcb_cx);
   JS_DestroyContext(tcb_cx);
   JS_DestroyRuntime(rt);
   JS_ShutDown();