[Temporal] Sync Rounding Mode

Sync to PR https://github.com/tc39/proposal-temporal/pull/2262
add "expand", "halfCeil", "halfFloor",  "halfTrunc", and "halfEven"*
rounding mode.

Bug: v8:11544
Change-Id: I8f7787a2d0743acc6a3b1ad43f370089ce405b8b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3933576
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83523}
This commit is contained in:
Frank Tang 2022-10-04 02:37:08 -07:00 committed by V8 LUCI CQ
parent f2ccffb863
commit 85e384960c
2 changed files with 17 additions and 105 deletions

View File

@ -392,11 +392,18 @@ Maybe<RoundingMode> ToTemporalRoundingMode(Isolate* isolate,
Handle<JSReceiver> options,
RoundingMode fallback,
const char* method_name) {
// 1. Return ? GetOption(normalizedOptions, "roundingMode", "string", «
// "ceil", "floor", "expand", "trunc", "halfCeil", "halfFloor", "halfExpand",
// "halfTrunc", "halfEven" », fallback).
return GetStringOption<RoundingMode>(
isolate, options, "roundingMode", method_name,
{"ceil", "floor", "trunc", "halfExpand"},
{RoundingMode::kCeil, RoundingMode::kFloor, RoundingMode::kTrunc,
RoundingMode::kHalfExpand},
{"ceil", "floor", "expand", "trunc", "halfCeil", "halfFloor",
"halfExpand", "halfTrunc", "halfEven"},
{RoundingMode::kCeil, RoundingMode::kFloor, RoundingMode::kExpand,
RoundingMode::kTrunc, RoundingMode::kHalfCeil, RoundingMode::kHalfFloor,
RoundingMode::kHalfExpand, RoundingMode::kHalfTrunc,
RoundingMode::kHalfEven},
fallback);
}
@ -18414,7 +18421,13 @@ RoundingMode NegateTemporalRoundingMode(RoundingMode rounding_mode) {
// 2. If roundingMode is "floor", return "ceil".
case RoundingMode::kFloor:
return RoundingMode::kCeil;
// 3. Return roundingMode.
// 3. If roundingMode is "halfCeil", return "halfFloor".
case RoundingMode::kHalfCeil:
return RoundingMode::kHalfFloor;
// 4. If roundingMode is "halfFloor", return "halfCeil".
case RoundingMode::kHalfFloor:
return RoundingMode::kHalfCeil;
// 5. Return roundingMode.
default:
return rounding_mode;
}

View File

@ -553,127 +553,26 @@
'built-ins/Temporal/Duration/prototype/round/precision-exact-in-balance-duration-relative-years-with-calendar': [FAIL],
'built-ins/Temporal/Duration/prototype/round/precision-exact-in-round-duration': [FAIL],
'built-ins/Temporal/Duration/prototype/round/roundingmode-ceil': [FAIL],
'built-ins/Temporal/Duration/prototype/round/roundingmode-expand': [FAIL],
'built-ins/Temporal/Duration/prototype/round/roundingmode-floor': [FAIL],
'built-ins/Temporal/Duration/prototype/round/roundingmode-halfCeil': [FAIL],
'built-ins/Temporal/Duration/prototype/round/roundingmode-halfEven': [FAIL],
'built-ins/Temporal/Duration/prototype/round/roundingmode-halfFloor': [FAIL],
'built-ins/Temporal/Duration/prototype/round/roundingmode-halfTrunc': [FAIL],
'built-ins/Temporal/Duration/prototype/round/roundingmode-trunc': [FAIL],
'built-ins/Temporal/Instant/prototype/round/roundingmode-expand': [FAIL],
'built-ins/Temporal/Instant/prototype/round/roundingmode-halfCeil': [FAIL],
'built-ins/Temporal/Instant/prototype/round/roundingmode-halfEven': [FAIL],
'built-ins/Temporal/Instant/prototype/round/roundingmode-halfFloor': [FAIL],
'built-ins/Temporal/Instant/prototype/round/roundingmode-halfTrunc': [FAIL],
'built-ins/Temporal/Instant/prototype/since/roundingmode-expand': [FAIL],
'built-ins/Temporal/Instant/prototype/since/roundingmode-halfCeil': [FAIL],
'built-ins/Temporal/Instant/prototype/since/roundingmode-halfEven': [FAIL],
'built-ins/Temporal/Instant/prototype/since/roundingmode-halfFloor': [FAIL],
'built-ins/Temporal/Instant/prototype/since/roundingmode-halfTrunc': [FAIL],
'built-ins/Temporal/Instant/prototype/toString/roundingmode-expand': [FAIL],
'built-ins/Temporal/Instant/prototype/toString/roundingmode-halfCeil': [FAIL],
'built-ins/Temporal/Instant/prototype/toString/roundingmode-halfEven': [FAIL],
'built-ins/Temporal/Instant/prototype/toString/roundingmode-halfFloor': [FAIL],
'built-ins/Temporal/Instant/prototype/toString/roundingmode-halfTrunc': [FAIL],
'built-ins/Temporal/Instant/prototype/until/roundingmode-expand': [FAIL],
'built-ins/Temporal/Instant/prototype/until/roundingmode-halfCeil': [FAIL],
'built-ins/Temporal/Instant/prototype/until/roundingmode-halfEven': [FAIL],
'built-ins/Temporal/Instant/prototype/until/roundingmode-halfFloor': [FAIL],
'built-ins/Temporal/Instant/prototype/until/roundingmode-halfTrunc': [FAIL],
'built-ins/Temporal/PlainDate/prototype/since/roundingmode-expand': [FAIL],
'built-ins/Temporal/PlainDate/prototype/since/roundingmode-halfCeil': [FAIL],
'built-ins/Temporal/PlainDate/prototype/since/roundingmode-halfEven': [FAIL],
'built-ins/Temporal/PlainDate/prototype/since/roundingmode-halfFloor': [FAIL],
'built-ins/Temporal/PlainDate/prototype/since/roundingmode-halfTrunc': [FAIL],
'built-ins/Temporal/PlainDate/prototype/until/roundingmode-expand': [FAIL],
'built-ins/Temporal/PlainDate/prototype/until/roundingmode-halfCeil': [FAIL],
'built-ins/Temporal/PlainDate/prototype/until/roundingmode-halfEven': [FAIL],
'built-ins/Temporal/PlainDate/prototype/until/roundingmode-halfFloor': [FAIL],
'built-ins/Temporal/PlainDate/prototype/until/roundingmode-halfTrunc': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/round/roundingmode-expand': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/round/roundingmode-halfCeil': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/round/roundingmode-halfEven': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/round/roundingmode-halfFloor': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/round/roundingmode-halfTrunc': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/since/roundingmode-ceil': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/since/roundingmode-expand': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/since/roundingmode-floor': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/since/roundingmode-halfCeil': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/since/roundingmode-halfEven': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/since/roundingmode-halfFloor': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/since/roundingmode-halfTrunc': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/toString/roundingmode-expand': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/toString/roundingmode-halfCeil': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/toString/roundingmode-halfEven': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/toString/roundingmode-halfFloor': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/toString/roundingmode-halfTrunc': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/until/roundingmode-ceil': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/until/roundingmode-expand': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/until/roundingmode-floor': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/until/roundingmode-halfCeil': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/until/roundingmode-halfEven': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/until/roundingmode-halfFloor': [FAIL],
'built-ins/Temporal/PlainDateTime/prototype/until/roundingmode-halfTrunc': [FAIL],
'built-ins/Temporal/PlainTime/prototype/add/precision-exact-mathematical-values-1': [FAIL],
'built-ins/Temporal/PlainTime/prototype/add/precision-exact-mathematical-values-2': [FAIL],
'built-ins/Temporal/PlainTime/prototype/add/precision-exact-mathematical-values-3': [FAIL],
'built-ins/Temporal/PlainTime/prototype/round/roundingmode-expand': [FAIL],
'built-ins/Temporal/PlainTime/prototype/round/roundingmode-halfCeil': [FAIL],
'built-ins/Temporal/PlainTime/prototype/round/roundingmode-halfEven': [FAIL],
'built-ins/Temporal/PlainTime/prototype/round/roundingmode-halfFloor': [FAIL],
'built-ins/Temporal/PlainTime/prototype/round/roundingmode-halfTrunc': [FAIL],
'built-ins/Temporal/PlainTime/prototype/since/roundingmode-expand': [FAIL],
'built-ins/Temporal/PlainTime/prototype/since/roundingmode-halfCeil': [FAIL],
'built-ins/Temporal/PlainTime/prototype/since/roundingmode-halfEven': [FAIL],
'built-ins/Temporal/PlainTime/prototype/since/roundingmode-halfFloor': [FAIL],
'built-ins/Temporal/PlainTime/prototype/since/roundingmode-halfTrunc': [FAIL],
'built-ins/Temporal/PlainTime/prototype/subtract/precision-exact-mathematical-values-1': [FAIL],
'built-ins/Temporal/PlainTime/prototype/subtract/precision-exact-mathematical-values-2': [FAIL],
'built-ins/Temporal/PlainTime/prototype/subtract/precision-exact-mathematical-values-3': [FAIL],
'built-ins/Temporal/PlainTime/prototype/toString/roundingmode-expand': [FAIL],
'built-ins/Temporal/PlainTime/prototype/toString/roundingmode-halfCeil': [FAIL],
'built-ins/Temporal/PlainTime/prototype/toString/roundingmode-halfEven': [FAIL],
'built-ins/Temporal/PlainTime/prototype/toString/roundingmode-halfFloor': [FAIL],
'built-ins/Temporal/PlainTime/prototype/toString/roundingmode-halfTrunc': [FAIL],
'built-ins/Temporal/PlainTime/prototype/until/roundingmode-expand': [FAIL],
'built-ins/Temporal/PlainTime/prototype/until/roundingmode-halfCeil': [FAIL],
'built-ins/Temporal/PlainTime/prototype/until/roundingmode-halfEven': [FAIL],
'built-ins/Temporal/PlainTime/prototype/until/roundingmode-halfFloor': [FAIL],
'built-ins/Temporal/PlainTime/prototype/until/roundingmode-halfTrunc': [FAIL],
'built-ins/Temporal/PlainYearMonth/prototype/since/roundingmode-expand': [FAIL],
'built-ins/Temporal/PlainYearMonth/prototype/since/roundingmode-halfCeil': [FAIL],
'built-ins/Temporal/PlainYearMonth/prototype/since/roundingmode-halfEven': [FAIL],
'built-ins/Temporal/PlainYearMonth/prototype/since/roundingmode-halfFloor': [FAIL],
'built-ins/Temporal/PlainYearMonth/prototype/since/roundingmode-halfTrunc': [FAIL],
'built-ins/Temporal/PlainYearMonth/prototype/until/roundingmode-expand': [FAIL],
'built-ins/Temporal/PlainYearMonth/prototype/until/roundingmode-halfCeil': [FAIL],
'built-ins/Temporal/PlainYearMonth/prototype/until/roundingmode-halfEven': [FAIL],
'built-ins/Temporal/PlainYearMonth/prototype/until/roundingmode-halfFloor': [FAIL],
'built-ins/Temporal/PlainYearMonth/prototype/until/roundingmode-halfTrunc': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/round/roundingmode-expand': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/round/roundingmode-halfCeil': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/round/roundingmode-halfEven': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/round/roundingmode-halfFloor': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/round/roundingmode-halfTrunc': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/since/roundingmode-ceil': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/since/roundingmode-expand': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/since/roundingmode-floor': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/since/roundingmode-halfCeil': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/since/roundingmode-halfEven': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/since/roundingmode-halfFloor': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/since/roundingmode-halfTrunc': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/roundingmode-expand': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/roundingmode-halfCeil': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/roundingmode-halfEven': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/roundingmode-halfFloor': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/roundingmode-halfTrunc': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/until/roundingmode-ceil': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/until/roundingmode-expand': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/until/roundingmode-floor': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/until/roundingmode-halfCeil': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/until/roundingmode-halfEven': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/until/roundingmode-halfFloor': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/until/roundingmode-halfTrunc': [FAIL],
'intl402/Temporal/ZonedDateTime/prototype/withCalendar/calendar-case-insensitive': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=13342