Index: src/objects-debug.cc |
diff --git a/src/objects-debug.cc b/src/objects-debug.cc |
index 3a667a4398f03f0d8f8fc132c9f1c5c00ecf11cc..5d98e0f9797a4e8c5e958f6a51fb94e62fd9bf5f 100644 |
--- a/src/objects-debug.cc |
+++ b/src/objects-debug.cc |
@@ -138,6 +138,9 @@ void HeapObject::HeapObjectVerify() { |
case JS_VALUE_TYPE: |
JSValue::cast(this)->JSValueVerify(); |
break; |
+ case JS_DATE_TYPE: |
+ JSDate::cast(this)->JSDateVerify(); |
+ break; |
case JS_FUNCTION_TYPE: |
JSFunction::cast(this)->JSFunctionVerify(); |
break; |
@@ -357,6 +360,45 @@ void JSValue::JSValueVerify() { |
} |
+void JSDate::JSDateVerify() { |
+ if (value()->IsHeapObject()) { |
+ VerifyHeapPointer(value()); |
+ } |
+ CHECK(value()->IsUndefined() || value()->IsSmi() || value()->IsHeapNumber()); |
+/* Don't check yet, will still be undefined... |
+ if (value()->IsHeapNumber() && isnan(HeapNumber::cast(value())->value())) { |
+ CHECK(year()->IsHeapNumber() && isnan(HeapNumber::cast(year())->value())); |
+ CHECK(month()->IsHeapNumber() && isnan(HeapNumber::cast(month())->value())); |
+ CHECK(day()->IsHeapNumber() && isnan(HeapNumber::cast(day())->value())); |
+ CHECK(hour()->IsHeapNumber() && isnan(HeapNumber::cast(hour())->value())); |
+ CHECK(min()->IsHeapNumber() && isnan(HeapNumber::cast(min())->value())); |
+ CHECK(sec()->IsHeapNumber() && isnan(HeapNumber::cast(sec())->value())); |
+ CHECK(ms()->IsHeapNumber() && isnan(HeapNumber::cast(ms())->value())); |
+ return; |
+ } |
+ CHECK(year()->IsSmi()); |
+ CHECK(month()->IsSmi()); |
+ CHECK(day()->IsSmi()); |
+ CHECK(hour()->IsSmi()); |
+ CHECK(min()->IsSmi()); |
+ CHECK(sec()->IsSmi()); |
+ CHECK(ms()->IsSmi()); |
+ int month = Smi::cast(this->month())->value(); |
+ int day = Smi::cast(this->day())->value(); |
+ int hour = Smi::cast(this->hour())->value(); |
+ int min = Smi::cast(this->min())->value(); |
+ int sec = Smi::cast(this->sec())->value(); |
+ int ms = Smi::cast(this->ms())->value(); |
+ CHECK(1 <= month && month <= 12); |
+ CHECK(1 <= day && day <= 31); |
+ CHECK(0 <= hour && hour <= 23); |
+ CHECK(0 <= min && min <= 59); |
+ CHECK(0 <= sec && sec <= 59); |
+ CHECK(0 <= ms && ms <= 999); |
+*/ |
+} |
+ |
+ |
void JSMessageObject::JSMessageObjectVerify() { |
CHECK(IsJSMessageObject()); |
CHECK(type()->IsString()); |