Commit 6033256a authored by Adam Klein's avatar Adam Klein Committed by V8 LUCI CQ

[temporal] Replace ToTemporalOverflowForSideEffects with better macro usage

Change-Id: I877a5ebe8e8dff51d7bbd49d203cf71131e4d9fd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3805821Reviewed-by: 's avatarFrank Tang <ftang@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82411}
parent 338869fc
...@@ -2139,17 +2139,6 @@ Maybe<ShowOverflow> ToTemporalOverflow(Isolate* isolate, Handle<Object> options, ...@@ -2139,17 +2139,6 @@ Maybe<ShowOverflow> ToTemporalOverflow(Isolate* isolate, Handle<Object> options,
ShowOverflow::kConstrain); ShowOverflow::kConstrain);
} }
// TODO(adamk): Remove this and replace with direct usage of
// MAYBE_RETURN_ON_EXCEPTION_VALUE().
Maybe<bool> ToTemporalOverflowForSideEffects(Isolate* isolate,
Handle<Object> options,
const char* method_name) {
MAYBE_RETURN_ON_EXCEPTION_VALUE(
isolate, ToTemporalOverflow(isolate, options, method_name),
Nothing<bool>());
return Just(true);
}
// #sec-temporal-totemporaloffset // #sec-temporal-totemporaloffset
Maybe<Offset> ToTemporalOffset(Isolate* isolate, Handle<Object> options, Maybe<Offset> ToTemporalOffset(Isolate* isolate, Handle<Object> options,
Offset fallback, const char* method_name) { Offset fallback, const char* method_name) {
...@@ -2462,7 +2451,8 @@ MaybeHandle<JSTemporalPlainDate> ToTemporalDate(Isolate* isolate, ...@@ -2462,7 +2451,8 @@ MaybeHandle<JSTemporalPlainDate> ToTemporalDate(Isolate* isolate,
return DateFromFields(isolate, calendar, fields, options); return DateFromFields(isolate, calendar, fields, options);
} }
// 4. Perform ? ToTemporalOverflow(options). // 4. Perform ? ToTemporalOverflow(options).
MAYBE_RETURN(ToTemporalOverflowForSideEffects(isolate, options, method_name), MAYBE_RETURN_ON_EXCEPTION_VALUE(
isolate, ToTemporalOverflow(isolate, options, method_name),
Handle<JSTemporalPlainDate>()); Handle<JSTemporalPlainDate>());
// 5. Let string be ? ToString(item). // 5. Let string be ? ToString(item).
...@@ -11833,8 +11823,8 @@ MaybeHandle<JSTemporalPlainDate> JSTemporalPlainDate::From( ...@@ -11833,8 +11823,8 @@ MaybeHandle<JSTemporalPlainDate> JSTemporalPlainDate::From(
// internal slot, then // internal slot, then
if (item->IsJSTemporalPlainDate()) { if (item->IsJSTemporalPlainDate()) {
// a. Perform ? ToTemporalOverflow(options). // a. Perform ? ToTemporalOverflow(options).
MAYBE_RETURN( MAYBE_RETURN_ON_EXCEPTION_VALUE(
ToTemporalOverflowForSideEffects(isolate, options, method_name), isolate, ToTemporalOverflow(isolate, options, method_name),
Handle<JSTemporalPlainDate>()); Handle<JSTemporalPlainDate>());
// b. Return ? CreateTemporalDate(item.[[ISOYear]], item.[[ISOMonth]], // b. Return ? CreateTemporalDate(item.[[ISOYear]], item.[[ISOMonth]],
// item.[[ISODay]], item.[[Calendar]]). // item.[[ISODay]], item.[[Calendar]]).
...@@ -12146,8 +12136,8 @@ MaybeHandle<JSTemporalPlainDateTime> ToTemporalDateTime( ...@@ -12146,8 +12136,8 @@ MaybeHandle<JSTemporalPlainDateTime> ToTemporalDateTime(
} else { } else {
// 3. Else, // 3. Else,
// a. Perform ? ToTemporalOverflow(options). // a. Perform ? ToTemporalOverflow(options).
MAYBE_RETURN( MAYBE_RETURN_ON_EXCEPTION_VALUE(
ToTemporalOverflowForSideEffects(isolate, options, method_name), isolate, ToTemporalOverflow(isolate, options, method_name),
Handle<JSTemporalPlainDateTime>()); Handle<JSTemporalPlainDateTime>());
// b. Let string be ? ToString(item). // b. Let string be ? ToString(item).
...@@ -12196,8 +12186,8 @@ MaybeHandle<JSTemporalPlainDateTime> JSTemporalPlainDateTime::From( ...@@ -12196,8 +12186,8 @@ MaybeHandle<JSTemporalPlainDateTime> JSTemporalPlainDateTime::From(
// internal slot, then // internal slot, then
if (item->IsJSTemporalPlainDateTime()) { if (item->IsJSTemporalPlainDateTime()) {
// a. Perform ? ToTemporalOverflow(options). // a. Perform ? ToTemporalOverflow(options).
MAYBE_RETURN( MAYBE_RETURN_ON_EXCEPTION_VALUE(
ToTemporalOverflowForSideEffects(isolate, options, method_name), isolate, ToTemporalOverflow(isolate, options, method_name),
Handle<JSTemporalPlainDateTime>()); Handle<JSTemporalPlainDateTime>());
// b. Return ? CreateTemporalDateTime(item.[[ISYear]], item.[[ISOMonth]], // b. Return ? CreateTemporalDateTime(item.[[ISYear]], item.[[ISOMonth]],
// item.[[ISODay]], item.[[ISOHour]], item.[[ISOMinute]], // item.[[ISODay]], item.[[ISOHour]], item.[[ISOMinute]],
...@@ -13659,7 +13649,8 @@ MaybeHandle<JSTemporalPlainYearMonth> ToTemporalYearMonth( ...@@ -13659,7 +13649,8 @@ MaybeHandle<JSTemporalPlainYearMonth> ToTemporalYearMonth(
return YearMonthFromFields(isolate, calendar, fields, options); return YearMonthFromFields(isolate, calendar, fields, options);
} }
// 4. Perform ? ToTemporalOverflow(options). // 4. Perform ? ToTemporalOverflow(options).
MAYBE_RETURN(ToTemporalOverflowForSideEffects(isolate, options, method_name), MAYBE_RETURN_ON_EXCEPTION_VALUE(
isolate, ToTemporalOverflow(isolate, options, method_name),
Handle<JSTemporalPlainYearMonth>()); Handle<JSTemporalPlainYearMonth>());
// 5. Let string be ? ToString(item). // 5. Let string be ? ToString(item).
Handle<String> string; Handle<String> string;
...@@ -13716,8 +13707,8 @@ MaybeHandle<JSTemporalPlainYearMonth> JSTemporalPlainYearMonth::From( ...@@ -13716,8 +13707,8 @@ MaybeHandle<JSTemporalPlainYearMonth> JSTemporalPlainYearMonth::From(
// internal slot, then // internal slot, then
if (item->IsJSTemporalPlainYearMonth()) { if (item->IsJSTemporalPlainYearMonth()) {
// a. Perform ? ToTemporalOverflow(options). // a. Perform ? ToTemporalOverflow(options).
MAYBE_RETURN( MAYBE_RETURN_ON_EXCEPTION_VALUE(
ToTemporalOverflowForSideEffects(isolate, options, method_name), isolate, ToTemporalOverflow(isolate, options, method_name),
Handle<JSTemporalPlainYearMonth>()); Handle<JSTemporalPlainYearMonth>());
// b. Return ? CreateTemporalYearMonth(item.[[ISOYear]], item.[[ISOMonth]], // b. Return ? CreateTemporalYearMonth(item.[[ISOYear]], item.[[ISOMonth]],
// item.[[Calendar]], item.[[ISODay]]). // item.[[Calendar]], item.[[ISODay]]).
...@@ -15666,8 +15657,8 @@ MaybeHandle<JSTemporalZonedDateTime> ToTemporalZonedDateTime( ...@@ -15666,8 +15657,8 @@ MaybeHandle<JSTemporalZonedDateTime> ToTemporalZonedDateTime(
// 5. Else, // 5. Else,
} else { } else {
// a. Perform ? ToTemporalOverflow(options). // a. Perform ? ToTemporalOverflow(options).
MAYBE_RETURN( MAYBE_RETURN_ON_EXCEPTION_VALUE(
ToTemporalOverflowForSideEffects(isolate, options, method_name), isolate, ToTemporalOverflow(isolate, options, method_name),
Handle<JSTemporalZonedDateTime>()); Handle<JSTemporalZonedDateTime>());
// b. Let string be ? ToString(item). // b. Let string be ? ToString(item).
Handle<String> string; Handle<String> string;
...@@ -15794,8 +15785,8 @@ MaybeHandle<JSTemporalZonedDateTime> JSTemporalZonedDateTime::From( ...@@ -15794,8 +15785,8 @@ MaybeHandle<JSTemporalZonedDateTime> JSTemporalZonedDateTime::From(
// [[InitializedTemporalZonedDateTime]] internal slot, then // [[InitializedTemporalZonedDateTime]] internal slot, then
if (item->IsJSTemporalZonedDateTime()) { if (item->IsJSTemporalZonedDateTime()) {
// a. Perform ? ToTemporalOverflow(options). // a. Perform ? ToTemporalOverflow(options).
MAYBE_RETURN( MAYBE_RETURN_ON_EXCEPTION_VALUE(
ToTemporalOverflowForSideEffects(isolate, options, method_name), isolate, ToTemporalOverflow(isolate, options, method_name),
Handle<JSTemporalZonedDateTime>()); Handle<JSTemporalZonedDateTime>());
// b. Perform ? ToTemporalDisambiguation(options). // b. Perform ? ToTemporalDisambiguation(options).
......
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