Bug 687621 - Convert getProperty to take a PropertyName*, and make getGeneric the only way to get a property for a jsid. r=luke

This commit is contained in:
Jeff Walden 2011-09-15 11:44:10 -07:00
parent 943ff8aaf5
commit 2cd9f2fb48
25 changed files with 277 additions and 224 deletions

View File

@ -2998,7 +2998,7 @@ JS_GetConstructor(JSContext *cx, JSObject *proto)
{
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED);
if (!proto->getProperty(cx, ATOM_TO_JSID(cx->runtime->atomState.constructorAtom), &cval))
if (!proto->getProperty(cx, cx->runtime->atomState.constructorAtom, &cval))
return NULL;
}
JSObject *funobj;
@ -3734,7 +3734,7 @@ JS_GetPropertyById(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
CHECK_REQUEST(cx);
assertSameCompartment(cx, obj, id);
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED);
return obj->getProperty(cx, id, vp);
return obj->getGeneric(cx, id, vp);
}
JS_PUBLIC_API(JSBool)
@ -4271,7 +4271,7 @@ JS_CloneFunctionObject(JSContext *cx, JSObject *funobj, JSObject *parent)
}
Value v;
if (!obj->getProperty(cx, r.front().propid, &v))
if (!obj->getGeneric(cx, r.front().propid, &v))
return NULL;
clone->getFlatClosureUpvars()[i] = v;
}

View File

@ -163,7 +163,7 @@ js_GetLengthProperty(JSContext *cx, JSObject *obj, jsuint *lengthp)
}
AutoValueRooter tvr(cx);
if (!obj->getProperty(cx, ATOM_TO_JSID(cx->runtime->atomState.lengthAtom), tvr.addr()))
if (!obj->getProperty(cx, cx->runtime->atomState.lengthAtom, tvr.addr()))
return false;
if (tvr.value().isInt32()) {
@ -395,7 +395,7 @@ GetElement(JSContext *cx, JSObject *obj, jsdouble index, JSBool *hole, Value *vp
*hole = JS_TRUE;
vp->setUndefined();
} else {
if (!obj->getProperty(cx, idr.id(), vp))
if (!obj->getGeneric(cx, idr.id(), vp))
return JS_FALSE;
*hole = JS_FALSE;
}
@ -776,7 +776,7 @@ js_GetDenseArrayElementValue(JSContext *cx, JSObject *obj, jsid id, Value *vp)
}
static JSBool
array_getProperty(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp)
array_getGeneric(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp)
{
uint32 i;
@ -826,6 +826,12 @@ array_getProperty(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Val
return JS_TRUE;
}
static JSBool
array_getProperty(JSContext *cx, JSObject *obj, JSObject *receiver, PropertyName *name, Value *vp)
{
return array_getGeneric(cx, obj, receiver, ATOM_TO_JSID(name), vp);
}
static JSBool
array_getElement(JSContext *cx, JSObject *obj, JSObject *receiver, uint32 index, Value *vp)
{
@ -866,7 +872,7 @@ array_getElement(JSContext *cx, JSObject *obj, JSObject *receiver, uint32 index,
static JSBool
array_getSpecial(JSContext *cx, JSObject *obj, JSObject *receiver, SpecialId sid, Value *vp)
{
return array_getProperty(cx, obj, receiver, SPECIALID_TO_JSID(sid), vp);
return array_getGeneric(cx, obj, receiver, SPECIALID_TO_JSID(sid), vp);
}
static JSBool
@ -1227,7 +1233,7 @@ Class js::ArrayClass = {
array_defineProperty,
array_defineElement,
array_defineSpecial,
array_getProperty,
array_getGeneric,
array_getProperty,
array_getElement,
array_getSpecial,
@ -1653,7 +1659,7 @@ array_toString(JSContext *cx, uintN argc, Value *vp)
return false;
Value &join = vp[0];
if (!obj->getProperty(cx, ATOM_TO_JSID(cx->runtime->atomState.joinAtom), &join))
if (!obj->getProperty(cx, cx->runtime->atomState.joinAtom, &join))
return false;
if (!js_IsCallable(join)) {

View File

@ -365,10 +365,11 @@ js_InitCommonAtoms(JSContext *cx)
JSAtomState *state = &cx->runtime->atomState;
JSAtom **atoms = state->commonAtomsStart();
for (size_t i = 0; i < JS_ARRAY_LENGTH(js_common_atom_names); i++, atoms++) {
*atoms = js_Atomize(cx, js_common_atom_names[i], strlen(js_common_atom_names[i]),
InternAtom);
if (!*atoms)
JSAtom *atom = js_Atomize(cx, js_common_atom_names[i], strlen(js_common_atom_names[i]),
InternAtom);
if (!atom)
return false;
*atoms = atom->asPropertyName();
}
state->clearLazyAtoms();

View File

@ -206,147 +206,147 @@ struct JSAtomState
/*
* From this point until the end of struct definition the struct must
* contain only JSAtom fields. We use this to access the storage occupied
* by the common atoms in js_FinishCommonAtoms.
* contain only js::PropertyName fields. We use this to access the storage
* occupied by the common atoms in js_FinishCommonAtoms.
*
* js_common_atom_names defined in jsatom.c contains C strings for atoms
* js_common_atom_names defined in jsatom.cpp contains C strings for atoms
* in the order of atom fields here. Therefore you must update that array
* if you change member order here.
*/
/* The rt->emptyString atom, see jsstr.c's js_InitRuntimeStringState. */
JSAtom *emptyAtom;
js::PropertyName *emptyAtom;
/*
* Literal value and type names.
* NB: booleanAtoms must come right before typeAtoms!
*/
JSAtom *booleanAtoms[2];
JSAtom *typeAtoms[JSTYPE_LIMIT];
JSAtom *nullAtom;
js::PropertyName *booleanAtoms[2];
js::PropertyName *typeAtoms[JSTYPE_LIMIT];
js::PropertyName *nullAtom;
/* Standard class constructor or prototype names. */
JSAtom *classAtoms[JSProto_LIMIT];
js::PropertyName *classAtoms[JSProto_LIMIT];
/* Various built-in or commonly-used atoms, pinned on first context. */
JSAtom *anonymousAtom;
JSAtom *applyAtom;
JSAtom *argumentsAtom;
JSAtom *arityAtom;
JSAtom *BYTES_PER_ELEMENTAtom;
JSAtom *callAtom;
JSAtom *calleeAtom;
JSAtom *callerAtom;
JSAtom *classPrototypeAtom;
JSAtom *constructorAtom;
JSAtom *eachAtom;
JSAtom *evalAtom;
JSAtom *fileNameAtom;
JSAtom *getAtom;
JSAtom *globalAtom;
JSAtom *ignoreCaseAtom;
JSAtom *indexAtom;
JSAtom *inputAtom;
JSAtom *toISOStringAtom;
JSAtom *iteratorAtom;
JSAtom *joinAtom;
JSAtom *lastIndexAtom;
JSAtom *lengthAtom;
JSAtom *lineNumberAtom;
JSAtom *messageAtom;
JSAtom *multilineAtom;
JSAtom *nameAtom;
JSAtom *nextAtom;
JSAtom *noSuchMethodAtom;
JSAtom *objectNullAtom;
JSAtom *objectUndefinedAtom;
JSAtom *protoAtom;
JSAtom *setAtom;
JSAtom *sourceAtom;
JSAtom *stackAtom;
JSAtom *stickyAtom;
JSAtom *toGMTStringAtom;
JSAtom *toLocaleStringAtom;
JSAtom *toSourceAtom;
JSAtom *toStringAtom;
JSAtom *toUTCStringAtom;
JSAtom *valueOfAtom;
JSAtom *toJSONAtom;
JSAtom *void0Atom;
JSAtom *enumerableAtom;
JSAtom *configurableAtom;
JSAtom *writableAtom;
JSAtom *valueAtom;
JSAtom *testAtom;
JSAtom *useStrictAtom;
JSAtom *locAtom;
JSAtom *lineAtom;
JSAtom *InfinityAtom;
JSAtom *NaNAtom;
JSAtom *builderAtom;
js::PropertyName *anonymousAtom;
js::PropertyName *applyAtom;
js::PropertyName *argumentsAtom;
js::PropertyName *arityAtom;
js::PropertyName *BYTES_PER_ELEMENTAtom;
js::PropertyName *callAtom;
js::PropertyName *calleeAtom;
js::PropertyName *callerAtom;
js::PropertyName *classPrototypeAtom;
js::PropertyName *constructorAtom;
js::PropertyName *eachAtom;
js::PropertyName *evalAtom;
js::PropertyName *fileNameAtom;
js::PropertyName *getAtom;
js::PropertyName *globalAtom;
js::PropertyName *ignoreCaseAtom;
js::PropertyName *indexAtom;
js::PropertyName *inputAtom;
js::PropertyName *toISOStringAtom;
js::PropertyName *iteratorAtom;
js::PropertyName *joinAtom;
js::PropertyName *lastIndexAtom;
js::PropertyName *lengthAtom;
js::PropertyName *lineNumberAtom;
js::PropertyName *messageAtom;
js::PropertyName *multilineAtom;
js::PropertyName *nameAtom;
js::PropertyName *nextAtom;
js::PropertyName *noSuchMethodAtom;
js::PropertyName *objectNullAtom;
js::PropertyName *objectUndefinedAtom;
js::PropertyName *protoAtom;
js::PropertyName *setAtom;
js::PropertyName *sourceAtom;
js::PropertyName *stackAtom;
js::PropertyName *stickyAtom;
js::PropertyName *toGMTStringAtom;
js::PropertyName *toLocaleStringAtom;
js::PropertyName *toSourceAtom;
js::PropertyName *toStringAtom;
js::PropertyName *toUTCStringAtom;
js::PropertyName *valueOfAtom;
js::PropertyName *toJSONAtom;
js::PropertyName *void0Atom;
js::PropertyName *enumerableAtom;
js::PropertyName *configurableAtom;
js::PropertyName *writableAtom;
js::PropertyName *valueAtom;
js::PropertyName *testAtom;
js::PropertyName *useStrictAtom;
js::PropertyName *locAtom;
js::PropertyName *lineAtom;
js::PropertyName *InfinityAtom;
js::PropertyName *NaNAtom;
js::PropertyName *builderAtom;
#if JS_HAS_XML_SUPPORT
JSAtom *etagoAtom;
JSAtom *namespaceAtom;
JSAtom *ptagcAtom;
JSAtom *qualifierAtom;
JSAtom *spaceAtom;
JSAtom *stagoAtom;
JSAtom *starAtom;
JSAtom *starQualifierAtom;
JSAtom *tagcAtom;
JSAtom *xmlAtom;
js::PropertyName *etagoAtom;
js::PropertyName *namespaceAtom;
js::PropertyName *ptagcAtom;
js::PropertyName *qualifierAtom;
js::PropertyName *spaceAtom;
js::PropertyName *stagoAtom;
js::PropertyName *starAtom;
js::PropertyName *starQualifierAtom;
js::PropertyName *tagcAtom;
js::PropertyName *xmlAtom;
/* Represents an invalid URI, for internal use only. */
JSAtom *functionNamespaceURIAtom;
js::PropertyName *functionNamespaceURIAtom;
#endif
JSAtom *ProxyAtom;
js::PropertyName *ProxyAtom;
JSAtom *getOwnPropertyDescriptorAtom;
JSAtom *getPropertyDescriptorAtom;
JSAtom *definePropertyAtom;
JSAtom *deleteAtom;
JSAtom *getOwnPropertyNamesAtom;
JSAtom *enumerateAtom;
JSAtom *fixAtom;
js::PropertyName *getOwnPropertyDescriptorAtom;
js::PropertyName *getPropertyDescriptorAtom;
js::PropertyName *definePropertyAtom;
js::PropertyName *deleteAtom;
js::PropertyName *getOwnPropertyNamesAtom;
js::PropertyName *enumerateAtom;
js::PropertyName *fixAtom;
JSAtom *hasAtom;
JSAtom *hasOwnAtom;
JSAtom *keysAtom;
JSAtom *iterateAtom;
js::PropertyName *hasAtom;
js::PropertyName *hasOwnAtom;
js::PropertyName *keysAtom;
js::PropertyName *iterateAtom;
JSAtom *WeakMapAtom;
js::PropertyName *WeakMapAtom;
JSAtom *byteLengthAtom;
js::PropertyName *byteLengthAtom;
JSAtom *returnAtom;
JSAtom *throwAtom;
js::PropertyName *returnAtom;
js::PropertyName *throwAtom;
/* Less frequently used atoms, pinned lazily by JS_ResolveStandardClass. */
struct {
JSAtom *XMLListAtom;
JSAtom *decodeURIAtom;
JSAtom *decodeURIComponentAtom;
JSAtom *defineGetterAtom;
JSAtom *defineSetterAtom;
JSAtom *encodeURIAtom;
JSAtom *encodeURIComponentAtom;
JSAtom *escapeAtom;
JSAtom *hasOwnPropertyAtom;
JSAtom *isFiniteAtom;
JSAtom *isNaNAtom;
JSAtom *isPrototypeOfAtom;
JSAtom *isXMLNameAtom;
JSAtom *lookupGetterAtom;
JSAtom *lookupSetterAtom;
JSAtom *parseFloatAtom;
JSAtom *parseIntAtom;
JSAtom *propertyIsEnumerableAtom;
JSAtom *unescapeAtom;
JSAtom *unevalAtom;
JSAtom *unwatchAtom;
JSAtom *watchAtom;
js::PropertyName *XMLListAtom;
js::PropertyName *decodeURIAtom;
js::PropertyName *decodeURIComponentAtom;
js::PropertyName *defineGetterAtom;
js::PropertyName *defineSetterAtom;
js::PropertyName *encodeURIAtom;
js::PropertyName *encodeURIComponentAtom;
js::PropertyName *escapeAtom;
js::PropertyName *hasOwnPropertyAtom;
js::PropertyName *isFiniteAtom;
js::PropertyName *isNaNAtom;
js::PropertyName *isPrototypeOfAtom;
js::PropertyName *isXMLNameAtom;
js::PropertyName *lookupGetterAtom;
js::PropertyName *lookupSetterAtom;
js::PropertyName *parseFloatAtom;
js::PropertyName *parseIntAtom;
js::PropertyName *propertyIsEnumerableAtom;
js::PropertyName *unescapeAtom;
js::PropertyName *unevalAtom;
js::PropertyName *unwatchAtom;
js::PropertyName *watchAtom;
} lazy;
static const size_t commonAtomsOffset;
@ -363,7 +363,7 @@ struct JSAtomState
}
JSAtom **commonAtomsStart() {
return &emptyAtom;
return reinterpret_cast<JSAtom **>(&emptyAtom);
}
void checkStaticInvariants();

View File

@ -51,6 +51,7 @@
namespace js {
class AutoIdVector;
class PropertyName;
class SpecialId;
static JS_ALWAYS_INLINE jsid
@ -201,7 +202,7 @@ typedef JSBool
typedef JSBool
(* GenericIdOp)(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp);
typedef JSBool
(* PropertyIdOp)(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp);
(* PropertyIdOp)(JSContext *cx, JSObject *obj, JSObject *receiver, PropertyName *name, Value *vp);
typedef JSBool
(* ElementIdOp)(JSContext *cx, JSObject *obj, JSObject *receiver, uint32 index, Value *vp);
typedef JSBool

View File

@ -583,7 +583,7 @@ JSStructuredCloneWriter::write(const Value &v)
if (prop) {
Value val;
if (!writeId(id) ||
!obj->getProperty(context(), id, &val) ||
!obj->getGeneric(context(), id, &val) ||
!startWrite(val))
return false;
}

View File

@ -2106,7 +2106,7 @@ date_toJSON(JSContext *cx, uintN argc, Value *vp)
/* Step 4. */
Value &toISO = vp[0];
if (!obj->getProperty(cx, ATOM_TO_JSID(cx->runtime->atomState.toISOStringAtom), &toISO))
if (!obj->getProperty(cx, cx->runtime->atomState.toISOStringAtom, &toISO))
return false;
/* Step 5. */

View File

@ -711,8 +711,7 @@ Exception(JSContext *cx, uintN argc, Value *vp)
* class prototype ourselves.
*/
Value protov;
jsid protoAtom = ATOM_TO_JSID(cx->runtime->atomState.classPrototypeAtom);
if (!args.callee().getProperty(cx, protoAtom, &protov))
if (!args.callee().getProperty(cx, cx->runtime->atomState.classPrototypeAtom, &protov))
return false;
if (!protov.isObject()) {
@ -793,7 +792,7 @@ exn_toString(JSContext *cx, uintN argc, Value *vp)
JSObject *obj = ToObject(cx, &vp[1]);
if (!obj)
return JS_FALSE;
if (!obj->getProperty(cx, ATOM_TO_JSID(cx->runtime->atomState.nameAtom), &v))
if (!obj->getProperty(cx, cx->runtime->atomState.nameAtom, &v))
return JS_FALSE;
name = JSVAL_IS_STRING(v) ? JSVAL_TO_STRING(v) : cx->runtime->emptyString;
vp->setString(name);
@ -854,7 +853,7 @@ exn_toSource(JSContext *cx, uintN argc, Value *vp)
JSObject *obj = ToObject(cx, &vp[1]);
if (!obj)
return false;
if (!obj->getProperty(cx, ATOM_TO_JSID(cx->runtime->atomState.nameAtom), vp))
if (!obj->getProperty(cx, cx->runtime->atomState.nameAtom, vp))
return false;
name = js_ValueToString(cx, *vp);
if (!name)

View File

@ -112,8 +112,7 @@ js_GetArgsValue(JSContext *cx, StackFrame *fp, Value *vp)
JSObject *argsobj;
if (fp->hasOverriddenArgs()) {
JS_ASSERT(fp->hasCallObj());
jsid id = ATOM_TO_JSID(cx->runtime->atomState.argumentsAtom);
return fp->callObj().getProperty(cx, id, vp);
return fp->callObj().getProperty(cx, cx->runtime->atomState.argumentsAtom, vp);
}
argsobj = js_GetArgsObject(cx, fp);
if (!argsobj)
@ -130,9 +129,8 @@ js_GetArgsProperty(JSContext *cx, StackFrame *fp, jsid id, Value *vp)
if (fp->hasOverriddenArgs()) {
JS_ASSERT(fp->hasCallObj());
jsid argumentsid = ATOM_TO_JSID(cx->runtime->atomState.argumentsAtom);
Value v;
if (!fp->callObj().getProperty(cx, argumentsid, &v))
if (!fp->callObj().getProperty(cx, cx->runtime->atomState.argumentsAtom, &v))
return false;
JSObject *obj;
@ -143,7 +141,7 @@ js_GetArgsProperty(JSContext *cx, StackFrame *fp, jsid id, Value *vp)
} else {
obj = &v.toObject();
}
return obj->getProperty(cx, id, vp);
return obj->getGeneric(cx, id, vp);
}
vp->setUndefined();
@ -154,7 +152,7 @@ js_GetArgsProperty(JSContext *cx, StackFrame *fp, jsid id, Value *vp)
if (argsobj) {
const Value &v = argsobj->element(arg);
if (v.isMagic(JS_ARGS_HOLE))
return argsobj->getProperty(cx, id, vp);
return argsobj->getGeneric(cx, id, vp);
if (fp->functionScript()->strictModeCode) {
*vp = v;
return true;
@ -175,12 +173,12 @@ js_GetArgsProperty(JSContext *cx, StackFrame *fp, jsid id, Value *vp)
* undefined in *vp.
*/
if (argsobj)
return argsobj->getProperty(cx, id, vp);
return argsobj->getGeneric(cx, id, vp);
}
} else if (JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom)) {
ArgumentsObject *argsobj = fp->maybeArgsObj();
if (argsobj && argsobj->hasOverriddenLength())
return argsobj->getProperty(cx, id, vp);
return argsobj->getGeneric(cx, id, vp);
vp->setInt32(fp->numActualArgs());
}
return true;
@ -1634,9 +1632,8 @@ fun_hasInstance(JSContext *cx, JSObject *obj, const Value *v, JSBool *bp)
obj = obj->getBoundFunctionTarget();
}
jsid id = ATOM_TO_JSID(cx->runtime->atomState.classPrototypeAtom);
Value pval;
if (!obj->getProperty(cx, id, &pval))
if (!obj->getProperty(cx, cx->runtime->atomState.classPrototypeAtom, &pval))
return JS_FALSE;
if (pval.isPrimitive()) {

View File

@ -901,7 +901,7 @@ js::CheckRedeclaration(JSContext *cx, JSObject *obj, jsid id, uintN attrs)
isFunction = (oldAttrs & (JSPROP_GETTER | JSPROP_SETTER)) != 0;
if (!isFunction) {
Value value;
if (!obj->getProperty(cx, id, &value))
if (!obj->getGeneric(cx, id, &value))
return JS_FALSE;
isFunction = IsFunctionObject(value);
}
@ -3345,7 +3345,7 @@ do_incop:
* we have done with obj->setProperty.
*/
PUSH_NULL();
if (!obj->getProperty(cx, id, &regs.sp[-1]))
if (!obj->getGeneric(cx, id, &regs.sp[-1]))
goto error;
const JSCodeSpec *cs = &js_CodeSpec[op];
@ -3562,7 +3562,8 @@ BEGIN_CASE(JSOP_LENGTH)
? JSGET_CACHE_RESULT | JSGET_NO_METHOD_BARRIER
: JSGET_CACHE_RESULT | JSGET_METHOD_BARRIER,
&rval)
: !obj->getProperty(cx, id, &rval)) {
: !obj->getGeneric(cx, id, &rval))
{
goto error;
}
} while (0);
@ -3904,7 +3905,7 @@ BEGIN_CASE(JSOP_GETELEM)
if (JSID_IS_STRING(id) && script->hasAnalysis() && !regs.fp()->hasImacropc())
script->analysis()->getCode(regs.pc).getStringElement = true;
if (!obj->getProperty(cx, id, &rval))
if (!obj->getGeneric(cx, id, &rval))
goto error;
copyFrom = &rval;
@ -4165,7 +4166,7 @@ BEGIN_CASE(JSOP_CALLNAME)
/* Take the slow path if prop was not found in a native object. */
if (!obj->isNative() || !obj2->isNative()) {
if (!obj->getProperty(cx, id, &rval))
if (!obj->getGeneric(cx, id, &rval))
goto error;
} else {
shape = (Shape *)prop;
@ -5292,7 +5293,7 @@ BEGIN_CASE(JSOP_USESHARP)
} else {
JSObject *obj = &regs.fp()->slots()[slot].toObject();
jsid id = INT_TO_JSID(i);
if (!obj->getProperty(cx, id, &rval))
if (!obj->getGeneric(cx, id, &rval))
goto error;
}
if (!rval.isObjectOrNull()) {
@ -5619,7 +5620,7 @@ BEGIN_CASE(JSOP_XMLNAME)
if (!js_FindXMLProperty(cx, lval, &obj, &id))
goto error;
Value rval;
if (!obj->getProperty(cx, id, &rval))
if (!obj->getGeneric(cx, id, &rval))
goto error;
regs.sp[-1] = rval;
if (op == JSOP_CALLXMLNAME)

View File

@ -992,7 +992,7 @@ js_IteratorMore(JSContext *cx, JSObject *iterobj, Value *rval)
JS_ASSERT(!ni->isKeyIter());
jsid id = *ni->current();
ni->incCursor();
if (!ni->obj->getProperty(cx, id, rval))
if (!ni->obj->getGeneric(cx, id, rval))
return false;
if ((ni->flags & JSITER_KEYVALUE) && !NewKeyValuePair(cx, id, *rval, rval))
return false;

View File

@ -282,7 +282,7 @@ MarkSharpObjects(JSContext *cx, JSObject *obj, JSIdArray **idap)
}
v.set(setter.value());
} else if (!hasGetter) {
ok = obj->getProperty(cx, id, v.addr());
ok = obj->getGeneric(cx, id, v.addr());
if (!ok)
break;
}
@ -626,7 +626,7 @@ obj_toSource(JSContext *cx, uintN argc, Value *vp)
if (doGet) {
valcnt = 1;
gsop[0] = NULL;
ok = obj->getProperty(cx, id, &val[0]);
ok = obj->getGeneric(cx, id, &val[0]);
if (!ok)
goto error;
}
@ -1864,7 +1864,7 @@ GetOwnPropertyDescriptor(JSContext *cx, JSObject *obj, jsid id, PropertyDescript
return false;
}
if (doGet && !obj->getProperty(cx, id, &desc->value))
if (doGet && !obj->getGeneric(cx, id, &desc->value))
return false;
desc->obj = obj;
@ -1970,7 +1970,7 @@ HasProperty(JSContext* cx, JSObject* obj, jsid id, Value* vp, bool *foundp)
* identity will be used by DefinePropertyOnObject, e.g., or reflected via
* js::GetOwnPropertyDescriptor, as the getter or setter callable object.
*/
return !!obj->getProperty(cx, id, vp);
return !!obj->getGeneric(cx, id, vp);
}
PropDesc::PropDesc()
@ -2543,7 +2543,7 @@ ReadPropertyDescriptors(JSContext *cx, JSObject *props, bool checkAccessors,
jsid id = (*ids)[i];
PropDesc* desc = descs->append();
Value v;
if (!desc || !props->getProperty(cx, id, &v) || !desc->initialize(cx, v, checkAccessors))
if (!desc || !props->getGeneric(cx, id, &v) || !desc->initialize(cx, v, checkAccessors))
return false;
}
return true;
@ -2982,7 +2982,7 @@ js_CreateThis(JSContext *cx, JSObject *callee)
}
Value protov;
if (!callee->getProperty(cx, ATOM_TO_JSID(cx->runtime->atomState.classPrototypeAtom), &protov))
if (!callee->getProperty(cx, cx->runtime->atomState.classPrototypeAtom, &protov))
return NULL;
JSObject *proto = protov.isObjectOrNull() ? protov.toObjectOrNull() : NULL;
@ -3039,11 +3039,8 @@ JSObject *
js_CreateThisForFunction(JSContext *cx, JSObject *callee, bool newType)
{
Value protov;
if (!callee->getProperty(cx,
ATOM_TO_JSID(cx->runtime->atomState.classPrototypeAtom),
&protov)) {
if (!callee->getProperty(cx, cx->runtime->atomState.classPrototypeAtom, &protov))
return NULL;
}
JSObject *proto;
if (protov.isObject())
proto = &protov.toObject();
@ -3284,9 +3281,15 @@ with_LookupSpecial(JSContext *cx, JSObject *obj, SpecialId sid, JSObject **objp,
}
static JSBool
with_GetProperty(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp)
with_GetGeneric(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp)
{
return obj->getProto()->getProperty(cx, id, vp);
return obj->getProto()->getGeneric(cx, id, vp);
}
static JSBool
with_GetProperty(JSContext *cx, JSObject *obj, JSObject *receiver, PropertyName *name, Value *vp)
{
return with_GetGeneric(cx, obj, receiver, ATOM_TO_JSID(name), vp);
}
static JSBool
@ -3295,13 +3298,13 @@ with_GetElement(JSContext *cx, JSObject *obj, JSObject *receiver, uint32 index,
jsid id;
if (!IndexToId(cx, index, &id))
return false;
return with_GetProperty(cx, obj, receiver, id, vp);
return with_GetGeneric(cx, obj, receiver, id, vp);
}
static JSBool
with_GetSpecial(JSContext *cx, JSObject *obj, JSObject *receiver, SpecialId sid, Value *vp)
{
return with_GetProperty(cx, obj, receiver, SPECIALID_TO_JSID(sid), vp);
return with_GetGeneric(cx, obj, receiver, SPECIALID_TO_JSID(sid), vp);
}
static JSBool
@ -3435,7 +3438,7 @@ Class js::WithClass = {
NULL, /* defineProperty */
NULL, /* defineElement */
NULL, /* defineSpecial */
with_GetProperty,
with_GetGeneric,
with_GetProperty,
with_GetElement,
with_GetSpecial,
@ -4888,10 +4891,8 @@ js_ConstructObject(JSContext *cx, Class *clasp, JSObject *proto, JSObject *paren
parent = ctor->getParent();
if (!proto) {
Value rval;
if (!ctor->getProperty(cx, ATOM_TO_JSID(cx->runtime->atomState.classPrototypeAtom),
&rval)) {
if (!ctor->getProperty(cx, cx->runtime->atomState.classPrototypeAtom, &rval))
return NULL;
}
if (rval.isObjectOrNull())
proto = rval.toObjectOrNull();
}
@ -5905,7 +5906,7 @@ js_GetPropertyHelperInline(JSContext *cx, JSObject *obj, JSObject *receiver, jsi
if (!obj2->isNative()) {
return obj2->isProxy()
? JSProxy::get(cx, obj2, receiver, id, vp)
: obj2->getProperty(cx, id, vp);
: obj2->getGeneric(cx, id, vp);
}
shape = (Shape *) prop;
@ -5967,7 +5968,7 @@ js_GetMethod(JSContext *cx, JSObject *obj, jsid id, uintN getHow, Value *vp)
{
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED);
PropertyIdOp op = obj->getOps()->getProperty;
GenericIdOp op = obj->getOps()->getGeneric;
if (!op) {
#if JS_HAS_XML_SUPPORT
JS_ASSERT(!obj->isXML());
@ -6712,7 +6713,7 @@ js::FindClassPrototype(JSContext *cx, JSObject *scopeobj, JSProtoKey protoKey,
if (IsFunctionObject(v)) {
JSObject *ctor = &v.toObject();
if (!ctor->getProperty(cx, ATOM_TO_JSID(cx->runtime->atomState.classPrototypeAtom), &v))
if (!ctor->getProperty(cx, cx->runtime->atomState.classPrototypeAtom, &v))
return false;
}

View File

@ -59,6 +59,8 @@
#include "jsvector.h"
#include "jscell.h"
#include "vm/String.h"
namespace nanojit { class ValidateWriter; }
namespace js {
@ -1440,12 +1442,16 @@ struct JSObject : js::gc::Cell {
return (op ? op : js_DefineElement)(cx, this, index, &value, getter, setter, attrs);
}
inline JSBool getProperty(JSContext *cx, JSObject *receiver, jsid id, js::Value *vp);
inline JSBool getGeneric(JSContext *cx, JSObject *receiver, jsid id, js::Value *vp);
inline JSBool getProperty(JSContext *cx, JSObject *receiver, js::PropertyName *name,
js::Value *vp);
inline JSBool getElement(JSContext *cx, JSObject *receiver, uint32 index, js::Value *vp);
inline JSBool getSpecial(JSContext *cx, JSObject *receiver, js::SpecialId sid, js::Value *vp);
inline JSBool getProperty(JSContext *cx, jsid id, js::Value *vp);
inline JSBool getGeneric(JSContext *cx, jsid id, js::Value *vp);
inline JSBool getProperty(JSContext *cx, js::PropertyName *name, js::Value *vp);
inline JSBool getElement(JSContext *cx, uint32 index, js::Value *vp);
inline JSBool getSpecial(JSContext *cx, jsid id, js::Value *vp);
inline JSBool getSpecial(JSContext *cx, js::SpecialId sid, js::Value *vp);
JSBool setProperty(JSContext *cx, jsid id, js::Value *vp, JSBool strict) {
if (getOps()->setProperty)

View File

@ -135,9 +135,9 @@ JSObject::setAttributes(JSContext *cx, jsid id, uintN *attrsp)
}
inline JSBool
JSObject::getProperty(JSContext *cx, JSObject *receiver, jsid id, js::Value *vp)
JSObject::getGeneric(JSContext *cx, JSObject *receiver, jsid id, js::Value *vp)
{
js::PropertyIdOp op = getOps()->getProperty;
js::GenericIdOp op = getOps()->getGeneric;
if (op) {
if (!op(cx, this, receiver, id, vp))
return false;
@ -149,9 +149,21 @@ JSObject::getProperty(JSContext *cx, JSObject *receiver, jsid id, js::Value *vp)
}
inline JSBool
JSObject::getProperty(JSContext *cx, jsid id, js::Value *vp)
JSObject::getProperty(JSContext *cx, JSObject *receiver, js::PropertyName *name, js::Value *vp)
{
return getProperty(cx, this, id, vp);
return getGeneric(cx, receiver, ATOM_TO_JSID(name), vp);
}
inline JSBool
JSObject::getGeneric(JSContext *cx, jsid id, js::Value *vp)
{
return getGeneric(cx, this, id, vp);
}
inline JSBool
JSObject::getProperty(JSContext *cx, js::PropertyName *name, js::Value *vp)
{
return getGeneric(cx, ATOM_TO_JSID(name), vp);
}
inline JSBool
@ -1104,7 +1116,7 @@ JSObject::getElement(JSContext *cx, JSObject *receiver, uint32 index, js::Value
jsid id;
if (!js::IndexToId(cx, index, &id))
return false;
return getProperty(cx, receiver, id, vp);
return getGeneric(cx, receiver, id, vp);
}
inline JSBool
@ -1113,7 +1125,7 @@ JSObject::getElement(JSContext *cx, uint32 index, js::Value *vp)
jsid id;
if (!js::IndexToId(cx, index, &id))
return false;
return getProperty(cx, id, vp);
return getGeneric(cx, id, vp);
}
inline JSBool
@ -1126,9 +1138,9 @@ JSObject::deleteElement(JSContext *cx, uint32 index, js::Value *rval, JSBool str
}
inline JSBool
JSObject::getSpecial(JSContext *cx, jsid id, js::Value *vp)
JSObject::getSpecial(JSContext *cx, js::SpecialId sid, js::Value *vp)
{
return getProperty(cx, id, vp);
return getGeneric(cx, SPECIALID_TO_JSID(sid), vp);
}
static inline bool

View File

@ -447,7 +447,7 @@ JO(JSContext *cx, JSObject *obj, StringifyContext *scx)
*/
const jsid &id = propertyList[i];
Value outputValue;
if (!obj->getProperty(cx, id, &outputValue))
if (!obj->getGeneric(cx, id, &outputValue))
return false;
if (!PreprocessValue(cx, obj, id, &outputValue, scx))
return false;
@ -776,7 +776,7 @@ Walk(JSContext *cx, JSObject *holder, jsid name, const Value &reviver, Value *vp
/* Step 1. */
Value val;
if (!holder->getProperty(cx, name, &val))
if (!holder->getGeneric(cx, name, &val))
return false;
/* Step 2. */

View File

@ -320,7 +320,7 @@ GetTrap(JSContext *cx, JSObject *handler, JSAtom *atom, Value *fvalp)
{
JS_CHECK_RECURSION(cx, return false);
return handler->getProperty(cx, ATOM_TO_JSID(atom), fvalp);
return handler->getGeneric(cx, ATOM_TO_JSID(atom), fvalp);
}
static bool
@ -951,26 +951,32 @@ proxy_DefineSpecial(JSContext *cx, JSObject *obj, SpecialId sid, const Value *va
}
static JSBool
proxy_GetProperty(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp)
proxy_GetGeneric(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp)
{
id = js_CheckForStringIndex(id);
return JSProxy::get(cx, obj, receiver, id, vp);
}
static JSBool
proxy_GetProperty(JSContext *cx, JSObject *obj, JSObject *receiver, PropertyName *name, Value *vp)
{
return proxy_GetGeneric(cx, obj, receiver, ATOM_TO_JSID(name), vp);
}
static JSBool
proxy_GetElement(JSContext *cx, JSObject *obj, JSObject *receiver, uint32 index, Value *vp)
{
jsid id;
if (!IndexToId(cx, index, &id))
return false;
return proxy_GetProperty(cx, obj, receiver, id, vp);
return proxy_GetGeneric(cx, obj, receiver, id, vp);
}
static JSBool
proxy_GetSpecial(JSContext *cx, JSObject *obj, JSObject *receiver, SpecialId sid, Value *vp)
{
return proxy_GetProperty(cx, obj, receiver, SPECIALID_TO_JSID(sid), vp);
return proxy_GetGeneric(cx, obj, receiver, SPECIALID_TO_JSID(sid), vp);
}
static JSBool
@ -1173,7 +1179,7 @@ JS_FRIEND_DATA(Class) js::ObjectProxyClass = {
proxy_DefineProperty,
proxy_DefineElement,
proxy_DefineSpecial,
proxy_GetProperty,
proxy_GetGeneric,
proxy_GetProperty,
proxy_GetElement,
proxy_GetSpecial,
@ -1234,7 +1240,7 @@ JS_FRIEND_DATA(Class) js::OuterWindowProxyClass = {
proxy_DefineProperty,
proxy_DefineElement,
proxy_DefineSpecial,
proxy_GetProperty,
proxy_GetGeneric,
proxy_GetProperty,
proxy_GetElement,
proxy_GetSpecial,
@ -1307,7 +1313,7 @@ JS_FRIEND_DATA(Class) js::FunctionProxyClass = {
proxy_DefineProperty,
proxy_DefineElement,
proxy_DefineSpecial,
proxy_GetProperty,
proxy_GetGeneric,
proxy_GetProperty,
proxy_GetElement,
proxy_GetSpecial,
@ -1523,7 +1529,7 @@ callable_Construct(JSContext *cx, uintN argc, Value *vp)
/* callable is the constructor, so get callable.prototype is the proto of the new object. */
Value protov;
if (!callable->getProperty(cx, ATOM_TO_JSID(ATOM(classPrototype)), &protov))
if (!callable->getProperty(cx, ATOM(classPrototype), &protov))
return false;
JSObject *proto;

View File

@ -11060,7 +11060,7 @@ TraceRecorder::getClassPrototype(JSObject* ctor, LIns*& proto_ins)
#endif
Value pval;
if (!ctor->getProperty(cx, ATOM_TO_JSID(cx->runtime->atomState.classPrototypeAtom), &pval))
if (!ctor->getProperty(cx, cx->runtime->atomState.classPrototypeAtom, &pval))
RETURN_ERROR("error getting prototype from constructor");
/*
@ -12617,7 +12617,7 @@ GetPropertyByName(JSContext* cx, JSObject* obj, JSString** namep, Value* vp)
LeaveTraceIfGlobalObject(cx, obj);
jsid id;
if (!RootedStringToId(cx, namep, &id) || !obj->getProperty(cx, id, vp)) {
if (!RootedStringToId(cx, namep, &id) || !obj->getGeneric(cx, id, vp)) {
SetBuiltinError(tm);
return false;
}
@ -12689,7 +12689,7 @@ GetPropertyByIndex(JSContext* cx, JSObject* obj, int32 index, Value* vp)
LeaveTraceIfGlobalObject(cx, obj);
AutoIdRooter idr(cx);
if (!js_Int32ToId(cx, index, idr.addr()) || !obj->getProperty(cx, idr.id(), vp)) {
if (!js_Int32ToId(cx, index, idr.addr()) || !obj->getGeneric(cx, idr.id(), vp)) {
SetBuiltinError(tm);
return JS_FALSE;
}
@ -12719,7 +12719,7 @@ GetPropertyById(JSContext* cx, JSObject* obj, jsid id, Value* vp)
TraceMonitor *tm = JS_TRACE_MONITOR_ON_TRACE(cx);
LeaveTraceIfGlobalObject(cx, obj);
if (!obj->getProperty(cx, id, vp)) {
if (!obj->getGeneric(cx, id, vp)) {
SetBuiltinError(tm);
return JS_FALSE;
}

View File

@ -348,7 +348,7 @@ ArrayBuffer::obj_defineSpecial(JSContext *cx, JSObject *obj, SpecialId sid, cons
}
JSBool
ArrayBuffer::obj_getProperty(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp)
ArrayBuffer::obj_getGeneric(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp)
{
obj = getArrayBuffer(obj);
if (JSID_IS_ATOM(id, cx->runtime->atomState.byteLengthAtom)) {
@ -362,6 +362,13 @@ ArrayBuffer::obj_getProperty(JSContext *cx, JSObject *obj, JSObject *receiver, j
return js_GetProperty(cx, delegate, receiver, id, vp);
}
JSBool
ArrayBuffer::obj_getProperty(JSContext *cx, JSObject *obj, JSObject *receiver, PropertyName *name,
Value *vp)
{
return obj_getGeneric(cx, obj, receiver, ATOM_TO_JSID(name), vp);
}
JSBool
ArrayBuffer::obj_getElement(JSContext *cx, JSObject *obj, JSObject *receiver, uint32 index, Value *vp)
{
@ -374,7 +381,7 @@ ArrayBuffer::obj_getElement(JSContext *cx, JSObject *obj, JSObject *receiver, ui
JSBool
ArrayBuffer::obj_getSpecial(JSContext *cx, JSObject *obj, JSObject *receiver, SpecialId sid, Value *vp)
{
return obj_getProperty(cx, obj, receiver, SPECIALID_TO_JSID(sid), vp);
return obj_getGeneric(cx, obj, receiver, SPECIALID_TO_JSID(sid), vp);
}
JSBool
@ -924,7 +931,7 @@ class TypedArrayTemplate
}
static JSBool
obj_getProperty(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp)
obj_getGeneric(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp)
{
JSObject *tarray = getTypedArray(obj);
@ -964,6 +971,13 @@ class TypedArrayTemplate
return true;
}
static JSBool
obj_getProperty(JSContext *cx, JSObject *obj, JSObject *receiver, PropertyName *name,
Value *vp)
{
return obj_getGeneric(cx, obj, receiver, ATOM_TO_JSID(name), vp);
}
static JSBool
obj_getElement(JSContext *cx, JSObject *obj, JSObject *receiver, uint32 index, Value *vp)
{
@ -1002,7 +1016,7 @@ class TypedArrayTemplate
static JSBool
obj_getSpecial(JSContext *cx, JSObject *obj, JSObject *receiver, SpecialId sid, Value *vp)
{
return obj_getProperty(cx, obj, receiver, SPECIALID_TO_JSID(sid), vp);
return obj_getGeneric(cx, obj, receiver, SPECIALID_TO_JSID(sid), vp);
}
static bool
@ -2017,7 +2031,7 @@ Class js::ArrayBufferClass = {
ArrayBuffer::obj_defineProperty,
ArrayBuffer::obj_defineElement,
ArrayBuffer::obj_defineSpecial,
ArrayBuffer::obj_getProperty,
ArrayBuffer::obj_getGeneric,
ArrayBuffer::obj_getProperty,
ArrayBuffer::obj_getElement,
ArrayBuffer::obj_getSpecial,
@ -2129,7 +2143,7 @@ JSFunctionSpec _typedArray::jsfuncs[] = { \
_typedArray::obj_defineProperty, \
_typedArray::obj_defineElement, \
_typedArray::obj_defineSpecial, \
_typedArray::obj_getProperty, \
_typedArray::obj_getGeneric, \
_typedArray::obj_getProperty, \
_typedArray::obj_getElement, \
_typedArray::obj_getSpecial, \

View File

@ -99,7 +99,11 @@ struct JS_FRIEND_API(ArrayBuffer) {
PropertyOp getter, StrictPropertyOp setter, uintN attrs);
static JSBool
obj_getProperty(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp);
obj_getGeneric(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp);
static JSBool
obj_getProperty(JSContext *cx, JSObject *obj, JSObject *receiver, PropertyName *name,
Value *vp);
static JSBool
obj_getElement(JSContext *cx, JSObject *obj, JSObject *receiver, uint32 index, Value *vp);

View File

@ -234,7 +234,7 @@ bool
JSWrapper::get(JSContext *cx, JSObject *wrapper, JSObject *receiver, jsid id, Value *vp)
{
vp->setUndefined(); // default result if we refuse to perform this action
GET(wrappedObject(wrapper)->getProperty(cx, receiver, id, vp));
GET(wrappedObject(wrapper)->getGeneric(cx, receiver, id, vp));
}
bool

View File

@ -4791,7 +4791,7 @@ xml_defineSpecial(JSContext *cx, JSObject *obj, SpecialId sid, const Value *v,
}
static JSBool
xml_getProperty(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp)
xml_getGeneric(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp)
{
if (JSID_IS_DEFAULT_XML_NAMESPACE(id)) {
vp->setUndefined();
@ -4801,19 +4801,25 @@ xml_getProperty(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value
return GetProperty(cx, obj, id, vp);
}
static JSBool
xml_getProperty(JSContext *cx, JSObject *obj, JSObject *receiver, PropertyName *name, Value *vp)
{
return xml_getGeneric(cx, obj, receiver, ATOM_TO_JSID(name), vp);
}
static JSBool
xml_getElement(JSContext *cx, JSObject *obj, JSObject *receiver, uint32 index, Value *vp)
{
jsid id;
if (!IndexToId(cx, index, &id))
return false;
return xml_getProperty(cx, obj, receiver, id, vp);
return xml_getGeneric(cx, obj, receiver, id, vp);
}
static JSBool
xml_getSpecial(JSContext *cx, JSObject *obj, JSObject *receiver, SpecialId sid, Value *vp)
{
return xml_getProperty(cx, obj, receiver, SPECIALID_TO_JSID(sid), vp);
return xml_getGeneric(cx, obj, receiver, SPECIALID_TO_JSID(sid), vp);
}
static JSBool
@ -5283,7 +5289,7 @@ JS_FRIEND_DATA(Class) js::XMLClass = {
xml_defineProperty,
xml_defineElement,
xml_defineSpecial,
xml_getProperty,
xml_getGeneric,
xml_getProperty,
xml_getElement,
xml_getSpecial,
@ -7457,7 +7463,7 @@ js_GetDefaultXMLNamespace(JSContext *cx, jsval *vp)
Class *clasp = tmp->getClass();
if (clasp == &BlockClass || clasp == &WithClass)
continue;
if (!tmp->getProperty(cx, JS_DEFAULT_XML_NAMESPACE_ID, &v))
if (!tmp->getSpecial(cx, SpecialId::defaultXMLNamespace(), &v))
return JS_FALSE;
if (!JSVAL_IS_PRIMITIVE(v)) {
*vp = v;
@ -7690,7 +7696,7 @@ GetXMLFunction(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
return false;
JS_ASSERT(tvr.object());
return tvr.object()->getProperty(cx, id, vp);
return tvr.object()->getGeneric(cx, id, vp);
}
static JSXML *

View File

@ -1755,7 +1755,7 @@ class ScopeNameCompiler : public PICStubCompiler
// If the property was found, but we decided not to cache it, then
// take a slow path and do a full property fetch.
if (!getprop.shape) {
if (!obj->getProperty(cx, ATOM_TO_JSID(atom), vp))
if (!obj->getGeneric(cx, ATOM_TO_JSID(atom), vp))
return false;
if (thisvp)
return ComputeImplicitThis(cx, obj, *vp, thisvp);
@ -1995,7 +1995,7 @@ ic::GetProp(VMFrame &f, ic::PICInfo *pic)
}
Value v;
if (!obj->getProperty(f.cx, ATOM_TO_JSID(atom), &v))
if (!obj->getGeneric(f.cx, ATOM_TO_JSID(atom), &v))
THROW();
f.regs.sp[-1] = v;
@ -2747,7 +2747,7 @@ GetElementIC::attachArguments(JSContext *cx, JSObject *obj, const Value &v, jsid
disable(cx, "generated arguments stub");
if (!obj->getProperty(cx, id, vp))
if (!obj->getGeneric(cx, id, vp))
return Lookup_Error;
return Lookup_Cacheable;
@ -2830,7 +2830,7 @@ GetElementIC::attachTypedArray(JSContext *cx, JSObject *obj, const Value &v, jsi
disable(cx, "generated typed array stub");
// Fetch the value as expected of Lookup_Cacheable for GetElement.
if (!obj->getProperty(cx, id, vp))
if (!obj->getGeneric(cx, id, vp))
return Lookup_Error;
return Lookup_Cacheable;
@ -2967,7 +2967,7 @@ ic::GetElement(VMFrame &f, ic::GetElementIC *ic)
}
}
if (!obj->getProperty(cx, id, &f.regs.sp[-2]))
if (!obj->getGeneric(cx, id, &f.regs.sp[-2]))
THROW();
}

View File

@ -383,7 +383,7 @@ NameOp(VMFrame &f, JSObject *obj, bool callname)
/* Take the slow path if prop was not found in a native object. */
if (!obj->isNative() || !obj2->isNative()) {
if (!obj->getProperty(cx, id, &rval))
if (!obj->getGeneric(cx, id, &rval))
return NULL;
} else {
shape = (Shape *)prop;
@ -499,7 +499,7 @@ stubs::GetElem(VMFrame &f)
}
}
if (!obj->getProperty(cx, id, &rval))
if (!obj->getGeneric(cx, id, &rval))
THROW();
copyFrom = &rval;
@ -1601,7 +1601,7 @@ InlineGetProp(VMFrame &f)
? JSGET_CACHE_RESULT | JSGET_NO_METHOD_BARRIER
: JSGET_CACHE_RESULT | JSGET_METHOD_BARRIER,
&rval)
: !obj->getProperty(cx, id, &rval)) {
: !obj->getGeneric(cx, id, &rval)) {
return false;
}
} while(0);
@ -1627,7 +1627,7 @@ stubs::GetPropNoCache(VMFrame &f, JSAtom *atom)
if (!obj)
THROW();
if (!obj->getProperty(cx, ATOM_TO_JSID(atom), vp))
if (!obj->getGeneric(cx, ATOM_TO_JSID(atom), vp))
THROW();
/* Don't check for undefined, this is only used for 'prototype'. See ic::GetProp. */

View File

@ -2363,7 +2363,7 @@ DumpStats(JSContext *cx, uintN argc, jsval *vp)
if (!js_FindProperty(cx, id, false, &obj, &obj2, &prop))
return JS_FALSE;
if (prop) {
if (!obj->getProperty(cx, id, &value))
if (!obj->getGeneric(cx, id, &value))
return JS_FALSE;
}
if (!prop || !value.isObjectOrNull()) {
@ -3171,7 +3171,7 @@ CopyProperty(JSContext *cx, JSObject *obj, JSObject *referent, jsid id,
return false;
if (*objp != referent)
return true;
if (!referent->getProperty(cx, id, &desc.value) ||
if (!referent->getGeneric(cx, id, &desc.value) ||
!referent->getAttributes(cx, id, &desc.attrs)) {
return false;
}

View File

@ -1603,8 +1603,7 @@ Debugger::construct(JSContext *cx, uintN argc, Value *vp)
/* Get Debugger.prototype. */
Value v;
jsid prototypeId = ATOM_TO_JSID(cx->runtime->atomState.classPrototypeAtom);
if (!args.callee().getProperty(cx, prototypeId, &v))
if (!args.callee().getProperty(cx, cx->runtime->atomState.classPrototypeAtom, &v))
return false;
JSObject *proto = &v.toObject();
JS_ASSERT(proto->getClass() == &Debugger::jsclass);
@ -2927,7 +2926,7 @@ DebuggerFrameEval(JSContext *cx, uintN argc, Value *vp, EvalBindingsMode mode)
}
for (size_t i = 0; i < keys.length(); i++) {
Value *valp = &values[i];
if (!bindingsobj->getProperty(cx, bindingsobj, keys[i], valp) ||
if (!bindingsobj->getGeneric(cx, bindingsobj, keys[i], valp) ||
!dbg->unwrapDebuggeeValue(cx, valp))
{
return false;