New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JSC] Support all rounding modes in Temporal #4907
[JSC] Support all rounding modes in Temporal #4907
Conversation
EWS run on current version of this PR (hash 37bf979) |
(WPE EWS seems to be unstable at the moment.) |
@@ -549,7 +553,9 @@ double TemporalDuration::total(JSGlobalObject* globalObject, JSValue optionsValu | |||
} | |||
|
|||
ISO8601::Duration newDuration = m_duration; | |||
balance(newDuration, unit); | |||
auto infiniteResult = balance(newDuration, unit); | |||
if (infiniteResult) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kind of prefer "infiniteResult.has_value()" in code like this. Otherwise it's too easy to read this as a check for zero. I'm not sure this is a project-wide consensus though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, seems like this could be one of those JSC vs. everybody else things. π
.has_value())
(with trailing paren) has nearly no results in JSC, despite having a bunch in WebCore & WebKit. Since we've been using this style quite a bit in neighboring code, I'm inclined to leave it as-is, as long as you don't object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me
Thanks for the review! |
(Win EWS seems to be encountering some unrelated flaky layout tests.) |
https://bugs.webkit.org/show_bug.cgi?id=245935 Reviewed by Geoffrey Garen. This patch implements the rest of the rounding modes for Temporal, namely, `expand`, `halfCeil`, `halfFloor`, `halfTrunc`, and `halfEven`. (As a bonus, it also addresses two adjacent spec tweaks related to fractionalSecondDigits and BalanceDuration.) Note: Some tests still fail due to precision loss beyond MAX_SAFE_INTEGER... * JSTests/test262/config.yaml: * JSTests/test262/expectations.yaml: * Source/JavaScriptCore/runtime/TemporalDuration.cpp: (JSC::TemporalDuration::balance): (JSC::TemporalDuration::total const): * Source/JavaScriptCore/runtime/TemporalDuration.h: * Source/JavaScriptCore/runtime/TemporalObject.cpp: (JSC::temporalFractionalSecondDigits): (JSC::temporalRoundingMode): (JSC::negateTemporalRoundingMode): (JSC::roundNumberToIncrement): Canonical link: https://commits.webkit.org/255068@main
37bf979
to
a8f81aa
Compare
Committed 255068@main (a8f81aa): https://commits.webkit.org/255068@main Reviewed commits have been landed. Closing PR #4907 and removing active labels. |
a8f81aa
37bf979
π§ͺ ios-wk2π mac-AS-debugπ§ͺ api-macπ§ͺ mac-AS-debug-wk2