Title: [231762] trunk
Revision
231762
Author
[email protected]
Date
2018-05-14 10:18:05 -0700 (Mon, 14 May 2018)

Log Message

[JSC] timeClip(-0) should produce +0
https://bugs.webkit.org/show_bug.cgi?id=185589

Reviewed by Saam Barati.

JSTests:

Fix several test262 failures.

* stress/date-negative-zero.js: Added.
(shouldBe):
* test262/expectations.yaml:

Source/WTF:

According to the spec[1], timeClip(-0) should produce +0.
We achieve this by adding 0.0 to the result of trunc(t).

[1]: https://tc39.github.io/ecma262/#sec-timeclip

* wtf/DateMath.cpp:
(WTF::timeClip):

LayoutTests:

* sputnik/Implementation_Diagnostics/S15.9.1.14_D1-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (231761 => 231762)


--- trunk/JSTests/ChangeLog	2018-05-14 16:47:35 UTC (rev 231761)
+++ trunk/JSTests/ChangeLog	2018-05-14 17:18:05 UTC (rev 231762)
@@ -1,3 +1,16 @@
+2018-05-14  Yusuke Suzuki  <[email protected]>
+
+        [JSC] timeClip(-0) should produce +0
+        https://bugs.webkit.org/show_bug.cgi?id=185589
+
+        Reviewed by Saam Barati.
+
+        Fix several test262 failures.
+
+        * stress/date-negative-zero.js: Added.
+        (shouldBe):
+        * test262/expectations.yaml:
+
 2018-05-13  Caio Lima  <[email protected]>
 
         [BigInt] stress/big-int-spec-to-primitive.js test is failing

Added: trunk/JSTests/stress/date-negative-zero.js (0 => 231762)


--- trunk/JSTests/stress/date-negative-zero.js	                        (rev 0)
+++ trunk/JSTests/stress/date-negative-zero.js	2018-05-14 17:18:05 UTC (rev 231762)
@@ -0,0 +1,7 @@
+function shouldBe(actual, expected) {
+    if (actual !== expected)
+        throw new Error('bad value: ' + actual);
+}
+
+var date = new Date(-0);
+shouldBe(Object.is(date.getTime(), 0), true);

Modified: trunk/JSTests/test262/expectations.yaml (231761 => 231762)


--- trunk/JSTests/test262/expectations.yaml	2018-05-14 16:47:35 UTC (rev 231761)
+++ trunk/JSTests/test262/expectations.yaml	2018-05-14 17:18:05 UTC (rev 231762)
@@ -958,9 +958,6 @@
 test/built-ins/DataView/prototype/setUint8/detached-buffer.js:
   default: 'Test262Error: Expected a TypeError but got a RangeError'
   strict mode: 'Test262Error: Expected a TypeError but got a RangeError'
-test/built-ins/Date/TimeClip_negative_zero.js:
-  default: 'Test262Error: TimeClip does not return negative zero Expected SameValue(«0», «0») to be true'
-  strict mode: 'Test262Error: TimeClip does not return negative zero Expected SameValue(«0», «0») to be true'
 test/built-ins/Date/UTC/return-value.js:
   default: 'Test262Error: 1970 Expected SameValue(«NaN», «0») to be true'
   strict mode: 'Test262Error: 1970 Expected SameValue(«NaN», «0») to be true'
@@ -973,9 +970,6 @@
 test/built-ins/Date/proto-from-ctor-realm-zero.js:
   default: 'TypeError: Type error'
   strict mode: 'TypeError: Type error'
-test/built-ins/Date/prototype/getTime/this-value-valid-date.js:
-  default: 'Test262Error: -0 Expected SameValue(«0», «0») to be true'
-  strict mode: 'Test262Error: -0 Expected SameValue(«0», «0») to be true'
 test/built-ins/Error/proto-from-ctor-realm.js:
   default: 'Test262Error: Expected SameValue(«Error», «Error») to be true'
   strict mode: 'Test262Error: Expected SameValue(«Error», «Error») to be true'

Modified: trunk/LayoutTests/ChangeLog (231761 => 231762)


--- trunk/LayoutTests/ChangeLog	2018-05-14 16:47:35 UTC (rev 231761)
+++ trunk/LayoutTests/ChangeLog	2018-05-14 17:18:05 UTC (rev 231762)
@@ -1,3 +1,12 @@
+2018-05-14  Yusuke Suzuki  <[email protected]>
+
+        [JSC] timeClip(-0) should produce +0
+        https://bugs.webkit.org/show_bug.cgi?id=185589
+
+        Reviewed by Saam Barati.
+
+        * sputnik/Implementation_Diagnostics/S15.9.1.14_D1-expected.txt:
+
 2018-05-14  Youenn Fablet  <[email protected]>
 
         Enable service-worker/navigation-redirect-body.https.html and service-worker/postmessage.https.html

Modified: trunk/LayoutTests/sputnik/Implementation_Diagnostics/S15.9.1.14_D1-expected.txt (231761 => 231762)


--- trunk/LayoutTests/sputnik/Implementation_Diagnostics/S15.9.1.14_D1-expected.txt	2018-05-14 16:47:35 UTC (rev 231761)
+++ trunk/LayoutTests/sputnik/Implementation_Diagnostics/S15.9.1.14_D1-expected.txt	2018-05-14 17:18:05 UTC (rev 231762)
@@ -1,6 +1,6 @@
 S15.9.1.14_D1
 
-#1: TimeClip returns (ToInteger(value))
+#1: TimeClip returns (ToInteger(value) + (+0))
 PASS 
 
 TEST COMPLETE

Modified: trunk/Source/WTF/ChangeLog (231761 => 231762)


--- trunk/Source/WTF/ChangeLog	2018-05-14 16:47:35 UTC (rev 231761)
+++ trunk/Source/WTF/ChangeLog	2018-05-14 17:18:05 UTC (rev 231762)
@@ -1,3 +1,18 @@
+2018-05-14  Yusuke Suzuki  <[email protected]>
+
+        [JSC] timeClip(-0) should produce +0
+        https://bugs.webkit.org/show_bug.cgi?id=185589
+
+        Reviewed by Saam Barati.
+
+        According to the spec[1], timeClip(-0) should produce +0.
+        We achieve this by adding 0.0 to the result of trunc(t).
+
+        [1]: https://tc39.github.io/ecma262/#sec-timeclip
+
+        * wtf/DateMath.cpp:
+        (WTF::timeClip):
+
 2018-05-13  Geoffrey Garen  <[email protected]>
 
         Simplified Mach exception handling

Modified: trunk/Source/WTF/wtf/DateMath.cpp (231761 => 231762)


--- trunk/Source/WTF/wtf/DateMath.cpp	2018-05-14 16:47:35 UTC (rev 231761)
+++ trunk/Source/WTF/wtf/DateMath.cpp	2018-05-14 17:18:05 UTC (rev 231762)
@@ -1159,7 +1159,7 @@
         return std::numeric_limits<double>::quiet_NaN();
     if (fabs(t) > maxECMAScriptTime)
         return std::numeric_limits<double>::quiet_NaN();
-    return trunc(t);
+    return trunc(t) + 0.0;
 }
 
 // See http://tools.ietf.org/html/rfc2822#section-3.3 for more information.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to