Bug 687621 - Further split ObjectOps to add a third property type (and temporarily a fourth to use for a property of indeterminate type), to encapsulate object-valued jsids and properties that don't fit in the property name/element distinction. r=luke

This commit is contained in:
Jeff Walden
2011-08-12 14:26:48 -04:00
parent 66a9aeb96f
commit 20cd82e08f
12 changed files with 487 additions and 5 deletions

View File

@@ -753,6 +753,13 @@ array_lookupElement(JSContext *cx, JSObject *obj, uint32 index, JSObject **objp,
return true;
}
static JSBool
array_lookupSpecial(JSContext *cx, JSObject *obj, jsid id, JSObject **objp,
JSProperty **propp)
{
return array_lookupProperty(cx, obj, id, objp, propp);
}
JSBool
js_GetDenseArrayElementValue(JSContext *cx, JSObject *obj, jsid id, Value *vp)
{
@@ -856,6 +863,12 @@ array_getElement(JSContext *cx, JSObject *obj, JSObject *receiver, uint32 index,
return js_NativeGet(cx, obj, obj2, shape, JSGET_METHOD_BARRIER, vp);
}
static JSBool
array_getSpecial(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp)
{
return array_getProperty(cx, obj, receiver, id, vp);
}
static JSBool
slowarray_addProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp)
{
@@ -950,6 +963,12 @@ array_setElement(JSContext *cx, JSObject *obj, uint32 index, Value *vp, JSBool s
return js_SetPropertyHelper(cx, obj, id, 0, vp, strict);
}
static JSBool
array_setSpecial(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
{
return array_setProperty(cx, obj, id, vp, strict);
}
JSBool
js_PrototypeHasIndexedProperties(JSContext *cx, JSObject *obj)
{
@@ -1051,6 +1070,13 @@ array_defineElement(JSContext *cx, JSObject *obj, uint32 index, const Value *val
} // namespace js
static JSBool
array_defineSpecial(JSContext *cx, JSObject *obj, jsid id, const Value *value,
PropertyOp getter, StrictPropertyOp setter, uintN attrs)
{
return array_defineProperty(cx, obj, id, value, getter, setter, attrs);
}
static JSBool
array_getAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
{
@@ -1066,6 +1092,12 @@ array_getElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *at
return true;
}
static JSBool
array_getSpecialAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
{
return array_getAttributes(cx, obj, id, attrsp);
}
static JSBool
array_setAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
{
@@ -1080,6 +1112,12 @@ array_setElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *at
return false;
}
static JSBool
array_setSpecialAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
{
return array_setAttributes(cx, obj, id, attrsp);
}
namespace js {
/* non-static for direct deletion of array elements within the engine */
@@ -1129,6 +1167,12 @@ array_deleteElement(JSContext *cx, JSObject *obj, uint32 index, Value *rval, JSB
} // namespace js
static JSBool
array_deleteSpecial(JSContext *cx, JSObject *obj, jsid id, Value *rval, JSBool strict)
{
return array_deleteProperty(cx, obj, id, rval, strict);
}
static void
array_trace(JSTracer *trc, JSObject *obj)
{
@@ -1175,20 +1219,34 @@ Class js::ArrayClass = {
array_trace, /* trace */
JS_NULL_CLASS_EXT,
{
array_lookupProperty,
array_lookupProperty,
array_lookupElement,
array_lookupSpecial,
array_defineProperty,
array_defineProperty,
array_defineElement,
array_defineSpecial,
array_getProperty,
array_getProperty,
array_getElement,
array_getSpecial,
array_setProperty,
array_setProperty,
array_setElement,
array_setSpecial,
array_getAttributes,
array_getAttributes,
array_getElementAttributes,
array_getSpecialAttributes,
array_setAttributes,
array_setAttributes,
array_setElementAttributes,
array_setSpecialAttributes,
array_deleteProperty,
array_deleteProperty,
array_deleteElement,
array_deleteSpecial,
NULL, /* enumerate */
array_typeOf,
array_fix,