Commit 3752ce19 authored by Frank Tang's avatar Frank Tang Committed by V8 LUCI CQ

[Temporal] Fix fractional second rounding in ParseTemporalDurationString

Spec text:
https://tc39.es/proposal-temporal/#sec-temporal-parsetemporaldurationstring

Bug: v8:11544
Change-Id: I2d54759c07529f95c7a27c334ee5d3fa6760b2e0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3835292Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82569}
parent 6c6deee7
......@@ -3808,12 +3808,11 @@ Maybe<DurationRecord> ParseTemporalDurationString(Isolate* isolate,
// millisecondsMV be ! ToIntegerOrInfinity(fSecondsDigits) /
// 10^fSecondsScale × 1000.
DCHECK_LE(IfEmptyReturnZero(parsed->seconds_fraction), 1e9);
nanoseconds_mv =
static_cast<int32_t>(IfEmptyReturnZero(parsed->seconds_fraction));
nanoseconds_mv = std::round(IfEmptyReturnZero(parsed->seconds_fraction));
// 15. Else,
} else {
// a. Let millisecondsMV be remainder(secondsMV, 1) × 1000.
nanoseconds_mv = (seconds_mv - std::floor(seconds_mv)) * 1000000000;
nanoseconds_mv = std::round((seconds_mv - std::floor(seconds_mv)) * 1e9);
}
milliseconds_mv = nanoseconds_mv / 1000000;
// 16. Let microsecondsMV be remainder(millisecondsMV, 1) × 1000.
......
......@@ -425,9 +425,6 @@
'built-ins/RegExp/prototype/Symbol.replace/get-flags-err': [FAIL],
'built-ins/RegExp/prototype/Symbol.replace/get-unicode-error': [FAIL],
# -0
'built-ins/Temporal/Duration/prototype/add/argument-string-negative-fractional-units': [FAIL],
# PlainTime RelativeTime
# https://github.com/tc39/proposal-temporal/pull/1862
'built-ins/Temporal/Duration/prototype/total/timezone-getpossibleinstantsfor-iterable': [FAIL],
......@@ -460,12 +457,10 @@
'built-ins/Temporal/Calendar/prototype/weekOfYear/calendar-temporal-object': [FAIL],
'built-ins/Temporal/Calendar/prototype/weekOfYear/cross-year': [FAIL],
'built-ins/Temporal/Calendar/prototype/weekOfYear/infinity-throws-rangeerror': [FAIL],
'built-ins/Temporal/Duration/compare/argument-string-negative-fractional-units': [FAIL],
'built-ins/Temporal/Duration/compare/relativeto-sub-minute-offset': [FAIL],
'built-ins/Temporal/Duration/prototype/add/relativeto-sub-minute-offset': [FAIL],
'built-ins/Temporal/Duration/prototype/round/relativeto-string-datetime': [FAIL],
'built-ins/Temporal/Duration/prototype/round/relativeto-sub-minute-offset': [FAIL],
'built-ins/Temporal/Duration/prototype/subtract/argument-string-negative-fractional-units': [FAIL],
'built-ins/Temporal/Duration/prototype/subtract/relativeto-sub-minute-offset': [FAIL],
'built-ins/Temporal/Duration/prototype/total/balance-negative-result': [FAIL],
'built-ins/Temporal/Duration/prototype/total/relativeto-string-plaindatetime': [FAIL],
......@@ -476,14 +471,12 @@
'built-ins/Temporal/Now/zonedDateTime/timezone-string-multiple-offsets': [FAIL],
'built-ins/Temporal/PlainDate/prototype/toZonedDateTime/timezone-string-multiple-offsets': [FAIL],
'built-ins/Temporal/PlainDate/prototype/weekOfYear/basic': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/add/argument-string-negative-fractional-units': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/since/argument-zoneddatetime-negative-epochnanoseconds': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/since/balance-negative-duration': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/timezone-string-multiple-offsets': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/until/argument-zoneddatetime-negative-epochnanoseconds': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/until/balance': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/until/balance-negative-duration': [FAIL],
'built-ins/Temporal/PlainTime/prototype/add/argument-string-negative-fractional-units': [FAIL],
'built-ins/Temporal/PlainTime/prototype/toZonedDateTime/timezone-string-multiple-offsets': [FAIL],
'built-ins/Temporal/PlainYearMonth/prototype/add/calendar-arguments': [FAIL],
'built-ins/Temporal/PlainYearMonth/prototype/add/overflow-wrong-type': [FAIL],
......@@ -622,15 +615,8 @@
'built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-time-separators': [FAIL],
'built-ins/Temporal/Calendar/prototype/weekOfYear/argument-zoneddatetime-convert': [FAIL],
'built-ins/Temporal/Calendar/prototype/weekOfYear/argument-zoneddatetime-slots': [FAIL],
'built-ins/Temporal/Duration/from/argument-string-negative-fractional-units': [FAIL],
'built-ins/Temporal/Duration/prototype/add/relativeto-year': [FAIL],
'built-ins/Temporal/Instant/from/argument-string': [FAIL],
'built-ins/Temporal/Instant/prototype/add/argument-string-negative-fractional-units': [FAIL],
'built-ins/Temporal/Instant/prototype/subtract/argument-string-negative-fractional-units': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/subtract/argument-string-negative-fractional-units': [FAIL],
'built-ins/Temporal/PlainTime/prototype/subtract/argument-string-negative-fractional-units': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/add/argument-string-negative-fractional-units': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/subtract/argument-string-negative-fractional-units': [FAIL],
'intl402/Temporal/Calendar/prototype/dateFromFields/order-of-operations': [FAIL],
'intl402/Temporal/Calendar/prototype/monthDayFromFields/order-of-operations': [FAIL],
'intl402/Temporal/Calendar/prototype/yearMonthFromFields/order-of-operations': [FAIL],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment