Bug 608959 - Don't call non-scripted getters with a proxy as its |this|, because that would require most non-scripted getters to unwrap and maybe do some prototype-chain walking. r=mrbkap

This commit is contained in:
Jeff Walden 2010-11-04 15:53:50 -07:00
parent 0132e2e110
commit b5ac7e26bd
4 changed files with 10 additions and 10 deletions

View File

@ -4836,8 +4836,8 @@ js_FindIdentifierBase(JSContext *cx, JSObject *scopeChain, jsid id)
}
static JS_ALWAYS_INLINE JSBool
js_NativeGetInline(JSContext *cx, JSObject *obj, JSObject *pobj, const Shape *shape, uintN getHow,
Value *vp)
js_NativeGetInline(JSContext *cx, JSObject *receiver, JSObject *obj, JSObject *pobj,
const Shape *shape, uintN getHow, Value *vp)
{
LeaveTraceIfGlobalObject(cx, pobj);
@ -4865,7 +4865,7 @@ js_NativeGetInline(JSContext *cx, JSObject *obj, JSObject *pobj, const Shape *sh
{
AutoShapeRooter tvr(cx, shape);
AutoObjectRooter tvr2(cx, pobj);
if (!shape->get(cx, obj, pobj, vp))
if (!shape->get(cx, receiver, obj, pobj, vp))
return false;
}
@ -4884,7 +4884,7 @@ JSBool
js_NativeGet(JSContext *cx, JSObject *obj, JSObject *pobj, const Shape *shape, uintN getHow,
Value *vp)
{
return js_NativeGetInline(cx, obj, pobj, shape, getHow, vp);
return js_NativeGetInline(cx, obj, obj, pobj, shape, getHow, vp);
}
JSBool
@ -5039,7 +5039,7 @@ js_GetPropertyHelperWithShapeInline(JSContext *cx, JSObject *obj, JSObject *rece
}
/* This call site is hot -- use the always-inlined variant of js_NativeGet(). */
if (!js_NativeGetInline(cx, receiver, obj2, shape, getHow, vp))
if (!js_NativeGetInline(cx, receiver, obj, obj2, shape, getHow, vp))
return JS_FALSE;
return JS_TRUE;

View File

@ -176,11 +176,11 @@ typedef Vector<PropDesc, 1> PropDescArray;
} /* namespace js */
struct JSObjectMap {
static JS_FRIEND_DATA(const JSObjectMap) sharedNonNative;
uint32 shape; /* shape identifier */
uint32 slotSpan; /* one more than maximum live slot number */
static JS_FRIEND_DATA(const JSObjectMap) sharedNonNative;
explicit JSObjectMap(uint32 shape) : shape(shape), slotSpan(0) {}
JSObjectMap(uint32 shape, uint32 slotSpan) : shape(shape), slotSpan(slotSpan) {}

View File

@ -551,7 +551,7 @@ struct Shape : public JSObjectMap
uint32 aslot, uintN aattrs, uintN aflags,
intN ashortid) const;
bool get(JSContext* cx, JSObject *obj, JSObject *pobj, js::Value* vp) const;
bool get(JSContext* cx, JSObject *receiver, JSObject *obj, JSObject *pobj, js::Value* vp) const;
bool set(JSContext* cx, JSObject *obj, js::Value* vp) const;
inline bool isSharedPermanent() const;

View File

@ -231,7 +231,7 @@ Shape::matchesParamsAfterId(js::PropertyOp agetter, js::PropertyOp asetter, uint
}
inline bool
Shape::get(JSContext* cx, JSObject* obj, JSObject *pobj, js::Value* vp) const
Shape::get(JSContext* cx, JSObject *receiver, JSObject* obj, JSObject *pobj, js::Value* vp) const
{
JS_ASSERT(!JSID_IS_VOID(this->id));
JS_ASSERT(!hasDefaultGetter());
@ -239,7 +239,7 @@ Shape::get(JSContext* cx, JSObject* obj, JSObject *pobj, js::Value* vp) const
if (hasGetterValue()) {
JS_ASSERT(!isMethod());
js::Value fval = getterValue();
return js::ExternalGetOrSet(cx, obj, id, fval, JSACC_READ, 0, 0, vp);
return js::ExternalGetOrSet(cx, receiver, id, fval, JSACC_READ, 0, 0, vp);
}
if (isMethod()) {