#include "JSArray.h"
#include "JSFunction.h"
#include "Lookup.h"
-#include "Operations.h"
+#include "JSCInlines.h"
namespace JSC {
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<InternalFunction>(exec, ExecState::arrayConstructorTable(exec), jsCast<ArrayConstructor*>(cell), propertyName, slot);
-}
-
-bool ArrayConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
-{
- return getStaticFunctionDescriptor<InternalFunction>(exec, ExecState::arrayConstructorTable(exec), jsCast<ArrayConstructor*>(object), propertyName, descriptor);
+ return getStaticFunctionSlot<InternalFunction>(exec, arrayConstructorTable, jsCast<ArrayConstructor*>(object), propertyName, slot);
}
// ------------------------------ Functions ---------------------------
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);
}
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