Revert change to EquivalentTime in date.js. The checks that I've removed in the last...
authoroleg@chromium.org <oleg@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 2 Mar 2010 14:19:34 +0000 (14:19 +0000)
committeroleg@chromium.org <oleg@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 2 Mar 2010 14:19:34 +0000 (14:19 +0000)
Review URL: http://codereview.chromium.org/660375

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3999 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/date-delay.js
src/runtime.cc

index 0ed59a7..c0180c2 100644 (file)
@@ -114,11 +114,9 @@ function EquivalentTime(t) {
   // the actual year if it is in the range 1970..2037
   if (t >= 0 && t <= 2.1e12) return t;
 
-  // We call the function from runtime.cc directly to avoid extra checks which
-  // are unneeded.
-  var day = %DateMakeDay(EquivalentYear(YEAR_FROM_TIME(t)),
-                         MONTH_FROM_TIME(t),
-                         DATE_FROM_TIME(t));
+  var day = MakeDay(EquivalentYear(YEAR_FROM_TIME(t)),
+                    MONTH_FROM_TIME(t),
+                    DATE_FROM_TIME(t));
   return MakeDate(day, TimeWithinDay(t));
 }
 
index e0011dd..d39be92 100644 (file)
@@ -4961,6 +4961,9 @@ static Object* Runtime_DateMakeDay(Arguments args) {
     month += 12;
   }
 
+  ASSERT(month >= 0);
+  ASSERT(month < 12);
+
   static const int base_day = 365*1969 + 1969/4 - 1969/100 + 1969/400;
   int year1 = year - 1;
   int day_from_year = 365 * year1 + year1 / 4 - year1 / 100 + year1 / 400 -