Bug 537873, Bug 514574: Have strict mode code report TypeErrors for assignments, deletions. r=brendan

TODO: Fix error messages.
This commit is contained in:
Jim Blandy 2010-09-15 13:43:55 -07:00
Родитель c568d21361
Коммит 1ccd1db5cf
24 изменённых файлов: 371 добавлений и 218 удалений

Просмотреть файл

@ -98,9 +98,9 @@ MSG_DEF(JSMSG_CANT_WATCH, 15, 1, JSEXN_TYPEERR, "can't watch non-na
MSG_DEF(JSMSG_STACK_UNDERFLOW, 16, 2, JSEXN_INTERNALERR, "internal error compiling {0}: stack underflow at pc {1}")
MSG_DEF(JSMSG_NEED_DIET, 17, 1, JSEXN_INTERNALERR, "{0} too large")
MSG_DEF(JSMSG_TOO_MANY_LOCAL_ROOTS, 18, 0, JSEXN_ERR, "out of local root space")
MSG_DEF(JSMSG_READ_ONLY, 19, 1, JSEXN_ERR, "{0} is read-only")
MSG_DEF(JSMSG_READ_ONLY, 19, 1, JSEXN_TYPEERR, "{0} is read-only")
MSG_DEF(JSMSG_BAD_FORMAL, 20, 0, JSEXN_SYNTAXERR, "malformed formal parameter")
MSG_DEF(JSMSG_UNUSED21, 21, 0, JSEXN_NONE, "")
MSG_DEF(JSMSG_CANT_DELETE, 21, 1, JSEXN_TYPEERR, "property '{0}' is non-configurable and cannot be deleted")
MSG_DEF(JSMSG_NOT_FUNCTION, 22, 1, JSEXN_TYPEERR, "{0} is not a function")
MSG_DEF(JSMSG_NOT_CONSTRUCTOR, 23, 1, JSEXN_TYPEERR, "{0} is not a constructor")
MSG_DEF(JSMSG_SCRIPT_STACK_QUOTA, 24, 0, JSEXN_INTERNALERR, "script stack space quota is exhausted")

Просмотреть файл

@ -3712,7 +3712,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, Valueify(vp));
return obj->setProperty(cx, id, Valueify(vp), false);
}
JS_PUBLIC_API(JSBool)
@ -3741,7 +3741,7 @@ JS_DeletePropertyById2(JSContext *cx, JSObject *obj, jsid id, jsval *rval)
CHECK_REQUEST(cx);
assertSameCompartment(cx, obj, id);
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED);
return obj->deleteProperty(cx, id, Valueify(rval));
return obj->deleteProperty(cx, id, Valueify(rval), false);
}
JS_PUBLIC_API(JSBool)

Просмотреть файл

@ -53,7 +53,7 @@
* getDenseArrayCapacity().
*
* In dense mode, holes in the array are represented by (JS_ARRAY_HOLE) invalid
* values. The final two slot in fslots are unused.
* values. The final slot in fslots is unused.
*
* NB: the capacity and length of a dense array are entirely unrelated! The
* length may be greater than, less than, or equal to the capacity. See
@ -516,7 +516,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);
return obj->setProperty(cx, idr.id(), &tmp, true);
}
#ifdef JS_TRACER
@ -537,7 +537,7 @@ JS_DEFINE_CALLINFO_3(extern, BOOL, js_EnsureDenseArrayCapacity, CONTEXT, OBJECT,
#endif
static JSBool
DeleteArrayElement(JSContext *cx, JSObject *obj, jsdouble index)
DeleteArrayElement(JSContext *cx, JSObject *obj, jsdouble index, JSBool strict)
{
JS_ASSERT(index >= 0);
if (obj->isDenseArray()) {
@ -559,7 +559,7 @@ DeleteArrayElement(JSContext *cx, JSObject *obj, jsdouble index)
return JS_TRUE;
Value junk;
return obj->deleteProperty(cx, idr.id(), &junk);
return obj->deleteProperty(cx, idr.id(), &junk, strict);
}
/*
@ -572,7 +572,7 @@ SetOrDeleteArrayElement(JSContext *cx, JSObject *obj, jsdouble index,
{
if (hole) {
JS_ASSERT(v.isUndefined());
return DeleteArrayElement(cx, obj, index);
return DeleteArrayElement(cx, obj, index, true);
}
return SetArrayElement(cx, obj, index, v);
}
@ -585,7 +585,8 @@ js_SetLengthProperty(JSContext *cx, JSObject *obj, jsdouble length)
v.setNumber(length);
id = ATOM_TO_JSID(cx->runtime->atomState.lengthAtom);
return obj->setProperty(cx, id, &v);
/* We don't support read-only array length yet. */
return obj->setProperty(cx, id, &v, false);
}
JSBool
@ -623,7 +624,7 @@ array_length_getter(JSContext *cx, JSObject *obj, jsid id, Value *vp)
}
static JSBool
array_length_setter(JSContext *cx, JSObject *obj, jsid id, Value *vp)
array_length_setter(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
{
jsuint newlen, oldlen, gap, index;
Value junk;
@ -669,8 +670,17 @@ array_length_setter(JSContext *cx, JSObject *obj, jsid id, Value *vp)
} else if (oldlen - newlen < (1 << 24)) {
do {
--oldlen;
if (!JS_CHECK_OPERATION_LIMIT(cx) || !DeleteArrayElement(cx, obj, oldlen))
if (!JS_CHECK_OPERATION_LIMIT(cx)) {
obj->setArrayLength(oldlen + 1);
return false;
}
if (!DeleteArrayElement(cx, obj, oldlen, true)) {
obj->setArrayLength(oldlen + 1);
if (strict)
return false;
JS_ClearPendingException(cx);
return true;
}
} while (oldlen != newlen);
obj->setArrayLength(newlen);
} else {
@ -695,7 +705,7 @@ array_length_setter(JSContext *cx, JSObject *obj, jsid id, Value *vp)
if (JSID_IS_VOID(id))
break;
if (js_IdIsIndex(id, &index) && index - newlen < gap &&
!obj->deleteProperty(cx, id, &junk)) {
!obj->deleteProperty(cx, id, &junk, false)) {
return false;
}
}
@ -827,30 +837,30 @@ array_typeOf(JSContext *cx, JSObject *obj)
}
static JSBool
array_setProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp)
array_setProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
{
uint32 i;
if (JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom))
return array_length_setter(cx, obj, id, vp);
return array_length_setter(cx, obj, id, vp, strict);
if (!obj->isDenseArray())
return js_SetProperty(cx, obj, id, vp);
return js_SetProperty(cx, obj, id, vp, strict);
if (!js_IdIsIndex(id, &i) || js_PrototypeHasIndexedProperties(cx, obj) ||
INDEX_TOO_SPARSE(obj, i)) {
if (!obj->makeDenseArraySlow(cx))
return JS_FALSE;
return js_SetProperty(cx, obj, id, vp);
return false;
return js_SetProperty(cx, obj, id, vp, strict);
}
if (!obj->ensureDenseArrayElements(cx, i + 1))
return JS_FALSE;
return false;
if (i >= obj->getArrayLength())
obj->setArrayLength(i + 1);
obj->setDenseArrayElement(i, *vp);
return JS_TRUE;
return true;
}
static JSBool
@ -921,7 +931,7 @@ array_defineProperty(JSContext *cx, JSObject *obj, jsid id, const Value *value,
}
Value tmp = *value;
return array_setProperty(cx, obj, id, &tmp);
return array_setProperty(cx, obj, id, &tmp, false);
}
static JSBool
@ -941,12 +951,12 @@ array_setAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
}
static JSBool
array_deleteProperty(JSContext *cx, JSObject *obj, jsid id, Value *rval)
array_deleteProperty(JSContext *cx, JSObject *obj, jsid id, Value *rval, JSBool strict)
{
uint32 i;
if (!obj->isDenseArray())
return js_DeleteProperty(cx, obj, id, rval);
return js_DeleteProperty(cx, obj, id, rval, strict);
if (JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom)) {
rval->setBoolean(false);
@ -1469,7 +1479,7 @@ InitArrayElements(JSContext *cx, JSObject *obj, jsuint start, jsuint count, Valu
do {
*tvr.addr() = *vector++;
if (!js_ValueToStringId(cx, idval, idr.addr()) ||
!obj->setProperty(cx, idr.id(), tvr.addr())) {
!obj->setProperty(cx, idr.id(), tvr.addr(), true)) {
return JS_FALSE;
}
idval.getDoubleRef() += 1;
@ -2030,8 +2040,8 @@ js::array_sort(JSContext *cx, uintN argc, Value *vp)
/* Re-create any holes that sorted to the end of the array. */
while (len > newlen) {
if (!JS_CHECK_OPERATION_LIMIT(cx) || !DeleteArrayElement(cx, obj, --len))
return JS_FALSE;
if (!JS_CHECK_OPERATION_LIMIT(cx) || !DeleteArrayElement(cx, obj, --len, true))
return false;
}
vp->setObject(*obj);
return true;
@ -2142,7 +2152,7 @@ array_pop_slowly(JSContext *cx, JSObject* obj, Value *vp)
/* Get the to-be-deleted property's value into vp. */
if (!GetArrayElement(cx, obj, index, &hole, vp))
return JS_FALSE;
if (!hole && !DeleteArrayElement(cx, obj, index))
if (!hole && !DeleteArrayElement(cx, obj, index, true))
return JS_FALSE;
}
return js_SetLengthProperty(cx, obj, index);
@ -2162,7 +2172,7 @@ array_pop_dense(JSContext *cx, JSObject* obj, Value *vp)
index--;
if (!GetArrayElement(cx, obj, index, &hole, vp))
return JS_FALSE;
if (!hole && !DeleteArrayElement(cx, obj, index))
if (!hole && !DeleteArrayElement(cx, obj, index, true))
return JS_FALSE;
obj->setArrayLength(index);
return JS_TRUE;
@ -2221,7 +2231,7 @@ array_shift(JSContext *cx, uintN argc, Value *vp)
}
/* Delete the only or last element when it exists. */
if (!hole && !DeleteArrayElement(cx, obj, length))
if (!hole && !DeleteArrayElement(cx, obj, length, true))
return JS_FALSE;
}
return js_SetLengthProperty(cx, obj, length);

Просмотреть файл

@ -582,8 +582,8 @@ ArgSetter(JSContext *cx, JSObject *obj, jsid id, Value *vp)
* collect its value.
*/
AutoValueRooter tvr(cx);
return js_DeleteProperty(cx, obj, id, tvr.addr()) &&
js_SetProperty(cx, obj, id, vp);
return js_DeleteProperty(cx, obj, id, tvr.addr(), false) &&
js_SetProperty(cx, obj, id, vp, false);
}
static JSBool
@ -698,8 +698,8 @@ StrictArgSetter(JSContext *cx, JSObject *obj, jsid id, Value *vp)
* collect its value.
*/
AutoValueRooter tvr(cx);
return js_DeleteProperty(cx, obj, id, tvr.addr()) &&
js_SetProperty(cx, obj, id, vp);
return js_DeleteProperty(cx, obj, id, tvr.addr(), true) &&
js_SetProperty(cx, obj, id, vp, true);
}
JSBool
@ -1646,8 +1646,8 @@ struct PoisonPillProp {
/* NB: no sentinels at ends -- use JS_ARRAY_LENGTH to bound loops. */
const LazyFunctionDataProp lazyFunctionDataProps[] = {
{ATOM_OFFSET(arity), FUN_ARITY, JSPROP_PERMANENT},
{ATOM_OFFSET(name), FUN_NAME, JSPROP_PERMANENT},
{ATOM_OFFSET(arity), FUN_ARITY, JSPROP_PERMANENT|JSPROP_READONLY},
{ATOM_OFFSET(name), FUN_NAME, JSPROP_PERMANENT|JSPROP_READONLY},
};
/* Properties censored into [[ThrowTypeError]] in strict mode. */
@ -1707,7 +1707,7 @@ fun_resolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
* fun is not a compiler-created function object, which must never leak to
* script or embedding code and then be mutated.
*/
if ((flags & JSRESOLVE_ASSIGNING) && !JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom)) {
if ((flags & JSRESOLVE_ASSIGNING) && JSID_IS_ATOM(id, cx->runtime->atomState.classPrototypeAtom)) {
JS_ASSERT(!IsInternalFunctionObject(obj));
return JS_TRUE;
}

Просмотреть файл

@ -2823,7 +2823,7 @@ BEGIN_CASE(JSOP_FORNAME)
JS_ASSERT(regs.sp[-1].isObject());
if (!IteratorNext(cx, &regs.sp[-1].toObject(), tvr.addr()))
goto error;
if (!obj->setProperty(cx, id, tvr.addr()))
if (!obj->setProperty(cx, id, tvr.addr(), script->strictModeCode))
goto error;
}
}
@ -2842,7 +2842,7 @@ BEGIN_CASE(JSOP_FORPROP)
JS_ASSERT(regs.sp[-2].isObject());
if (!IteratorNext(cx, &regs.sp[-2].toObject(), tvr.addr()))
goto error;
if (!obj->setProperty(cx, id, tvr.addr()))
if (!obj->setProperty(cx, id, tvr.addr(), script->strictModeCode))
goto error;
}
regs.sp--;
@ -3490,11 +3490,14 @@ BEGIN_CASE(JSOP_DELNAME)
if (!js_FindProperty(cx, id, &obj, &obj2, &prop))
goto error;
/* Strict mode code should never contain JSOP_DELNAME opcodes. */
JS_ASSERT(!script->strictModeCode);
/* ECMA says to return true if name is undefined or inherited. */
PUSH_BOOLEAN(true);
if (prop) {
obj2->dropProperty(cx, prop);
if (!obj->deleteProperty(cx, id, &regs.sp[-1]))
if (!obj->deleteProperty(cx, id, &regs.sp[-1], false))
goto error;
}
}
@ -3510,7 +3513,7 @@ BEGIN_CASE(JSOP_DELPROP)
FETCH_OBJECT(cx, -1, obj);
Value rval;
if (!obj->deleteProperty(cx, id, &rval))
if (!obj->deleteProperty(cx, id, &rval, script->strictModeCode))
goto error;
regs.sp[-1] = rval;
@ -3528,7 +3531,7 @@ BEGIN_CASE(JSOP_DELELEM)
FETCH_ELEMENT_ID(obj, -1, id);
/* Get or set the element. */
if (!obj->deleteProperty(cx, id, &regs.sp[-2]))
if (!obj->deleteProperty(cx, id, &regs.sp[-2], script->strictModeCode))
goto error;
regs.sp--;
@ -3651,7 +3654,7 @@ do_incop:
else
ref.getInt32Ref() = tmp += incr;
regs.fp->setAssigning();
JSBool ok = obj->setProperty(cx, id, &ref);
JSBool ok = obj->setProperty(cx, id, &ref, script->strictModeCode);
regs.fp->clearAssigning();
if (!ok)
goto error;
@ -3667,7 +3670,7 @@ do_incop:
if (!js_DoIncDec(cx, cs, &regs.sp[-2], &regs.sp[-1]))
goto error;
regs.fp->setAssigning();
JSBool ok = obj->setProperty(cx, id, &regs.sp[-1]);
JSBool ok = obj->setProperty(cx, id, &regs.sp[-1], script->strictModeCode);
regs.fp->clearAssigning();
if (!ok)
goto error;
@ -3743,7 +3746,6 @@ BEGIN_CASE(JSOP_LOCALINC)
do_local_incop:
slot = GET_SLOTNO(regs.pc);
JS_ASSERT(slot < regs.fp->numSlots());
vp = regs.fp->slots() + slot;
METER_SLOT_OP(op, slot);
vp = regs.fp->slots() + slot;
@ -4173,10 +4175,10 @@ BEGIN_CASE(JSOP_SETMETHOD)
defineHow = JSDNP_CACHE_RESULT | JSDNP_UNQUALIFIED;
else
defineHow = JSDNP_CACHE_RESULT;
if (!js_SetPropertyHelper(cx, obj, id, defineHow, &rval))
if (!js_SetPropertyHelper(cx, obj, id, defineHow, &rval, script->strictModeCode))
goto error;
} else {
if (!obj->setProperty(cx, id, &rval))
if (!obj->setProperty(cx, id, &rval, script->strictModeCode))
goto error;
ABORT_RECORDING(cx, "Non-native set");
}
@ -4309,7 +4311,7 @@ BEGIN_CASE(JSOP_SETELEM)
}
} while (0);
rval = regs.sp[-1];
if (!obj->setProperty(cx, id, &rval))
if (!obj->setProperty(cx, id, &rval, script->strictModeCode))
goto error;
end_setelem:;
}
@ -4323,7 +4325,7 @@ BEGIN_CASE(JSOP_ENUMELEM)
jsid id;
FETCH_ELEMENT_ID(obj, -1, id);
Value rval = regs.sp[-3];
if (!obj->setProperty(cx, id, &rval))
if (!obj->setProperty(cx, id, &rval, script->strictModeCode))
goto error;
regs.sp -= 3;
}
@ -5254,7 +5256,7 @@ BEGIN_CASE(JSOP_DEFFUN)
}
Value rval = ObjectValue(*obj);
ok = doSet
? parent->setProperty(cx, id, &rval)
? parent->setProperty(cx, id, &rval, script->strictModeCode)
: parent->defineProperty(cx, id, rval, PropertyStub, PropertyStub, attrs);
if (!ok)
goto error;
@ -5286,7 +5288,7 @@ BEGIN_CASE(JSOP_DEFFUN_DBGFC)
goto error;
if ((attrs == JSPROP_ENUMERATE)
? !parent.setProperty(cx, id, &rval)
? !parent.setProperty(cx, id, &rval, script->strictModeCode)
: !parent.defineProperty(cx, id, rval, PropertyStub, PropertyStub, attrs)) {
goto error;
}
@ -5748,7 +5750,7 @@ BEGIN_CASE(JSOP_INITMETHOD)
? JSDNP_CACHE_RESULT | JSDNP_SET_METHOD
: JSDNP_CACHE_RESULT;
if (!(JS_UNLIKELY(atom == cx->runtime->atomState.protoAtom)
? js_SetPropertyHelper(cx, obj, id, defineHow, &rval)
? js_SetPropertyHelper(cx, obj, id, defineHow, &rval, script->strictModeCode)
: js_DefineNativeProperty(cx, obj, id, rval, NULL, NULL,
JSPROP_ENUMERATE, 0, 0, NULL,
defineHow))) {
@ -6145,7 +6147,7 @@ BEGIN_CASE(JSOP_SETXMLNAME)
Value rval = regs.sp[-1];
jsid id;
FETCH_ELEMENT_ID(obj, -2, id);
if (!obj->setProperty(cx, id, &rval))
if (!obj->setProperty(cx, id, &rval, script->strictModeCode))
goto error;
rval = regs.sp[-1];
regs.sp -= 2;

Просмотреть файл

@ -2843,9 +2843,9 @@ with_GetProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp)
}
static JSBool
with_SetProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp)
with_SetProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
{
return obj->getProto()->setProperty(cx, id, vp);
return obj->getProto()->setProperty(cx, id, vp, strict);
}
static JSBool
@ -2861,9 +2861,9 @@ with_SetAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
}
static JSBool
with_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, Value *rval)
with_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, Value *rval, JSBool strict)
{
return obj->getProto()->deleteProperty(cx, id, rval);
return obj->getProto()->deleteProperty(cx, id, rval, strict);
}
static JSBool
@ -3484,7 +3484,7 @@ js_InitClass(JSContext *cx, JSObject *obj, JSObject *parent_proto,
bad:
if (named) {
Value rval;
obj->deleteProperty(cx, ATOM_TO_JSID(atom), &rval);
obj->deleteProperty(cx, ATOM_TO_JSID(atom), &rval, false);
}
return NULL;
}
@ -4917,6 +4917,14 @@ ReportReadOnly(JSContext* cx, jsid id, uintN flags)
NULL, NULL);
}
JSBool
ReportNotConfigurable(JSContext* cx, jsid id, uintN flags)
{
return js_ReportValueErrorFlags(cx, flags, JSMSG_CANT_DELETE,
JSDVG_IGNORE_STACK, IdToValue(id), NULL,
NULL, NULL);
}
}
/*
@ -4926,7 +4934,7 @@ ReportReadOnly(JSContext* cx, jsid id, uintN flags)
*/
JSBool
js_SetPropertyHelper(JSContext *cx, JSObject *obj, jsid id, uintN defineHow,
Value *vp)
Value *vp, JSBool strict)
{
int protoIndex;
JSObject *pobj;
@ -5005,7 +5013,9 @@ js_SetPropertyHelper(JSContext *cx, JSObject *obj, jsid id, uintN defineHow,
TRACE_2(SetPropHit, JS_NO_PROP_CACHE_FILL, shape);
}
/* Warn in strict mode, otherwise do nothing. */
/* Error in strict mode code, warn with strict option, otherwise do nothing. */
if (strict)
return ReportReadOnly(cx, id, 0);
if (JS_HAS_STRICT_OPTION(cx))
return ReportReadOnly(cx, id, JSREPORT_STRICT | JSREPORT_WARNING);
return JS_TRUE;
@ -5164,9 +5174,9 @@ js_SetPropertyHelper(JSContext *cx, JSObject *obj, jsid id, uintN defineHow,
}
JSBool
js_SetProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp)
js_SetProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
{
return js_SetPropertyHelper(cx, obj, id, 0, vp);
return js_SetPropertyHelper(cx, obj, id, 0, vp, strict);
}
JSBool
@ -5212,7 +5222,7 @@ js_SetAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
}
JSBool
js_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, Value *rval)
js_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, Value *rval, JSBool strict)
{
JSObject *proto;
JSProperty *prop;
@ -5225,7 +5235,7 @@ js_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, Value *rval)
id = js_CheckForStringIndex(id);
if (!js_LookupProperty(cx, obj, id, &proto, &prop))
return JS_FALSE;
return false;
if (!prop || proto != obj) {
/*
* If the property was found in a native prototype, check whether it's
@ -5233,15 +5243,16 @@ js_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, Value *rval)
* in all delegating objects, matching ECMA semantics without bloating
* each delegating object.
*/
if (prop) {
if (proto->isNative()) {
shape = (Shape *)prop;
if (shape->isSharedPermanent())
rval->setBoolean(false);
if (prop && proto->isNative()) {
shape = (Shape *)prop;
if (shape->isSharedPermanent()) {
JS_UNLOCK_OBJ(cx, proto);
if (strict)
return ReportNotConfigurable(cx, id, 0);
rval->setBoolean(false);
return true;
}
if (rval->isBoolean() && rval->toBoolean() == false)
return JS_TRUE;
JS_UNLOCK_OBJ(cx, proto);
}
/*
@ -5255,14 +5266,16 @@ js_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, Value *rval)
shape = (Shape *)prop;
if (!shape->configurable()) {
JS_UNLOCK_OBJ(cx, obj);
if (strict)
return ReportNotConfigurable(cx, id, 0);
rval->setBoolean(false);
return JS_TRUE;
return true;
}
/* XXXbe called with obj locked */
if (!CallJSPropertyOp(cx, obj->getClass()->delProperty, obj, SHAPE_USERID(shape), rval)) {
JS_UNLOCK_OBJ(cx, obj);
return JS_FALSE;
return false;
}
if (obj->containsSlot(shape->slot)) {

Просмотреть файл

@ -215,7 +215,7 @@ extern JSBool
js_GetProperty(JSContext *cx, JSObject *obj, jsid id, js::Value *vp);
extern JSBool
js_SetProperty(JSContext *cx, JSObject *obj, jsid id, js::Value *vp);
js_SetProperty(JSContext *cx, JSObject *obj, jsid id, js::Value *vp, JSBool strict);
extern JSBool
js_GetAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp);
@ -224,7 +224,7 @@ extern JSBool
js_SetAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp);
extern JSBool
js_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, js::Value *rval);
js_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, js::Value *rval, JSBool strict);
extern JS_FRIEND_API(JSBool)
js_Enumerate(JSContext *cx, JSObject *obj, JSIterateOp enum_op,
@ -1042,9 +1042,9 @@ struct JSObject {
return (op ? op : js_GetProperty)(cx, this, id, vp);
}
JSBool setProperty(JSContext *cx, jsid id, js::Value *vp) {
js::PropertyIdOp op = getOps()->setProperty;
return (op ? op : js_SetProperty)(cx, this, id, vp);
JSBool setProperty(JSContext *cx, jsid id, js::Value *vp, JSBool strict) {
js::StrictPropertyIdOp op = getOps()->setProperty;
return (op ? op : js_SetProperty)(cx, this, id, vp, strict);
}
JSBool getAttributes(JSContext *cx, jsid id, uintN *attrsp) {
@ -1057,9 +1057,9 @@ struct JSObject {
return (op ? op : js_SetAttributes)(cx, this, id, attrsp);
}
JSBool deleteProperty(JSContext *cx, jsid id, js::Value *rval) {
js::PropertyIdOp op = getOps()->deleteProperty;
return (op ? op : js_DeleteProperty)(cx, this, id, rval);
JSBool deleteProperty(JSContext *cx, jsid id, js::Value *rval, JSBool strict) {
js::StrictPropertyIdOp op = getOps()->deleteProperty;
return (op ? op : js_DeleteProperty)(cx, this, id, rval, strict);
}
JSBool enumerate(JSContext *cx, JSIterateOp iterop, js::Value *statep, jsid *idp) {
@ -1550,7 +1550,7 @@ js_CheckUndeclaredVarAssignment(JSContext *cx, JSString *propname);
extern JSBool
js_SetPropertyHelper(JSContext *cx, JSObject *obj, jsid id, uintN defineHow,
js::Value *vp);
js::Value *vp, JSBool strict);
/*
* Change attributes for the given native property. The caller must ensure

Просмотреть файл

@ -122,7 +122,7 @@ JSObject::methodReadBarrier(JSContext *cx, const js::Shape &shape, js::Value *vp
funobj->setMethodObj(*this);
vp->setObject(*funobj);
if (!js_SetPropertyHelper(cx, this, shape.id, 0, vp))
if (!js_SetPropertyHelper(cx, this, shape.id, 0, vp, false))
return false;
#ifdef DEBUG

Просмотреть файл

@ -616,7 +616,7 @@ Walk(JSContext *cx, jsid id, JSObject *holder, const Value &reviver, Value *vp)
if (!Walk(cx, idName, obj, reviver, propValue.addr()))
return false;
if (propValue.value().isUndefined()) {
if (!js_DeleteProperty(cx, obj, idName, propValue.addr()))
if (!js_DeleteProperty(cx, obj, idName, propValue.addr(), false))
return false;
} else {
if (!obj->defineProperty(cx, idName, propValue.value(), NULL, NULL,

Просмотреть файл

@ -844,8 +844,9 @@ proxy_GetProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp)
}
static JSBool
proxy_SetProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp)
proxy_SetProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
{
// TODO: throwing away strict
return JSProxy::set(cx, obj, obj, id, vp);
}
@ -871,8 +872,9 @@ proxy_SetAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
}
static JSBool
proxy_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, Value *rval)
proxy_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, Value *rval, JSBool strict)
{
// TODO: throwing away strict
bool deleted;
if (!JSProxy::delete_(cx, obj, id, &deleted))
return false;

Просмотреть файл

@ -810,7 +810,7 @@ static JSBool
str_resolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
JSObject **objp)
{
if (!JSID_IS_INT(id) || (flags & JSRESOLVE_ASSIGNING))
if (!JSID_IS_INT(id))
return JS_TRUE;
JSString *str = obj->getPrimitiveThis().toString();
@ -1880,7 +1880,7 @@ MatchCallback(JSContext *cx, RegExpStatics *res, size_t count, void *p)
return false;
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED | JSRESOLVE_ASSIGNING);
return !!arrayobj->setProperty(cx, INT_TO_JSID(count), &v);
return !!arrayobj->setProperty(cx, INT_TO_JSID(count), &v, false);
}
static JSBool

Просмотреть файл

@ -2316,6 +2316,7 @@ TraceRecorder::TraceRecorder(JSContext* cx, VMSideExit* anchor, VMFragment* frag
consts(cx->fp()->script()->constOffset
? cx->fp()->script()->consts()->vector
: NULL),
strictModeCode_ins(NULL),
cfgMerges(&tempAlloc()),
trashSelf(false),
whichTreesToTrash(&tempAlloc()),
@ -2453,6 +2454,8 @@ TraceRecorder::TraceRecorder(JSContext* cx, VMSideExit* anchor, VMFragment* frag
InitConst(eor_ins) =
addName(lir->insLoad(LIR_ldp, lirbuf->state, offsetof(TracerState, eor), ACCSET_OTHER), "eor");
strictModeCode_ins = addName(lir->insImmI(cx->fp()->script()->strictModeCode), "strict");
#ifdef DEBUG
// Need to update these before any stack/rstack loads/stores occur.
extras[0] = lirbuf->sp;
@ -7919,10 +7922,12 @@ TraceRecorder::stackval(int n) const
JS_REQUIRES_STACK void
TraceRecorder::updateAtoms()
{
JSScript *script = cx->fp()->script();
atoms = FrameAtomBase(cx, cx->fp());
consts = cx->fp()->hasImacropc() || cx->fp()->script()->constOffset == 0
consts = cx->fp()->hasImacropc() || script->constOffset == 0
? 0
: cx->fp()->script()->consts()->vector;
: script->consts()->vector;
strictModeCode_ins = addName(lir->insImmI(script->strictModeCode), "strict");
}
JS_REQUIRES_STACK void
@ -7930,6 +7935,7 @@ TraceRecorder::updateAtoms(JSScript *script)
{
atoms = script->atomMap.vector;
consts = script->constOffset == 0 ? 0 : script->consts()->vector;
strictModeCode_ins = addName(lir->insImmI(script->strictModeCode), "strict");
}
/*
@ -11466,19 +11472,20 @@ TraceRecorder::record_JSOP_DELNAME()
}
JSBool JS_FASTCALL
DeleteIntKey(JSContext* cx, JSObject* obj, int32 i)
DeleteIntKey(JSContext* cx, JSObject* obj, int32 i, JSBool strict)
{
LeaveTraceIfGlobalObject(cx, obj);
Value v = BooleanValue(false);
jsid id = INT_TO_JSID(i);
if (!obj->deleteProperty(cx, id, &v))
if (!obj->deleteProperty(cx, id, &v, strict))
SetBuiltinError(cx);
return v.toBoolean();
}
JS_DEFINE_CALLINFO_3(extern, BOOL_FAIL, DeleteIntKey, CONTEXT, OBJECT, INT32, 0, ACCSET_STORE_ANY)
JS_DEFINE_CALLINFO_4(extern, BOOL_FAIL, DeleteIntKey, CONTEXT, OBJECT, INT32, BOOL,
0, ACCSET_STORE_ANY)
JSBool JS_FASTCALL
DeleteStrKey(JSContext* cx, JSObject* obj, JSString* str)
DeleteStrKey(JSContext* cx, JSObject* obj, JSString* str, JSBool strict)
{
LeaveTraceIfGlobalObject(cx, obj);
Value v = BooleanValue(false);
@ -11489,11 +11496,12 @@ DeleteStrKey(JSContext* cx, JSObject* obj, JSString* str)
* jsatominlines.h) that helper early-returns if the computed property name
* string is already atomized, and we are *not* on a perf-critical path!
*/
if (!js_ValueToStringId(cx, StringValue(str), &id) || !obj->deleteProperty(cx, id, &v))
if (!js_ValueToStringId(cx, StringValue(str), &id) || !obj->deleteProperty(cx, id, &v, strict))
SetBuiltinError(cx);
return v.toBoolean();
}
JS_DEFINE_CALLINFO_3(extern, BOOL_FAIL, DeleteStrKey, CONTEXT, OBJECT, STRING, 0, ACCSET_STORE_ANY)
JS_DEFINE_CALLINFO_4(extern, BOOL_FAIL, DeleteStrKey, CONTEXT, OBJECT, STRING, BOOL,
0, ACCSET_STORE_ANY)
JS_REQUIRES_STACK AbortableRecordingStatus
TraceRecorder::record_JSOP_DELPROP()
@ -11507,7 +11515,7 @@ TraceRecorder::record_JSOP_DELPROP()
JSAtom* atom = atoms[GET_INDEX(cx->regs->pc)];
enterDeepBailCall();
LIns* args[] = { INS_ATOM(atom), get(&lval), cx_ins };
LIns* args[] = { strictModeCode_ins, INS_ATOM(atom), get(&lval), cx_ins };
LIns* rval_ins = lir->insCall(&DeleteStrKey_ci, args);
LIns* status_ins = lir->insLoad(LIR_ldi,
@ -11534,10 +11542,10 @@ TraceRecorder::record_JSOP_DELELEM()
enterDeepBailCall();
if (hasInt32Repr(idx)) {
LIns* args[] = { makeNumberInt32(get(&idx)), get(&lval), cx_ins };
LIns* args[] = { strictModeCode_ins, makeNumberInt32(get(&idx)), get(&lval), cx_ins };
rval_ins = lir->insCall(&DeleteIntKey_ci, args);
} else if (idx.isString()) {
LIns* args[] = { get(&idx), get(&lval), cx_ins };
LIns* args[] = { strictModeCode_ins, get(&idx), get(&lval), cx_ins };
rval_ins = lir->insCall(&DeleteStrKey_ci, args);
} else {
RETURN_STOP_A("JSOP_DELELEM on non-int, non-string index");
@ -12530,18 +12538,19 @@ TraceRecorder::record_JSOP_GETELEM()
/* Functions used by JSOP_SETELEM */
static JSBool FASTCALL
SetPropertyByName(JSContext* cx, JSObject* obj, JSString** namep, Value* vp)
SetPropertyByName(JSContext* cx, JSObject* obj, JSString** namep, Value* vp, JSBool strict)
{
LeaveTraceIfGlobalObject(cx, obj);
jsid id;
if (!RootedStringToId(cx, namep, &id) || !obj->setProperty(cx, id, vp)) {
if (!RootedStringToId(cx, namep, &id) || !obj->setProperty(cx, id, vp, strict)) {
SetBuiltinError(cx);
return JS_FALSE;
return false;
}
return cx->tracerState->builtinStatus == 0;
}
JS_DEFINE_CALLINFO_4(static, BOOL_FAIL, SetPropertyByName, CONTEXT, OBJECT, STRINGPTR, VALUEPTR,
JS_DEFINE_CALLINFO_5(static, BOOL_FAIL, SetPropertyByName,
CONTEXT, OBJECT, STRINGPTR, VALUEPTR, BOOL,
0, ACCSET_STORE_ANY)
static JSBool FASTCALL
@ -12576,7 +12585,7 @@ TraceRecorder::initOrSetPropertyByName(LIns* obj_ins, Value* idvalp, Value* rval
LIns* vp_ins = box_value_into_alloc(*rvalp, get(rvalp));
enterDeepBailCall();
LIns* idvalp_ins = addName(addr(idvalp), "idvalp");
LIns* args[] = {vp_ins, idvalp_ins, obj_ins, cx_ins};
LIns* args[] = { strictModeCode_ins, vp_ins, idvalp_ins, obj_ins, cx_ins };
pendingGuardCondition = lir->insCall(&SetPropertyByName_ci, args);
}
@ -12585,18 +12594,18 @@ TraceRecorder::initOrSetPropertyByName(LIns* obj_ins, Value* idvalp, Value* rval
}
static JSBool FASTCALL
SetPropertyByIndex(JSContext* cx, JSObject* obj, int32 index, Value* vp)
SetPropertyByIndex(JSContext* cx, JSObject* obj, int32 index, Value* vp, JSBool strict)
{
LeaveTraceIfGlobalObject(cx, obj);
AutoIdRooter idr(cx);
if (!js_Int32ToId(cx, index, idr.addr()) || !obj->setProperty(cx, idr.id(), vp)) {
if (!js_Int32ToId(cx, index, idr.addr()) || !obj->setProperty(cx, idr.id(), vp, strict)) {
SetBuiltinError(cx);
return JS_FALSE;
return false;
}
return cx->tracerState->builtinStatus == 0;
}
JS_DEFINE_CALLINFO_4(static, BOOL_FAIL, SetPropertyByIndex, CONTEXT, OBJECT, INT32, VALUEPTR,
JS_DEFINE_CALLINFO_5(static, BOOL_FAIL, SetPropertyByIndex, CONTEXT, OBJECT, INT32, VALUEPTR, BOOL,
0, ACCSET_STORE_ANY)
static JSBool FASTCALL
@ -12629,7 +12638,7 @@ TraceRecorder::initOrSetPropertyByIndex(LIns* obj_ins, LIns* index_ins, Value* r
// See note in getPropertyByName about vp.
LIns* vp_ins = box_value_into_alloc(*rvalp, get(rvalp));
enterDeepBailCall();
LIns* args[] = {vp_ins, index_ins, obj_ins, cx_ins};
LIns* args[] = {strictModeCode_ins, vp_ins, index_ins, obj_ins, cx_ins};
pendingGuardCondition = lir->insCall(&SetPropertyByIndex_ci, args);
}

Просмотреть файл

@ -927,6 +927,9 @@ class TraceRecorder
JSAtom** atoms;
Value* consts;
/* An instruction yielding the current script's strict mode code flag. */
nanojit::LIns* strictModeCode_ins;
/* FIXME: Dead, but soon to be used for something or other. */
Queue<jsbytecode*> cfgMerges;

Просмотреть файл

@ -535,7 +535,7 @@ class TypedArrayTemplate
}
static JSBool
obj_setProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp)
obj_setProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
{
ThisTypeArray *tarray = ThisTypeArray::fromJSObject(obj);
JS_ASSERT(tarray);
@ -620,11 +620,11 @@ class TypedArrayTemplate
return true;
Value tmp = *v;
return obj_setProperty(cx, obj, id, &tmp);
return obj_setProperty(cx, obj, id, &tmp, false);
}
static JSBool
obj_deleteProperty(JSContext *cx, JSObject *obj, jsid id, Value *rval)
obj_deleteProperty(JSContext *cx, JSObject *obj, jsid id, Value *rval, JSBool strict)
{
if (JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom)) {
rval->setBoolean(false);

Просмотреть файл

@ -485,8 +485,8 @@ typedef JSUintPtr JSUword;
***********************************************************************/
#ifdef __GNUC__
# define JS_FUNC_TO_DATA_PTR(type, fun) (__extension__ (type) (fun))
# define JS_DATA_TO_FUNC_PTR(type, ptr) (__extension__ (type) (ptr))
# define JS_FUNC_TO_DATA_PTR(type, fun) (__extension__ (type) (size_t) (fun))
# define JS_DATA_TO_FUNC_PTR(type, ptr) (__extension__ (type) (size_t) (ptr))
#else
/* Use an extra (void *) cast for MSVC. */
# define JS_FUNC_TO_DATA_PTR(type, fun) ((type) (void *) (fun))

Просмотреть файл

@ -878,6 +878,8 @@ typedef JSBool
typedef JSBool
(* PropertyIdOp)(JSContext *cx, JSObject *obj, jsid id, Value *vp);
typedef JSBool
(* StrictPropertyIdOp)(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict);
typedef JSBool
(* CallOp)(JSContext *cx, uintN argc, Value *vp);
static inline Native Valueify(JSNative f) { return (Native)f; }
@ -945,18 +947,18 @@ struct ClassExtension {
#define JS_NULL_CLASS_EXT {NULL,NULL,NULL,NULL,NULL}
struct ObjectOps {
JSLookupPropOp lookupProperty;
js::DefinePropOp defineProperty;
js::PropertyIdOp getProperty;
js::PropertyIdOp setProperty;
JSAttributesOp getAttributes;
JSAttributesOp setAttributes;
js::PropertyIdOp deleteProperty;
js::NewEnumerateOp enumerate;
JSTypeOfOp typeOf;
JSTraceOp trace;
JSObjectOp thisObject;
JSFinalizeOp clear;
JSLookupPropOp lookupProperty;
js::DefinePropOp defineProperty;
js::PropertyIdOp getProperty;
js::StrictPropertyIdOp setProperty;
JSAttributesOp getAttributes;
JSAttributesOp setAttributes;
js::StrictPropertyIdOp deleteProperty;
js::NewEnumerateOp enumerate;
JSTypeOfOp typeOf;
JSTraceOp trace;
JSObjectOp thisObject;
JSFinalizeOp clear;
};
#define JS_NULL_OBJECT_OPS {NULL,NULL,NULL,NULL,NULL,NULL, NULL,NULL,NULL,NULL,NULL,NULL}

Просмотреть файл

@ -4145,7 +4145,7 @@ PutProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
if (!nameqn)
goto bad;
if (!JSID_IS_VOID(funid)) {
ok = js_SetProperty(cx, obj, funid, Valueify(vp));
ok = js_SetProperty(cx, obj, funid, Valueify(vp), false);
goto out;
}
nameobj = nameqn;
@ -4729,7 +4729,7 @@ xml_getProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp)
}
static JSBool
xml_setProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp)
xml_setProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict)
{
return PutProperty(cx, obj, id, Jsvalify(vp));
}
@ -4761,7 +4761,7 @@ xml_setAttributes(JSContext *cx, JSObject *obj, jsid id, uintN *attrsp)
}
static JSBool
xml_deleteProperty(JSContext *cx, JSObject *obj, jsid id, Value *rval)
xml_deleteProperty(JSContext *cx, JSObject *obj, jsid id, Value *rval, JSBool strict)
{
JSXML *xml;
jsval idval;
@ -4775,7 +4775,7 @@ xml_deleteProperty(JSContext *cx, JSObject *obj, jsid id, Value *rval)
if (xml->xml_class != JSXML_CLASS_LIST) {
/* See NOTE in spec: this variation is reserved for future use. */
ReportBadXMLName(cx, IdToValue(id));
return JS_FALSE;
return false;
}
/* ECMA-357 9.2.1.3. */
@ -4783,9 +4783,9 @@ xml_deleteProperty(JSContext *cx, JSObject *obj, jsid id, Value *rval)
} else {
nameqn = ToXMLName(cx, idval, &funid);
if (!nameqn)
return JS_FALSE;
return false;
if (!JSID_IS_VOID(funid))
return js_DeleteProperty(cx, obj, funid, rval);
return js_DeleteProperty(cx, obj, funid, rval, false);
DeleteNamedProperty(cx, xml, nameqn,
nameqn->getClass() == &js_AttributeNameClass);
@ -4798,11 +4798,11 @@ xml_deleteProperty(JSContext *cx, JSObject *obj, jsid id, Value *rval)
* property's getter or setter. But now it's time to remove any such
* property, to purge the property cache and remove the scope entry.
*/
if (!obj->nativeEmpty() && !js_DeleteProperty(cx, obj, id, rval))
return JS_FALSE;
if (!obj->nativeEmpty() && !js_DeleteProperty(cx, obj, id, rval, false))
return false;
rval->setBoolean(true);
return JS_TRUE;
return true;
}
JSBool
@ -5738,7 +5738,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()))
if (!arrayobj->setProperty(cx, INT_TO_JSID(i), tvr.addr(), false))
return false;
}
return true;

Просмотреть файл

@ -896,79 +896,79 @@ mjit::Compiler::generateMethod()
END_CASE(JSOP_VOID)
BEGIN_CASE(JSOP_INCNAME)
jsop_nameinc(op, stubs::IncName, fullAtomIndex(PC));
jsop_nameinc(op, STRICT_VARIANT(stubs::IncName), fullAtomIndex(PC));
break;
END_CASE(JSOP_INCNAME)
BEGIN_CASE(JSOP_INCGNAME)
jsop_gnameinc(op, stubs::IncGlobalName, fullAtomIndex(PC));
jsop_gnameinc(op, STRICT_VARIANT(stubs::IncGlobalName), fullAtomIndex(PC));
break;
END_CASE(JSOP_INCGNAME)
BEGIN_CASE(JSOP_INCPROP)
jsop_propinc(op, stubs::IncProp, fullAtomIndex(PC));
jsop_propinc(op, STRICT_VARIANT(stubs::IncProp), fullAtomIndex(PC));
break;
END_CASE(JSOP_INCPROP)
BEGIN_CASE(JSOP_INCELEM)
jsop_eleminc(op, stubs::IncElem);
jsop_eleminc(op, STRICT_VARIANT(stubs::IncElem));
END_CASE(JSOP_INCELEM)
BEGIN_CASE(JSOP_DECNAME)
jsop_nameinc(op, stubs::DecName, fullAtomIndex(PC));
jsop_nameinc(op, STRICT_VARIANT(stubs::DecName), fullAtomIndex(PC));
break;
END_CASE(JSOP_DECNAME)
BEGIN_CASE(JSOP_DECGNAME)
jsop_gnameinc(op, stubs::DecGlobalName, fullAtomIndex(PC));
jsop_gnameinc(op, STRICT_VARIANT(stubs::DecGlobalName), fullAtomIndex(PC));
break;
END_CASE(JSOP_DECGNAME)
BEGIN_CASE(JSOP_DECPROP)
jsop_propinc(op, stubs::DecProp, fullAtomIndex(PC));
jsop_propinc(op, STRICT_VARIANT(stubs::DecProp), fullAtomIndex(PC));
break;
END_CASE(JSOP_DECPROP)
BEGIN_CASE(JSOP_DECELEM)
jsop_eleminc(op, stubs::DecElem);
jsop_eleminc(op, STRICT_VARIANT(stubs::DecElem));
END_CASE(JSOP_DECELEM)
BEGIN_CASE(JSOP_NAMEINC)
jsop_nameinc(op, stubs::NameInc, fullAtomIndex(PC));
jsop_nameinc(op, STRICT_VARIANT(stubs::NameInc), fullAtomIndex(PC));
break;
END_CASE(JSOP_NAMEINC)
BEGIN_CASE(JSOP_GNAMEINC)
jsop_gnameinc(op, stubs::GlobalNameInc, fullAtomIndex(PC));
jsop_gnameinc(op, STRICT_VARIANT(stubs::GlobalNameInc), fullAtomIndex(PC));
break;
END_CASE(JSOP_GNAMEINC)
BEGIN_CASE(JSOP_PROPINC)
jsop_propinc(op, stubs::PropInc, fullAtomIndex(PC));
jsop_propinc(op, STRICT_VARIANT(stubs::PropInc), fullAtomIndex(PC));
break;
END_CASE(JSOP_PROPINC)
BEGIN_CASE(JSOP_ELEMINC)
jsop_eleminc(op, stubs::ElemInc);
jsop_eleminc(op, STRICT_VARIANT(stubs::ElemInc));
END_CASE(JSOP_ELEMINC)
BEGIN_CASE(JSOP_NAMEDEC)
jsop_nameinc(op, stubs::NameDec, fullAtomIndex(PC));
jsop_nameinc(op, STRICT_VARIANT(stubs::NameDec), fullAtomIndex(PC));
break;
END_CASE(JSOP_NAMEDEC)
BEGIN_CASE(JSOP_GNAMEDEC)
jsop_gnameinc(op, stubs::GlobalNameDec, fullAtomIndex(PC));
jsop_gnameinc(op, STRICT_VARIANT(stubs::GlobalNameDec), fullAtomIndex(PC));
break;
END_CASE(JSOP_GNAMEDEC)
BEGIN_CASE(JSOP_PROPDEC)
jsop_propinc(op, stubs::PropDec, fullAtomIndex(PC));
jsop_propinc(op, STRICT_VARIANT(stubs::PropDec), fullAtomIndex(PC));
break;
END_CASE(JSOP_PROPDEC)
BEGIN_CASE(JSOP_ELEMDEC)
jsop_eleminc(op, stubs::ElemDec);
jsop_eleminc(op, STRICT_VARIANT(stubs::ElemDec));
END_CASE(JSOP_ELEMDEC)
BEGIN_CASE(JSOP_GETTHISPROP)
@ -1249,7 +1249,7 @@ mjit::Compiler::generateMethod()
BEGIN_CASE(JSOP_FORNAME)
prepareStubCall(Uses(1));
masm.move(ImmPtr(script->getAtom(fullAtomIndex(PC))), Registers::ArgReg1);
stubCall(stubs::ForName);
stubCall(STRICT_VARIANT(stubs::ForName));
END_CASE(JSOP_FORNAME)
BEGIN_CASE(JSOP_INCLOCAL)
@ -1322,7 +1322,7 @@ mjit::Compiler::generateMethod()
prepareStubCall(Uses(0));
masm.move(ImmPtr(inner), Registers::ArgReg1);
stubCall(stubs::DefFun);
stubCall(STRICT_VARIANT(stubs::DefFun));
}
END_CASE(JSOP_DEFFUN)
@ -2207,7 +2207,7 @@ mjit::Compiler::jsop_setprop_slow(JSAtom *atom)
{
prepareStubCall(Uses(2));
masm.move(ImmPtr(atom), Registers::ArgReg1);
stubCall(stubs::SetName);
stubCall(STRICT_VARIANT(stubs::SetName));
JS_STATIC_ASSERT(JSOP_SETNAME_LENGTH == JSOP_SETPROP_LENGTH);
frame.shimmy(1);
}
@ -2852,7 +2852,7 @@ mjit::Compiler::jsop_setprop(JSAtom *atom)
if (op == JSOP_SETNAME || op == JSOP_SETPROP || op == JSOP_SETGNAME || op ==
JSOP_SETMETHOD) {
stubcc.masm.move(ImmPtr(atom), Registers::ArgReg1);
stubcc.call(stubs::SetName);
stubcc.call(STRICT_VARIANT(stubs::SetName));
} else {
stubcc.masm.move(Imm32(pics.length()), Registers::ArgReg1);
stubcc.call(ic::SetPropDumb);
@ -3800,7 +3800,7 @@ mjit::Compiler::jsop_setgname_slow(uint32 index)
JSAtom *atom = script->getAtom(index);
prepareStubCall(Uses(2));
masm.move(ImmPtr(atom), Registers::ArgReg1);
stubCall(stubs::SetGlobalName);
stubCall(STRICT_VARIANT(stubs::SetGlobalName));
frame.popn(2);
frame.pushSynced();
}
@ -3948,7 +3948,7 @@ void
mjit::Compiler::jsop_setelem_slow()
{
prepareStubCall(Uses(3));
stubCall(stubs::SetElem);
stubCall(STRICT_VARIANT(stubs::SetElem));
frame.popn(3);
frame.pushSynced();
}

Просмотреть файл

@ -1234,7 +1234,7 @@ mjit::Compiler::jsop_setelem()
stubcc.linkExit(notHole, Uses(3));
stubcc.leave();
stubcc.call(stubs::SetElem);
stubcc.call(STRICT_VARIANT(stubs::SetElem));
/* Infallible, start killing everything. */
frame.eviscerate(obj);
@ -1316,7 +1316,7 @@ mjit::Compiler::jsop_setelem()
stubcc.crossJump(jmpHoleExit, lblRejoin);
stubcc.leave();
stubcc.call(stubs::SetElem);
stubcc.call(STRICT_VARIANT(stubs::SetElem));
/* Infallible, start killing everything. */
frame.eviscerate(obj);

Просмотреть файл

@ -131,8 +131,12 @@ ic::GetGlobalName(VMFrame &f, uint32 index)
static void JS_FASTCALL
SetGlobalNameSlow(VMFrame &f, uint32 index)
{
JSAtom *atom = f.fp()->script()->getAtom(GET_INDEX(f.regs.pc));
stubs::SetGlobalName(f, atom);
JSScript *script = f.fp()->script();
JSAtom *atom = script->getAtom(GET_INDEX(f.regs.pc));
if (script->strictModeCode)
stubs::SetGlobalName<true>(f, atom);
else
stubs::SetGlobalName<false>(f, atom);
}
static void
@ -146,11 +150,12 @@ PatchSetFallback(VMFrame &f, ic::MICInfo &mic)
static VoidStubAtom
GetStubForSetGlobalName(VMFrame &f)
{
JSScript *script = f.fp()->script();
// The property cache doesn't like inc ops, so we use a simpler
// stub for that case.
return js_CodeSpec[*f.regs.pc].format & (JOF_INC | JOF_DEC)
? stubs::SetGlobalNameDumb
: stubs::SetGlobalName;
? STRICT_VARIANT(stubs::SetGlobalNameDumb)
: STRICT_VARIANT(stubs::SetGlobalName);
}
void JS_FASTCALL

Просмотреть файл

@ -2121,7 +2121,8 @@ ic::SetPropDumb(VMFrame &f, uint32 index)
if (!obj)
THROW();
Value rval = f.regs.sp[-1];
if (!obj->setProperty(f.cx, ATOM_TO_JSID(atom), &f.regs.sp[-1]))
if (!obj->setProperty(f.cx, ATOM_TO_JSID(atom), &f.regs.sp[-1],
script->strictModeCode))
THROW();
f.regs.sp[-2] = rval;
}
@ -2134,7 +2135,7 @@ SetPropSlow(VMFrame &f, uint32 index)
JS_ASSERT(pic.isSet());
JSAtom *atom = pic.atom;
stubs::SetName(f, atom);
STRICT_VARIANT(stubs::SetName)(f, atom);
}
void JS_FASTCALL

Просмотреть файл

@ -103,6 +103,7 @@ stubs::BindGlobalName(VMFrame &f)
return f.fp()->scopeChain().getGlobal();
}
template<JSBool strict>
void JS_FASTCALL
stubs::SetName(VMFrame &f, JSAtom *origAtom)
{
@ -266,10 +267,10 @@ stubs::SetName(VMFrame &f, JSAtom *origAtom)
defineHow = JSDNP_CACHE_RESULT | JSDNP_UNQUALIFIED;
else
defineHow = JSDNP_CACHE_RESULT;
if (!js_SetPropertyHelper(cx, obj, id, defineHow, &rval))
if (!js_SetPropertyHelper(cx, obj, id, defineHow, &rval, strict))
THROW();
} else {
if (!obj->setProperty(cx, id, &rval))
if (!obj->setProperty(cx, id, &rval, strict))
THROW();
}
} while (0);
@ -277,6 +278,10 @@ stubs::SetName(VMFrame &f, JSAtom *origAtom)
f.regs.sp[-2] = f.regs.sp[-1];
}
template void JS_FASTCALL stubs::SetName<true>(VMFrame &f, JSAtom *origAtom);
template void JS_FASTCALL stubs::SetName<false>(VMFrame &f, JSAtom *origAtom);
template<JSBool strict>
void JS_FASTCALL
stubs::SetGlobalNameDumb(VMFrame &f, JSAtom *atom)
{
@ -288,18 +293,25 @@ stubs::SetGlobalNameDumb(VMFrame &f, JSAtom *atom)
if (!obj)
THROW();
jsid id = ATOM_TO_JSID(atom);
if (!obj->setProperty(cx, id, &rval))
if (!obj->setProperty(cx, id, &rval, strict))
THROW();
f.regs.sp[-2] = f.regs.sp[-1];
}
template void JS_FASTCALL stubs::SetGlobalNameDumb<true>(VMFrame &f, JSAtom *atom);
template void JS_FASTCALL stubs::SetGlobalNameDumb<false>(VMFrame &f, JSAtom *atom);
template<JSBool strict>
void JS_FASTCALL
stubs::SetGlobalName(VMFrame &f, JSAtom *atom)
{
SetName(f, atom);
SetName<strict>(f, atom);
}
template void JS_FASTCALL stubs::SetGlobalName<true>(VMFrame &f, JSAtom *atom);
template void JS_FASTCALL stubs::SetGlobalName<false>(VMFrame &f, JSAtom *atom);
static JSObject *
NameOp(VMFrame &f, JSObject *obj, bool callname = false)
{
@ -438,6 +450,7 @@ IteratorNext(JSContext *cx, JSObject *iterobj, Value *rval)
return js_IteratorNext(cx, iterobj, rval);
}
template<JSBool strict>
void JS_FASTCALL
stubs::ForName(VMFrame &f, JSAtom *atom)
{
@ -457,11 +470,14 @@ stubs::ForName(VMFrame &f, JSAtom *atom)
JS_ASSERT(regs.sp[-1].isObject());
if (!IteratorNext(cx, &regs.sp[-1].toObject(), tvr.addr()))
THROW();
if (!obj->setProperty(cx, id, tvr.addr()))
if (!obj->setProperty(cx, id, tvr.addr(), strict))
THROW();
}
}
template void JS_FASTCALL stubs::ForName<true>(VMFrame &f, JSAtom *atom);
template void JS_FASTCALL stubs::ForName<false>(VMFrame &f, JSAtom *atom);
void JS_FASTCALL
stubs::GetElem(VMFrame &f)
{
@ -582,6 +598,7 @@ stubs::CallElem(VMFrame &f)
}
}
template<JSBool strict>
void JS_FASTCALL
stubs::SetElem(VMFrame &f)
{
@ -618,7 +635,7 @@ stubs::SetElem(VMFrame &f)
}
}
} while (0);
if (!obj->setProperty(cx, id, &retval))
if (!obj->setProperty(cx, id, &retval, strict))
THROW();
end_setelem:
/* :FIXME: Moving the assigned object into the lowest stack slot
@ -628,6 +645,9 @@ stubs::SetElem(VMFrame &f)
regs.sp[-3] = retval;
}
template void JS_FASTCALL stubs::SetElem<true>(VMFrame &f);
template void JS_FASTCALL stubs::SetElem<false>(VMFrame &f);
void JS_FASTCALL
stubs::CallName(VMFrame &f)
{
@ -823,6 +843,7 @@ stubs::DecLocal(VMFrame &f, uint32 slot)
f.fp()->slots()[slot] = f.regs.sp[-1];
}
template<JSBool strict>
void JS_FASTCALL
stubs::DefFun(VMFrame &f, JSFunction *fun)
{
@ -938,12 +959,15 @@ stubs::DefFun(VMFrame &f, JSFunction *fun)
}
Value rval = ObjectValue(*obj);
ok = doSet
? parent->setProperty(cx, id, &rval)
? parent->setProperty(cx, id, &rval, strict)
: parent->defineProperty(cx, id, rval, PropertyStub, PropertyStub, attrs);
if (!ok)
THROW();
}
template void JS_FASTCALL stubs::DefFun<true>(VMFrame &f, JSFunction *fun);
template void JS_FASTCALL stubs::DefFun<false>(VMFrame &f, JSFunction *fun);
#define DEFAULT_VALUE(cx, n, hint, v) \
JS_BEGIN_MACRO \
JS_ASSERT(v.isObject()); \
@ -1650,7 +1674,7 @@ CanIncDecWithoutOverflow(int32_t i)
return (i > JSVAL_INT_MIN) && (i < JSVAL_INT_MAX);
}
template <int32 N, bool POST>
template <int32 N, bool POST, JSBool strict>
static inline bool
ObjIncOp(VMFrame &f, JSObject *obj, jsid id)
{
@ -1670,7 +1694,7 @@ ObjIncOp(VMFrame &f, JSObject *obj, jsid id)
else
ref.getInt32Ref() = tmp += N;
fp->setAssigning();
JSBool ok = obj->setProperty(cx, id, &ref);
JSBool ok = obj->setProperty(cx, id, &ref, strict);
fp->clearAssigning();
if (!ok)
return false;
@ -1694,7 +1718,7 @@ ObjIncOp(VMFrame &f, JSObject *obj, jsid id)
}
v.setDouble(d);
fp->setAssigning();
JSBool ok = obj->setProperty(cx, id, &v);
JSBool ok = obj->setProperty(cx, id, &v, strict);
fp->clearAssigning();
if (!ok)
return false;
@ -1703,7 +1727,7 @@ ObjIncOp(VMFrame &f, JSObject *obj, jsid id)
return true;
}
template <int32 N, bool POST>
template <int32 N, bool POST, JSBool strict>
static inline bool
NameIncDec(VMFrame &f, JSObject *obj, JSAtom *origAtom)
{
@ -1740,53 +1764,70 @@ NameIncDec(VMFrame &f, JSObject *obj, JSAtom *origAtom)
return false;
}
obj2->dropProperty(cx, prop);
return ObjIncOp<N, POST>(f, obj, id);
return ObjIncOp<N, POST, strict>(f, obj, id);
}
template<JSBool strict>
void JS_FASTCALL
stubs::PropInc(VMFrame &f, JSAtom *atom)
{
JSObject *obj = ValueToObject(f.cx, &f.regs.sp[-1]);
if (!obj)
THROW();
if (!ObjIncOp<1, true>(f, obj, ATOM_TO_JSID(atom)))
if (!ObjIncOp<1, true, strict>(f, obj, ATOM_TO_JSID(atom)))
THROW();
f.regs.sp[-2] = f.regs.sp[-1];
}
template void JS_FASTCALL stubs::PropInc<true>(VMFrame &f, JSAtom *atom);
template void JS_FASTCALL stubs::PropInc<false>(VMFrame &f, JSAtom *atom);
template<JSBool strict>
void JS_FASTCALL
stubs::PropDec(VMFrame &f, JSAtom *atom)
{
JSObject *obj = ValueToObject(f.cx, &f.regs.sp[-1]);
if (!obj)
THROW();
if (!ObjIncOp<-1, true>(f, obj, ATOM_TO_JSID(atom)))
if (!ObjIncOp<-1, true, strict>(f, obj, ATOM_TO_JSID(atom)))
THROW();
f.regs.sp[-2] = f.regs.sp[-1];
}
template void JS_FASTCALL stubs::PropDec<true>(VMFrame &f, JSAtom *atom);
template void JS_FASTCALL stubs::PropDec<false>(VMFrame &f, JSAtom *atom);
template<JSBool strict>
void JS_FASTCALL
stubs::IncProp(VMFrame &f, JSAtom *atom)
{
JSObject *obj = ValueToObject(f.cx, &f.regs.sp[-1]);
if (!obj)
THROW();
if (!ObjIncOp<1, false>(f, obj, ATOM_TO_JSID(atom)))
if (!ObjIncOp<1, false, strict>(f, obj, ATOM_TO_JSID(atom)))
THROW();
f.regs.sp[-2] = f.regs.sp[-1];
}
template void JS_FASTCALL stubs::IncProp<true>(VMFrame &f, JSAtom *atom);
template void JS_FASTCALL stubs::IncProp<false>(VMFrame &f, JSAtom *atom);
template<JSBool strict>
void JS_FASTCALL
stubs::DecProp(VMFrame &f, JSAtom *atom)
{
JSObject *obj = ValueToObject(f.cx, &f.regs.sp[-1]);
if (!obj)
THROW();
if (!ObjIncOp<-1, false>(f, obj, ATOM_TO_JSID(atom)))
if (!ObjIncOp<-1, false, strict>(f, obj, ATOM_TO_JSID(atom)))
THROW();
f.regs.sp[-2] = f.regs.sp[-1];
}
template void JS_FASTCALL stubs::DecProp<true>(VMFrame &f, JSAtom *atom);
template void JS_FASTCALL stubs::DecProp<false>(VMFrame &f, JSAtom *atom);
template<JSBool strict>
void JS_FASTCALL
stubs::ElemInc(VMFrame &f)
{
@ -1796,11 +1837,15 @@ stubs::ElemInc(VMFrame &f)
jsid id;
if (!FetchElementId(f, obj, f.regs.sp[-1], id, &f.regs.sp[-1]))
THROW();
if (!ObjIncOp<1, true>(f, obj, id))
if (!ObjIncOp<1, true, strict>(f, obj, id))
THROW();
f.regs.sp[-3] = f.regs.sp[-1];
}
template void JS_FASTCALL stubs::ElemInc<true>(VMFrame &f);
template void JS_FASTCALL stubs::ElemInc<false>(VMFrame &f);
template<JSBool strict>
void JS_FASTCALL
stubs::ElemDec(VMFrame &f)
{
@ -1810,11 +1855,15 @@ stubs::ElemDec(VMFrame &f)
jsid id;
if (!FetchElementId(f, obj, f.regs.sp[-1], id, &f.regs.sp[-1]))
THROW();
if (!ObjIncOp<-1, true>(f, obj, id))
if (!ObjIncOp<-1, true, strict>(f, obj, id))
THROW();
f.regs.sp[-3] = f.regs.sp[-1];
}
template void JS_FASTCALL stubs::ElemDec<true>(VMFrame &f);
template void JS_FASTCALL stubs::ElemDec<false>(VMFrame &f);
template<JSBool strict>
void JS_FASTCALL
stubs::IncElem(VMFrame &f)
{
@ -1824,11 +1873,15 @@ stubs::IncElem(VMFrame &f)
jsid id;
if (!FetchElementId(f, obj, f.regs.sp[-1], id, &f.regs.sp[-1]))
THROW();
if (!ObjIncOp<1, false>(f, obj, id))
if (!ObjIncOp<1, false, strict>(f, obj, id))
THROW();
f.regs.sp[-3] = f.regs.sp[-1];
}
template void JS_FASTCALL stubs::IncElem<true>(VMFrame &f);
template void JS_FASTCALL stubs::IncElem<false>(VMFrame &f);
template<JSBool strict>
void JS_FASTCALL
stubs::DecElem(VMFrame &f)
{
@ -1838,75 +1891,110 @@ stubs::DecElem(VMFrame &f)
jsid id;
if (!FetchElementId(f, obj, f.regs.sp[-1], id, &f.regs.sp[-1]))
THROW();
if (!ObjIncOp<-1, false>(f, obj, id))
if (!ObjIncOp<-1, false, strict>(f, obj, id))
THROW();
f.regs.sp[-3] = f.regs.sp[-1];
}
template void JS_FASTCALL stubs::DecElem<true>(VMFrame &f);
template void JS_FASTCALL stubs::DecElem<false>(VMFrame &f);
template<JSBool strict>
void JS_FASTCALL
stubs::NameInc(VMFrame &f, JSAtom *atom)
{
JSObject *obj = &f.fp()->scopeChain();
if (!NameIncDec<1, true>(f, obj, atom))
if (!NameIncDec<1, true, strict>(f, obj, atom))
THROW();
}
template void JS_FASTCALL stubs::NameInc<true>(VMFrame &f, JSAtom *atom);
template void JS_FASTCALL stubs::NameInc<false>(VMFrame &f, JSAtom *atom);
template<JSBool strict>
void JS_FASTCALL
stubs::NameDec(VMFrame &f, JSAtom *atom)
{
JSObject *obj = &f.fp()->scopeChain();
if (!NameIncDec<-1, true>(f, obj, atom))
if (!NameIncDec<-1, true, strict>(f, obj, atom))
THROW();
}
template void JS_FASTCALL stubs::NameDec<true>(VMFrame &f, JSAtom *atom);
template void JS_FASTCALL stubs::NameDec<false>(VMFrame &f, JSAtom *atom);
template<JSBool strict>
void JS_FASTCALL
stubs::IncName(VMFrame &f, JSAtom *atom)
{
JSObject *obj = &f.fp()->scopeChain();
if (!NameIncDec<1, false>(f, obj, atom))
if (!NameIncDec<1, false, strict>(f, obj, atom))
THROW();
}
template void JS_FASTCALL stubs::IncName<true>(VMFrame &f, JSAtom *atom);
template void JS_FASTCALL stubs::IncName<false>(VMFrame &f, JSAtom *atom);
template<JSBool strict>
void JS_FASTCALL
stubs::DecName(VMFrame &f, JSAtom *atom)
{
JSObject *obj = &f.fp()->scopeChain();
if (!NameIncDec<-1, false>(f, obj, atom))
if (!NameIncDec<-1, false, strict>(f, obj, atom))
THROW();
}
template void JS_FASTCALL stubs::DecName<true>(VMFrame &f, JSAtom *atom);
template void JS_FASTCALL stubs::DecName<false>(VMFrame &f, JSAtom *atom);
template<JSBool strict>
void JS_FASTCALL
stubs::GlobalNameInc(VMFrame &f, JSAtom *atom)
{
JSObject *obj = f.fp()->scopeChain().getGlobal();
if (!NameIncDec<1, true>(f, obj, atom))
if (!NameIncDec<1, true, strict>(f, obj, atom))
THROW();
}
template void JS_FASTCALL stubs::GlobalNameInc<true>(VMFrame &f, JSAtom *atom);
template void JS_FASTCALL stubs::GlobalNameInc<false>(VMFrame &f, JSAtom *atom);
template<JSBool strict>
void JS_FASTCALL
stubs::GlobalNameDec(VMFrame &f, JSAtom *atom)
{
JSObject *obj = f.fp()->scopeChain().getGlobal();
if (!NameIncDec<-1, true>(f, obj, atom))
if (!NameIncDec<-1, true, strict>(f, obj, atom))
THROW();
}
template void JS_FASTCALL stubs::GlobalNameDec<true>(VMFrame &f, JSAtom *atom);
template void JS_FASTCALL stubs::GlobalNameDec<false>(VMFrame &f, JSAtom *atom);
template<JSBool strict>
void JS_FASTCALL
stubs::IncGlobalName(VMFrame &f, JSAtom *atom)
{
JSObject *obj = f.fp()->scopeChain().getGlobal();
if (!NameIncDec<1, false>(f, obj, atom))
if (!NameIncDec<1, false, strict>(f, obj, atom))
THROW();
}
template void JS_FASTCALL stubs::IncGlobalName<true>(VMFrame &f, JSAtom *atom);
template void JS_FASTCALL stubs::IncGlobalName<false>(VMFrame &f, JSAtom *atom);
template<JSBool strict>
void JS_FASTCALL
stubs::DecGlobalName(VMFrame &f, JSAtom *atom)
{
JSObject *obj = f.fp()->scopeChain().getGlobal();
if (!NameIncDec<-1, false>(f, obj, atom))
if (!NameIncDec<-1, false, strict>(f, obj, atom))
THROW();
}
template void JS_FASTCALL stubs::DecGlobalName<true>(VMFrame &f, JSAtom *atom);
template void JS_FASTCALL stubs::DecGlobalName<false>(VMFrame &f, JSAtom *atom);
static bool JS_FASTCALL
InlineGetProp(VMFrame &f)
{
@ -2201,7 +2289,7 @@ InitPropOrMethod(VMFrame &f, JSAtom *atom, JSOp op)
? JSDNP_CACHE_RESULT | JSDNP_SET_METHOD
: JSDNP_CACHE_RESULT;
if (!(JS_UNLIKELY(atom == cx->runtime->atomState.protoAtom)
? js_SetPropertyHelper(cx, obj, id, defineHow, &rval)
? js_SetPropertyHelper(cx, obj, id, defineHow, &rval, false)
: js_DefineNativeProperty(cx, obj, id, rval, NULL, NULL,
JSPROP_ENUMERATE, 0, 0, NULL,
defineHow))) {

Просмотреть файл

@ -115,38 +115,38 @@ void * JS_FASTCALL TableSwitch(VMFrame &f, jsbytecode *origPc);
void JS_FASTCALL BindName(VMFrame &f);
JSObject * JS_FASTCALL BindGlobalName(VMFrame &f);
void JS_FASTCALL SetName(VMFrame &f, JSAtom *atom);
void JS_FASTCALL SetGlobalName(VMFrame &f, JSAtom *atom);
void JS_FASTCALL SetGlobalNameDumb(VMFrame &f, JSAtom *atom);
template<JSBool strict> void JS_FASTCALL SetName(VMFrame &f, JSAtom *atom);
template<JSBool strict> void JS_FASTCALL SetGlobalName(VMFrame &f, JSAtom *atom);
template<JSBool strict> void JS_FASTCALL SetGlobalNameDumb(VMFrame &f, JSAtom *atom);
void JS_FASTCALL Name(VMFrame &f);
void JS_FASTCALL GetProp(VMFrame &f);
void JS_FASTCALL GetElem(VMFrame &f);
void JS_FASTCALL CallElem(VMFrame &f);
void JS_FASTCALL SetElem(VMFrame &f);
template<JSBool strict> void JS_FASTCALL SetElem(VMFrame &f);
void JS_FASTCALL Length(VMFrame &f);
void JS_FASTCALL CallName(VMFrame &f);
void JS_FASTCALL GetUpvar(VMFrame &f, uint32 index);
void JS_FASTCALL GetGlobalName(VMFrame &f);
void JS_FASTCALL NameInc(VMFrame &f, JSAtom *atom);
void JS_FASTCALL NameDec(VMFrame &f, JSAtom *atom);
void JS_FASTCALL IncName(VMFrame &f, JSAtom *atom);
void JS_FASTCALL DecName(VMFrame &f, JSAtom *atom);
void JS_FASTCALL GlobalNameInc(VMFrame &f, JSAtom *atom);
void JS_FASTCALL GlobalNameDec(VMFrame &f, JSAtom *atom);
void JS_FASTCALL IncGlobalName(VMFrame &f, JSAtom *atom);
void JS_FASTCALL DecGlobalName(VMFrame &f, JSAtom *atom);
void JS_FASTCALL PropInc(VMFrame &f, JSAtom *atom);
void JS_FASTCALL PropDec(VMFrame &f, JSAtom *atom);
void JS_FASTCALL IncProp(VMFrame &f, JSAtom *atom);
void JS_FASTCALL DecProp(VMFrame &f, JSAtom *atom);
void JS_FASTCALL ElemInc(VMFrame &f);
void JS_FASTCALL ElemDec(VMFrame &f);
void JS_FASTCALL IncElem(VMFrame &f);
void JS_FASTCALL DecElem(VMFrame &f);
template<JSBool strict> void JS_FASTCALL NameInc(VMFrame &f, JSAtom *atom);
template<JSBool strict> void JS_FASTCALL NameDec(VMFrame &f, JSAtom *atom);
template<JSBool strict> void JS_FASTCALL IncName(VMFrame &f, JSAtom *atom);
template<JSBool strict> void JS_FASTCALL DecName(VMFrame &f, JSAtom *atom);
template<JSBool strict> void JS_FASTCALL GlobalNameInc(VMFrame &f, JSAtom *atom);
template<JSBool strict> void JS_FASTCALL GlobalNameDec(VMFrame &f, JSAtom *atom);
template<JSBool strict> void JS_FASTCALL IncGlobalName(VMFrame &f, JSAtom *atom);
template<JSBool strict> void JS_FASTCALL DecGlobalName(VMFrame &f, JSAtom *atom);
template<JSBool strict> void JS_FASTCALL PropInc(VMFrame &f, JSAtom *atom);
template<JSBool strict> void JS_FASTCALL PropDec(VMFrame &f, JSAtom *atom);
template<JSBool strict> void JS_FASTCALL IncProp(VMFrame &f, JSAtom *atom);
template<JSBool strict> void JS_FASTCALL DecProp(VMFrame &f, JSAtom *atom);
template<JSBool strict> void JS_FASTCALL ElemInc(VMFrame &f);
template<JSBool strict> void JS_FASTCALL ElemDec(VMFrame &f);
template<JSBool strict> void JS_FASTCALL IncElem(VMFrame &f);
template<JSBool strict> void JS_FASTCALL DecElem(VMFrame &f);
void JS_FASTCALL CallProp(VMFrame &f, JSAtom *atom);
void JS_FASTCALL DefFun(VMFrame &f, JSFunction *fun);
template<JSBool strict> void JS_FASTCALL DefFun(VMFrame &f, JSFunction *fun);
JSObject * JS_FASTCALL DefLocalFun(VMFrame &f, JSFunction *fun);
JSObject * JS_FASTCALL DefLocalFun_FC(VMFrame &f, JSFunction *fun);
JSObject * JS_FASTCALL RegExp(VMFrame &f, JSObject *regex);
@ -199,7 +199,7 @@ void JS_FASTCALL Iter(VMFrame &f, uint32 flags);
void JS_FASTCALL IterNext(VMFrame &f);
JSBool JS_FASTCALL IterMore(VMFrame &f);
void JS_FASTCALL EndIter(VMFrame &f);
void JS_FASTCALL ForName(VMFrame &f, JSAtom *atom);
template<JSBool strict> void JS_FASTCALL ForName(VMFrame &f, JSAtom *atom);
JSBool JS_FASTCALL ValueToBoolean(VMFrame &f);
JSString * JS_FASTCALL TypeOf(VMFrame &f);
@ -208,7 +208,25 @@ void JS_FASTCALL FastInstanceOf(VMFrame &f);
void JS_FASTCALL ArgCnt(VMFrame &f);
void JS_FASTCALL Unbrand(VMFrame &f);
}}} /* namespace stubs,mjit,js */
} /* namespace stubs */
/*
* If COND is true, return A; otherwise, return B. This allows us to choose between
* function template instantiations without running afoul of C++'s overload resolution
* rules. (Try simplifying, and you'll either see the problem --- or have found a
* better solution!)
*/
template<typename FuncPtr>
inline FuncPtr FunctionTemplateConditional(bool cond, FuncPtr a, FuncPtr b) {
return cond ? a : b;
}
/* Return f<true> if the script is strict mode code, f<false> otherwise. */
#define STRICT_VARIANT(f) \
(FunctionTemplateConditional(script->strictModeCode, \
f<true>, f<false>))
}} /* namespace stubs,mjit,js */
extern "C" void *
js_InternalThrow(js::VMFrame &f);

Просмотреть файл

@ -2787,7 +2787,7 @@ split_delProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
/* Make sure to define this property on the inner object. */
if (!JS_ValueToId(cx, *vp, &asId))
return JS_FALSE;
return cpx->inner->deleteProperty(cx, asId, Valueify(vp));
return cpx->inner->deleteProperty(cx, asId, Valueify(vp), true);
}
return JS_TRUE;
}