зеркало из https://github.com/mozilla/gecko-dev.git
Bug 686582 - Begin to specialize ObjectOps::getElementAttributes to not just delegate to ObjectOps::getAttributes. r=dvander
--HG-- extra : rebase_source : a3767fed5456d13c5ee5b6a8617fa22e064c758c
This commit is contained in:
Родитель
e96d878fa9
Коммит
a237a27a20
|
@ -1004,10 +1004,8 @@ array_getAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
|||
static JSBool
|
||||
array_getElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp)
|
||||
{
|
||||
jsid id;
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return array_getAttributes(cx, obj, id, attrsp);
|
||||
*attrsp = JSPROP_ENUMERATE;
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
|
|
|
@ -6266,6 +6266,24 @@ js_GetAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
|
|||
return true;
|
||||
}
|
||||
|
||||
JSBool
|
||||
js_GetElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp)
|
||||
{
|
||||
JSProperty *prop;
|
||||
if (!js_LookupElement(cx, obj, index, &obj, &prop))
|
||||
return false;
|
||||
if (!prop) {
|
||||
*attrsp = 0;
|
||||
return true;
|
||||
}
|
||||
if (!obj->isNative())
|
||||
return obj->getElementAttributes(cx, index, attrsp);
|
||||
|
||||
const Shape *shape = (Shape *)prop;
|
||||
*attrsp = shape->attributes();
|
||||
return true;
|
||||
}
|
||||
|
||||
JSBool
|
||||
js_SetNativeAttributes(JSContext *cx, JSObject *obj, Shape *shape, uintN attrs)
|
||||
{
|
||||
|
|
|
@ -286,6 +286,9 @@ js_SetPropertyHelper(JSContext *cx, JSObject *obj, jsid id, uintN defineHow,
|
|||
extern JSBool
|
||||
js_GetAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp);
|
||||
|
||||
extern JSBool
|
||||
js_GetElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp);
|
||||
|
||||
extern JSBool
|
||||
js_SetAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp);
|
||||
|
||||
|
@ -1426,7 +1429,10 @@ struct JSObject : js::gc::Cell {
|
|||
return (op ? op : js_GetAttributes)(cx, this, id, attrsp);
|
||||
}
|
||||
|
||||
inline JSBool getElementAttributes(JSContext *cx, uint32 index, uintN *attrsp);
|
||||
JSBool getElementAttributes(JSContext *cx, uint32 index, uintN *attrsp) {
|
||||
js::ElementAttributesOp op = getOps()->getElementAttributes;
|
||||
return (op ? op : js_GetElementAttributes)(cx, this, index, attrsp);
|
||||
}
|
||||
|
||||
inline JSBool setAttributes(JSContext *cx, jsid id, uintN *attrsp);
|
||||
|
||||
|
|
|
@ -1137,15 +1137,6 @@ JSObject::setElement(JSContext *cx, uint32 index, js::Value *vp, JSBool strict)
|
|||
return setProperty(cx, id, vp, strict);
|
||||
}
|
||||
|
||||
inline JSBool
|
||||
JSObject::getElementAttributes(JSContext *cx, uint32 index, uintN *attrsp)
|
||||
{
|
||||
jsid id;
|
||||
if (!js::IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return getAttributes(cx, id, attrsp);
|
||||
}
|
||||
|
||||
inline JSBool
|
||||
JSObject::setElementAttributes(JSContext *cx, uint32 index, uintN *attrsp)
|
||||
{
|
||||
|
|
|
@ -437,10 +437,10 @@ ArrayBuffer::obj_getAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *att
|
|||
JSBool
|
||||
ArrayBuffer::obj_getElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp)
|
||||
{
|
||||
jsid id;
|
||||
if (!IndexToId(cx, index, &id))
|
||||
JSObject *delegate = DelegateObject(cx, obj);
|
||||
if (!delegate)
|
||||
return false;
|
||||
return obj_getAttributes(cx, obj, id, attrsp);
|
||||
return js_GetElementAttributes(cx, delegate, index, attrsp);
|
||||
}
|
||||
|
||||
JSBool
|
||||
|
@ -660,10 +660,8 @@ TypedArray::obj_getAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attr
|
|||
JSBool
|
||||
TypedArray::obj_getElementAttributes(JSContext *cx, JSObject *obj, uint32 index, uintN *attrsp)
|
||||
{
|
||||
jsid id;
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return obj_getAttributes(cx, obj, id, attrsp);
|
||||
*attrsp = JSPROP_PERMANENT | JSPROP_ENUMERATE;
|
||||
return true;
|
||||
}
|
||||
|
||||
JSBool
|
||||
|
|
Загрузка…
Ссылка в новой задаче