extend js_NewObjectWithGivenProto to permit specifying additional new-thing flags (such as GCX_DONT_BLOCK)

This commit is contained in:
shaver@mozilla.org 2008-08-10 22:56:10 -04:00
Родитель 3e4cdf84d6
Коммит d359968651
5 изменённых файлов: 9 добавлений и 9 удалений

Просмотреть файл

@ -3043,7 +3043,7 @@ JS_NewObjectWithGivenProto(JSContext *cx, JSClass *clasp, JSObject *proto,
CHECK_REQUEST(cx);
if (!clasp)
clasp = &js_ObjectClass; /* default class is Object */
return js_NewObjectWithGivenProto(cx, clasp, proto, parent, 0);
return js_NewObjectWithGivenProto(cx, clasp, proto, parent, 0, 0);
}
JS_PUBLIC_API(JSBool)

Просмотреть файл

@ -2503,12 +2503,12 @@ js_NewObject(JSContext *cx, JSClass *clasp, JSObject *proto, JSObject *parent,
}
}
return js_NewObjectWithGivenProto(cx, clasp, proto, parent, objectSize);
return js_NewObjectWithGivenProto(cx, clasp, proto, parent, objectSize, 0);
}
JSObject *
js_NewObjectWithGivenProto(JSContext *cx, JSClass *clasp, JSObject *proto,
JSObject *parent, uintN objectSize)
JSObject *parent, uintN objectSize, uintN flags)
{
JSObject *obj;
JSObjectOps *ops;
@ -2537,7 +2537,7 @@ js_NewObjectWithGivenProto(JSContext *cx, JSClass *clasp, JSObject *proto,
* Allocate an object from the GC heap and initialize all its fields before
* doing any operation that can potentially trigger GC.
*/
obj = (JSObject *) js_NewGCThing(cx, GCX_OBJECT, objectSize);
obj = (JSObject *) js_NewGCThing(cx, GCX_OBJECT | flags, objectSize);
if (!obj)
goto earlybad;

Просмотреть файл

@ -440,10 +440,12 @@ js_NewObject(JSContext *cx, JSClass *clasp, JSObject *proto, JSObject *parent,
*
* objectSize is either the explicit size for the allocated object or 0
* indicating to use the default size based on object's class.
*
* flags are or-ed into the flags parameter for js_NewGCThing.
*/
extern JSObject *
js_NewObjectWithGivenProto(JSContext *cx, JSClass *clasp, JSObject *proto,
JSObject *parent, uintN objectSize);
JSObject *parent, uintN objectSize, uintN flags);
/*
* Fast access to immutable standard objects (constructors and prototypes).

Просмотреть файл

@ -2811,10 +2811,8 @@ TraceRecorder::record_JSOP_NEW()
return interpretedFunctionCall(v, fun, argc);
}
if (fun->u.n.clasp) {
if (fun->u.n.clasp)
ABORT_TRACE("NYI");
return true;
}
ABORT_TRACE("can't trace unknown constructor");
}

Просмотреть файл

@ -8052,7 +8052,7 @@ js_GetAnyName(JSContext *cx, jsval *vp)
}
obj = js_NewObjectWithGivenProto(cx, &js_AnyNameClass, NULL,
NULL, 0);
NULL, 0, 0);
if (!obj || !JS_SetPrivate(cx, obj, qn)) {
cx->weakRoots.newborn[GCX_OBJECT] = NULL;
ok = JS_FALSE;