static inline JSObject* constructArrayWithSizeQuirk(ExecState* exec, const ArgList& args) { JSGlobalObject* globalObject = asInternalFunction(exec->callee())->globalObject(); // a single numeric argument denotes the array size (!) if (args.size() == 1) return constructArrayWithSizeQuirk(exec, 0, globalObject, args.at(0)); // otherwise the array is constructed with the arguments in it return constructArray(exec, 0, globalObject, args); }
static EncodedJSValue JSC_HOST_CALL constructWithArrayConstructor(ExecState* exec) { ArgList args(exec); JSValue prototype = JSValue(); JSObject* newTarget = exec->newTarget().getObject(); if (newTarget->classInfo() != ArrayConstructor::info()) prototype = newTarget->get(exec, exec->propertyNames().prototype); return JSValue::encode(constructArrayWithSizeQuirk(exec, args, prototype)); }
static JSValue JSC_HOST_CALL callArrayConstructor(ExecState* exec, JSObject*, JSValue, const ArgList& args) { return constructArrayWithSizeQuirk(exec, args); }
static JSObject* constructWithArrayConstructor(ExecState* exec, JSObject*, const ArgList& args) { return constructArrayWithSizeQuirk(exec, args); }
static EncodedJSValue JSC_HOST_CALL constructWithArrayConstructor(ExecState* exec) { ArgList args(exec); return JSValue::encode(constructArrayWithSizeQuirk(exec, args)); }