Bug 185589

Summary: [JSC] timeClip(-0) should produce +0
Product: WebKit Reporter: Yusuke Suzuki <ysuzuki>
Component: New BugsAssignee: Yusuke Suzuki <ysuzuki>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, cdumez, cmarcelo, darin, dbates, ews-watchlist, fpizlo, mark.lam, rniwa, saam, sam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Archive of layout-test-results from ews101 for mac-sierra
none
Archive of layout-test-results from ews107 for mac-sierra-wk2
none
Archive of layout-test-results from ews113 for mac-sierra
none
Archive of layout-test-results from ews126 for ios-simulator-wk2
none
Archive of layout-test-results from ews201 for win-future
none
Patch
saam: review+, ews-watchlist: commit-queue-
Archive of layout-test-results from ews200 for win-future none

Yusuke Suzuki
Reported 2018-05-13 12:16:07 PDT
[JSC] timeClip(-0) should produce +0
Attachments
Patch (3.61 KB, patch)
2018-05-13 12:17 PDT, Yusuke Suzuki
no flags
Archive of layout-test-results from ews101 for mac-sierra (2.23 MB, application/zip)
2018-05-13 13:21 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews107 for mac-sierra-wk2 (2.71 MB, application/zip)
2018-05-13 13:27 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews113 for mac-sierra (3.12 MB, application/zip)
2018-05-13 13:46 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews126 for ios-simulator-wk2 (2.18 MB, application/zip)
2018-05-13 13:58 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews201 for win-future (12.74 MB, application/zip)
2018-05-13 14:02 PDT, EWS Watchlist
no flags
Patch (4.77 KB, patch)
2018-05-13 21:24 PDT, Yusuke Suzuki
saam: review+
ews-watchlist: commit-queue-
Archive of layout-test-results from ews200 for win-future (12.79 MB, application/zip)
2018-05-13 23:45 PDT, EWS Watchlist
no flags
Yusuke Suzuki
Comment 1 2018-05-13 12:17:16 PDT
EWS Watchlist
Comment 2 2018-05-13 13:21:25 PDT
Comment on attachment 340272 [details] Patch Attachment 340272 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/7670542 New failing tests: sputnik/Implementation_Diagnostics/S15.9.1.14_D1.html
EWS Watchlist
Comment 3 2018-05-13 13:21:26 PDT
Created attachment 340273 [details] Archive of layout-test-results from ews101 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews101 Port: mac-sierra Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 4 2018-05-13 13:27:06 PDT
Comment on attachment 340272 [details] Patch Attachment 340272 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/7670552 New failing tests: sputnik/Implementation_Diagnostics/S15.9.1.14_D1.html
EWS Watchlist
Comment 5 2018-05-13 13:27:07 PDT
Created attachment 340274 [details] Archive of layout-test-results from ews107 for mac-sierra-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-sierra-wk2 Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 6 2018-05-13 13:46:15 PDT
Comment on attachment 340272 [details] Patch Attachment 340272 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/7670558 New failing tests: sputnik/Implementation_Diagnostics/S15.9.1.14_D1.html
EWS Watchlist
Comment 7 2018-05-13 13:46:17 PDT
Created attachment 340275 [details] Archive of layout-test-results from ews113 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews113 Port: mac-sierra Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 8 2018-05-13 13:58:50 PDT
Comment on attachment 340272 [details] Patch Attachment 340272 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/7670589 New failing tests: sputnik/Implementation_Diagnostics/S15.9.1.14_D1.html
EWS Watchlist
Comment 9 2018-05-13 13:58:51 PDT
Created attachment 340276 [details] Archive of layout-test-results from ews126 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews126 Port: ios-simulator-wk2 Platform: Mac OS X 10.13.4
EWS Watchlist
Comment 10 2018-05-13 14:02:39 PDT
Comment on attachment 340272 [details] Patch Attachment 340272 [details] did not pass win-ews (win): Output: http://webkit-queues.webkit.org/results/7670677 New failing tests: sputnik/Implementation_Diagnostics/S15.9.1.14_D1.html
EWS Watchlist
Comment 11 2018-05-13 14:02:50 PDT
Created attachment 340277 [details] Archive of layout-test-results from ews201 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: ews201 Port: win-future Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Yusuke Suzuki
Comment 12 2018-05-13 21:24:36 PDT
EWS Watchlist
Comment 13 2018-05-13 23:45:38 PDT
Comment on attachment 340289 [details] Patch Attachment 340289 [details] did not pass win-ews (win): Output: http://webkit-queues.webkit.org/results/7674124 New failing tests: http/tests/security/canvas-remote-read-remote-video-localhost.html
EWS Watchlist
Comment 14 2018-05-13 23:45:49 PDT
Created attachment 340293 [details] Archive of layout-test-results from ews200 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: ews200 Port: win-future Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Yusuke Suzuki
Comment 15 2018-05-14 02:42:05 PDT
(In reply to Build Bot from comment #13) > Comment on attachment 340289 [details] > Patch > > Attachment 340289 [details] did not pass win-ews (win): > Output: http://webkit-queues.webkit.org/results/7674124 > > New failing tests: > http/tests/security/canvas-remote-read-remote-video-localhost.html It is not related to this change.
Saam Barati
Comment 16 2018-05-14 08:51:23 PDT
Comment on attachment 340289 [details] Patch Please add a test
Yusuke Suzuki
Comment 17 2018-05-14 10:17:50 PDT
(In reply to Saam Barati from comment #16) > Comment on attachment 340289 [details] > Patch > > Please add a test Thank you for your review! I've added a stress test for this, which is separate from sputnik and test262's ones.
Yusuke Suzuki
Comment 18 2018-05-14 10:18:10 PDT
Radar WebKit Bug Importer
Comment 19 2018-05-14 10:27:00 PDT
Darin Adler
Comment 20 2018-05-14 12:27:04 PDT
Comment on attachment 340289 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=340289&action=review > Source/WTF/wtf/DateMath.cpp:1159 > return std::numeric_limits<double>::quiet_NaN(); Not critical, but I think that the isfinite test is not needed. We could remove it without having any effect on test results except the code should be a tiny bit faster. > Source/WTF/wtf/DateMath.cpp:1162 > if (fabs(t) > maxECMAScriptTime) > return std::numeric_limits<double>::quiet_NaN(); > - return trunc(t); > + return trunc(t) + 0.0; If this was written recently we would probably be using std::abs and std::trunc. I am also wondering if this gives the right result for values just a tiny bit larger than maxECMAScriptTime: in other words, should they be truncated first and then checked rather than checked first and then truncated?
Yusuke Suzuki
Comment 21 2018-05-16 12:29:52 PDT
Comment on attachment 340289 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=340289&action=review >> Source/WTF/wtf/DateMath.cpp:1159 >> return std::numeric_limits<double>::quiet_NaN(); > > Not critical, but I think that the isfinite test is not needed. We could remove it without having any effect on test results except the code should be a tiny bit faster. I was considering about NaN case, but it seems that NaN can work with the following code. Nice catch. I'll remove this. >> Source/WTF/wtf/DateMath.cpp:1162 >> + return trunc(t) + 0.0; > > If this was written recently we would probably be using std::abs and std::trunc. > > I am also wondering if this gives the right result for values just a tiny bit larger than maxECMAScriptTime: in other words, should they be truncated first and then checked rather than checked first and then truncated? Using std::abs and std::trunc sounds fine. I'll do it in a follow-up change. I think this order is OK since this is corresponding to the spec https://tc39.github.io/ecma262/#sec-timeclip. I believe that the rationale behind this is if t is larger than maxECMAScriptTime, even if it can be trunc-ed to maxECMAScriptTime, it returns NaN since the original value was actually larger than maxECMAScriptTime.
Yusuke Suzuki
Comment 22 2018-05-16 12:46:31 PDT
Note You need to log in before you can comment on or make changes to this bug.