bug 486106 - restoring JS*Lookup API compatibility with fast arrays. r=shaver

This commit is contained in:
Igor Bukanov
2009-03-31 21:42:31 +02:00
parent 12fc0ecac3
commit 0d4da913d9
3 changed files with 25 additions and 0 deletions

View File

@@ -739,6 +739,23 @@ array_dropProperty(JSContext *cx, JSObject *obj, JSProperty *prop)
#endif
}
jsval
js_GetDenseArrayElementValue(JSObject *obj, JSProperty *prop)
{
/* OBJ_IS_DENSE_ARRAY does not use the cx argument. */
JS_ASSERT(OBJ_IS_DENSE_ARRAY(cx, obj));
JS_ASSERT((void *) prop ==
(void *) &(obj->fslots[JSSLOT_ARRAY_LOOKUP_HOLDER]));
JS_ASSERT((jsval) prop->id == obj->fslots[JSSLOT_ARRAY_LOOKUP_HOLDER]);
JS_ASSERT(JSVAL_IS_INT(prop->id));
jsint i = JSID_TO_INT(prop->id);
JS_ASSERT(i >= 0);
jsval v = obj->dslots[i];
JS_ASSERT(v != JSVAL_HOLE);
return v;
}
static JSBool
array_getProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
{