Revert change to EquivalentTime in date.js. The checks that I've removed in the last changed were essential after all.

Review URL: http://codereview.chromium.org/660375

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3999 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
oleg@chromium.org 2010-03-02 14:19:34 +00:00
parent 7657955f3f
commit 5e0763efd5
2 changed files with 6 additions and 5 deletions

View 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));
}

View 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 -