#include "JSWrapperObject.h"
-namespace WTF {
- struct GregorianDateTime;
-}
-
namespace JSC {
class DateInstance : public JSWrapperObject {
+ protected:
+ JS_EXPORT_PRIVATE DateInstance(ExecState*, Structure*);
+ void finishCreation(VM&);
+ JS_EXPORT_PRIVATE void finishCreation(VM&, double);
+
+ static void destroy(JSCell*);
+
public:
- DateInstance(ExecState*, double);
- DateInstance(ExecState*, NonNullPassRefPtr<Structure>, double);
- explicit DateInstance(ExecState*, NonNullPassRefPtr<Structure>);
+ typedef JSWrapperObject Base;
- double internalNumber() const { return internalValue().uncheckedGetNumber(); }
+ static DateInstance* create(ExecState* exec, Structure* structure, double date)
+ {
+ DateInstance* instance = new (NotNull, allocateCell<DateInstance>(*exec->heap())) DateInstance(exec, structure);
+ instance->finishCreation(exec->vm(), date);
+ return instance;
+ }
- static JS_EXPORTDATA const ClassInfo info;
+ static DateInstance* create(ExecState* exec, Structure* structure)
+ {
+ DateInstance* instance = new (NotNull, allocateCell<DateInstance>(*exec->heap())) DateInstance(exec, structure);
+ instance->finishCreation(exec->vm());
+ return instance;
+ }
+
+ double internalNumber() const { return internalValue().asNumber(); }
+
+ static JS_EXPORTDATA const ClassInfo s_info;
const GregorianDateTime* gregorianDateTime(ExecState* exec) const
{
return calculateGregorianDateTimeUTC(exec);
}
- static PassRefPtr<Structure> createStructure(JSValue prototype)
+ static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
{
- return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+ return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), &s_info);
}
- protected:
- static const unsigned StructureFlags = OverridesMarkChildren | JSWrapperObject::StructureFlags;
-
private:
const GregorianDateTime* calculateGregorianDateTime(ExecState*) const;
const GregorianDateTime* calculateGregorianDateTimeUTC(ExecState*) const;
- virtual const ClassInfo* classInfo() const { return &info; }
mutable RefPtr<DateInstanceData> m_data;
};
inline DateInstance* asDateInstance(JSValue value)
{
- ASSERT(asObject(value)->inherits(&DateInstance::info));
+ ASSERT(asObject(value)->inherits(&DateInstance::s_info));
return static_cast<DateInstance*>(asObject(value));
}