]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - runtime/ArrayConstructor.h
JavaScriptCore-7600.1.4.17.5.tar.gz
[apple/javascriptcore.git] / runtime / ArrayConstructor.h
index dc0df2455e05a8d3f532318af6a005e12e8db818..a6ac76ea4e49704ea29565865dd01e00b7c7e967 100644 (file)
 
 namespace JSC {
 
-    class ArrayPrototype;
+class ArrayAllocationProfile;
+class ArrayPrototype;
+class JSArray;
 
-    class ArrayConstructor : public InternalFunction {
-    public:
-        ArrayConstructor(ExecState*, JSGlobalObject*, Structure*, ArrayPrototype*);
+class ArrayConstructor : public InternalFunction {
+public:
+    typedef InternalFunction Base;
 
-        static const ClassInfo s_info;
+    static ArrayConstructor* create(VM& vm, Structure* structure, ArrayPrototype* arrayPrototype)
+    {
+        ArrayConstructor* constructor = new (NotNull, allocateCell<ArrayConstructor>(vm.heap)) ArrayConstructor(vm, structure);
+        constructor->finishCreation(vm, arrayPrototype);
+        return constructor;
+    }
 
-        static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
-        {
-            return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
-        }
+    DECLARE_INFO;
 
-    protected:
-        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
+    static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
+    {
+        return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
+    }
 
-    private:
-        virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
-        virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+protected:
+    void finishCreation(VM&, ArrayPrototype*);
+    static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
 
-        virtual ConstructType getConstructData(ConstructData&);
-        virtual CallType getCallData(CallData&);
-    };
+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