mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset fe305819d2f2 (bug 771026) for orange
This commit is contained in:
parent
9ebed0e659
commit
c93917f268
@ -3397,7 +3397,7 @@ JS_DeepFreezeObject(JSContext *cx, JSObject *obj_)
|
||||
|
||||
static JSBool
|
||||
LookupPropertyById(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
MutableHandleObject objp, JSProperty **propp)
|
||||
{
|
||||
AssertNoGC(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
@ -3411,15 +3411,17 @@ LookupPropertyById(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
|
||||
|
||||
static JSBool
|
||||
LookupResult(JSContext *cx, HandleObject obj, HandleObject obj2, jsid id,
|
||||
HandleShape shape, Value *vp)
|
||||
JSProperty* prop, Value *vp)
|
||||
{
|
||||
if (!shape) {
|
||||
if (!prop) {
|
||||
/* XXX bad API: no way to tell "not defined" from "void value" */
|
||||
vp->setUndefined();
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
if (obj2->isNative()) {
|
||||
Shape *shape = (Shape *) prop;
|
||||
|
||||
/* Peek at the native property's slot value, without doing a Get. */
|
||||
if (shape->hasSlot()) {
|
||||
*vp = obj2->nativeGetSlot(shape->slot());
|
||||
@ -3450,7 +3452,7 @@ JS_LookupPropertyById(JSContext *cx, JSObject *obj_, jsid id_, jsval *vp)
|
||||
RootedId id(cx, id_);
|
||||
RootedObject obj(cx, obj_);
|
||||
RootedObject obj2(cx);
|
||||
RootedShape prop(cx);
|
||||
JSProperty* prop;
|
||||
|
||||
return LookupPropertyById(cx, obj, id, JSRESOLVE_QUALIFIED, &obj2, &prop) &&
|
||||
LookupResult(cx, obj, obj2, id, prop, vp);
|
||||
@ -3488,7 +3490,7 @@ JS_LookupPropertyWithFlagsById(JSContext *cx, JSObject *obj_, jsid id_, unsigned
|
||||
RootedObject obj(cx, obj_);
|
||||
RootedObject objp(cx, *objp_);
|
||||
RootedId id(cx, id_);
|
||||
RootedShape prop(cx);
|
||||
JSProperty* prop;
|
||||
|
||||
AssertNoGC(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
@ -3519,7 +3521,7 @@ JS_HasPropertyById(JSContext *cx, JSObject *obj_, jsid id_, JSBool *foundp)
|
||||
RootedObject obj(cx, obj_);
|
||||
RootedId id(cx, id_);
|
||||
RootedObject obj2(cx);
|
||||
RootedShape prop(cx);
|
||||
JSProperty* prop;
|
||||
JSBool ok = LookupPropertyById(cx, obj, id, JSRESOLVE_QUALIFIED | JSRESOLVE_DETECTING,
|
||||
&obj2, &prop);
|
||||
*foundp = (prop != NULL);
|
||||
@ -3564,7 +3566,7 @@ JS_AlreadyHasOwnPropertyById(JSContext *cx, JSObject *obj_, jsid id_, JSBool *fo
|
||||
|
||||
if (!obj->isNative()) {
|
||||
RootedObject obj2(cx);
|
||||
RootedShape prop(cx);
|
||||
JSProperty *prop;
|
||||
|
||||
if (!LookupPropertyById(cx, obj, id, JSRESOLVE_QUALIFIED | JSRESOLVE_DETECTING,
|
||||
&obj2, &prop)) {
|
||||
@ -3836,12 +3838,12 @@ GetPropertyDescriptorById(JSContext *cx, HandleObject obj, HandleId id, unsigned
|
||||
JSBool own, PropertyDescriptor *desc)
|
||||
{
|
||||
RootedObject obj2(cx);
|
||||
RootedShape shape(cx);
|
||||
JSProperty *prop;
|
||||
|
||||
if (!LookupPropertyById(cx, obj, id, flags, &obj2, &shape))
|
||||
if (!LookupPropertyById(cx, obj, id, flags, &obj2, &prop))
|
||||
return JS_FALSE;
|
||||
|
||||
if (!shape || (own && obj != obj2)) {
|
||||
if (!prop || (own && obj != obj2)) {
|
||||
desc->obj = NULL;
|
||||
desc->attrs = 0;
|
||||
desc->getter = NULL;
|
||||
@ -3852,6 +3854,7 @@ GetPropertyDescriptorById(JSContext *cx, HandleObject obj, HandleId id, unsigned
|
||||
|
||||
desc->obj = obj2;
|
||||
if (obj2->isNative()) {
|
||||
Shape *shape = (Shape *) prop;
|
||||
desc->attrs = shape->attributes();
|
||||
desc->getter = shape->getter();
|
||||
desc->setter = shape->setter();
|
||||
@ -3960,14 +3963,15 @@ static JSBool
|
||||
SetPropertyAttributesById(JSContext *cx, HandleObject obj, HandleId id, unsigned attrs, JSBool *foundp)
|
||||
{
|
||||
RootedObject obj2(cx);
|
||||
RootedShape shape(cx);
|
||||
JSProperty *prop;
|
||||
|
||||
if (!LookupPropertyById(cx, obj, id, JSRESOLVE_QUALIFIED, &obj2, &shape))
|
||||
if (!LookupPropertyById(cx, obj, id, JSRESOLVE_QUALIFIED, &obj2, &prop))
|
||||
return false;
|
||||
if (!shape || obj != obj2) {
|
||||
if (!prop || obj != obj2) {
|
||||
*foundp = false;
|
||||
return true;
|
||||
}
|
||||
Shape *shape = (Shape *) prop;
|
||||
JSBool ok = obj->isNative()
|
||||
? obj->changePropertyAttributes(cx, shape, attrs)
|
||||
: obj->setGenericAttributes(cx, id, &attrs);
|
||||
|
@ -347,7 +347,7 @@ DoGetElement(JSContext *cx, JSObject *obj_, double index, JSBool *hole, Value *v
|
||||
}
|
||||
|
||||
RootedObject obj2(cx);
|
||||
RootedShape prop(cx);
|
||||
JSProperty *prop;
|
||||
if (!obj->lookupGeneric(cx, id, &obj2, &prop))
|
||||
return JS_FALSE;
|
||||
if (!prop) {
|
||||
@ -692,14 +692,14 @@ IsDenseArrayId(JSContext *cx, JSObject *obj, jsid id)
|
||||
}
|
||||
|
||||
static JSBool
|
||||
array_lookupGeneric(JSContext *cx, HandleObject obj, HandleId id,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
array_lookupGeneric(JSContext *cx, HandleObject obj, HandleId id, MutableHandleObject objp,
|
||||
JSProperty **propp)
|
||||
{
|
||||
if (!obj->isDenseArray())
|
||||
return baseops::LookupProperty(cx, obj, id, objp, propp);
|
||||
|
||||
if (IsDenseArrayId(cx, obj, id)) {
|
||||
MarkNonNativePropertyFound(obj, propp);
|
||||
*propp = (JSProperty *) 1; /* non-null to indicate found */
|
||||
objp.set(obj);
|
||||
return JS_TRUE;
|
||||
}
|
||||
@ -707,7 +707,7 @@ array_lookupGeneric(JSContext *cx, HandleObject obj, HandleId id,
|
||||
JSObject *proto = obj->getProto();
|
||||
if (!proto) {
|
||||
objp.set(NULL);
|
||||
propp.set(NULL);
|
||||
*propp = NULL;
|
||||
return JS_TRUE;
|
||||
}
|
||||
return proto->lookupGeneric(cx, id, objp, propp);
|
||||
@ -715,21 +715,21 @@ array_lookupGeneric(JSContext *cx, HandleObject obj, HandleId id,
|
||||
|
||||
static JSBool
|
||||
array_lookupProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
MutableHandleObject objp, JSProperty **propp)
|
||||
{
|
||||
Rooted<jsid> id(cx, NameToId(name));
|
||||
return array_lookupGeneric(cx, obj, id, objp, propp);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
array_lookupElement(JSContext *cx, HandleObject obj, uint32_t index,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
array_lookupElement(JSContext *cx, HandleObject obj, uint32_t index, MutableHandleObject objp,
|
||||
JSProperty **propp)
|
||||
{
|
||||
if (!obj->isDenseArray())
|
||||
return baseops::LookupElement(cx, obj, index, objp, propp);
|
||||
|
||||
if (IsDenseArrayIndex(obj, index)) {
|
||||
MarkNonNativePropertyFound(obj, propp);
|
||||
*propp = (JSProperty *) 1; /* non-null to indicate found */
|
||||
objp.set(obj);
|
||||
return true;
|
||||
}
|
||||
@ -738,13 +738,13 @@ array_lookupElement(JSContext *cx, HandleObject obj, uint32_t index,
|
||||
return proto->lookupElement(cx, index, objp, propp);
|
||||
|
||||
objp.set(NULL);
|
||||
propp.set(NULL);
|
||||
*propp = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
array_lookupSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
array_lookupSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid, MutableHandleObject objp,
|
||||
JSProperty **propp)
|
||||
{
|
||||
Rooted<jsid> id(cx, SPECIALID_TO_JSID(sid));
|
||||
return array_lookupGeneric(cx, obj, id, objp, propp);
|
||||
|
@ -149,17 +149,17 @@ typedef JS::Handle<SpecialId> HandleSpecialId;
|
||||
/* js::Class operation signatures. */
|
||||
|
||||
typedef JSBool
|
||||
(* LookupGenericOp)(JSContext *cx, HandleObject obj, HandleId id,
|
||||
MutableHandleObject objp, MutableHandleShape propp);
|
||||
(* LookupGenericOp)(JSContext *cx, HandleObject obj, HandleId id, MutableHandleObject objp,
|
||||
JSProperty **propp);
|
||||
typedef JSBool
|
||||
(* LookupPropOp)(JSContext *cx, HandleObject obj, HandlePropertyName name,
|
||||
MutableHandleObject objp, MutableHandleShape propp);
|
||||
(* LookupPropOp)(JSContext *cx, HandleObject obj, HandlePropertyName name, MutableHandleObject objp,
|
||||
JSProperty **propp);
|
||||
typedef JSBool
|
||||
(* LookupElementOp)(JSContext *cx, HandleObject obj, uint32_t index,
|
||||
MutableHandleObject objp, MutableHandleShape propp);
|
||||
(* LookupElementOp)(JSContext *cx, HandleObject obj, uint32_t index, MutableHandleObject objp,
|
||||
JSProperty **propp);
|
||||
typedef JSBool
|
||||
(* LookupSpecialOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid,
|
||||
MutableHandleObject objp, MutableHandleShape propp);
|
||||
(* LookupSpecialOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, MutableHandleObject objp,
|
||||
JSProperty **propp);
|
||||
typedef JSBool
|
||||
(* DefineGenericOp)(JSContext *cx, HandleObject obj, HandleId id, const Value *value,
|
||||
PropertyOp getter, StrictPropertyOp setter, unsigned attrs);
|
||||
|
@ -559,7 +559,7 @@ JSStructuredCloneWriter::write(const Value &v)
|
||||
* NativeIterators.
|
||||
*/
|
||||
RootedObject obj2(context());
|
||||
RootedShape prop(context());
|
||||
JSProperty *prop;
|
||||
if (!js_HasOwnProperty(context(), obj->getOps()->lookupGeneric, obj, id,
|
||||
&obj2, &prop)) {
|
||||
return false;
|
||||
|
@ -954,7 +954,7 @@ js::AssertValidPropertyCacheHit(JSContext *cx, JSObject *start_,
|
||||
|
||||
RootedObject obj(cx);
|
||||
RootedObject pobj(cx);
|
||||
RootedShape prop(cx);
|
||||
JSProperty *prop;
|
||||
JSBool ok;
|
||||
|
||||
if (JOF_OPMODE(*pc) == JOF_NAME)
|
||||
@ -967,7 +967,9 @@ js::AssertValidPropertyCacheHit(JSContext *cx, JSObject *start_,
|
||||
JS_PROPERTY_CACHE(cx).restore(&savedEntry);
|
||||
JS_ASSERT(prop);
|
||||
JS_ASSERT(pobj == found);
|
||||
JS_ASSERT(entry->prop == prop);
|
||||
|
||||
Shape *shape = (Shape *) prop;
|
||||
JS_ASSERT(entry->prop == shape);
|
||||
}
|
||||
#endif /* DEBUG && !JS_THREADSAFE */
|
||||
|
||||
@ -1279,7 +1281,6 @@ js::Interpret(JSContext *cx, StackFrame *entryFrame, InterpMode interpMode)
|
||||
RootedTypeObject rootType0(cx);
|
||||
RootedPropertyName rootName0(cx);
|
||||
RootedId rootId0(cx);
|
||||
RootedShape rootShape0(cx);
|
||||
|
||||
if (rt->profilingScripts)
|
||||
ENABLE_INTERRUPTS();
|
||||
@ -1745,7 +1746,7 @@ BEGIN_CASE(JSOP_IN)
|
||||
RootedId &id = rootId0;
|
||||
FETCH_ELEMENT_ID(obj, -2, id);
|
||||
RootedObject &obj2 = rootObject1;
|
||||
RootedShape &prop = rootShape0;
|
||||
JSProperty *prop;
|
||||
if (!obj->lookupGeneric(cx, id, &obj2, &prop))
|
||||
goto error;
|
||||
bool cond = prop != NULL;
|
||||
@ -2205,7 +2206,7 @@ BEGIN_CASE(JSOP_DELNAME)
|
||||
|
||||
RootedObject &obj = rootObject1;
|
||||
RootedObject &obj2 = rootObject2;
|
||||
RootedShape &prop = rootShape0;
|
||||
JSProperty *prop;
|
||||
if (!FindProperty(cx, name, scopeObj, &obj, &obj2, &prop))
|
||||
goto error;
|
||||
|
||||
@ -2552,7 +2553,7 @@ BEGIN_CASE(JSOP_IMPLICITTHIS)
|
||||
|
||||
RootedObject &obj = rootObject1;
|
||||
RootedObject &obj2 = rootObject2;
|
||||
RootedShape &prop = rootShape0;
|
||||
JSProperty *prop;
|
||||
if (!FindPropertyHelper(cx, name, false, scopeObj, &obj, &obj2, &prop))
|
||||
goto error;
|
||||
|
||||
@ -2919,9 +2920,9 @@ BEGIN_CASE(JSOP_DEFFUN)
|
||||
/* ES5 10.5 (NB: with subsequent errata). */
|
||||
RootedPropertyName &name = rootName0;
|
||||
name = fun->atom->asPropertyName();
|
||||
RootedShape &shape = rootShape0;
|
||||
JSProperty *prop = NULL;
|
||||
RootedObject &pobj = rootObject1;
|
||||
if (!parent->lookupProperty(cx, name, &pobj, &shape))
|
||||
if (!parent->lookupProperty(cx, name, &pobj, &prop))
|
||||
goto error;
|
||||
|
||||
RootedValue &rval = rootValue0;
|
||||
@ -2929,7 +2930,7 @@ BEGIN_CASE(JSOP_DEFFUN)
|
||||
|
||||
do {
|
||||
/* Steps 5d, 5f. */
|
||||
if (!shape || pobj != parent) {
|
||||
if (!prop || pobj != parent) {
|
||||
if (!parent->defineProperty(cx, name, rval,
|
||||
JS_PropertyStub, JS_StrictPropertyStub, attrs))
|
||||
{
|
||||
@ -2940,6 +2941,7 @@ BEGIN_CASE(JSOP_DEFFUN)
|
||||
|
||||
/* Step 5e. */
|
||||
JS_ASSERT(parent->isNative());
|
||||
Shape *shape = reinterpret_cast<Shape *>(prop);
|
||||
if (parent->isGlobal()) {
|
||||
if (shape->configurable()) {
|
||||
if (!parent->defineProperty(cx, name, rval,
|
||||
|
@ -385,10 +385,10 @@ NameOperation(JSContext *cx, JSScript *script, jsbytecode *pc, Value *vp)
|
||||
return true;
|
||||
}
|
||||
|
||||
RootedShape shape(cx);
|
||||
if (!FindPropertyHelper(cx, name, true, obj, &obj, &obj2, &shape))
|
||||
JSProperty *prop;
|
||||
if (!FindPropertyHelper(cx, name, true, obj, &obj, &obj2, &prop))
|
||||
return false;
|
||||
if (!shape) {
|
||||
if (!prop) {
|
||||
/* Kludge to allow (typeof foo == "undefined") tests. */
|
||||
JSOp op2 = JSOp(pc[JSOP_NAME_LENGTH]);
|
||||
if (op2 == JSOP_TYPEOF) {
|
||||
@ -401,12 +401,13 @@ NameOperation(JSContext *cx, JSScript *script, jsbytecode *pc, Value *vp)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Take the slow path if shape was not found in a native object. */
|
||||
/* Take the slow path if prop was not found in a native object. */
|
||||
if (!obj->isNative() || !obj2->isNative()) {
|
||||
Rooted<jsid> id(cx, NameToId(name));
|
||||
if (!obj->getGeneric(cx, id, vp))
|
||||
return false;
|
||||
} else {
|
||||
Shape *shape = (Shape *)prop;
|
||||
Rooted<JSObject*> normalized(cx, obj);
|
||||
if (normalized->getClass() == &WithClass && !shape->hasDefaultGetter())
|
||||
normalized = &normalized->asWith().object();
|
||||
@ -423,7 +424,7 @@ DefVarOrConstOperation(JSContext *cx, HandleObject varobj, PropertyName *dn, uns
|
||||
JS_ASSERT(varobj->isVarObj());
|
||||
JS_ASSERT(!varobj->getOps()->defineProperty || varobj->isDebugScope());
|
||||
|
||||
RootedShape prop(cx);
|
||||
JSProperty *prop;
|
||||
RootedObject obj2(cx);
|
||||
if (!varobj->lookupProperty(cx, dn, &obj2, &prop))
|
||||
return false;
|
||||
|
@ -993,7 +993,7 @@ SuppressDeletedPropertyHelper(JSContext *cx, HandleObject obj, StringPredicate p
|
||||
if (obj->getProto()) {
|
||||
JSObject *proto = obj->getProto();
|
||||
RootedObject obj2(cx);
|
||||
RootedShape prop(cx);
|
||||
JSProperty *prop;
|
||||
RootedId id(cx);
|
||||
if (!ValueToId(cx, StringValue(*idp), id.address()))
|
||||
return false;
|
||||
@ -1002,7 +1002,7 @@ SuppressDeletedPropertyHelper(JSContext *cx, HandleObject obj, StringPredicate p
|
||||
if (prop) {
|
||||
unsigned attrs;
|
||||
if (obj2->isNative())
|
||||
attrs = prop->attributes();
|
||||
attrs = ((Shape *) prop)->attributes();
|
||||
else if (!obj2->getGenericAttributes(cx, id, &attrs))
|
||||
return false;
|
||||
|
||||
|
176
js/src/jsobj.cpp
176
js/src/jsobj.cpp
@ -179,7 +179,7 @@ MarkSharpObjects(JSContext *cx, HandleObject obj, JSIdArray **idap, JSSharpInfo
|
||||
for (int i = 0, length = ida->length; i < length; i++) {
|
||||
id = ida->vector[i];
|
||||
RootedObject obj2(cx);
|
||||
RootedShape prop(cx);
|
||||
JSProperty *prop;
|
||||
ok = obj->lookupGeneric(cx, id, &obj2, &prop);
|
||||
if (!ok)
|
||||
break;
|
||||
@ -460,7 +460,7 @@ obj_toSource(JSContext *cx, unsigned argc, Value *vp)
|
||||
JSLinearString *idstr;
|
||||
|
||||
RootedObject obj2(cx);
|
||||
RootedShape prop(cx);
|
||||
JSProperty *prop;
|
||||
if (!obj->lookupGeneric(cx, id, &obj2, &prop))
|
||||
return false;
|
||||
|
||||
@ -807,7 +807,7 @@ js_HasOwnPropertyHelper(JSContext *cx, LookupGenericOp lookup, unsigned argc,
|
||||
if (!obj)
|
||||
return false;
|
||||
RootedObject obj2(cx);
|
||||
RootedShape prop(cx);
|
||||
JSProperty *prop;
|
||||
if (obj->isProxy()) {
|
||||
bool has;
|
||||
if (!Proxy::hasOwn(cx, obj, id, &has))
|
||||
@ -823,7 +823,7 @@ js_HasOwnPropertyHelper(JSContext *cx, LookupGenericOp lookup, unsigned argc,
|
||||
|
||||
JSBool
|
||||
js_HasOwnProperty(JSContext *cx, LookupGenericOp lookup, HandleObject obj, HandleId id,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
MutableHandleObject objp, JSProperty **propp)
|
||||
{
|
||||
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED | JSRESOLVE_DETECTING);
|
||||
if (lookup) {
|
||||
@ -833,7 +833,7 @@ js_HasOwnProperty(JSContext *cx, LookupGenericOp lookup, HandleObject obj, Handl
|
||||
if (!baseops::LookupProperty(cx, obj, id, objp, propp))
|
||||
return false;
|
||||
}
|
||||
if (!propp)
|
||||
if (!*propp)
|
||||
return true;
|
||||
|
||||
if (objp == obj)
|
||||
@ -848,7 +848,7 @@ js_HasOwnProperty(JSContext *cx, LookupGenericOp lookup, HandleObject obj, Handl
|
||||
}
|
||||
|
||||
if (outer != objp)
|
||||
propp.set(NULL);
|
||||
*propp = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -894,7 +894,7 @@ JSBool
|
||||
js_PropertyIsEnumerable(JSContext *cx, HandleObject obj, HandleId id, Value *vp)
|
||||
{
|
||||
RootedObject pobj(cx);
|
||||
RootedShape prop(cx);
|
||||
JSProperty *prop;
|
||||
if (!obj->lookupGeneric(cx, id, &pobj, &prop))
|
||||
return false;
|
||||
|
||||
@ -1004,12 +1004,13 @@ obj_lookupGetter(JSContext *cx, unsigned argc, Value *vp)
|
||||
return JS_TRUE;
|
||||
}
|
||||
RootedObject pobj(cx);
|
||||
RootedShape shape(cx);
|
||||
if (!obj->lookupGeneric(cx, id, &pobj, &shape))
|
||||
JSProperty *prop;
|
||||
if (!obj->lookupGeneric(cx, id, &pobj, &prop))
|
||||
return JS_FALSE;
|
||||
vp->setUndefined();
|
||||
if (shape) {
|
||||
if (prop) {
|
||||
if (pobj->isNative()) {
|
||||
Shape *shape = (Shape *) prop;
|
||||
if (shape->hasGetterValue())
|
||||
*vp = shape->getterValue();
|
||||
}
|
||||
@ -1038,12 +1039,13 @@ obj_lookupSetter(JSContext *cx, unsigned argc, Value *vp)
|
||||
return JS_TRUE;
|
||||
}
|
||||
RootedObject pobj(cx);
|
||||
RootedShape shape(cx);
|
||||
if (!obj->lookupGeneric(cx, id, &pobj, &shape))
|
||||
JSProperty *prop;
|
||||
if (!obj->lookupGeneric(cx, id, &pobj, &prop))
|
||||
return JS_FALSE;
|
||||
vp->setUndefined();
|
||||
if (shape) {
|
||||
if (prop) {
|
||||
if (pobj->isNative()) {
|
||||
Shape *shape = (Shape *) prop;
|
||||
if (shape->hasSetterValue())
|
||||
*vp = shape->setterValue();
|
||||
}
|
||||
@ -1169,16 +1171,17 @@ GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id, PropertyD
|
||||
return Proxy::getOwnPropertyDescriptor(cx, obj, id, false, desc);
|
||||
|
||||
RootedObject pobj(cx);
|
||||
RootedShape shape(cx);
|
||||
if (!js_HasOwnProperty(cx, obj->getOps()->lookupGeneric, obj, id, &pobj, &shape))
|
||||
JSProperty *prop;
|
||||
if (!js_HasOwnProperty(cx, obj->getOps()->lookupGeneric, obj, id, &pobj, &prop))
|
||||
return false;
|
||||
if (!shape) {
|
||||
if (!prop) {
|
||||
desc->obj = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool doGet = true;
|
||||
if (pobj->isNative()) {
|
||||
Shape *shape = (Shape *) prop;
|
||||
desc->attrs = shape->attributes();
|
||||
if (desc->attrs & (JSPROP_GETTER | JSPROP_SETTER)) {
|
||||
doGet = false;
|
||||
@ -1506,16 +1509,16 @@ DefinePropertyOnObject(JSContext *cx, HandleObject obj, HandleId id, const PropD
|
||||
bool throwError, bool *rval)
|
||||
{
|
||||
/* 8.12.9 step 1. */
|
||||
RootedShape shape(cx);
|
||||
JSProperty *current;
|
||||
RootedObject obj2(cx);
|
||||
JS_ASSERT(!obj->getOps()->lookupGeneric);
|
||||
if (!js_HasOwnProperty(cx, NULL, obj, id, &obj2, &shape))
|
||||
if (!js_HasOwnProperty(cx, NULL, obj, id, &obj2, ¤t))
|
||||
return JS_FALSE;
|
||||
|
||||
JS_ASSERT(!obj->getOps()->defineProperty);
|
||||
|
||||
/* 8.12.9 steps 2-4. */
|
||||
if (!shape) {
|
||||
if (!current) {
|
||||
if (!obj->isExtensible())
|
||||
return Reject(cx, obj, JSMSG_OBJECT_NOT_EXTENSIBLE, throwError, rval);
|
||||
|
||||
@ -1550,6 +1553,7 @@ DefinePropertyOnObject(JSContext *cx, HandleObject obj, HandleId id, const PropD
|
||||
|
||||
JS_ASSERT(obj == obj2);
|
||||
|
||||
Rooted<Shape *> shape(cx, reinterpret_cast<Shape *>(current));
|
||||
do {
|
||||
if (desc.isAccessorDescriptor()) {
|
||||
if (!shape->isAccessorDescriptor())
|
||||
@ -3853,6 +3857,9 @@ js_FindClassObject(JSContext *cx, HandleObject start, JSProtoKey protoKey,
|
||||
MutableHandleValue vp, Class *clasp)
|
||||
{
|
||||
RootedId id(cx);
|
||||
JSProperty *prop;
|
||||
Shape *shape;
|
||||
|
||||
RootedObject obj(cx);
|
||||
|
||||
if (start) {
|
||||
@ -3884,11 +3891,11 @@ js_FindClassObject(JSContext *cx, HandleObject start, JSProtoKey protoKey,
|
||||
|
||||
JS_ASSERT(obj->isNative());
|
||||
RootedObject pobj(cx);
|
||||
RootedShape shape(cx);
|
||||
if (!LookupPropertyWithFlags(cx, obj, id, 0, &pobj, &shape))
|
||||
if (!LookupPropertyWithFlags(cx, obj, id, 0, &pobj, &prop))
|
||||
return false;
|
||||
RootedValue v(cx, UndefinedValue());
|
||||
if (shape && pobj->isNative()) {
|
||||
if (prop && pobj->isNative()) {
|
||||
shape = (Shape *) prop;
|
||||
if (shape->hasSlot()) {
|
||||
v = pobj->nativeGetSlot(shape->slot());
|
||||
if (v.get().isPrimitive())
|
||||
@ -4108,6 +4115,8 @@ DefineNativeProperty(JSContext *cx, HandleObject obj, HandleId id, const Value &
|
||||
*/
|
||||
RootedShape shape(cx);
|
||||
if (attrs & (JSPROP_GETTER | JSPROP_SETTER)) {
|
||||
JSProperty *prop;
|
||||
|
||||
/* Type information for getter/setter properties is unknown. */
|
||||
AddTypePropertyId(cx, obj, id, types::Type::UnknownType());
|
||||
MarkTypePropertyConfigured(cx, obj, id);
|
||||
@ -4118,10 +4127,10 @@ DefineNativeProperty(JSContext *cx, HandleObject obj, HandleId id, const Value &
|
||||
* property cache line for (obj, id) to map shape.
|
||||
*/
|
||||
RootedObject pobj(cx);
|
||||
RootedShape shape(cx);
|
||||
if (!baseops::LookupProperty(cx, obj, id, &pobj, &shape))
|
||||
if (!baseops::LookupProperty(cx, obj, id, &pobj, &prop))
|
||||
return NULL;
|
||||
if (shape && pobj == obj) {
|
||||
if (prop && pobj == obj) {
|
||||
shape = (Shape *) prop;
|
||||
if (shape->isAccessorDescriptor()) {
|
||||
shape = obj->changeProperty(cx, shape, attrs,
|
||||
JSPROP_GETTER | JSPROP_SETTER,
|
||||
@ -4209,7 +4218,7 @@ DefineNativeProperty(JSContext *cx, HandleObject obj, HandleId id, const Value &
|
||||
*/
|
||||
static JSBool
|
||||
CallResolveOp(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
|
||||
MutableHandleObject objp, MutableHandleShape propp, bool *recursedp)
|
||||
MutableHandleObject objp, JSProperty **propp, bool *recursedp)
|
||||
{
|
||||
Class *clasp = obj->getClass();
|
||||
JSResolveOp resolve = clasp->resolve;
|
||||
@ -4230,7 +4239,7 @@ CallResolveOp(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
|
||||
}
|
||||
*recursedp = false;
|
||||
|
||||
propp.set(NULL);
|
||||
*propp = NULL;
|
||||
|
||||
if (clasp->flags & JSCLASS_NEW_RESOLVE) {
|
||||
JSNewResolveOp newresolve = reinterpret_cast<JSNewResolveOp>(resolve);
|
||||
@ -4264,7 +4273,7 @@ CallResolveOp(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
|
||||
if (!obj->nativeEmpty()) {
|
||||
if (Shape *shape = obj->nativeLookup(cx, id)) {
|
||||
objp.set(obj);
|
||||
propp.set(shape);
|
||||
*propp = (JSProperty *) shape;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4273,7 +4282,7 @@ CallResolveOp(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
|
||||
|
||||
static JS_ALWAYS_INLINE bool
|
||||
LookupPropertyWithFlagsInline(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
MutableHandleObject objp, JSProperty **propp)
|
||||
{
|
||||
/* Search scopes starting with obj and following the prototype link. */
|
||||
RootedObject current(cx, obj);
|
||||
@ -4281,7 +4290,7 @@ LookupPropertyWithFlagsInline(JSContext *cx, HandleObject obj, HandleId id, unsi
|
||||
Shape *shape = current->nativeLookup(cx, id);
|
||||
if (shape) {
|
||||
objp.set(current);
|
||||
propp.set(shape);
|
||||
*propp = (JSProperty *) shape;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -4292,7 +4301,7 @@ LookupPropertyWithFlagsInline(JSContext *cx, HandleObject obj, HandleId id, unsi
|
||||
return false;
|
||||
if (recursed)
|
||||
break;
|
||||
if (propp) {
|
||||
if (*propp) {
|
||||
/*
|
||||
* For stats we do not recalculate protoIndex even if it was
|
||||
* resolved on some other object.
|
||||
@ -4317,7 +4326,7 @@ LookupPropertyWithFlagsInline(JSContext *cx, HandleObject obj, HandleId id, unsi
|
||||
* arguments.callee through the delegating |this| object's method
|
||||
* read barrier.
|
||||
*/
|
||||
if (propp && objp->isNative()) {
|
||||
if (*propp && objp->isNative()) {
|
||||
while ((proto = proto->getProto()) != objp)
|
||||
JS_ASSERT(proto);
|
||||
}
|
||||
@ -4329,20 +4338,20 @@ LookupPropertyWithFlagsInline(JSContext *cx, HandleObject obj, HandleId id, unsi
|
||||
}
|
||||
|
||||
objp.set(NULL);
|
||||
propp.set(NULL);
|
||||
*propp = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_FRIEND_API(JSBool)
|
||||
baseops::LookupProperty(JSContext *cx, HandleObject obj, HandleId id, MutableHandleObject objp,
|
||||
MutableHandleShape propp)
|
||||
JSProperty **propp)
|
||||
{
|
||||
return LookupPropertyWithFlagsInline(cx, obj, id, cx->resolveFlags, objp, propp);
|
||||
}
|
||||
|
||||
JS_FRIEND_API(JSBool)
|
||||
baseops::LookupElement(JSContext *cx, HandleObject obj, uint32_t index,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
MutableHandleObject objp, JSProperty **propp)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
@ -4353,7 +4362,7 @@ baseops::LookupElement(JSContext *cx, HandleObject obj, uint32_t index,
|
||||
|
||||
bool
|
||||
js::LookupPropertyWithFlags(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
MutableHandleObject objp, JSProperty **propp)
|
||||
{
|
||||
return LookupPropertyWithFlagsInline(cx, obj, id, flags, objp, propp);
|
||||
}
|
||||
@ -4361,14 +4370,13 @@ js::LookupPropertyWithFlags(JSContext *cx, HandleObject obj, HandleId id, unsign
|
||||
bool
|
||||
js::FindPropertyHelper(JSContext *cx,
|
||||
HandlePropertyName name, bool cacheResult, HandleObject scopeChain,
|
||||
MutableHandleObject objp, MutableHandleObject pobjp,
|
||||
MutableHandleShape propp)
|
||||
MutableHandleObject objp, MutableHandleObject pobjp, JSProperty **propp)
|
||||
{
|
||||
RootedId id(cx, NameToId(name));
|
||||
|
||||
RootedObject pobj(cx);
|
||||
int scopeIndex;
|
||||
RootedShape prop(cx);
|
||||
JSProperty *prop;
|
||||
|
||||
/* Scan entries on the scope chain that we can cache across. */
|
||||
RootedObject obj(cx, scopeChain);
|
||||
@ -4408,7 +4416,8 @@ js::FindPropertyHelper(JSContext *cx,
|
||||
* non-native prototype.
|
||||
*/
|
||||
if (cacheResult && pobj->isNative()) {
|
||||
JS_PROPERTY_CACHE(cx).fill(cx, scopeChain, scopeIndex, pobj, prop);
|
||||
JS_PROPERTY_CACHE(cx).fill(cx, scopeChain, scopeIndex, pobj,
|
||||
(Shape *) prop);
|
||||
}
|
||||
|
||||
goto out;
|
||||
@ -4444,7 +4453,7 @@ js::FindPropertyHelper(JSContext *cx,
|
||||
JS_ASSERT(!!pobj == !!prop);
|
||||
objp.set(obj);
|
||||
pobjp.set(pobj);
|
||||
propp.set(prop);
|
||||
*propp = prop;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -4454,7 +4463,7 @@ js::FindPropertyHelper(JSContext *cx,
|
||||
*/
|
||||
bool
|
||||
js::FindProperty(JSContext *cx, HandlePropertyName name, HandleObject scopeChain,
|
||||
MutableHandleObject objp, MutableHandleObject pobjp, MutableHandleShape propp)
|
||||
MutableHandleObject objp, MutableHandleObject pobjp, JSProperty **propp)
|
||||
{
|
||||
return !!FindPropertyHelper(cx, name, false, scopeChain, objp, pobjp, propp);
|
||||
}
|
||||
@ -4484,16 +4493,16 @@ js::FindIdentifierBase(JSContext *cx, HandleObject scopeChain, HandlePropertyNam
|
||||
scopeIndex++)
|
||||
{
|
||||
RootedObject pobj(cx);
|
||||
RootedShape shape(cx);
|
||||
if (!LookupPropertyWithFlags(cx, obj, name, cx->resolveFlags, &pobj, &shape))
|
||||
JSProperty *prop;
|
||||
if (!LookupPropertyWithFlags(cx, obj, name, cx->resolveFlags, &pobj, &prop))
|
||||
return NULL;
|
||||
if (shape) {
|
||||
if (prop) {
|
||||
if (!pobj->isNative()) {
|
||||
JS_ASSERT(obj->isGlobal());
|
||||
return obj;
|
||||
}
|
||||
JS_ASSERT_IF(obj->isScope(), pobj->getClass() == obj->getClass());
|
||||
JS_PROPERTY_CACHE(cx).fill(cx, scopeChain, scopeIndex, pobj, shape);
|
||||
JS_PROPERTY_CACHE(cx).fill(cx, scopeChain, scopeIndex, pobj, (Shape *) prop);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@ -4506,10 +4515,10 @@ js::FindIdentifierBase(JSContext *cx, HandleObject scopeChain, HandlePropertyNam
|
||||
/* Loop until we find a property or reach the global object. */
|
||||
do {
|
||||
RootedObject pobj(cx);
|
||||
RootedShape shape(cx);
|
||||
if (!obj->lookupProperty(cx, name, &pobj, &shape))
|
||||
JSProperty *prop;
|
||||
if (!obj->lookupProperty(cx, name, &pobj, &prop))
|
||||
return NULL;
|
||||
if (shape)
|
||||
if (prop)
|
||||
break;
|
||||
|
||||
/*
|
||||
@ -4620,15 +4629,16 @@ static JS_ALWAYS_INLINE JSBool
|
||||
js_GetPropertyHelperInline(JSContext *cx, HandleObject obj, HandleObject receiver, jsid id_,
|
||||
uint32_t getHow, Value *vp)
|
||||
{
|
||||
JSProperty *prop;
|
||||
|
||||
RootedId id(cx, id_);
|
||||
|
||||
/* This call site is hot -- use the always-inlined variant of LookupPropertyWithFlags(). */
|
||||
RootedObject obj2(cx);
|
||||
RootedShape shape(cx);
|
||||
if (!LookupPropertyWithFlagsInline(cx, obj, id, cx->resolveFlags, &obj2, &shape))
|
||||
if (!LookupPropertyWithFlagsInline(cx, obj, id, cx->resolveFlags, &obj2, &prop))
|
||||
return false;
|
||||
|
||||
if (!shape) {
|
||||
if (!prop) {
|
||||
vp->setUndefined();
|
||||
|
||||
if (!CallJSPropertyOp(cx, obj->getClass()->getProperty, obj, id, vp))
|
||||
@ -4696,6 +4706,8 @@ js_GetPropertyHelperInline(JSContext *cx, HandleObject obj, HandleObject receive
|
||||
: obj2->getGeneric(cx, id, vp);
|
||||
}
|
||||
|
||||
Shape *shape = (Shape *) prop;
|
||||
|
||||
if (getHow & JSGET_CACHE_RESULT)
|
||||
JS_PROPERTY_CACHE(cx).fill(cx, obj, 0, obj2, shape);
|
||||
|
||||
@ -4733,7 +4745,7 @@ baseops::GetElement(JSContext *cx, HandleObject obj, HandleObject receiver, uint
|
||||
JSBool
|
||||
baseops::GetPropertyDefault(JSContext *cx, HandleObject obj, HandleId id, const Value &def, Value *vp)
|
||||
{
|
||||
RootedShape prop(cx);
|
||||
JSProperty *prop;
|
||||
RootedObject obj2(cx);
|
||||
if (!LookupPropertyWithFlags(cx, obj, id, JSRESOLVE_QUALIFIED, &obj2, &prop))
|
||||
return false;
|
||||
@ -4824,6 +4836,7 @@ JSBool
|
||||
baseops::SetPropertyHelper(JSContext *cx, HandleObject obj, HandleObject receiver, HandleId id,
|
||||
unsigned defineHow, Value *vp, JSBool strict)
|
||||
{
|
||||
JSProperty *prop;
|
||||
unsigned attrs, flags;
|
||||
int shortid;
|
||||
Class *clasp;
|
||||
@ -4841,10 +4854,9 @@ baseops::SetPropertyHelper(JSContext *cx, HandleObject obj, HandleObject receive
|
||||
}
|
||||
|
||||
RootedObject pobj(cx);
|
||||
RootedShape shape(cx);
|
||||
if (!LookupPropertyWithFlags(cx, obj, id, cx->resolveFlags, &pobj, &shape))
|
||||
if (!LookupPropertyWithFlags(cx, obj, id, cx->resolveFlags, &pobj, &prop))
|
||||
return false;
|
||||
if (shape) {
|
||||
if (prop) {
|
||||
if (!pobj->isNative()) {
|
||||
if (pobj->isProxy()) {
|
||||
AutoPropertyDescriptorRooter pd(cx);
|
||||
@ -4866,7 +4878,7 @@ baseops::SetPropertyHelper(JSContext *cx, HandleObject obj, HandleObject receive
|
||||
}
|
||||
}
|
||||
|
||||
shape = NULL;
|
||||
prop = NULL;
|
||||
}
|
||||
} else {
|
||||
/* We should never add properties to lexical blocks. */
|
||||
@ -4879,6 +4891,8 @@ baseops::SetPropertyHelper(JSContext *cx, HandleObject obj, HandleObject receive
|
||||
}
|
||||
}
|
||||
|
||||
RootedShape shape(cx, (Shape *) prop);
|
||||
|
||||
/*
|
||||
* Now either shape is null, meaning id was not found in obj or one of its
|
||||
* prototypes; or shape is non-null, meaning id was found directly in pobj.
|
||||
@ -5018,16 +5032,17 @@ JSBool
|
||||
baseops::GetAttributes(JSContext *cx, HandleObject obj, HandleId id, unsigned *attrsp)
|
||||
{
|
||||
RootedObject nobj(cx);
|
||||
RootedShape shape(cx);
|
||||
if (!baseops::LookupProperty(cx, obj, id, &nobj, &shape))
|
||||
JSProperty *prop;
|
||||
if (!baseops::LookupProperty(cx, obj, id, &nobj, &prop))
|
||||
return false;
|
||||
if (!shape) {
|
||||
if (!prop) {
|
||||
*attrsp = 0;
|
||||
return true;
|
||||
}
|
||||
if (!nobj->isNative())
|
||||
return nobj->getGenericAttributes(cx, id, attrsp);
|
||||
|
||||
Shape *shape = (Shape *)prop;
|
||||
*attrsp = shape->attributes();
|
||||
return true;
|
||||
}
|
||||
@ -5036,16 +5051,17 @@ JSBool
|
||||
baseops::GetElementAttributes(JSContext *cx, HandleObject obj, uint32_t index, unsigned *attrsp)
|
||||
{
|
||||
RootedObject nobj(cx);
|
||||
RootedShape shape(cx);
|
||||
if (!baseops::LookupElement(cx, obj, index, &nobj, &shape))
|
||||
JSProperty *prop;
|
||||
if (!baseops::LookupElement(cx, obj, index, &nobj, &prop))
|
||||
return false;
|
||||
if (!shape) {
|
||||
if (!prop) {
|
||||
*attrsp = 0;
|
||||
return true;
|
||||
}
|
||||
if (!nobj->isNative())
|
||||
return nobj->getElementAttributes(cx, index, attrsp);
|
||||
|
||||
Shape *shape = (Shape *)prop;
|
||||
*attrsp = shape->attributes();
|
||||
return true;
|
||||
}
|
||||
@ -5054,13 +5070,13 @@ JSBool
|
||||
baseops::SetAttributes(JSContext *cx, HandleObject obj, HandleId id, unsigned *attrsp)
|
||||
{
|
||||
RootedObject nobj(cx);
|
||||
RootedShape shape(cx);
|
||||
if (!baseops::LookupProperty(cx, obj, id, &nobj, &shape))
|
||||
JSProperty *prop;
|
||||
if (!baseops::LookupProperty(cx, obj, id, &nobj, &prop))
|
||||
return false;
|
||||
if (!shape)
|
||||
if (!prop)
|
||||
return true;
|
||||
return nobj->isNative()
|
||||
? nobj->changePropertyAttributes(cx, shape, *attrsp)
|
||||
? nobj->changePropertyAttributes(cx, (Shape *) prop, *attrsp)
|
||||
: nobj->setGenericAttributes(cx, id, attrsp);
|
||||
}
|
||||
|
||||
@ -5068,26 +5084,28 @@ JSBool
|
||||
baseops::SetElementAttributes(JSContext *cx, HandleObject obj, uint32_t index, unsigned *attrsp)
|
||||
{
|
||||
RootedObject nobj(cx);
|
||||
RootedShape shape(cx);
|
||||
if (!baseops::LookupElement(cx, obj, index, &nobj, &shape))
|
||||
JSProperty *prop;
|
||||
if (!baseops::LookupElement(cx, obj, index, &nobj, &prop))
|
||||
return false;
|
||||
if (!shape)
|
||||
if (!prop)
|
||||
return true;
|
||||
return nobj->isNative()
|
||||
? nobj->changePropertyAttributes(cx, shape, *attrsp)
|
||||
? nobj->changePropertyAttributes(cx, (Shape *) prop, *attrsp)
|
||||
: nobj->setElementAttributes(cx, index, attrsp);
|
||||
}
|
||||
|
||||
JSBool
|
||||
baseops::DeleteGeneric(JSContext *cx, HandleObject obj, HandleId id, Value *rval, JSBool strict)
|
||||
{
|
||||
JSProperty *prop;
|
||||
Shape *shape;
|
||||
|
||||
rval->setBoolean(true);
|
||||
|
||||
RootedObject proto(cx);
|
||||
RootedShape shape(cx);
|
||||
if (!baseops::LookupProperty(cx, obj, id, &proto, &shape))
|
||||
if (!baseops::LookupProperty(cx, obj, id, &proto, &prop))
|
||||
return false;
|
||||
if (!shape || proto != obj) {
|
||||
if (!prop || proto != obj) {
|
||||
/*
|
||||
* If no property, or the property comes from a prototype, call the
|
||||
* class's delProperty hook, passing rval as the result parameter.
|
||||
@ -5095,6 +5113,7 @@ baseops::DeleteGeneric(JSContext *cx, HandleObject obj, HandleId id, Value *rval
|
||||
return CallJSPropertyOp(cx, obj->getClass()->delProperty, obj, id, rval);
|
||||
}
|
||||
|
||||
shape = (Shape *)prop;
|
||||
if (!shape->configurable()) {
|
||||
if (strict)
|
||||
return obj->reportNotConfigurable(cx, id);
|
||||
@ -5286,6 +5305,9 @@ CheckAccess(JSContext *cx, JSObject *obj_, HandleId id, JSAccessMode mode,
|
||||
Value *vp, unsigned *attrsp)
|
||||
{
|
||||
JSBool writing;
|
||||
JSProperty *prop;
|
||||
Shape *shape;
|
||||
|
||||
RootedObject obj(cx, obj_), pobj(cx);
|
||||
|
||||
while (JS_UNLIKELY(obj->isWith()))
|
||||
@ -5301,10 +5323,9 @@ CheckAccess(JSContext *cx, JSObject *obj_, HandleId id, JSAccessMode mode,
|
||||
break;
|
||||
|
||||
default:
|
||||
RootedShape shape(cx);
|
||||
if (!obj->lookupGeneric(cx, id, &pobj, &shape))
|
||||
if (!obj->lookupGeneric(cx, id, &pobj, &prop))
|
||||
return JS_FALSE;
|
||||
if (!shape) {
|
||||
if (!prop) {
|
||||
if (!writing)
|
||||
vp->setUndefined();
|
||||
*attrsp = 0;
|
||||
@ -5320,6 +5341,7 @@ CheckAccess(JSContext *cx, JSObject *obj_, HandleId id, JSAccessMode mode,
|
||||
break;
|
||||
}
|
||||
|
||||
shape = (Shape *)prop;
|
||||
*attrsp = shape->attributes();
|
||||
if (!writing) {
|
||||
if (shape->hasSlot())
|
||||
|
@ -99,11 +99,11 @@ namespace baseops {
|
||||
*/
|
||||
extern JS_FRIEND_API(JSBool)
|
||||
LookupProperty(JSContext *cx, HandleObject obj, HandleId id, MutableHandleObject objp,
|
||||
MutableHandleShape propp);
|
||||
JSProperty **propp);
|
||||
|
||||
inline bool
|
||||
LookupProperty(JSContext *cx, HandleObject obj, PropertyName *name,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
MutableHandleObject objp, JSProperty **propp)
|
||||
{
|
||||
Rooted<jsid> id(cx, NameToId(name));
|
||||
return LookupProperty(cx, obj, id, objp, propp);
|
||||
@ -111,7 +111,7 @@ LookupProperty(JSContext *cx, HandleObject obj, PropertyName *name,
|
||||
|
||||
extern JS_FRIEND_API(JSBool)
|
||||
LookupElement(JSContext *cx, HandleObject obj, uint32_t index,
|
||||
MutableHandleObject objp, MutableHandleShape propp);
|
||||
MutableHandleObject objp, JSProperty **propp);
|
||||
|
||||
extern JSBool
|
||||
DefineGeneric(JSContext *cx, HandleObject obj, HandleId id, const js::Value *value,
|
||||
@ -785,14 +785,12 @@ struct JSObject : public js::ObjectImpl
|
||||
/* Clear the scope, making it empty. */
|
||||
void clear(JSContext *cx);
|
||||
|
||||
inline JSBool lookupGeneric(JSContext *cx, js::HandleId id,
|
||||
js::MutableHandleObject objp, js::MutableHandleShape propp);
|
||||
inline JSBool lookupProperty(JSContext *cx, js::PropertyName *name,
|
||||
js::MutableHandleObject objp, js::MutableHandleShape propp);
|
||||
inline JSBool lookupGeneric(JSContext *cx, js::HandleId id, js::MutableHandleObject objp, JSProperty **propp);
|
||||
inline JSBool lookupProperty(JSContext *cx, js::PropertyName *name, js::MutableHandleObject objp, JSProperty **propp);
|
||||
inline JSBool lookupElement(JSContext *cx, uint32_t index,
|
||||
js::MutableHandleObject objp, js::MutableHandleShape propp);
|
||||
js::MutableHandleObject objp, JSProperty **propp);
|
||||
inline JSBool lookupSpecial(JSContext *cx, js::SpecialId sid,
|
||||
js::MutableHandleObject objp, js::MutableHandleShape propp);
|
||||
js::MutableHandleObject objp, JSProperty **propp);
|
||||
|
||||
inline JSBool defineGeneric(JSContext *cx, js::HandleId id, const js::Value &value,
|
||||
JSPropertyOp getter = JS_PropertyStub,
|
||||
@ -1048,7 +1046,7 @@ js_HasOwnPropertyHelper(JSContext *cx, js::LookupGenericOp lookup, unsigned argc
|
||||
|
||||
extern JSBool
|
||||
js_HasOwnProperty(JSContext *cx, js::LookupGenericOp lookup, js::HandleObject obj, js::HandleId id,
|
||||
js::MutableHandleObject objp, js::MutableHandleShape propp);
|
||||
js::MutableHandleObject objp, JSProperty **propp);
|
||||
|
||||
extern JSBool
|
||||
js_PropertyIsEnumerable(JSContext *cx, js::HandleObject obj, js::HandleId id, js::Value *vp);
|
||||
@ -1167,11 +1165,11 @@ DefineNativeProperty(JSContext *cx, HandleObject obj, PropertyName *name, const
|
||||
*/
|
||||
extern bool
|
||||
LookupPropertyWithFlags(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
|
||||
js::MutableHandleObject objp, js::MutableHandleShape propp);
|
||||
js::MutableHandleObject objp, JSProperty **propp);
|
||||
|
||||
inline bool
|
||||
LookupPropertyWithFlags(JSContext *cx, HandleObject obj, PropertyName *name, unsigned flags,
|
||||
js::MutableHandleObject objp, js::MutableHandleShape propp)
|
||||
js::MutableHandleObject objp, JSProperty **propp)
|
||||
{
|
||||
Rooted<jsid> id(cx, NameToId(name));
|
||||
return LookupPropertyWithFlags(cx, obj, id, flags, objp, propp);
|
||||
@ -1210,7 +1208,7 @@ static const unsigned RESOLVE_INFER = 0xffff;
|
||||
extern bool
|
||||
FindPropertyHelper(JSContext *cx, HandlePropertyName name,
|
||||
bool cacheResult, HandleObject scopeChain,
|
||||
MutableHandleObject objp, MutableHandleObject pobjp, MutableHandleShape propp);
|
||||
MutableHandleObject objp, MutableHandleObject pobjp, JSProperty **propp);
|
||||
|
||||
/*
|
||||
* Search for name either on the current scope chain or on the scope chain's
|
||||
@ -1218,7 +1216,7 @@ FindPropertyHelper(JSContext *cx, HandlePropertyName name,
|
||||
*/
|
||||
extern bool
|
||||
FindProperty(JSContext *cx, HandlePropertyName name, HandleObject scopeChain,
|
||||
MutableHandleObject objp, MutableHandleObject pobjp, MutableHandleShape propp);
|
||||
MutableHandleObject objp, MutableHandleObject pobjp, JSProperty **propp);
|
||||
|
||||
extern JSObject *
|
||||
FindIdentifierBase(JSContext *cx, HandleObject scopeChain, HandlePropertyName name);
|
||||
|
@ -927,7 +927,7 @@ inline bool
|
||||
JSObject::hasProperty(JSContext *cx, js::HandleId id, bool *foundp, unsigned flags)
|
||||
{
|
||||
js::RootedObject pobj(cx);
|
||||
js::RootedShape prop(cx);
|
||||
JSProperty *prop;
|
||||
JSAutoResolveFlags rf(cx, flags);
|
||||
if (!lookupGeneric(cx, id, &pobj, &prop))
|
||||
return false;
|
||||
@ -1034,8 +1034,7 @@ JSObject::sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf,
|
||||
}
|
||||
|
||||
inline JSBool
|
||||
JSObject::lookupGeneric(JSContext *cx, js::HandleId id,
|
||||
js::MutableHandleObject objp, js::MutableHandleShape propp)
|
||||
JSObject::lookupGeneric(JSContext *cx, js::HandleId id, js::MutableHandleObject objp, JSProperty **propp)
|
||||
{
|
||||
js::RootedObject self(cx, this);
|
||||
|
||||
@ -1046,8 +1045,7 @@ JSObject::lookupGeneric(JSContext *cx, js::HandleId id,
|
||||
}
|
||||
|
||||
inline JSBool
|
||||
JSObject::lookupProperty(JSContext *cx, js::PropertyName *name,
|
||||
js::MutableHandleObject objp, js::MutableHandleShape propp)
|
||||
JSObject::lookupProperty(JSContext *cx, js::PropertyName *name, js::MutableHandleObject objp, JSProperty **propp)
|
||||
{
|
||||
js::Rooted<jsid> id(cx, js::NameToId(name));
|
||||
return lookupGeneric(cx, id, objp, propp);
|
||||
@ -1099,8 +1097,7 @@ JSObject::defineSpecial(JSContext *cx, js::SpecialId sid, const js::Value &value
|
||||
}
|
||||
|
||||
inline JSBool
|
||||
JSObject::lookupElement(JSContext *cx, uint32_t index,
|
||||
js::MutableHandleObject objp, js::MutableHandleShape propp)
|
||||
JSObject::lookupElement(JSContext *cx, uint32_t index, js::MutableHandleObject objp, JSProperty **propp)
|
||||
{
|
||||
js::RootedObject self(cx, this);
|
||||
|
||||
@ -1109,8 +1106,7 @@ JSObject::lookupElement(JSContext *cx, uint32_t index,
|
||||
}
|
||||
|
||||
inline JSBool
|
||||
JSObject::lookupSpecial(JSContext *cx, js::SpecialId sid,
|
||||
js::MutableHandleObject objp, js::MutableHandleShape propp)
|
||||
JSObject::lookupSpecial(JSContext *cx, js::SpecialId sid, js::MutableHandleObject objp, JSProperty **propp)
|
||||
{
|
||||
js::Rooted<jsid> id(cx, SPECIALID_TO_JSID(sid));
|
||||
return lookupGeneric(cx, id, objp, propp);
|
||||
@ -1158,7 +1154,7 @@ JSObject::getElementIfPresent(JSContext *cx, js::HandleObject receiver, uint32_t
|
||||
return false;
|
||||
|
||||
js::RootedObject obj2(cx);
|
||||
js::RootedShape prop(cx);
|
||||
JSProperty *prop;
|
||||
if (!self->lookupGeneric(cx, id, &obj2, &prop))
|
||||
return false;
|
||||
|
||||
|
@ -1221,34 +1221,34 @@ proxy_innerObject(JSContext *cx, HandleObject obj)
|
||||
}
|
||||
|
||||
static JSBool
|
||||
proxy_LookupGeneric(JSContext *cx, HandleObject obj, HandleId id,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
proxy_LookupGeneric(JSContext *cx, HandleObject obj, HandleId id, MutableHandleObject objp,
|
||||
JSProperty **propp)
|
||||
{
|
||||
bool found;
|
||||
if (!Proxy::has(cx, obj, id, &found))
|
||||
return false;
|
||||
|
||||
if (found) {
|
||||
MarkNonNativePropertyFound(obj, propp);
|
||||
*propp = (JSProperty *)0x1;
|
||||
objp.set(obj);
|
||||
} else {
|
||||
objp.set(NULL);
|
||||
propp.set(NULL);
|
||||
*propp = NULL;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
proxy_LookupProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
MutableHandleObject objp, JSProperty **propp)
|
||||
{
|
||||
Rooted<jsid> id(cx, NameToId(name));
|
||||
return proxy_LookupGeneric(cx, obj, id, objp, propp);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
proxy_LookupElement(JSContext *cx, HandleObject obj, uint32_t index,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
proxy_LookupElement(JSContext *cx, HandleObject obj, uint32_t index, MutableHandleObject objp,
|
||||
JSProperty **propp)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
@ -1258,7 +1258,7 @@ proxy_LookupElement(JSContext *cx, HandleObject obj, uint32_t index,
|
||||
|
||||
static JSBool
|
||||
proxy_LookupSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
MutableHandleObject objp, JSProperty **propp)
|
||||
{
|
||||
Rooted<jsid> id(cx, SPECIALID_TO_JSID(sid));
|
||||
return proxy_LookupGeneric(cx, obj, id, objp, propp);
|
||||
|
@ -51,6 +51,7 @@ typedef struct JSArgumentFormatMap JSArgumentFormatMap;
|
||||
typedef struct JSGCThing JSGCThing;
|
||||
typedef struct JSGenerator JSGenerator;
|
||||
typedef struct JSNativeEnumerator JSNativeEnumerator;
|
||||
typedef struct JSProperty JSProperty;
|
||||
typedef struct JSSharpObjectMap JSSharpObjectMap;
|
||||
typedef struct JSTryNote JSTryNote;
|
||||
|
||||
@ -224,8 +225,6 @@ typedef JS::Handle<types::TypeObject*> HandleTypeObject;
|
||||
typedef JS::Handle<JSAtom*> HandleAtom;
|
||||
typedef JS::Handle<PropertyName*> HandlePropertyName;
|
||||
|
||||
typedef JS::MutableHandle<Shape*> MutableHandleShape;
|
||||
|
||||
typedef JS::Rooted<Shape*> RootedShape;
|
||||
typedef JS::Rooted<BaseShape*> RootedBaseShape;
|
||||
typedef JS::Rooted<types::TypeObject*> RootedTypeObject;
|
||||
|
@ -1393,16 +1393,3 @@ JSCompartment::sweepInitialShapeTable()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Property lookup hooks on non-native objects are required to return a non-NULL
|
||||
* shape to signify that the property has been found. The actual shape returned
|
||||
* is arbitrary, and it should never be read from. We use the non-native
|
||||
* object's shape_ field, since it is readily available.
|
||||
*/
|
||||
void
|
||||
js::MarkNonNativePropertyFound(HandleObject obj, MutableHandleShape propp)
|
||||
{
|
||||
propp.set(obj->lastProperty());
|
||||
}
|
||||
|
||||
|
@ -1162,9 +1162,6 @@ Shape::searchNoAllocation(JSContext *cx, Shape *start, jsid id)
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
void
|
||||
MarkNonNativePropertyFound(HandleObject obj, MutableHandleShape propp);
|
||||
|
||||
} // namespace js
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
@ -295,12 +295,14 @@ ArrayBufferObject::obj_trace(JSTracer *trc, JSObject *obj)
|
||||
}
|
||||
}
|
||||
|
||||
static JSProperty * const PROPERTY_FOUND = reinterpret_cast<JSProperty *>(1);
|
||||
|
||||
JSBool
|
||||
ArrayBufferObject::obj_lookupGeneric(JSContext *cx, HandleObject obj, HandleId id,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
MutableHandleObject objp, JSProperty **propp)
|
||||
{
|
||||
if (JSID_IS_ATOM(id, cx->runtime->atomState.byteLengthAtom)) {
|
||||
MarkNonNativePropertyFound(obj, propp);
|
||||
*propp = PROPERTY_FOUND;
|
||||
objp.set(getArrayBuffer(obj));
|
||||
return true;
|
||||
}
|
||||
@ -319,7 +321,7 @@ ArrayBufferObject::obj_lookupGeneric(JSContext *cx, HandleObject obj, HandleId i
|
||||
if (!delegateResult)
|
||||
return false;
|
||||
|
||||
if (propp) {
|
||||
if (*propp != NULL) {
|
||||
if (objp == delegate)
|
||||
objp.set(obj);
|
||||
return true;
|
||||
@ -328,7 +330,7 @@ ArrayBufferObject::obj_lookupGeneric(JSContext *cx, HandleObject obj, HandleId i
|
||||
JSObject *proto = obj->getProto();
|
||||
if (!proto) {
|
||||
objp.set(NULL);
|
||||
propp.set(NULL);
|
||||
*propp = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -337,7 +339,7 @@ ArrayBufferObject::obj_lookupGeneric(JSContext *cx, HandleObject obj, HandleId i
|
||||
|
||||
JSBool
|
||||
ArrayBufferObject::obj_lookupProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
MutableHandleObject objp, JSProperty **propp)
|
||||
{
|
||||
Rooted<jsid> id(cx, NameToId(name));
|
||||
return obj_lookupGeneric(cx, obj, id, objp, propp);
|
||||
@ -345,7 +347,7 @@ ArrayBufferObject::obj_lookupProperty(JSContext *cx, HandleObject obj, HandlePro
|
||||
|
||||
JSBool
|
||||
ArrayBufferObject::obj_lookupElement(JSContext *cx, HandleObject obj, uint32_t index,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
MutableHandleObject objp, JSProperty **propp)
|
||||
{
|
||||
RootedObject delegate(cx, ArrayBufferDelegate(cx, obj));
|
||||
if (!delegate)
|
||||
@ -360,7 +362,7 @@ ArrayBufferObject::obj_lookupElement(JSContext *cx, HandleObject obj, uint32_t i
|
||||
if (!delegate->lookupElement(cx, index, objp, propp))
|
||||
return false;
|
||||
|
||||
if (propp) {
|
||||
if (*propp != NULL) {
|
||||
if (objp == delegate)
|
||||
objp.set(obj);
|
||||
return true;
|
||||
@ -370,13 +372,13 @@ ArrayBufferObject::obj_lookupElement(JSContext *cx, HandleObject obj, uint32_t i
|
||||
return proto->lookupElement(cx, index, objp, propp);
|
||||
|
||||
objp.set(NULL);
|
||||
propp.set(NULL);
|
||||
*propp = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
JSBool
|
||||
ArrayBufferObject::obj_lookupSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
MutableHandleObject objp, JSProperty **propp)
|
||||
{
|
||||
Rooted<jsid> id(cx, SPECIALID_TO_JSID(sid));
|
||||
return obj_lookupGeneric(cx, obj, id, objp, propp);
|
||||
@ -772,13 +774,13 @@ js::IsDataView(JSObject* obj)
|
||||
|
||||
JSBool
|
||||
TypedArray::obj_lookupGeneric(JSContext *cx, HandleObject obj, HandleId id,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
MutableHandleObject objp, JSProperty **propp)
|
||||
{
|
||||
JSObject *tarray = getTypedArray(obj);
|
||||
JS_ASSERT(tarray);
|
||||
|
||||
if (isArrayIndex(cx, tarray, id)) {
|
||||
MarkNonNativePropertyFound(obj, propp);
|
||||
*propp = PROPERTY_FOUND;
|
||||
objp.set(obj);
|
||||
return true;
|
||||
}
|
||||
@ -786,7 +788,7 @@ TypedArray::obj_lookupGeneric(JSContext *cx, HandleObject obj, HandleId id,
|
||||
JSObject *proto = obj->getProto();
|
||||
if (!proto) {
|
||||
objp.set(NULL);
|
||||
propp.set(NULL);
|
||||
*propp = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -795,7 +797,7 @@ TypedArray::obj_lookupGeneric(JSContext *cx, HandleObject obj, HandleId id,
|
||||
|
||||
JSBool
|
||||
TypedArray::obj_lookupProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
MutableHandleObject objp, JSProperty **propp)
|
||||
{
|
||||
Rooted<jsid> id(cx, NameToId(name));
|
||||
return obj_lookupGeneric(cx, obj, id, objp, propp);
|
||||
@ -803,13 +805,13 @@ TypedArray::obj_lookupProperty(JSContext *cx, HandleObject obj, HandlePropertyNa
|
||||
|
||||
JSBool
|
||||
TypedArray::obj_lookupElement(JSContext *cx, HandleObject obj, uint32_t index,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
MutableHandleObject objp, JSProperty **propp)
|
||||
{
|
||||
JSObject *tarray = getTypedArray(obj);
|
||||
JS_ASSERT(tarray);
|
||||
|
||||
if (index < length(tarray)) {
|
||||
MarkNonNativePropertyFound(obj, propp);
|
||||
*propp = PROPERTY_FOUND;
|
||||
objp.set(obj);
|
||||
return true;
|
||||
}
|
||||
@ -818,13 +820,13 @@ TypedArray::obj_lookupElement(JSContext *cx, HandleObject obj, uint32_t index,
|
||||
return proto->lookupElement(cx, index, objp, propp);
|
||||
|
||||
objp.set(NULL);
|
||||
propp.set(NULL);
|
||||
*propp = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
JSBool
|
||||
TypedArray::obj_lookupSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
MutableHandleObject objp, JSProperty **propp)
|
||||
{
|
||||
Rooted<jsid> id(cx, SPECIALID_TO_JSID(sid));
|
||||
return obj_lookupGeneric(cx, obj, id, objp, propp);
|
||||
|
@ -47,16 +47,16 @@ class ArrayBufferObject : public JSObject
|
||||
|
||||
static JSBool
|
||||
obj_lookupGeneric(JSContext *cx, HandleObject obj, HandleId id,
|
||||
MutableHandleObject objp, MutableHandleShape propp);
|
||||
MutableHandleObject objp, JSProperty **propp);
|
||||
static JSBool
|
||||
obj_lookupProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
|
||||
MutableHandleObject objp, MutableHandleShape propp);
|
||||
MutableHandleObject objp, JSProperty **propp);
|
||||
static JSBool
|
||||
obj_lookupElement(JSContext *cx, HandleObject obj, uint32_t index,
|
||||
MutableHandleObject objp, MutableHandleShape propp);
|
||||
MutableHandleObject objp, JSProperty **propp);
|
||||
static JSBool
|
||||
obj_lookupSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid,
|
||||
MutableHandleObject objp, MutableHandleShape propp);
|
||||
MutableHandleObject objp, JSProperty **propp);
|
||||
|
||||
static JSBool
|
||||
obj_defineGeneric(JSContext *cx, HandleObject obj, HandleId id, const Value *v,
|
||||
@ -189,13 +189,13 @@ struct TypedArray {
|
||||
static Class protoClasses[TYPE_MAX];
|
||||
|
||||
static JSBool obj_lookupGeneric(JSContext *cx, HandleObject obj, HandleId id,
|
||||
MutableHandleObject objp, MutableHandleShape propp);
|
||||
MutableHandleObject objp, JSProperty **propp);
|
||||
static JSBool obj_lookupProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
|
||||
MutableHandleObject objp, MutableHandleShape propp);
|
||||
MutableHandleObject objp, JSProperty **propp);
|
||||
static JSBool obj_lookupElement(JSContext *cx, HandleObject obj, uint32_t index,
|
||||
MutableHandleObject objp, MutableHandleShape propp);
|
||||
MutableHandleObject objp, JSProperty **propp);
|
||||
static JSBool obj_lookupSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid,
|
||||
MutableHandleObject objp, MutableHandleShape propp);
|
||||
MutableHandleObject objp, JSProperty **propp);
|
||||
|
||||
static JSBool obj_getGenericAttributes(JSContext *cx, HandleObject obj, HandleId id, unsigned *attrsp);
|
||||
static JSBool obj_getPropertyAttributes(JSContext *cx, HandleObject obj, HandlePropertyName name, unsigned *attrsp);
|
||||
|
@ -4632,6 +4632,7 @@ HasSimpleContent(JSXML *xml);
|
||||
static JSBool
|
||||
HasFunctionProperty(JSContext *cx, JSObject *obj_, jsid funid_, JSBool *found)
|
||||
{
|
||||
JSProperty *prop;
|
||||
JSXML *xml;
|
||||
|
||||
JS_ASSERT(obj_->getClass() == &XMLClass);
|
||||
@ -4640,7 +4641,6 @@ HasFunctionProperty(JSContext *cx, JSObject *obj_, jsid funid_, JSBool *found)
|
||||
|
||||
Rooted<JSObject*> obj(cx, obj_);
|
||||
RootedObject pobj(cx);
|
||||
RootedShape prop(cx);
|
||||
if (!baseops::LookupProperty(cx, obj, funid, &pobj, &prop))
|
||||
return false;
|
||||
if (!prop) {
|
||||
@ -4743,8 +4743,8 @@ HasProperty(JSContext *cx, JSObject *obj, jsval id, JSBool *found)
|
||||
* For a proper solution see bug 355257.
|
||||
*/
|
||||
static JSBool
|
||||
xml_lookupGeneric(JSContext *cx, HandleObject obj, HandleId id,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
xml_lookupGeneric(JSContext *cx, HandleObject obj, HandleId id, MutableHandleObject objp,
|
||||
JSProperty **propp)
|
||||
{
|
||||
JSBool found;
|
||||
JSXML *xml;
|
||||
@ -4766,7 +4766,7 @@ xml_lookupGeneric(JSContext *cx, HandleObject obj, HandleId id,
|
||||
}
|
||||
if (!found) {
|
||||
objp.set(NULL);
|
||||
propp.set(NULL);
|
||||
*propp = NULL;
|
||||
} else {
|
||||
Shape *shape =
|
||||
js_AddNativeProperty(cx, obj, id, GetProperty, PutProperty,
|
||||
@ -4776,14 +4776,14 @@ xml_lookupGeneric(JSContext *cx, HandleObject obj, HandleId id,
|
||||
return JS_FALSE;
|
||||
|
||||
objp.set(obj);
|
||||
propp.set(shape);
|
||||
*propp = (JSProperty *) shape;
|
||||
}
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
xml_lookupProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
MutableHandleObject objp, JSProperty **propp)
|
||||
{
|
||||
Rooted<jsid> id(cx, NameToId(name));
|
||||
return xml_lookupGeneric(cx, obj, id, objp, propp);
|
||||
@ -4791,12 +4791,12 @@ xml_lookupProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
|
||||
|
||||
static JSBool
|
||||
xml_lookupElement(JSContext *cx, HandleObject obj, uint32_t index, MutableHandleObject objp,
|
||||
MutableHandleShape propp)
|
||||
JSProperty **propp)
|
||||
{
|
||||
JSXML *xml = reinterpret_cast<JSXML *>(obj->getPrivate());
|
||||
if (!HasIndexedProperty(xml, index)) {
|
||||
objp.set(NULL);
|
||||
propp.set(NULL);
|
||||
*propp = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -4811,13 +4811,13 @@ xml_lookupElement(JSContext *cx, HandleObject obj, uint32_t index, MutableHandle
|
||||
return false;
|
||||
|
||||
objp.set(obj);
|
||||
propp.set(shape);
|
||||
*propp = (JSProperty *) shape;
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSBool
|
||||
xml_lookupSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
MutableHandleObject objp, JSProperty **propp)
|
||||
{
|
||||
Rooted<jsid> id(cx, SPECIALID_TO_JSID(sid));
|
||||
return xml_lookupGeneric(cx, obj, id, objp, propp);
|
||||
@ -7745,6 +7745,7 @@ js_FindXMLProperty(JSContext *cx, const Value &nameval, MutableHandleObject objp
|
||||
JSObject *obj, *target, *proto;
|
||||
JSXML *xml;
|
||||
JSBool found;
|
||||
JSProperty *prop;
|
||||
|
||||
JS_ASSERT(nameval.isObject());
|
||||
nameobj = &nameval.toObject();
|
||||
@ -7791,7 +7792,6 @@ js_FindXMLProperty(JSContext *cx, const Value &nameval, MutableHandleObject objp
|
||||
}
|
||||
} else if (!JSID_IS_VOID(funid)) {
|
||||
RootedObject pobj(cx);
|
||||
RootedShape prop(cx);
|
||||
if (!target->lookupGeneric(cx, funid, &pobj, &prop))
|
||||
return JS_FALSE;
|
||||
if (prop) {
|
||||
|
@ -5071,12 +5071,13 @@ mjit::Compiler::testSingletonProperty(HandleObject obj, HandleId id)
|
||||
}
|
||||
|
||||
RootedObject holder(cx);
|
||||
RootedShape shape(cx);
|
||||
if (!obj->lookupGeneric(cx, id, &holder, &shape))
|
||||
JSProperty *prop = NULL;
|
||||
if (!obj->lookupGeneric(cx, id, &holder, &prop))
|
||||
return false;
|
||||
if (!shape)
|
||||
if (!prop)
|
||||
return false;
|
||||
|
||||
Shape *shape = (Shape *) prop;
|
||||
if (shape->hasDefaultGetter()) {
|
||||
if (!shape->hasSlot())
|
||||
return false;
|
||||
|
@ -2686,17 +2686,18 @@ mjit::Compiler::jsop_initprop()
|
||||
}
|
||||
|
||||
RootedObject holder(cx);
|
||||
RootedShape shape(cx);
|
||||
JSProperty *prop = NULL;
|
||||
Rooted<jsid> id(cx, NameToId(name));
|
||||
#ifdef DEBUG
|
||||
bool res =
|
||||
#endif
|
||||
LookupPropertyWithFlags(cx, baseobj, id, JSRESOLVE_QUALIFIED, &holder, &shape);
|
||||
JS_ASSERT(res && shape && holder == baseobj);
|
||||
LookupPropertyWithFlags(cx, baseobj, id, JSRESOLVE_QUALIFIED, &holder, &prop);
|
||||
JS_ASSERT(res && prop && holder == baseobj);
|
||||
|
||||
RegisterID objReg = frame.copyDataIntoReg(obj);
|
||||
|
||||
/* Perform the store. */
|
||||
Shape *shape = (Shape *) prop;
|
||||
Address address = masm.objPropAddress(baseobj, objReg, shape->slot());
|
||||
frame.storeTo(fe, address);
|
||||
frame.freeReg(objReg);
|
||||
|
@ -454,17 +454,19 @@ class SetPropCompiler : public PICStubCompiler
|
||||
return disable("ops set property hook");
|
||||
|
||||
RootedObject holder(cx);
|
||||
RootedShape shape(cx);
|
||||
JSProperty *prop = NULL;
|
||||
|
||||
/* lookupProperty can trigger recompilations. */
|
||||
RecompilationMonitor monitor(cx);
|
||||
if (!obj->lookupProperty(cx, name, &holder, &shape))
|
||||
if (!obj->lookupProperty(cx, name, &holder, &prop))
|
||||
return error();
|
||||
if (monitor.recompiled())
|
||||
return Lookup_Uncacheable;
|
||||
|
||||
/* If the property exists but is on a prototype, treat as addprop. */
|
||||
if (shape && holder != obj) {
|
||||
if (prop && holder != obj) {
|
||||
Shape *shape = (Shape *) prop;
|
||||
|
||||
if (!holder->isNative())
|
||||
return disable("non-native holder");
|
||||
|
||||
@ -477,10 +479,10 @@ class SetPropCompiler : public PICStubCompiler
|
||||
if (!shape->hasSlot())
|
||||
return disable("missing slot");
|
||||
|
||||
shape = NULL;
|
||||
prop = NULL;
|
||||
}
|
||||
|
||||
if (!shape) {
|
||||
if (!prop) {
|
||||
/* Adding a property to the object. */
|
||||
if (obj->isDelegate())
|
||||
return disable("delegate");
|
||||
@ -521,7 +523,7 @@ class SetPropCompiler : public PICStubCompiler
|
||||
* populate the slot to satisfy the method invariant (in case we
|
||||
* hit an early return below).
|
||||
*/
|
||||
shape =
|
||||
Shape *shape =
|
||||
obj->putProperty(cx, name, getter, clasp->setProperty,
|
||||
SHAPE_INVALID_SLOT, JSPROP_ENUMERATE, flags, 0);
|
||||
if (!shape)
|
||||
@ -573,6 +575,7 @@ class SetPropCompiler : public PICStubCompiler
|
||||
return generateStub(initialShape, shape, true);
|
||||
}
|
||||
|
||||
Shape *shape = (Shape *) prop;
|
||||
if (!shape->writable())
|
||||
return disable("readonly");
|
||||
if (shape->hasDefaultSetter()) {
|
||||
@ -658,14 +661,14 @@ struct GetPropHelper {
|
||||
// These fields are set by |bind| and |lookup|. After a call to either
|
||||
// function, these are set exactly as they are in JSOP_GETPROP or JSOP_NAME.
|
||||
RootedObject holder;
|
||||
RootedShape prop;
|
||||
JSProperty *prop;
|
||||
|
||||
// This field is set by |bind| and |lookup| only if they returned
|
||||
// Lookup_Cacheable, otherwise it is NULL.
|
||||
RootedShape shape;
|
||||
Shape *shape;
|
||||
|
||||
GetPropHelper(JSContext *cx, JSObject *obj, PropertyName *name, IC &ic, VMFrame &f)
|
||||
: cx(cx), obj(cx, obj), name(cx, name), ic(ic), f(f), holder(cx), prop(cx), shape(cx)
|
||||
: cx(cx), obj(cx, obj), name(cx, name), ic(ic), f(f), holder(cx), prop(NULL), shape(NULL)
|
||||
{ }
|
||||
|
||||
public:
|
||||
@ -684,7 +687,7 @@ struct GetPropHelper {
|
||||
return ic.disable(cx, "non-native");
|
||||
if (!IsCacheableProtoChain(obj, holder))
|
||||
return ic.disable(cx, "non-native holder");
|
||||
shape = prop;
|
||||
shape = (Shape *)prop;
|
||||
return Lookup_Cacheable;
|
||||
}
|
||||
|
||||
@ -705,7 +708,7 @@ struct GetPropHelper {
|
||||
return ic.disable(f, "lookup failed");
|
||||
if (!IsCacheableProtoChain(obj, holder))
|
||||
return ic.disable(f, "non-native holder");
|
||||
shape = prop;
|
||||
shape = (Shape *)prop;
|
||||
return Lookup_Cacheable;
|
||||
}
|
||||
|
||||
@ -1672,7 +1675,7 @@ class ScopeNameCompiler : public PICStubCompiler
|
||||
{
|
||||
JSObject *obj = getprop.obj;
|
||||
Rooted<JSObject*> holder(cx, getprop.holder);
|
||||
RootedShape prop(cx, getprop.prop);
|
||||
const JSProperty *prop = getprop.prop;
|
||||
|
||||
if (!prop) {
|
||||
/* Kludge to allow (typeof foo == "undefined") tests. */
|
||||
@ -1695,7 +1698,7 @@ class ScopeNameCompiler : public PICStubCompiler
|
||||
return true;
|
||||
}
|
||||
|
||||
RootedShape shape(cx, getprop.shape);
|
||||
Shape *shape = getprop.shape;
|
||||
Rooted<JSObject*> normalized(cx, obj);
|
||||
if (obj->isWith() && !shape->hasDefaultGetter())
|
||||
normalized = &obj->asWith().object();
|
||||
|
@ -193,7 +193,7 @@ stubs::ImplicitThis(VMFrame &f, PropertyName *name_)
|
||||
RootedPropertyName name(f.cx, name_);
|
||||
|
||||
RootedObject obj(f.cx), obj2(f.cx);
|
||||
RootedShape prop(f.cx);
|
||||
JSProperty *prop;
|
||||
if (!FindPropertyHelper(f.cx, name, false, scopeObj, &obj, &obj2, &prop))
|
||||
THROW();
|
||||
|
||||
@ -338,16 +338,16 @@ stubs::DefFun(VMFrame &f, JSFunction *fun_)
|
||||
|
||||
/* ES5 10.5 (NB: with subsequent errata). */
|
||||
PropertyName *name = fun->atom->asPropertyName();
|
||||
RootedShape shape(cx);
|
||||
JSProperty *prop = NULL;
|
||||
RootedObject pobj(cx);
|
||||
if (!parent->lookupProperty(cx, name, &pobj, &shape))
|
||||
if (!parent->lookupProperty(cx, name, &pobj, &prop))
|
||||
THROW();
|
||||
|
||||
Value rval = ObjectValue(*fun);
|
||||
|
||||
do {
|
||||
/* Steps 5d, 5f. */
|
||||
if (!shape || pobj != parent) {
|
||||
if (!prop || pobj != parent) {
|
||||
if (!parent->defineProperty(cx, name, rval,
|
||||
JS_PropertyStub, JS_StrictPropertyStub, attrs))
|
||||
{
|
||||
@ -358,6 +358,7 @@ stubs::DefFun(VMFrame &f, JSFunction *fun_)
|
||||
|
||||
/* Step 5e. */
|
||||
JS_ASSERT(parent->isNative());
|
||||
Shape *shape = reinterpret_cast<Shape *>(prop);
|
||||
if (parent->isGlobal()) {
|
||||
if (shape->configurable()) {
|
||||
if (!parent->defineProperty(cx, name, rval,
|
||||
@ -1338,7 +1339,7 @@ stubs::DelName(VMFrame &f, PropertyName *name_)
|
||||
RootedPropertyName name(f.cx, name_);
|
||||
|
||||
RootedObject obj(f.cx), obj2(f.cx);
|
||||
RootedShape prop(f.cx);
|
||||
JSProperty *prop;
|
||||
if (!FindProperty(f.cx, name, scopeObj, &obj, &obj2, &prop))
|
||||
THROW();
|
||||
|
||||
@ -1438,7 +1439,7 @@ stubs::In(VMFrame &f)
|
||||
THROWV(JS_FALSE);
|
||||
|
||||
RootedObject obj2(cx);
|
||||
RootedShape prop(cx);
|
||||
JSProperty *prop;
|
||||
if (!obj->lookupGeneric(cx, id, &obj2, &prop))
|
||||
THROWV(JS_FALSE);
|
||||
|
||||
|
@ -2689,18 +2689,19 @@ static JSBool
|
||||
CopyProperty(JSContext *cx, HandleObject obj, HandleObject referent, HandleId id,
|
||||
unsigned lookupFlags, MutableHandleObject objp)
|
||||
{
|
||||
RootedShape shape(cx);
|
||||
JSProperty *prop;
|
||||
PropertyDescriptor desc;
|
||||
unsigned propFlags = 0;
|
||||
RootedObject obj2(cx);
|
||||
|
||||
objp.set(NULL);
|
||||
if (referent->isNative()) {
|
||||
if (!LookupPropertyWithFlags(cx, referent, id, lookupFlags, &obj2, &shape))
|
||||
if (!LookupPropertyWithFlags(cx, referent, id, lookupFlags, &obj2, &prop))
|
||||
return false;
|
||||
if (obj2 != referent)
|
||||
return true;
|
||||
|
||||
const Shape *shape = (Shape *) prop;
|
||||
if (shape->hasSlot()) {
|
||||
desc.value = referent->nativeGetSlot(shape->slot());
|
||||
} else {
|
||||
@ -2723,7 +2724,7 @@ CopyProperty(JSContext *cx, HandleObject obj, HandleObject referent, HandleId id
|
||||
if (!desc.obj)
|
||||
return true;
|
||||
} else {
|
||||
if (!referent->lookupGeneric(cx, id, objp, &shape))
|
||||
if (!referent->lookupGeneric(cx, id, objp, &prop))
|
||||
return false;
|
||||
if (objp != referent)
|
||||
return true;
|
||||
|
@ -259,7 +259,7 @@ args_enumerate(JSContext *cx, HandleObject obj)
|
||||
: INT_TO_JSID(i);
|
||||
|
||||
RootedObject pobj(cx);
|
||||
RootedShape prop(cx);
|
||||
JSProperty *prop;
|
||||
if (!baseops::LookupProperty(cx, argsobj, id, &pobj, &prop))
|
||||
return false;
|
||||
}
|
||||
@ -369,7 +369,7 @@ strictargs_enumerate(JSContext *cx, HandleObject obj)
|
||||
* js_LookupProperty calls.
|
||||
*/
|
||||
RootedObject pobj(cx);
|
||||
RootedShape prop(cx);
|
||||
JSProperty *prop;
|
||||
RootedId id(cx);
|
||||
|
||||
// length
|
||||
|
@ -4413,7 +4413,7 @@ DebuggerEnv_find(JSContext *cx, unsigned argc, Value *vp)
|
||||
|
||||
/* This can trigger resolve hooks. */
|
||||
ErrorCopier ec(ac, dbg->toJSObject());
|
||||
RootedShape prop(cx);
|
||||
JSProperty *prop = NULL;
|
||||
RootedObject pobj(cx);
|
||||
for (; env && !prop; env = env->enclosingScope()) {
|
||||
if (!env->lookupGeneric(cx, id, &pobj, &prop))
|
||||
|
@ -351,22 +351,22 @@ WithObject::create(JSContext *cx, HandleObject proto, HandleObject enclosing, ui
|
||||
|
||||
static JSBool
|
||||
with_LookupGeneric(JSContext *cx, HandleObject obj, HandleId id,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
MutableHandleObject objp, JSProperty **propp)
|
||||
{
|
||||
return obj->asWith().object().lookupGeneric(cx, id, objp, propp);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
with_LookupProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
MutableHandleObject objp, JSProperty **propp)
|
||||
{
|
||||
Rooted<jsid> id(cx, NameToId(name));
|
||||
return with_LookupGeneric(cx, obj, id, objp, propp);
|
||||
}
|
||||
|
||||
static JSBool
|
||||
with_LookupElement(JSContext *cx, HandleObject obj, uint32_t index,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
with_LookupElement(JSContext *cx, HandleObject obj, uint32_t index, MutableHandleObject objp,
|
||||
JSProperty **propp)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
@ -376,7 +376,7 @@ with_LookupElement(JSContext *cx, HandleObject obj, uint32_t index,
|
||||
|
||||
static JSBool
|
||||
with_LookupSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
MutableHandleObject objp, JSProperty **propp)
|
||||
{
|
||||
Rooted<jsid> id(cx, SPECIALID_TO_JSID(sid));
|
||||
return with_LookupGeneric(cx, obj, id, objp, propp);
|
||||
|
Loading…
Reference in New Issue
Block a user