if (JSVAL_IS_PRIMITIVE(argv[0])) {  if (!js_ValueToObject(cx, argv[0], &tmp)) return JS_FALSE; argv[0] = OBJECT_TO_JSVAL(tmp); }
JS_STATIC_DLL_CALLBACK(JSBool)js_generic_native_method_dispatcher(JSContext *cx, JSObject *obj,                                    uintN argc, jsval *argv, jsval *rval){    jsval fsv;    JSFunctionSpec *fs;    JSObject *tmp;    if (!JS_GetReservedSlot(cx, JSVAL_TO_OBJECT(argv[-2]), 0, &fsv))        return JS_FALSE;    fs = (JSFunctionSpec *) JSVAL_TO_PRIVATE(fsv);    /*     * We know that argv[0] is valid because JS_DefineFunctions, which is our     * only (indirect) referrer, defined us as requiring at least one argument     * (notice how it passes fs->nargs + 1 as the next-to-last argument to     * JS_DefineFunction).     */    if (JSVAL_IS_PRIMITIVE(argv[0])) {        /*         * Make sure that this is an object or null, as required by the generic         * functions.         */        if (!js_ValueToObject(cx, argv[0], &tmp))            return JS_FALSE;        argv[0] = OBJECT_TO_JSVAL(tmp);    }    /*     * Copy all actual (argc) and required but missing (fs->nargs + 1 - argc)     * args down over our |this| parameter, argv[-1], which is almost always     * the class constructor object, e.g. Array.  Then call the corresponding     * prototype native method with our first argument passed as |this|.     */    memmove(argv - 1, argv, (fs->nargs + 1) * sizeof(jsval));    /*     * Follow Function.prototype.apply and .call by using the global object as     * the 'this' param if no args.     */    JS_ASSERT(cx->fp->argv == argv);    if (!js_ComputeThis(cx, JSVAL_TO_OBJECT(argv[-1]), cx->fp))        return JS_FALSE;    /*     * Protect against argc - 1 underflowing below. By calling js_ComputeThis,     * we made it as if the static was called with one parameter.     */    if (argc == 0)        argc = 1;    return fs->call(cx, JSVAL_TO_OBJECT(argv[-1]), argc - 1, argv, rval);}