Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Unified Diff: src/objects-debug.cc

Issue 9117034: New class for Date objects: caches individual date components. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add constant for index of first barrier-free slot. Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « src/objects.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698