Index: src/objects.h |
diff --git a/src/objects.h b/src/objects.h |
index f2e35a6b7c422cbaca13a4a8cbb89861ea1f1204..10096426d21c90891620a8858be2e0fc56e146c5 100644 |
--- a/src/objects.h |
+++ b/src/objects.h |
@@ -64,6 +64,7 @@ |
// - JSBuiltinsObject |
// - JSGlobalProxy |
// - JSValue |
+// - JSDate |
// - JSMessageObject |
// - JSProxy |
// - JSFunctionProxy |
@@ -295,6 +296,7 @@ const int kVariableSizeSentinel = 0; |
V(JS_MESSAGE_OBJECT_TYPE) \ |
\ |
V(JS_VALUE_TYPE) \ |
+ V(JS_DATE_TYPE) \ |
V(JS_OBJECT_TYPE) \ |
V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ |
V(JS_GLOBAL_OBJECT_TYPE) \ |
@@ -610,6 +612,7 @@ enum InstanceType { |
JS_PROXY_TYPE, // LAST_JS_PROXY_TYPE |
JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE |
+ JS_DATE_TYPE, |
JS_OBJECT_TYPE, |
JS_CONTEXT_EXTENSION_OBJECT_TYPE, |
JS_GLOBAL_OBJECT_TYPE, |
@@ -803,6 +806,7 @@ class MaybeObject BASE_EMBEDDED { |
V(Oddball) \ |
V(SharedFunctionInfo) \ |
V(JSValue) \ |
+ V(JSDate) \ |
V(JSMessageObject) \ |
V(StringWrapper) \ |
V(Foreign) \ |
@@ -5823,7 +5827,7 @@ class JSBuiltinsObject: public GlobalObject { |
}; |
-// Representation for JS Wrapper objects, String, Number, Boolean, Date, etc. |
+// Representation for JS Wrapper objects, String, Number, Boolean, etc. |
class JSValue: public JSObject { |
public: |
// [value]: the object being wrapped. |
@@ -5852,6 +5856,57 @@ class JSValue: public JSObject { |
}; |
+// Representation for JS date objects. |
+class JSDate: public JSObject { |
ulan
2012/01/25 13:08:48
As we discussed offline, all these fields could be
rossberg
2012/01/25 15:48:37
Yeah, I don't want to optimize this prematurely. T
|
+ public: |
+ // If one component is NaN, all of them are, indicating a NaN time value. |
+ // [value]: the time value. Transitional, will disappear. |
ulan
2012/01/25 13:08:48
As we discussed offline, the [value] should stay s
rossberg
2012/01/25 15:48:37
Done.
|
+ DECL_ACCESSORS(value, Object) |
+ // [year]: caches year. |
+ DECL_ACCESSORS(year, Object) |
+ // [day]: caches month. |
+ DECL_ACCESSORS(month, Object) |
+ // [day]: caches day. |
+ DECL_ACCESSORS(day, Object) |
+ // [day]: caches hours. |
ulan
2012/01/25 13:08:48
[day] -> [hour] in the comment.
rossberg
2012/01/25 15:48:37
Done. (And for month above.)
|
+ DECL_ACCESSORS(hour, Object) |
+ // [min]: caches minutes. |
+ DECL_ACCESSORS(min, Object) |
+ // [sec]: caches seconds. |
+ DECL_ACCESSORS(sec, Object) |
+ // [ms]: caches milliseconds. |
+ DECL_ACCESSORS(ms, Object) |
+ |
+ // Casting. |
+ static inline JSDate* cast(Object* obj); |
+ |
+ // Dispatched behavior. |
+#ifdef OBJECT_PRINT |
+ inline void JSDatePrint() { |
+ JSDatePrint(stdout); |
+ } |
+ void JSDatePrint(FILE* out); |
+#endif |
+#ifdef DEBUG |
+ void JSDateVerify(); |
+#endif |
+ |
+ // Layout description. |
+ static const int kValueOffset = JSObject::kHeaderSize; // transitional |
+ static const int kYearOffset = kValueOffset + kPointerSize; |
+ static const int kMonthOffset = kYearOffset + kPointerSize; |
+ static const int kDayOffset = kMonthOffset + kPointerSize; |
+ static const int kHourOffset = kDayOffset + kPointerSize; |
+ static const int kMinOffset = kHourOffset + kPointerSize; |
+ static const int kSecOffset = kMinOffset + kPointerSize; |
+ static const int kMsOffset = kSecOffset + kPointerSize; |
+ static const int kSize = kMsOffset + kPointerSize; |
+ |
+ private: |
+ DISALLOW_IMPLICIT_CONSTRUCTORS(JSDate); |
+}; |
+ |
+ |
// Representation of message objects used for error reporting through |
// the API. The messages are formatted in JavaScript so this object is |
// a real JavaScript object. The information used for formatting the |