[Temporal] Sync to PR 2295

Pass OrdinaryObjectCreate(*null*) to DifferenceISODateTime in NanosecondsToDays
and to DifferenceZonedDateTime in AddDuration

https://github.com/tc39/proposal-temporal/pull/2295

Bug: v8:11544
Change-Id: Ied1860b755b1cebd0fbcbc4bd574cd525f108378
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3835263
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82547}
This commit is contained in:
Frank Tang 2022-08-16 17:43:00 -07:00 committed by V8 LUCI CQ
parent a94b566a75
commit 7e86bb86f1

View File

@ -5554,7 +5554,7 @@ Maybe<NanosecondsToDaysResult> NanosecondsToDays(Isolate* isolate,
// endDateTime.[[ISOHour]], endDateTime.[[ISOMinute]], // endDateTime.[[ISOHour]], endDateTime.[[ISOMinute]],
// endDateTime.[[ISOSecond]], endDateTime.[[ISOMillisecond]], // endDateTime.[[ISOSecond]], endDateTime.[[ISOMillisecond]],
// endDateTime.[[ISOMicrosecond]], endDateTime.[[ISONanosecond]], // endDateTime.[[ISOMicrosecond]], endDateTime.[[ISONanosecond]],
// relativeTo.[[Calendar]], "day"). // relativeTo.[[Calendar]], "day", OrdinaryObjectCreate(null)).
DurationRecord date_difference; DurationRecord date_difference;
MAYBE_ASSIGN_RETURN_ON_EXCEPTION_VALUE( MAYBE_ASSIGN_RETURN_ON_EXCEPTION_VALUE(
isolate, date_difference, isolate, date_difference,
@ -5571,7 +5571,8 @@ Maybe<NanosecondsToDaysResult> NanosecondsToDays(Isolate* isolate,
{end_date_time->iso_hour(), end_date_time->iso_minute(), {end_date_time->iso_hour(), end_date_time->iso_minute(),
end_date_time->iso_second(), end_date_time->iso_millisecond(), end_date_time->iso_second(), end_date_time->iso_millisecond(),
end_date_time->iso_microsecond(), end_date_time->iso_nanosecond()}}, end_date_time->iso_microsecond(), end_date_time->iso_nanosecond()}},
calendar, Unit::kDay, relative_to, method_name), calendar, Unit::kDay, isolate->factory()->NewJSObjectWithNullProto(),
method_name),
Nothing<NanosecondsToDaysResult>()); Nothing<NanosecondsToDaysResult>());
// 13. Let days be dateDifference.[[Days]]. // 13. Let days be dateDifference.[[Days]].
@ -8534,10 +8535,10 @@ Maybe<DurationRecord> AddDuration(Isolate* isolate, const DurationRecord& dur1,
.ToChecked()); .ToChecked());
} }
// 12. Return ? DifferenceZonedDateTime(relativeTo.[[Nanoseconds]], endNs, // 12. Return ? DifferenceZonedDateTime(relativeTo.[[Nanoseconds]], endNs,
// timeZone, calendar, largestUnit). // timeZone, calendar, largestUnit, OrdinaryObjectCreate(null)).
return DifferenceZonedDateTime( return DifferenceZonedDateTime(
isolate, handle(relative_to->nanoseconds(), isolate), end_ns, time_zone, isolate, handle(relative_to->nanoseconds(), isolate), end_ns, time_zone,
calendar, largest_unit, factory->undefined_value(), method_name); calendar, largest_unit, factory->NewJSObjectWithNullProto(), method_name);
} }
MaybeHandle<JSTemporalDuration> AddDurationToOrSubtractDurationFromDuration( MaybeHandle<JSTemporalDuration> AddDurationToOrSubtractDurationFromDuration(