if (proto && (map = proto->map)->ops == ops) {
if (proto && (map = proto->map)->ops == ops && ((clasp->flags ^ OBJ_GET_CLASS(cx, proto)->flags) & (JSCLASS_HAS_PRIVATE | (JSCLASS_RESERVED_SLOTS_MASK << JSCLASS_RESERVED_SLOTS_SHIFT))) == 0) {
js_NewObject(JSContext *cx, JSClass *clasp, JSObject *proto, JSObject *parent){    JSObject *obj, *ctor;    JSObjectOps *ops;    JSObjectMap *map;    jsval cval;    uint32 nslots, i;    jsval *newslots;    /* Allocate an object from the GC heap and zero it. */    obj = (JSObject *) js_AllocGCThing(cx, GCX_OBJECT);    if (!obj)        return NULL;    /* Bootstrap the ur-object, and make it the default prototype object. */    if (!proto) {        if (!GetClassPrototype(cx, parent, clasp->name, &proto))            goto bad;        if (!proto && !GetClassPrototype(cx, parent, js_Object_str, &proto))            goto bad;    }    /* Always call the class's getObjectOps hook if it has one. */    ops = clasp->getObjectOps          ? clasp->getObjectOps(cx, clasp)          : &js_ObjectOps;    if (proto && (map = proto->map)->ops == ops) {        /* Default parent to the parent of the prototype's constructor. */        if (!parent) {            if (!OBJ_GET_PROPERTY(cx, proto,                                  (jsid)cx->runtime->atomState.constructorAtom,                                  &cval)) {                goto bad;            }            if (JSVAL_IS_OBJECT(cval) && (ctor = JSVAL_TO_OBJECT(cval)) != NULL)                parent = OBJ_GET_PARENT(cx, ctor);        }        /* Share the given prototype's map. */        obj->map = js_HoldObjectMap(cx, map);        /* Ensure that obj starts with the minimum slots for clasp. */        nslots = JS_INITIAL_NSLOTS;    } else {        /* Leave parent alone.  Allocate a new map for obj. */        map = ops->newObjectMap(cx, 1, ops, clasp, obj);        if (!map)            goto bad;        obj->map = map;        /* Let ops->newObjectMap set nslots so as to reserve slots. */        nslots = map->nslots;    }    /* Allocate a slots vector, with a -1'st element telling its length. */    newslots = (jsval *) JS_malloc(cx, (nslots + 1) * sizeof(jsval));    if (!newslots) {        js_DropObjectMap(cx, obj->map, obj);        obj->map = NULL;        goto bad;    }    newslots[0] = nslots;    newslots++;    /* Set the proto, parent, and class properties. */    newslots[JSSLOT_PROTO] = OBJECT_TO_JSVAL(proto);    newslots[JSSLOT_PARENT] = OBJECT_TO_JSVAL(parent);    newslots[JSSLOT_CLASS] = PRIVATE_TO_JSVAL(clasp);    /* Clear above JSSLOT_CLASS so the GC doesn't load uninitialized memory. */    for (i = JSSLOT_CLASS + 1; i < nslots; i++)        newslots[i] = JSVAL_VOID;    /* Store newslots after initializing all of 'em, just in case. */    obj->slots = newslots;    if (cx->runtime->objectHook)        cx->runtime->objectHook(cx, obj, JS_TRUE, cx->runtime->objectHookData);    return obj;bad:    cx->newborn[GCX_OBJECT] = NULL;    return NULL;}