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

--HG--
extra : rebase_source : 9239eb648466f929733428eb1a18bb0c0af51506
This commit is contained in:
Jeff Walden 2011-10-05 17:16:25 -07:00
parent 0ada627fa4
commit 9ca9fe0086
15 changed files with 117 additions and 79 deletions

View File

@ -3894,7 +3894,7 @@ JS_SetPropertyById(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
CHECK_REQUEST(cx);
assertSameCompartment(cx, obj, id);
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED | JSRESOLVE_ASSIGNING);
return obj->setProperty(cx, id, vp, false);
return obj->setGeneric(cx, id, vp, false);
}
JS_PUBLIC_API(JSBool)

View File

@ -481,7 +481,7 @@ SetArrayElement(JSContext *cx, JSObject *obj, jsdouble index, const Value &v)
JS_ASSERT(!JSID_IS_VOID(idr.id()));
Value tmp = v;
return obj->setProperty(cx, idr.id(), &tmp, true);
return obj->setGeneric(cx, idr.id(), &tmp, true);
}
#ifdef JS_TRACER
@ -564,13 +564,10 @@ SetOrDeleteArrayElement(JSContext *cx, JSObject *obj, jsdouble index,
JSBool
js_SetLengthProperty(JSContext *cx, JSObject *obj, jsdouble length)
{
Value v;
jsid id;
Value v = NumberValue(length);
v.setNumber(length);
id = ATOM_TO_JSID(cx->runtime->atomState.lengthAtom);
/* We don't support read-only array length yet. */
return obj->setProperty(cx, id, &v, false);
return obj->setProperty(cx, cx->runtime->atomState.lengthAtom, &v, false);
}
/*
@ -902,7 +899,7 @@ array_typeOf(JSContext *cx, JSObject *obj)
}
static JSBool
array_setProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
array_setGeneric(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
{
uint32 i;
@ -937,6 +934,12 @@ array_setProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool stric
return js_SetPropertyHelper(cx, obj, id, 0, vp, strict);
}
static JSBool
array_setProperty(JSContext *cx, JSObject *obj, PropertyName *name, Value *vp, JSBool strict)
{
return array_setGeneric(cx, obj, ATOM_TO_JSID(name), vp, strict);
}
static JSBool
array_setElement(JSContext *cx, JSObject *obj, uint32 index, Value *vp, JSBool strict)
{
@ -979,7 +982,7 @@ array_setElement(JSContext *cx, JSObject *obj, uint32 index, Value *vp, JSBool s
static JSBool
array_setSpecial(JSContext *cx, JSObject *obj, SpecialId sid, Value *vp, JSBool strict)
{
return array_setProperty(cx, obj, SPECIALID_TO_JSID(sid), vp, strict);
return array_setGeneric(cx, obj, SPECIALID_TO_JSID(sid), vp, strict);
}
JSBool
@ -1273,7 +1276,7 @@ Class js::ArrayClass = {
array_getProperty,
array_getElement,
array_getSpecial,
array_setProperty,
array_setGeneric,
array_setProperty,
array_setElement,
array_setSpecial,
@ -1816,7 +1819,7 @@ InitArrayElements(JSContext *cx, JSObject *obj, jsuint start, jsuint count, cons
do {
*tvr.addr() = *vector++;
if (!js_ValueToStringId(cx, idval, idr.addr()) ||
!obj->setProperty(cx, idr.id(), tvr.addr(), true)) {
!obj->setGeneric(cx, idr.id(), tvr.addr(), true)) {
return JS_FALSE;
}
idval.getDoubleRef() += 1;

View File

@ -212,7 +212,7 @@ typedef JSBool
typedef JSBool
(* StrictGenericIdOp)(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict);
typedef JSBool
(* StrictPropertyIdOp)(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict);
(* StrictPropertyIdOp)(JSContext *cx, JSObject *obj, PropertyName *name, Value *vp, JSBool strict);
typedef JSBool
(* StrictElementIdOp)(JSContext *cx, JSObject *obj, uint32 index, Value *vp, JSBool strict);
typedef JSBool

View File

@ -3342,7 +3342,7 @@ do_incop:
{
JSAutoResolveFlags rf(cx, setPropFlags);
if (!obj->setProperty(cx, id, &ref, script->strictModeCode))
if (!obj->setGeneric(cx, id, &ref, script->strictModeCode))
goto error;
}
@ -3359,7 +3359,7 @@ do_incop:
{
JSAutoResolveFlags rf(cx, setPropFlags);
if (!obj->setProperty(cx, id, &regs.sp[-1], script->strictModeCode))
if (!obj->setGeneric(cx, id, &regs.sp[-1], script->strictModeCode))
goto error;
}
@ -3795,7 +3795,7 @@ BEGIN_CASE(JSOP_SETMETHOD)
if (!js_SetPropertyHelper(cx, obj, id, defineHow, &rval, script->strictModeCode))
goto error;
} else {
if (!obj->setProperty(cx, id, &rval, script->strictModeCode))
if (!obj->setGeneric(cx, id, &rval, script->strictModeCode))
goto error;
ABORT_RECORDING(cx, "Non-native set");
}
@ -3944,7 +3944,7 @@ BEGIN_CASE(JSOP_SETELEM)
}
} while (0);
rval = regs.sp[-1];
if (!obj->setProperty(cx, id, &rval, script->strictModeCode))
if (!obj->setGeneric(cx, id, &rval, script->strictModeCode))
goto error;
end_setelem:;
}
@ -3958,7 +3958,7 @@ BEGIN_CASE(JSOP_ENUMELEM)
jsid id;
FETCH_ELEMENT_ID(obj, -1, id);
Value rval = regs.sp[-3];
if (!obj->setProperty(cx, id, &rval, script->strictModeCode))
if (!obj->setGeneric(cx, id, &rval, script->strictModeCode))
goto error;
regs.sp -= 3;
}
@ -4666,8 +4666,6 @@ BEGIN_CASE(JSOP_DEFFUN)
Value rval = ObjectValue(*obj);
do {
PropertyName *name = fun->atom->asPropertyName();
/* Steps 5d, 5f. */
if (!prop || pobj != parent) {
if (!parent->defineProperty(cx, name, rval,
@ -4709,7 +4707,7 @@ BEGIN_CASE(JSOP_DEFFUN)
*/
/* Step 5f. */
if (!parent->setProperty(cx, id, &rval, script->strictModeCode))
if (!parent->setProperty(cx, name, &rval, script->strictModeCode))
goto error;
} while (false);
}
@ -4736,10 +4734,10 @@ BEGIN_CASE(JSOP_DEFFUN_FC)
if (!CheckRedeclaration(cx, &parent, id, attrs))
goto error;
PropertyName *name = fun->atom->asPropertyName();
if ((attrs == JSPROP_ENUMERATE)
? !parent.setProperty(cx, id, &rval, script->strictModeCode)
: !parent.defineProperty(cx, fun->atom->asPropertyName(), rval,
JS_PropertyStub, JS_StrictPropertyStub, attrs))
? !parent.setProperty(cx, name, &rval, script->strictModeCode)
: !parent.defineProperty(cx, name, rval, JS_PropertyStub, JS_StrictPropertyStub, attrs))
{
goto error;
}
@ -5580,7 +5578,7 @@ BEGIN_CASE(JSOP_SETXMLNAME)
Value rval = regs.sp[-1];
jsid id;
FETCH_ELEMENT_ID(obj, -2, id);
if (!obj->setProperty(cx, id, &rval, script->strictModeCode))
if (!obj->setGeneric(cx, id, &rval, script->strictModeCode))
goto error;
rval = regs.sp[-1];
regs.sp -= 2;

View File

@ -3310,24 +3310,27 @@ with_GetSpecial(JSContext *cx, JSObject *obj, JSObject *receiver, SpecialId sid,
}
static JSBool
with_SetProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
with_SetGeneric(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
{
return obj->getProto()->setProperty(cx, id, vp, strict);
return obj->getProto()->setGeneric(cx, id, vp, strict);
}
static JSBool
with_SetProperty(JSContext *cx, JSObject *obj, PropertyName *name, Value *vp, JSBool strict)
{
return obj->getProto()->setProperty(cx, name, vp, strict);
}
static JSBool
with_SetElement(JSContext *cx, JSObject *obj, uint32 index, Value *vp, JSBool strict)
{
jsid id;
if (!IndexToId(cx, index, &id))
return false;
return with_SetProperty(cx, obj, id, vp, strict);
return obj->getProto()->setElement(cx, index, vp, strict);
}
static JSBool
with_SetSpecial(JSContext *cx, JSObject *obj, SpecialId sid, Value *vp, JSBool strict)
{
return with_SetProperty(cx, obj, SPECIALID_TO_JSID(sid), vp, strict);
return obj->getProto()->setSpecial(cx, sid, vp, strict);
}
static JSBool
@ -3453,7 +3456,7 @@ Class js::WithClass = {
with_GetProperty,
with_GetElement,
with_GetSpecial,
with_SetProperty,
with_SetGeneric,
with_SetProperty,
with_SetElement,
with_SetSpecial,
@ -3670,7 +3673,7 @@ JSObject::nonNativeSetProperty(JSContext *cx, jsid id, js::Value *vp, JSBool str
if (wpmap && !wpmap->triggerWatchpoint(cx, this, id, vp))
return false;
}
return getOps()->setProperty(cx, this, id, vp, strict);
return getOps()->setGeneric(cx, this, id, vp, strict);
}
JSBool

View File

@ -1385,17 +1385,10 @@ struct JSObject : js::gc::Cell {
inline JSBool getElement(JSContext *cx, uint32 index, 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)
return nonNativeSetProperty(cx, id, vp, strict);
return js_SetPropertyHelper(cx, this, id, 0, vp, strict);
}
JSBool setElement(JSContext *cx, uint32 index, js::Value *vp, JSBool strict) {
if (getOps()->setElement)
return nonNativeSetElement(cx, index, vp, strict);
return js_SetElementHelper(cx, this, index, 0, vp, strict);
}
inline JSBool setGeneric(JSContext *cx, jsid id, js::Value *vp, JSBool strict);
inline JSBool setProperty(JSContext *cx, js::PropertyName *name, js::Value *vp, JSBool strict);
inline JSBool setElement(JSContext *cx, uint32 index, js::Value *vp, JSBool strict);
inline JSBool setSpecial(JSContext *cx, js::SpecialId sid, js::Value *vp, JSBool strict);
JSBool nonNativeSetProperty(JSContext *cx, jsid id, js::Value *vp, JSBool strict);

View File

@ -125,6 +125,34 @@ JSObject::unbrand(JSContext *cx)
return true;
}
inline JSBool
JSObject::setGeneric(JSContext *cx, jsid id, js::Value *vp, JSBool strict)
{
if (getOps()->setGeneric)
return nonNativeSetProperty(cx, id, vp, strict);
return js_SetPropertyHelper(cx, this, id, 0, vp, strict);
}
inline JSBool
JSObject::setProperty(JSContext *cx, js::PropertyName *name, js::Value *vp, JSBool strict)
{
return setGeneric(cx, ATOM_TO_JSID(name), vp, strict);
}
inline JSBool
JSObject::setElement(JSContext *cx, uint32 index, js::Value *vp, JSBool strict)
{
if (getOps()->setElement)
return nonNativeSetElement(cx, index, vp, strict);
return js_SetElementHelper(cx, this, index, 0, vp, strict);
}
inline JSBool
JSObject::setSpecial(JSContext *cx, js::SpecialId sid, js::Value *vp, JSBool strict)
{
return setGeneric(cx, SPECIALID_TO_JSID(sid), vp, strict);
}
inline JSBool
JSObject::setGenericAttributes(JSContext *cx, jsid id, uintN *attrsp)
{

View File

@ -1024,26 +1024,32 @@ proxy_GetSpecial(JSContext *cx, JSObject *obj, JSObject *receiver, SpecialId sid
}
static JSBool
proxy_SetProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
proxy_SetGeneric(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
{
id = js_CheckForStringIndex(id);
return Proxy::set(cx, obj, obj, id, strict, vp);
}
static JSBool
proxy_SetProperty(JSContext *cx, JSObject *obj, PropertyName *name, Value *vp, JSBool strict)
{
return proxy_SetGeneric(cx, obj, ATOM_TO_JSID(name), vp, strict);
}
static JSBool
proxy_SetElement(JSContext *cx, JSObject *obj, uint32 index, Value *vp, JSBool strict)
{
jsid id;
if (!IndexToId(cx, index, &id))
return false;
return proxy_SetProperty(cx, obj, id, vp, strict);
return proxy_SetGeneric(cx, obj, id, vp, strict);
}
static JSBool
proxy_SetSpecial(JSContext *cx, JSObject *obj, SpecialId sid, Value *vp, JSBool strict)
{
return proxy_SetProperty(cx, obj, SPECIALID_TO_JSID(sid), vp, strict);
return proxy_SetGeneric(cx, obj, SPECIALID_TO_JSID(sid), vp, strict);
}
static JSBool
@ -1246,7 +1252,7 @@ JS_FRIEND_DATA(Class) js::ObjectProxyClass = {
proxy_GetProperty,
proxy_GetElement,
proxy_GetSpecial,
proxy_SetProperty,
proxy_SetGeneric,
proxy_SetProperty,
proxy_SetElement,
proxy_SetSpecial,
@ -1307,7 +1313,7 @@ JS_FRIEND_DATA(Class) js::OuterWindowProxyClass = {
proxy_GetProperty,
proxy_GetElement,
proxy_GetSpecial,
proxy_SetProperty,
proxy_SetGeneric,
proxy_SetProperty,
proxy_SetElement,
proxy_SetSpecial,
@ -1380,7 +1386,7 @@ JS_FRIEND_DATA(Class) js::FunctionProxyClass = {
proxy_GetProperty,
proxy_GetElement,
proxy_GetSpecial,
proxy_SetProperty,
proxy_SetGeneric,
proxy_SetProperty,
proxy_SetElement,
proxy_SetSpecial,

View File

@ -660,7 +660,7 @@ NodeBuilder::newArray(NodeVector &elts, Value *dst)
if (val.isMagic(JS_SERIALIZE_NO_NODE))
continue;
if (!array->setProperty(cx, INT_TO_JSID(i), &val, false))
if (!array->setElement(cx, i, &val, false))
return false;
}

View File

@ -12853,7 +12853,7 @@ SetPropertyByName(JSContext* cx, JSObject* obj, JSString** namep, Value* vp, JSB
LeaveTraceIfGlobalObject(cx, obj);
jsid id;
if (!RootedStringToId(cx, namep, &id) || !obj->setProperty(cx, id, vp, strict)) {
if (!RootedStringToId(cx, namep, &id) || !obj->setGeneric(cx, id, vp, strict)) {
SetBuiltinError(tm);
return false;
}
@ -12913,7 +12913,7 @@ SetPropertyByIndex(JSContext* cx, JSObject* obj, int32 index, Value* vp, JSBool
LeaveTraceIfGlobalObject(cx, obj);
AutoIdRooter idr(cx);
if (!js_Int32ToId(cx, index, idr.addr()) || !obj->setProperty(cx, idr.id(), vp, strict)) {
if (!js_Int32ToId(cx, index, idr.addr()) || !obj->setGeneric(cx, idr.id(), vp, strict)) {
SetBuiltinError(tm);
return false;
}

View File

@ -399,7 +399,7 @@ ArrayBuffer::obj_getSpecial(JSContext *cx, JSObject *obj, JSObject *receiver, Sp
}
JSBool
ArrayBuffer::obj_setProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
ArrayBuffer::obj_setGeneric(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
{
if (JSID_IS_ATOM(id, cx->runtime->atomState.byteLengthAtom))
return true;
@ -452,6 +452,12 @@ ArrayBuffer::obj_setProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp, J
return js_SetPropertyHelper(cx, delegate, id, 0, vp, strict);
}
JSBool
ArrayBuffer::obj_setProperty(JSContext *cx, JSObject *obj, PropertyName *name, Value *vp, JSBool strict)
{
return obj_setGeneric(cx, obj, ATOM_TO_JSID(name), vp, strict);
}
JSBool
ArrayBuffer::obj_setElement(JSContext *cx, JSObject *obj, uint32 index, Value *vp, JSBool strict)
{
@ -465,7 +471,7 @@ ArrayBuffer::obj_setElement(JSContext *cx, JSObject *obj, uint32 index, Value *v
JSBool
ArrayBuffer::obj_setSpecial(JSContext *cx, JSObject *obj, SpecialId sid, Value *vp, JSBool strict)
{
return obj_setProperty(cx, obj, SPECIALID_TO_JSID(sid), vp, strict);
return obj_setGeneric(cx, obj, SPECIALID_TO_JSID(sid), vp, strict);
}
JSBool
@ -1128,7 +1134,7 @@ class TypedArrayTemplate
}
static JSBool
obj_setProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
obj_setGeneric(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
{
JSObject *tarray = getTypedArray(obj);
JS_ASSERT(tarray);
@ -1153,6 +1159,12 @@ class TypedArrayTemplate
return setElementTail(cx, tarray, index, vp, strict);
}
static JSBool
obj_setProperty(JSContext *cx, JSObject *obj, PropertyName *name, Value *vp, JSBool strict)
{
return obj_setGeneric(cx, obj, ATOM_TO_JSID(name), vp, strict);
}
static JSBool
obj_setElement(JSContext *cx, JSObject *obj, uint32 index, Value *vp, JSBool strict)
{
@ -1175,7 +1187,7 @@ class TypedArrayTemplate
static JSBool
obj_setSpecial(JSContext *cx, JSObject *obj, SpecialId sid, Value *vp, JSBool strict)
{
return obj_setProperty(cx, obj, SPECIALID_TO_JSID(sid), vp, strict);
return obj_setGeneric(cx, obj, SPECIALID_TO_JSID(sid), vp, strict);
}
static JSBool
@ -1186,7 +1198,7 @@ class TypedArrayTemplate
return true;
Value tmp = *v;
return obj_setProperty(cx, obj, id, &tmp, false);
return obj_setGeneric(cx, obj, id, &tmp, false);
}
static JSBool
@ -2094,7 +2106,7 @@ Class js::ArrayBufferClass = {
ArrayBuffer::obj_getProperty,
ArrayBuffer::obj_getElement,
ArrayBuffer::obj_getSpecial,
ArrayBuffer::obj_setProperty,
ArrayBuffer::obj_setGeneric,
ArrayBuffer::obj_setProperty,
ArrayBuffer::obj_setElement,
ArrayBuffer::obj_setSpecial,
@ -2206,7 +2218,7 @@ JSFunctionSpec _typedArray::jsfuncs[] = { \
_typedArray::obj_getProperty, \
_typedArray::obj_getElement, \
_typedArray::obj_getSpecial, \
_typedArray::obj_setProperty, \
_typedArray::obj_setGeneric, \
_typedArray::obj_setProperty, \
_typedArray::obj_setElement, \
_typedArray::obj_setSpecial, \

View File

@ -114,11 +114,11 @@ struct JS_FRIEND_API(ArrayBuffer) {
obj_getSpecial(JSContext *cx, JSObject *obj, JSObject *receiver, SpecialId sid, Value *vp);
static JSBool
obj_setProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict);
obj_setGeneric(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict);
static JSBool
obj_setProperty(JSContext *cx, JSObject *obj, PropertyName *name, Value *vp, JSBool strict);
static JSBool
obj_setElement(JSContext *cx, JSObject *obj, uint32 index, Value *vp, JSBool strict);
static JSBool
obj_setSpecial(JSContext *cx, JSObject *obj, SpecialId sid, Value *vp, JSBool strict);

View File

@ -235,7 +235,7 @@ Wrapper::set(JSContext *cx, JSObject *wrapper, JSObject *receiver, jsid id, bool
Value *vp)
{
// FIXME (bug 596351): Need deal with strict mode.
SET(wrappedObject(wrapper)->setProperty(cx, id, vp, false));
SET(wrappedObject(wrapper)->setGeneric(cx, id, vp, false));
}
bool

View File

@ -4863,9 +4863,9 @@ xml_setGeneric(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
}
static JSBool
xml_setProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
xml_setProperty(JSContext *cx, JSObject *obj, PropertyName *name, Value *vp, JSBool strict)
{
return xml_setGeneric(cx, obj, id, vp, strict);
return xml_setGeneric(cx, obj, ATOM_TO_JSID(name), vp, strict);
}
static JSBool
@ -5345,7 +5345,7 @@ JS_FRIEND_DATA(Class) js::XMLClass = {
xml_getProperty,
xml_getElement,
xml_getSpecial,
xml_setProperty,
xml_setGeneric,
xml_setProperty,
xml_setElement,
xml_setSpecial,
@ -6032,7 +6032,7 @@ NamespacesToJSArray(JSContext *cx, JSXMLArray *array, jsval *rval)
if (!ns)
continue;
tvr.set(ObjectValue(*ns));
if (!arrayobj->setProperty(cx, INT_TO_JSID(i), tvr.addr(), false))
if (!arrayobj->setElement(cx, i, tvr.addr(), false))
return false;
}
return true;

View File

@ -254,6 +254,7 @@ stubs::SetName(VMFrame &f, JSAtom *origAtom)
JS_ASSERT(atom);
}
PropertyName *name = atom->asPropertyName();
jsid id = ATOM_TO_JSID(atom);
if (entry && JS_LIKELY(!obj->getOps()->setProperty)) {
uintN defineHow;
@ -267,7 +268,7 @@ stubs::SetName(VMFrame &f, JSAtom *origAtom)
if (!js_SetPropertyHelper(cx, obj, id, defineHow, &rval, strict))
THROW();
} else {
if (!obj->setProperty(cx, id, &rval, strict))
if (!obj->setProperty(cx, name, &rval, strict))
THROW();
}
} while (0);
@ -287,7 +288,7 @@ stubs::SetPropNoCache(VMFrame &f, JSAtom *atom)
THROW();
Value rval = f.regs.sp[-1];
if (!obj->setProperty(f.cx, ATOM_TO_JSID(atom), &f.regs.sp[-1], strict))
if (!obj->setGeneric(f.cx, ATOM_TO_JSID(atom), &f.regs.sp[-1], strict))
THROW();
f.regs.sp[-2] = rval;
}
@ -304,11 +305,7 @@ stubs::SetGlobalNameNoCache(VMFrame &f, JSAtom *atom)
Value rval = f.regs.sp[-1];
Value &lref = f.regs.sp[-2];
JSObject *obj = ValueToObject(cx, &lref);
if (!obj)
THROW();
jsid id = ATOM_TO_JSID(atom);
if (!obj->setProperty(cx, id, &rval, strict))
if (!obj || !obj->setProperty(cx, atom->asPropertyName(), &rval, strict))
THROW();
f.regs.sp[-2] = f.regs.sp[-1];
@ -582,7 +579,7 @@ stubs::SetElem(VMFrame &f)
}
}
} while (0);
if (!obj->setProperty(cx, id, &rval, strict))
if (!obj->setGeneric(cx, id, &rval, strict))
THROW();
end_setelem:
/* :FIXME: Moving the assigned object into the lowest stack slot
@ -796,8 +793,6 @@ stubs::DefFun(VMFrame &f, JSFunction *fun)
Value rval = ObjectValue(*obj);
do {
PropertyName *name = fun->atom->asPropertyName();
/* Steps 5d, 5f. */
if (!prop || pobj != parent) {
if (!parent->defineProperty(cx, name, rval,
@ -839,7 +834,7 @@ stubs::DefFun(VMFrame &f, JSFunction *fun)
*/
/* Step 5f. */
if (!parent->setProperty(cx, id, &rval, strict))
if (!parent->setProperty(cx, name, &rval, strict))
THROW();
} while (false);
}