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,
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
Maybe<Offset> ToTemporalOffset(Isolate* isolate, Handle<Object> options,
Offset fallback, const char* method_name) {
......@@ -2462,8 +2451,9 @@ MaybeHandle<JSTemporalPlainDate> ToTemporalDate(Isolate* isolate,
return DateFromFields(isolate, calendar, fields, options);
}
// 4. Perform ? ToTemporalOverflow(options).
MAYBE_RETURN(ToTemporalOverflowForSideEffects(isolate, options, method_name),
Handle<JSTemporalPlainDate>());
MAYBE_RETURN_ON_EXCEPTION_VALUE(
isolate, ToTemporalOverflow(isolate, options, method_name),
Handle<JSTemporalPlainDate>());
// 5. Let string be ? ToString(item).
Handle<String> string;
......@@ -11833,8 +11823,8 @@ MaybeHandle<JSTemporalPlainDate> JSTemporalPlainDate::From(
// internal slot, then
if (item->IsJSTemporalPlainDate()) {
// a. Perform ? ToTemporalOverflow(options).
MAYBE_RETURN(
ToTemporalOverflowForSideEffects(isolate, options, method_name),
MAYBE_RETURN_ON_EXCEPTION_VALUE(
isolate, ToTemporalOverflow(isolate, options, method_name),
Handle<JSTemporalPlainDate>());
// b. Return ? CreateTemporalDate(item.[[ISOYear]], item.[[ISOMonth]],
// item.[[ISODay]], item.[[Calendar]]).
......@@ -12146,8 +12136,8 @@ MaybeHandle<JSTemporalPlainDateTime> ToTemporalDateTime(
} else {
// 3. Else,
// a. Perform ? ToTemporalOverflow(options).
MAYBE_RETURN(
ToTemporalOverflowForSideEffects(isolate, options, method_name),
MAYBE_RETURN_ON_EXCEPTION_VALUE(
isolate, ToTemporalOverflow(isolate, options, method_name),
Handle<JSTemporalPlainDateTime>());
// b. Let string be ? ToString(item).
......@@ -12196,8 +12186,8 @@ MaybeHandle<JSTemporalPlainDateTime> JSTemporalPlainDateTime::From(
// internal slot, then
if (item->IsJSTemporalPlainDateTime()) {
// a. Perform ? ToTemporalOverflow(options).
MAYBE_RETURN(
ToTemporalOverflowForSideEffects(isolate, options, method_name),
MAYBE_RETURN_ON_EXCEPTION_VALUE(
isolate, ToTemporalOverflow(isolate, options, method_name),
Handle<JSTemporalPlainDateTime>());
// b. Return ? CreateTemporalDateTime(item.[[ISYear]], item.[[ISOMonth]],
// item.[[ISODay]], item.[[ISOHour]], item.[[ISOMinute]],
......@@ -13659,8 +13649,9 @@ MaybeHandle<JSTemporalPlainYearMonth> ToTemporalYearMonth(
return YearMonthFromFields(isolate, calendar, fields, options);
}
// 4. Perform ? ToTemporalOverflow(options).
MAYBE_RETURN(ToTemporalOverflowForSideEffects(isolate, options, method_name),
Handle<JSTemporalPlainYearMonth>());
MAYBE_RETURN_ON_EXCEPTION_VALUE(
isolate, ToTemporalOverflow(isolate, options, method_name),
Handle<JSTemporalPlainYearMonth>());
// 5. Let string be ? ToString(item).
Handle<String> string;
ASSIGN_RETURN_ON_EXCEPTION(isolate, string,
......@@ -13716,8 +13707,8 @@ MaybeHandle<JSTemporalPlainYearMonth> JSTemporalPlainYearMonth::From(
// internal slot, then
if (item->IsJSTemporalPlainYearMonth()) {
// a. Perform ? ToTemporalOverflow(options).
MAYBE_RETURN(
ToTemporalOverflowForSideEffects(isolate, options, method_name),
MAYBE_RETURN_ON_EXCEPTION_VALUE(
isolate, ToTemporalOverflow(isolate, options, method_name),
Handle<JSTemporalPlainYearMonth>());
// b. Return ? CreateTemporalYearMonth(item.[[ISOYear]], item.[[ISOMonth]],
// item.[[Calendar]], item.[[ISODay]]).
......@@ -15666,8 +15657,8 @@ MaybeHandle<JSTemporalZonedDateTime> ToTemporalZonedDateTime(
// 5. Else,
} else {
// a. Perform ? ToTemporalOverflow(options).
MAYBE_RETURN(
ToTemporalOverflowForSideEffects(isolate, options, method_name),
MAYBE_RETURN_ON_EXCEPTION_VALUE(
isolate, ToTemporalOverflow(isolate, options, method_name),
Handle<JSTemporalZonedDateTime>());
// b. Let string be ? ToString(item).
Handle<String> string;
......@@ -15794,8 +15785,8 @@ MaybeHandle<JSTemporalZonedDateTime> JSTemporalZonedDateTime::From(
// [[InitializedTemporalZonedDateTime]] internal slot, then
if (item->IsJSTemporalZonedDateTime()) {
// a. Perform ? ToTemporalOverflow(options).
MAYBE_RETURN(
ToTemporalOverflowForSideEffects(isolate, options, method_name),
MAYBE_RETURN_ON_EXCEPTION_VALUE(
isolate, ToTemporalOverflow(isolate, options, method_name),
Handle<JSTemporalZonedDateTime>());
// 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