Bug 692978 - Split lookupProperty into property and generic forms, and use them throughout the engine. r=bhackett

This commit is contained in:
Jeff Walden
2011-10-08 15:45:04 -07:00
parent 922b18ac85
commit 8b54fc3ddd
20 changed files with 201 additions and 140 deletions

View File

@@ -390,7 +390,7 @@ GetElement(JSContext *cx, JSObject *obj, jsdouble index, JSBool *hole, Value *vp
JSObject *obj2;
JSProperty *prop;
if (!obj->lookupProperty(cx, idr.id(), &obj2, &prop))
if (!obj->lookupGeneric(cx, idr.id(), &obj2, &prop))
return JS_FALSE;
if (!prop) {
*hole = JS_TRUE;
@@ -712,8 +712,8 @@ IsDenseArrayId(JSContext *cx, JSObject *obj, jsid id)
}
static JSBool
array_lookupProperty(JSContext *cx, JSObject *obj, jsid id, JSObject **objp,
JSProperty **propp)
array_lookupGeneric(JSContext *cx, JSObject *obj, jsid id, JSObject **objp,
JSProperty **propp)
{
if (!obj->isDenseArray())
return js_LookupProperty(cx, obj, id, objp, propp);
@@ -730,7 +730,14 @@ array_lookupProperty(JSContext *cx, JSObject *obj, jsid id, JSObject **objp,
*propp = NULL;
return JS_TRUE;
}
return proto->lookupProperty(cx, id, objp, propp);
return proto->lookupGeneric(cx, id, objp, propp);
}
static JSBool
array_lookupProperty(JSContext *cx, JSObject *obj, PropertyName *name, JSObject **objp,
JSProperty **propp)
{
return array_lookupGeneric(cx, obj, ATOM_TO_JSID(name), objp, propp);
}
static JSBool
@@ -758,7 +765,7 @@ static JSBool
array_lookupSpecial(JSContext *cx, JSObject *obj, SpecialId sid, JSObject **objp,
JSProperty **propp)
{
return array_lookupProperty(cx, obj, SPECIALID_TO_JSID(sid), objp, propp);
return array_lookupGeneric(cx, obj, SPECIALID_TO_JSID(sid), objp, propp);
}
JSBool
@@ -1226,7 +1233,7 @@ Class js::ArrayClass = {
array_trace, /* trace */
JS_NULL_CLASS_EXT,
{
array_lookupProperty,
array_lookupGeneric,
array_lookupProperty,
array_lookupElement,
array_lookupSpecial,