]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - runtime/DateInstance.h
JavaScriptCore-7600.1.4.11.8.tar.gz
[apple/javascriptcore.git] / runtime / DateInstance.h
index 6195c8549f5534c575fe880ebfc1c7fdc2a93669..193e054216af975351dbbb4984b9e3173669850f 100644 (file)
 
 #include "JSWrapperObject.h"
 
-namespace WTF {
-    struct GregorianDateTime;
-}
-
 namespace JSC {
 
     class DateInstance : public JSWrapperObject {
+    protected:
+        JS_EXPORT_PRIVATE DateInstance(VM&, Structure*);
+        void finishCreation(VM&);
+        JS_EXPORT_PRIVATE void finishCreation(VM&, double);
+
+        static void destroy(JSCell*);
     public:
-        DateInstance(ExecState*, Structure*, double);
-        explicit DateInstance(ExecState*, Structure*);
+        typedef JSWrapperObject Base;
+
+        static DateInstance* create(VM& vm, Structure* structure, double date)
+        {
+            DateInstance* instance = new (NotNull, allocateCell<DateInstance>(vm.heap)) DateInstance(vm, structure);
+            instance->finishCreation(vm, date);
+            return instance;
+        }
+
+        static DateInstance* create(VM& vm, Structure* structure)
+        {
+            DateInstance* instance = new (NotNull, allocateCell<DateInstance>(vm.heap)) DateInstance(vm, structure);
+            instance->finishCreation(vm);
+            return instance;
+        }
 
-        double internalNumber() const { return internalValue().uncheckedGetNumber(); }
+        double internalNumber() const { return internalValue().asNumber(); }
 
-        static JS_EXPORTDATA const ClassInfo s_info;
+        DECLARE_EXPORT_INFO;
 
         const GregorianDateTime* gregorianDateTime(ExecState* exec) const
         {
@@ -52,9 +68,9 @@ namespace JSC {
             return calculateGregorianDateTimeUTC(exec);
         }
 
-        static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
         {
-            return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
+            return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
         }
 
     private:
@@ -68,7 +84,7 @@ namespace JSC {
 
     inline DateInstance* asDateInstance(JSValue value)
     {
-        ASSERT(asObject(value)->inherits(&DateInstance::s_info));
+        ASSERT(asObject(value)->inherits(DateInstance::info()));
         return static_cast<DateInstance*>(asObject(value));
     }