static JSBool ArgSetter(JSContext *cx, HandleObject obj, HandleId id, JSBool strict, Value *vp) { if (!obj->isNormalArguments()) return true; NormalArgumentsObject &argsobj = obj->asNormalArguments(); if (JSID_IS_INT(id)) { unsigned arg = unsigned(JSID_TO_INT(id)); if (arg < argsobj.initialLength()) { if (StackFrame *fp = argsobj.maybeStackFrame()) { JSScript *script = fp->functionScript(); JS_ASSERT(script->needsArgsObj()); if (arg < fp->numFormalArgs()) { JS_ASSERT(fp->script()->formalIsAliased(arg)); types::TypeScript::SetArgument(cx, script, arg, *vp); } fp->canonicalActualArg(arg) = *vp; return true; } } } else { JS_ASSERT(JSID_IS_ATOM(id, cx->runtime->atomState.lengthAtom) || JSID_IS_ATOM(id, cx->runtime->atomState.calleeAtom)); } /* * For simplicity we use delete/define to replace the property with one * backed by the default Object getter and setter. Note that we rely on * args_delProperty to clear the corresponding reserved slot so the GC can * collect its value. Note also that we must define the property instead * of setting it in case the user has changed the prototype to an object * that has a setter for this id. */ RootedVarValue value(cx); return baseops::DeleteGeneric(cx, obj, id, value.address(), false) && baseops::DefineProperty(cx, obj, id, vp, NULL, NULL, JSPROP_ENUMERATE); }