From 56b7a40fe27ee5dab4fd86d874cf1af5f2959639 Mon Sep 17 00:00:00 2001 From: "ggaren@apple.com" Date: Wed, 25 Jun 2014 21:51:45 +0000 Subject: [PATCH] Unreviewed, rolling out r166876. Caused some ECMA test262 failures Reverted changeset: "Date object needs to check for ES5 15.9.1.14 TimeClip limit." https://bugs.webkit.org/show_bug.cgi?id=131248 http://trac.webkit.org/changeset/166876 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170440 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- LayoutTests/ChangeLog | 12 +++++ LayoutTests/js/regress-131248-expected.txt | 41 ---------------- LayoutTests/js/regress-131248.html | 10 ---- LayoutTests/js/script-tests/regress-131248.js | 57 ----------------------- Source/JavaScriptCore/ChangeLog | 12 +++++ Source/JavaScriptCore/runtime/DateConstructor.cpp | 9 +--- Source/JavaScriptCore/runtime/JSDateMath.cpp | 18 +++---- Source/JavaScriptCore/runtime/JSDateMath.h | 3 +- Source/JavaScriptCore/runtime/VM.cpp | 2 +- Source/WTF/ChangeLog | 12 +++++ Source/WTF/wtf/DateMath.cpp | 10 ++-- Source/WTF/wtf/DateMath.h | 7 +-- 12 files changed, 55 insertions(+), 138 deletions(-) delete mode 100644 LayoutTests/js/regress-131248-expected.txt delete mode 100644 LayoutTests/js/regress-131248.html delete mode 100644 LayoutTests/js/script-tests/regress-131248.js diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index ce32c27..66d6d8c 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,15 @@ +2014-06-25 Geoffrey Garen + + Unreviewed, rolling out r166876. + + Caused some ECMA test262 failures + + Reverted changeset: + + "Date object needs to check for ES5 15.9.1.14 TimeClip limit." + https://bugs.webkit.org/show_bug.cgi?id=131248 + http://trac.webkit.org/changeset/166876 + 2014-06-25 Dirk Schulze Add all blend modes to feBlend diff --git a/LayoutTests/js/regress-131248-expected.txt b/LayoutTests/js/regress-131248-expected.txt deleted file mode 100644 index 82bd4c3..0000000 --- a/LayoutTests/js/regress-131248-expected.txt +++ /dev/null @@ -1,41 +0,0 @@ -This test checks date values at the limits set by the ES5 15.9.1.14 TimeClip specification and ensures that we don't crash on any assertions. - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -(new Date(1396547803766)).setDate(1396549003769) ==> NaN ms, Invalid Date -(new Date(1396547803766)).setDate(100000000) ==> NaN ms, Invalid Date -(new Date(1396547803766)).setDate(99983840) ==> NaN ms, Invalid Date -(new Date(1396547803766)).setDate(99983839) ==> 8639999978203766 ms, Fri Sep 12 275760 -(new Date(1396547803766)).setDate(10000000) ==> 865396288603766 ms, Thu Apr 25 29393 - -(new Date(0)).setTime(8640000000000001) ==> NaN ms, Invalid Date NaN ms -(new Date(0)).setTime(8640000000000000) ==> 8640000000000000 ms, Sat, 13 Sep 275760 00:00:00 GMT 0 ms -(new Date(0)).setTime(-8640000000000000) ==> -8640000000000000 ms, Tue, 20 Apr -271821 00:00:00 GMT 0 ms -(new Date(0)).setTime(-8640000000000001) ==> NaN ms, Invalid Date NaN ms - -(new Date(13 Sep 275760 00:00:00 -0001) ==> NaN ms, Invalid Date NaN ms -(new Date(13 Sep 275760 00:00:00 +0000) ==> 8640000000000000 ms, Sat, 13 Sep 275760 00:00:00 GMT 0 ms -(new Date(13 Sep 275760 00:00:00 +0001) ==> 8639999996400000 ms, Fri, 12 Sep 275760 23:00:00 GMT 0 ms -(new Date(20 Apr -271821 00:00:00 -0001) ==> -8639999996400000 ms, Tue, 20 Apr -271821 01:00:00 GMT 0 ms -(new Date(20 Apr -271821 00:00:00 +0000) ==> -8640000000000000 ms, Tue, 20 Apr -271821 00:00:00 GMT 0 ms -(new Date(20 Apr -271821 00:00:00 +0001) ==> NaN ms, Invalid Date NaN ms - -(new Date(19 Apr -271821 23:59:59) ==> NaN ms, Invalid Date NaN ms - -(new Date(275760-09-13T00:00:00.001) ==> NaN ms, Invalid Date NaN ms -(new Date(275760-09-13T00:00:00.000) ==> 8640000000000000 ms, Sat, 13 Sep 275760 00:00:00 GMT 0 ms -(new Date(-271821-04-20T00:00:00.0000) ==> -8640000000000000 ms, Tue, 20 Apr -271821 00:00:00 GMT 0 ms -(new Date(-271821-04-19T23:59:59.999) ==> NaN ms, Invalid Date NaN ms - -(new Date(Sat, 13 Sep 275760 00:00:00 UTC-2) ==> NaN ms, Invalid Date NaN ms -(new Date(Sat, 13 Sep 275760 00:00:00 UTC) ==> 8640000000000000 ms, Sat, 13 Sep 275760 00:00:00 GMT 0 ms -(new Date(Sat, 13 Sep 275760 00:00:00 UTC+2) ==> 8639999992800000 ms, Fri, 12 Sep 275760 22:00:00 GMT 0 ms -(new Date(Tue, 20 Apr -271821 00:00:00 UTC-2) ==> -8639999992800000 ms, Tue, 20 Apr -271821 02:00:00 GMT 0 ms -(new Date(Tue, 20 Apr -271821 00:00:00 UTC) ==> -8640000000000000 ms, Tue, 20 Apr -271821 00:00:00 GMT 0 ms -(new Date(Tue, 20 Apr -271821 00:00:00 UTC+2) ==> NaN ms, Invalid Date NaN ms - -PASS successfullyParsed is true - -TEST COMPLETE - diff --git a/LayoutTests/js/regress-131248.html b/LayoutTests/js/regress-131248.html deleted file mode 100644 index 5dbd626..0000000 --- a/LayoutTests/js/regress-131248.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/LayoutTests/js/script-tests/regress-131248.js b/LayoutTests/js/script-tests/regress-131248.js deleted file mode 100644 index 98e3379..0000000 --- a/LayoutTests/js/script-tests/regress-131248.js +++ /dev/null @@ -1,57 +0,0 @@ -description( -"This test checks date values at the limits set by the ES5 15.9.1.14 TimeClip specification and ensures that we don't crash on any assertions." -); - -function testDateFromSetDateAdjustement(initialMs, adjustMs) { - var date = new Date(initialMs); - debug("(new Date(" + initialMs + ")).setDate(" + adjustMs + ") ==> " + date.setDate(adjustMs) + " ms, " + date.toDateString()); -} - -testDateFromSetDateAdjustement(1396547803766, 1396549003769); -testDateFromSetDateAdjustement(1396547803766, 100000000); -testDateFromSetDateAdjustement(1396547803766, 99983839+1); -testDateFromSetDateAdjustement(1396547803766, 99983839); -testDateFromSetDateAdjustement(1396547803766, 10000000); -debug(""); - -function testDateFromSetTimeWithMilliseconds(ms) { - var date = new Date(0); - debug("(new Date(0)).setTime(" + ms + ") ==> " + date.setTime(ms) + " ms, " + date.toUTCString() + " " + date.getUTCMilliseconds() + " ms"); -} - -testDateFromSetTimeWithMilliseconds(8640000000000001); -testDateFromSetTimeWithMilliseconds(8640000000000000); -testDateFromSetTimeWithMilliseconds(-8640000000000000); -testDateFromSetTimeWithMilliseconds(-8640000000000001); -debug(""); - -function testDateFromString(str) { - var date = new Date(str); - debug("(new Date(" + str + ") ==> " + date.getTime() + " ms, " + date.toUTCString() + " " + date.getUTCMilliseconds() + " ms"); -} - -testDateFromString("13 Sep 275760 00:00:00 -0001"); -testDateFromString("13 Sep 275760 00:00:00 +0000"); -testDateFromString("13 Sep 275760 00:00:00 +0001"); -testDateFromString("20 Apr -271821 00:00:00 -0001"); -testDateFromString("20 Apr -271821 00:00:00 +0000"); -testDateFromString("20 Apr -271821 00:00:00 +0001"); -debug(""); - -testDateFromString("19 Apr -271821 23:59:59"); -debug(""); - -testDateFromString("275760-09-13T00:00:00.001"); -testDateFromString("275760-09-13T00:00:00.000"); -testDateFromString("-271821-04-20T00:00:00.0000"); -testDateFromString("-271821-04-19T23:59:59.999"); -debug(""); - -testDateFromString("Sat, 13 Sep 275760 00:00:00 UTC-2"); -testDateFromString("Sat, 13 Sep 275760 00:00:00 UTC"); -testDateFromString("Sat, 13 Sep 275760 00:00:00 UTC+2"); -testDateFromString("Tue, 20 Apr -271821 00:00:00 UTC-2"); -testDateFromString("Tue, 20 Apr -271821 00:00:00 UTC"); -testDateFromString("Tue, 20 Apr -271821 00:00:00 UTC+2"); -debug(""); - diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog index 229a6d7..85873ab 100644 --- a/Source/JavaScriptCore/ChangeLog +++ b/Source/JavaScriptCore/ChangeLog @@ -1,3 +1,15 @@ +2014-06-25 Geoffrey Garen + + Unreviewed, rolling out r166876. + + Caused some ECMA test262 failures + + Reverted changeset: + + "Date object needs to check for ES5 15.9.1.14 TimeClip limit." + https://bugs.webkit.org/show_bug.cgi?id=131248 + http://trac.webkit.org/changeset/166876 + 2014-06-25 Brent Fulgham [Win] Unreviewed gardening. diff --git a/Source/JavaScriptCore/runtime/DateConstructor.cpp b/Source/JavaScriptCore/runtime/DateConstructor.cpp index 2315554..476a31b 100644 --- a/Source/JavaScriptCore/runtime/DateConstructor.cpp +++ b/Source/JavaScriptCore/runtime/DateConstructor.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) - * Copyright (C) 2004-2008, 2011, 2014 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -190,12 +190,7 @@ static EncodedJSValue JSC_HOST_CALL callDate(ExecState* exec) { VM& vm = exec->vm(); GregorianDateTime ts; - - double currentTime = timeClip(currentTimeMS()); - if (std::isnan(currentTime)) - return JSValue::encode(jsNaN()); - - msToGregorianDateTime(vm, currentTime, false, ts); + msToGregorianDateTime(vm, currentTimeMS(), false, ts); return JSValue::encode(jsNontrivialString(&vm, formatDateTime(ts, DateTimeFormatDateAndTime, false))); } diff --git a/Source/JavaScriptCore/runtime/JSDateMath.cpp b/Source/JavaScriptCore/runtime/JSDateMath.cpp index 16f1ecc..b2afc16 100644 --- a/Source/JavaScriptCore/runtime/JSDateMath.cpp +++ b/Source/JavaScriptCore/runtime/JSDateMath.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) - * Copyright (C) 2006-2007, 2012, 2014 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2012 Apple Inc. All rights reserved. * Copyright (C) 2009 Google Inc. All rights reserved. * Copyright (C) 2007-2009 Torch Mobile, Inc. * Copyright (C) 2010 &yet, LLC. (nate@andyet.net) @@ -138,7 +138,6 @@ static LocalTimeOffset localTimeOffset(VM& vm, double ms) double start = cache.start; double end = cache.end; - ASSERT(fabs(ms) <= WTF::maxECMAScriptTime); if (start <= ms) { // If the time fits in the cached interval, return the cached offset. if (ms <= end) return cache.offset; @@ -146,7 +145,7 @@ static LocalTimeOffset localTimeOffset(VM& vm, double ms) // Compute a possible new interval end. double newEnd = end + cache.increment; - if (ms <= newEnd && newEnd <= WTF::maxECMAScriptTime) { + if (ms <= newEnd) { LocalTimeOffset endOffset = calculateLocalTimeOffset(newEnd); if (cache.offset == endOffset) { // If the offset at the end of the new interval still matches @@ -195,19 +194,15 @@ double gregorianDateTimeToMS(VM& vm, const GregorianDateTime& t, double milliSec double ms = timeToMS(t.hour(), t.minute(), t.second(), milliSeconds); double result = (day * WTF::msPerDay) + ms; - if (fabs(result) > WTF::maxECMAScriptTime) - return std::numeric_limits::quiet_NaN(); - if (!inputIsUTC) result -= localTimeOffset(vm, result).offset; - return timeClip(result); + return result; } // input is UTC void msToGregorianDateTime(VM& vm, double ms, bool outputIsUTC, GregorianDateTime& tm) { - ASSERT(fabs(ms) <= WTF::maxECMAScriptTime); LocalTimeOffset localTime; if (!outputIsUTC) { localTime = localTimeOffset(vm, ms); @@ -227,13 +222,13 @@ void msToGregorianDateTime(VM& vm, double ms, bool outputIsUTC, GregorianDateTim tm.setUtcOffset(localTime.offset / WTF::msPerSecond); } -static double parseDateFromNullTerminatedCharacters(VM& vm, const char* dateString) +double parseDateFromNullTerminatedCharacters(VM& vm, const char* dateString) { bool haveTZ; int offset; double ms = WTF::parseDateFromNullTerminatedCharacters(dateString, haveTZ, offset); - if (std::isnan(ms) || fabs(ms) > WTF::maxECMAScriptTime) - return std::numeric_limits::quiet_NaN(); + if (std::isnan(ms)) + return QNaN; // fall back to local timezone if (!haveTZ) @@ -249,7 +244,6 @@ double parseDate(VM& vm, const String& date) double value = parseES5DateFromNullTerminatedCharacters(date.utf8().data()); if (std::isnan(value)) value = parseDateFromNullTerminatedCharacters(vm, date.utf8().data()); - value = timeClip(value); vm.cachedDateString = date; vm.cachedDateStringValue = value; return value; diff --git a/Source/JavaScriptCore/runtime/JSDateMath.h b/Source/JavaScriptCore/runtime/JSDateMath.h index 61b490d..17ba4a2 100644 --- a/Source/JavaScriptCore/runtime/JSDateMath.h +++ b/Source/JavaScriptCore/runtime/JSDateMath.h @@ -1,6 +1,6 @@ /* * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) - * Copyright (C) 2006-2007, 2014 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. * Copyright (C) 2009 Google Inc. All rights reserved. * Copyright (C) 2010 Research In Motion Limited. All rights reserved. * @@ -53,6 +53,7 @@ class VM; void msToGregorianDateTime(VM&, double, bool outputIsUTC, GregorianDateTime&); double gregorianDateTimeToMS(VM&, const GregorianDateTime&, double, bool inputIsUTC); double getUTCOffset(VM&); +double parseDateFromNullTerminatedCharacters(VM&, const char* dateString); double parseDate(VM&, const WTF::String&); } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/VM.cpp b/Source/JavaScriptCore/runtime/VM.cpp index 3f7fb0e..0768005 100644 --- a/Source/JavaScriptCore/runtime/VM.cpp +++ b/Source/JavaScriptCore/runtime/VM.cpp @@ -496,7 +496,7 @@ void VM::resetDateCache() { localTimeOffsetCache.reset(); cachedDateString = String(); - cachedDateStringValue = std::numeric_limits::quiet_NaN(); + cachedDateStringValue = QNaN; dateInstanceCache.reset(); } diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog index 3d645a2..4d2ccdf 100644 --- a/Source/WTF/ChangeLog +++ b/Source/WTF/ChangeLog @@ -1,3 +1,15 @@ +2014-06-25 Geoffrey Garen + + Unreviewed, rolling out r166876. + + Caused some ECMA test262 failures + + Reverted changeset: + + "Date object needs to check for ES5 15.9.1.14 TimeClip limit." + https://bugs.webkit.org/show_bug.cgi?id=131248 + http://trac.webkit.org/changeset/166876 + 2014-06-25 peavo@outlook.com [Win64] ASM LLINT is not enabled. diff --git a/Source/WTF/wtf/DateMath.cpp b/Source/WTF/wtf/DateMath.cpp index c81dddf..6ee36d3 100644 --- a/Source/WTF/wtf/DateMath.cpp +++ b/Source/WTF/wtf/DateMath.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) - * Copyright (C) 2006-2007, 2014 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. * Copyright (C) 2009 Google Inc. All rights reserved. * Copyright (C) 2007-2009 Torch Mobile, Inc. * Copyright (C) 2010 &yet, LLC. (nate@andyet.net) @@ -109,6 +109,10 @@ namespace WTF { /* Constants */ static const double maxUnixTime = 2145859200.0; // 12/31/2037 +// ECMAScript asks not to support for a date of which total +// millisecond value is larger than the following value. +// See 15.9.1.14 of ECMA-262 5th edition. +static const double maxECMAScriptTime = 8.64E15; // Day of year for the first day of each month, where index 0 is January, and day 0 is January 1. // First for non-leap years, then for leap years. @@ -180,7 +184,6 @@ static void appendTwoDigitNumber(StringBuilder& builder, int number) int msToYear(double ms) { - ASSERT(fabs(ms) <= maxECMAScriptTime); int approxYear = static_cast(floor(ms / (msPerDay * 365.2425)) + 1970); double msFromApproxYearTo1970 = msPerDay * daysFrom1970ToYear(approxYear); if (msFromApproxYearTo1970 > ms) @@ -327,7 +330,7 @@ static inline int minimumYearForDST() } /* - * Find an equivalent year for the one given, where equivalence is determined by + * Find an equivalent year for the one given, where equivalence is deterined by * the two years having the same leapness and the first day of the year, falling * on the same day of the week. * @@ -793,6 +796,7 @@ double parseES5DateFromNullTerminatedCharacters(const char* dateString) return dateSeconds * msPerSecond; } +// Odd case where 'exec' is allowed to be 0, to accomodate a caller in WebCore. double parseDateFromNullTerminatedCharacters(const char* dateString, bool& haveTZ, int& offset) { haveTZ = false; diff --git a/Source/WTF/wtf/DateMath.h b/Source/WTF/wtf/DateMath.h index 2b9e329..c8ae0d9 100644 --- a/Source/WTF/wtf/DateMath.h +++ b/Source/WTF/wtf/DateMath.h @@ -1,6 +1,6 @@ /* * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) - * Copyright (C) 2006-2007, 2014 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. * Copyright (C) 2009 Google Inc. All rights reserved. * Copyright (C) 2010 Research In Motion Limited. All rights reserved. * @@ -53,11 +53,6 @@ namespace WTF { -// ECMAScript asks not to support for a date of which total -// millisecond value is larger than the following value. -// See 15.9.1.14 of ECMA-262 5th edition. -static const double maxECMAScriptTime = 8.64E15; - struct LocalTimeOffset { LocalTimeOffset() : isDST(false) -- 1.8.3.1