X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/9dae56ea45a0f5f8136a5c93d6f3a7f99399ca73..cb9aa2694aba0ae4f946ed34b8e0f6c99c1cfe44:/runtime/ArrayConstructor.h?ds=sidebyside diff --git a/runtime/ArrayConstructor.h b/runtime/ArrayConstructor.h index 8300d8c..a6ac76e 100644 --- a/runtime/ArrayConstructor.h +++ b/runtime/ArrayConstructor.h @@ -1,6 +1,6 @@ /* * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) - * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -25,15 +25,41 @@ namespace JSC { - class ArrayPrototype; +class ArrayAllocationProfile; +class ArrayPrototype; +class JSArray; - class ArrayConstructor : public InternalFunction { - public: - ArrayConstructor(ExecState*, PassRefPtr, ArrayPrototype*); +class ArrayConstructor : public InternalFunction { +public: + typedef InternalFunction Base; - virtual ConstructType getConstructData(ConstructData&); - virtual CallType getCallData(CallData&); - }; + static ArrayConstructor* create(VM& vm, Structure* structure, ArrayPrototype* arrayPrototype) + { + ArrayConstructor* constructor = new (NotNull, allocateCell(vm.heap)) ArrayConstructor(vm, structure); + constructor->finishCreation(vm, arrayPrototype); + return constructor; + } + + DECLARE_INFO; + + static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) + { + return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); + } + +protected: + void finishCreation(VM&, ArrayPrototype*); + static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags; + +private: + ArrayConstructor(VM&, Structure*); + static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&); + + static ConstructType getConstructData(JSCell*, ConstructData&); + static CallType getCallData(JSCell*, CallData&); +}; + +JSObject* constructArrayWithSizeQuirk(ExecState*, ArrayAllocationProfile*, JSGlobalObject*, JSValue); } // namespace JSC