X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/93a3786624b2768d89bfa27e46598dc64e2fb70a..HEAD:/runtime/ArrayConstructor.cpp diff --git a/runtime/ArrayConstructor.cpp b/runtime/ArrayConstructor.cpp index 7520557..194f921 100644 --- a/runtime/ArrayConstructor.cpp +++ b/runtime/ArrayConstructor.cpp @@ -32,7 +32,7 @@ #include "JSArray.h" #include "JSFunction.h" #include "Lookup.h" -#include "Operations.h" +#include "JSCInlines.h" namespace JSC { @@ -44,36 +44,33 @@ static EncodedJSValue JSC_HOST_CALL arrayConstructorIsArray(ExecState*); namespace JSC { -ASSERT_HAS_TRIVIAL_DESTRUCTOR(ArrayConstructor); +STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(ArrayConstructor); -const ClassInfo ArrayConstructor::s_info = { "Function", &InternalFunction::s_info, 0, ExecState::arrayConstructorTable, CREATE_METHOD_TABLE(ArrayConstructor) }; +const ClassInfo ArrayConstructor::s_info = { "Function", &InternalFunction::s_info, &arrayConstructorTable, CREATE_METHOD_TABLE(ArrayConstructor) }; /* Source for ArrayConstructor.lut.h @begin arrayConstructorTable isArray arrayConstructorIsArray DontEnum|Function 1 + of arrayConstructorOf DontEnum|Function 0 + from arrayConstructorFrom DontEnum|Function 0 @end */ -ArrayConstructor::ArrayConstructor(JSGlobalObject* globalObject, Structure* structure) - : InternalFunction(globalObject, structure) +ArrayConstructor::ArrayConstructor(VM& vm, Structure* structure) + : InternalFunction(vm, structure) { } -void ArrayConstructor::finishCreation(ExecState* exec, ArrayPrototype* arrayPrototype) +void ArrayConstructor::finishCreation(VM& vm, ArrayPrototype* arrayPrototype) { - Base::finishCreation(exec->vm(), arrayPrototype->classInfo()->className); - putDirectWithoutTransition(exec->vm(), exec->propertyNames().prototype, arrayPrototype, DontEnum | DontDelete | ReadOnly); - putDirectWithoutTransition(exec->vm(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete); + Base::finishCreation(vm, arrayPrototype->classInfo()->className); + putDirectWithoutTransition(vm, vm.propertyNames->prototype, arrayPrototype, DontEnum | DontDelete | ReadOnly); + putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum | DontDelete); } -bool ArrayConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot &slot) +bool ArrayConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot &slot) { - return getStaticFunctionSlot(exec, ExecState::arrayConstructorTable(exec), jsCast(cell), propertyName, slot); -} - -bool ArrayConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor) -{ - return getStaticFunctionDescriptor(exec, ExecState::arrayConstructorTable(exec), jsCast(object), propertyName, descriptor); + return getStaticFunctionSlot(exec, arrayConstructorTable, jsCast(object), propertyName, slot); } // ------------------------------ Functions --------------------------- @@ -81,11 +78,11 @@ bool ArrayConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exe JSObject* constructArrayWithSizeQuirk(ExecState* exec, ArrayAllocationProfile* profile, JSGlobalObject* globalObject, JSValue length) { if (!length.isNumber()) - return constructArray(exec, profile, globalObject, &length, 1); + return constructArrayNegativeIndexed(exec, profile, globalObject, &length, 1); uint32_t n = length.toUInt32(exec); if (n != length.toNumber(exec)) - return throwError(exec, createRangeError(exec, ASCIILiteral("Array size is not a small enough positive integer."))); + return exec->vm().throwException(exec, createRangeError(exec, ASCIILiteral("Array size is not a small enough positive integer."))); return constructEmptyArray(exec, profile, globalObject, n); } @@ -128,7 +125,7 @@ CallType ArrayConstructor::getCallData(JSCell*, CallData& callData) EncodedJSValue JSC_HOST_CALL arrayConstructorIsArray(ExecState* exec) { - return JSValue::encode(jsBoolean(exec->argument(0).inherits(&JSArray::s_info))); + return JSValue::encode(jsBoolean(exec->argument(0).inherits(JSArray::info()))); } } // namespace JSC