rlimit += clasp->reserveSlots(cx, obj); JS_ASSERT(slot < rlimit); if (rlimit > nslots) nslots = rlimit;
nslots += clasp->reserveSlots(cx, obj); JS_ASSERT(slot < nslots);
js_SetRequiredSlot(JSContext *cx, JSObject *obj, uint32 slot, jsval v){    uint32 nslots, rlimit, i;    JSClass *clasp;    jsval *newslots;    JS_LOCK_OBJ(cx, obj);    nslots = (uint32) obj->slots[-1];    if (slot >= nslots) {        clasp = LOCKED_OBJ_GET_CLASS(obj);        rlimit = JSSLOT_START(clasp) + JSCLASS_RESERVED_SLOTS(clasp);        if (clasp->reserveSlots)            rlimit += clasp->reserveSlots(cx, obj);        JS_ASSERT(slot < rlimit);        if (rlimit > nslots)            nslots = rlimit;        newslots = (jsval *)            JS_realloc(cx, obj->slots - 1, (nslots + 1) * sizeof(jsval));        if (!newslots) {            JS_UNLOCK_OBJ(cx, obj);            return JS_FALSE;        }        for (i = 1 + newslots[0]; i <= rlimit; i++)            newslots[i] = JSVAL_VOID;        newslots[0] = nslots;        if (OBJ_SCOPE(obj)->object == obj)            obj->map->nslots = nslots;        obj->slots = newslots + 1;    }    obj->slots[slot] = v;    JS_UNLOCK_OBJ(cx, obj);    return JS_TRUE;}