# HG changeset patch # User Atul Varma # Date 1248588527 25200 # Node ID f3ecf06a28513f2e6de153cdc1618cd4c011df3b # Parent 2b5696b91b01e8ff2a883f5bf26501983c7d178c js objects no longer have a unique id in addition to their JSObject *, since mrbkap verified that SpiderMonkey's mark-and-sweep garbage collector isn't a copying one. diff -r 2b5696b91b01 -r f3ecf06a2851 object.c --- a/object.c Sat Jul 25 22:51:20 2009 -0700 +++ b/object.c Sat Jul 25 23:08:47 2009 -0700 @@ -51,7 +51,7 @@ { if (self->obj) { JS_DHashTableOperate(&self->runtime->objects, - (void *) self->uniqueId, + (void *) self->obj, JS_DHASH_REMOVE); // JS_RemoveRoot() always returns JS_TRUE, so don't @@ -116,16 +116,10 @@ PYM_JSObject *PYM_newJSObject(PYM_JSContextObject *context, JSObject *obj, PYM_JSObject *subclass) { - jsid uniqueId; - if (!JS_GetObjectId(context->cx, obj, &uniqueId)) { - PyErr_SetString(PYM_error, "JS_GetObjectId() failed"); - return NULL; - } - PYM_JSRuntimeObject *runtime = context->runtime; PYM_HashEntry *cached = (PYM_HashEntry *) JS_DHashTableOperate( &runtime->objects, - (void *) uniqueId, + (void *) obj, JS_DHASH_LOOKUP ); @@ -153,10 +147,9 @@ object->runtime = NULL; object->obj = NULL; - object->uniqueId = NULL; cached = (PYM_HashEntry *) JS_DHashTableOperate(&runtime->objects, - (void *) uniqueId, + (void *) obj, JS_DHASH_ADD); if (cached == NULL) { Py_DECREF(object); @@ -164,14 +157,13 @@ return NULL; } - cached->base.key = (void *) uniqueId; + cached->base.key = (void *) obj; cached->value = object; object->runtime = context->runtime; Py_INCREF(object->runtime); object->obj = obj; - object->uniqueId = uniqueId; JS_AddNamedRootRT(object->runtime->rt, &object->obj, "Pymonkey-Generated Object"); diff -r 2b5696b91b01 -r f3ecf06a2851 object.h --- a/object.h Sat Jul 25 22:51:20 2009 -0700 +++ b/object.h Sat Jul 25 23:08:47 2009 -0700 @@ -48,7 +48,6 @@ PyObject_HEAD PYM_JSRuntimeObject *runtime; JSObject *obj; - jsid uniqueId; } PYM_JSObject; extern PyTypeObject PYM_JSObjectType;