diff --git a/src/builtins/builtins-temporal.cc b/src/builtins/builtins-temporal.cc index 464ecf8c47..8846e67c6a 100644 --- a/src/builtins/builtins-temporal.cc +++ b/src/builtins/builtins-temporal.cc @@ -64,6 +64,10 @@ TO_BE_IMPLEMENTED(TemporalZonedDateTimePrototypeSince) /* Temporal.Duration */ /* Temporal #sec-temporal.duration.compare */ TO_BE_IMPLEMENTED(TemporalDurationCompare) +/* Temporal #sec-temporal.duration.prototype.add */ +TO_BE_IMPLEMENTED(TemporalDurationPrototypeAdd) +/* Temporal #sec-temporal.duration.prototype.subtract */ +TO_BE_IMPLEMENTED(TemporalDurationPrototypeSubtract) /* Temporal #sec-temporal.duration.prototype.round */ TO_BE_IMPLEMENTED(TemporalDurationPrototypeRound) /* Temporal #sec-temporal.duration.prototype.total */ @@ -226,8 +230,8 @@ TO_BE_IMPLEMENTED(TemporalCalendarPrototypeWeekOfYear) #define TEMPORAL_GET_BY_INVOKE_CALENDAR_METHOD(T, METHOD, name) \ BUILTIN(Temporal##T##Prototype##METHOD) { \ HandleScope scope(isolate); \ - /* 2. Perform ? RequireInternalSlot(temporalDate, */ \ - /* [[InitializedTemporal#T]]). */ \ + /* 2. Perform ? RequireInternalSlot(temporalDate, [[InitializedTemporal \ + * #T]]). */ \ CHECK_RECEIVER(JSTemporal##T, date_like, \ "get Temporal." #T ".prototype." #name); \ /* 3. Let calendar be temporalDate.[[Calendar]]. */ \ @@ -589,8 +593,6 @@ TEMPORAL_PROTOTYPE_METHOD0(Duration, Sign, sign) TEMPORAL_PROTOTYPE_METHOD0(Duration, Blank, blank) TEMPORAL_PROTOTYPE_METHOD0(Duration, Negated, negated) TEMPORAL_PROTOTYPE_METHOD0(Duration, Abs, abs) -TEMPORAL_PROTOTYPE_METHOD2(Duration, Add, add) -TEMPORAL_PROTOTYPE_METHOD2(Duration, Subtract, subtract) TEMPORAL_VALUE_OF(Duration) TEMPORAL_PROTOTYPE_METHOD0(Duration, ToJSON, toJSON) TEMPORAL_PROTOTYPE_METHOD2(Duration, ToLocaleString, toLocaleString) diff --git a/src/objects/js-temporal-objects.cc b/src/objects/js-temporal-objects.cc index b22c54a3f8..cc8d8b4b1f 100644 --- a/src/objects/js-temporal-objects.cc +++ b/src/objects/js-temporal-objects.cc @@ -275,11 +275,6 @@ V8_WARN_UNUSED_RESULT Maybe ParseTemporalDateString( // #sec-temporal-parsetemporaltimestring Maybe ParseTemporalTimeString(Isolate* isolate, Handle iso_string); - -// #sec-temporal-parsetemporalrelativetostring -Maybe ParseTemporalRelativeToString( - Isolate* isolate, Handle iso_string); - // #sec-temporal-parsetemporaldurationstring V8_WARN_UNUSED_RESULT Maybe ParseTemporalDurationString( Isolate* isolate, Handle iso_string); @@ -295,8 +290,6 @@ V8_WARN_UNUSED_RESULT Maybe ParseTimeZoneOffsetString( // #sec-temporal-parsetemporalinstant V8_WARN_UNUSED_RESULT MaybeHandle ParseTemporalInstant( Isolate* isolate, Handle iso_string); -V8_WARN_UNUSED_RESULT MaybeHandle ParseTemporalInstant( - Isolate* isolate, Handle iso_string); DateRecordCommon BalanceISODate(Isolate* isolate, const DateRecordCommon& date); @@ -3498,54 +3491,6 @@ Maybe ParseTemporalInstantString(Isolate* isolate, return Just(record); } -// #sec-temporal-parsetemporalrelativetostring -Maybe ParseTemporalRelativeToString( - Isolate* isolate, Handle iso_string) { - TEMPORAL_ENTER_FUNC(); - - // 1. If ParseText(StringToCodePoints(isoString), TemporalDateTimeString) is a - // List of errors, throw a RangeError exception. - base::Optional parsed = - TemporalParser::ParseTemporalDateTimeString(isolate, iso_string); - if (!parsed.has_value()) { - // a. Throw a *RangeError* exception. - THROW_NEW_ERROR_RETURN_VALUE(isolate, - NEW_TEMPORAL_INVALID_ARG_RANGE_ERROR(), - Nothing()); - } - // 2. Let result be ? ParseISODateTime(isoString). - ZonedDateTimeRecord result; - MAYBE_ASSIGN_RETURN_ON_EXCEPTION_VALUE( - isolate, result.date_time, ParseISODateTime(isolate, iso_string, *parsed), - Nothing()); - - // 3. If ParseText(StringToCodePoints(isoString), TemporalZonedDateTimeString) - // is a Parse Node, then - base::Optional parsed2 = - TemporalParser::ParseTemporalZonedDateTimeString(isolate, iso_string); - if (parsed2.has_value()) { - // a. Let timeZoneResult be ! ParseTemporalTimeZoneString(isoString). - result.time_zone = - ParseTemporalTimeZoneString(isolate, iso_string).ToChecked(); - // b. Let z be timeZoneResult.[[Z]]. - // c. Let offsetString be timeZoneResult.[[OffsetString]]. - // d. Let timeZone be timeZoneResult.[[Name]]. - } else { - // a. Let z be false. - result.time_zone.z = false; - // b. Let offsetString be undefined. - // c. Let timeZone be undefined. - } - // 5. Return the Record { [[Year]]: result.[[Year]], [[Month]]: - // result.[[Month]], [[Day]]: result.[[Day]], [[Hour]]: result.[[Hour]], - // [[Minute]]: result.[[Minute]], [[Second]]: result.[[Second]], - // [[Millisecond]]: result.[[Millisecond]], [[Microsecond]]: - // result.[[Microsecond]], [[Nanosecond]]: result.[[Nanosecond]], - // [[Calendar]]: result.[[Calendar]], [[TimeZoneZ]]: z, - // [[TimeZoneOffsetString]]: offsetString, [[TimeZoneIANAName]]: timeZone }. - return Just(result); -} - // #sec-temporal-parsetemporalinstant MaybeHandle ParseTemporalInstant(Isolate* isolate, Handle iso_string) { @@ -4790,7 +4735,7 @@ MaybeHandle ToIntegerThrowOnInfinity(Isolate* isolate, } // #sec-temporal-largeroftwotemporalunits -Unit LargerOfTwoTemporalUnits(Unit u1, Unit u2) { +Unit LargerOfTwoTemporalUnits(Isolate* isolate, Unit u1, Unit u2) { // 1. If either u1 or u2 is "year", return "year". if (u1 == Unit::kYear || u2 == Unit::kYear) return Unit::kYear; // 2. If either u1 or u2 is "month", return "month". @@ -5540,7 +5485,8 @@ Maybe DifferenceISODateTime( isolate, date2, CreateTemporalDate(isolate, date_time2.date, calendar), Nothing()); // 10. Let dateLargestUnit be ! LargerOfTwoTemporalUnits("day", largestUnit). - Unit date_largest_unit = LargerOfTwoTemporalUnits(Unit::kDay, largest_unit); + Unit date_largest_unit = + LargerOfTwoTemporalUnits(isolate, Unit::kDay, largest_unit); // 11. Let untilOptions be ? MergeLargestUnitOption(options, dateLargestUnit). Handle until_options; @@ -6488,677 +6434,6 @@ MaybeHandle JSTemporalDuration::Abs( std::abs(duration->nanoseconds().Number())}}); } -namespace { - -// #sec-temporal-interpretisodatetimeoffset -MaybeHandle InterpretISODateTimeOffset( - Isolate* isolate, const DateTimeRecord& data, - OffsetBehaviour offset_behaviour, int64_t offset_nanoseconds, - Handle time_zone, Disambiguation disambiguation, - Offset offset_option, MatchBehaviour match_behaviour, - const char* method_name); - -Maybe InterpretTemporalDateTimeFields( - Isolate* isolate, Handle calendar, Handle fields, - Handle options, const char* method_name); - -// #sec-temporal-torelativetemporalobject -MaybeHandle ToRelativeTemporalObject(Isolate* isolate, - Handle options, - const char* method_name) { - TEMPORAL_ENTER_FUNC(); - - Factory* factory = isolate->factory(); - // 1. Assert: Type(options) is Object. - // 2. Let value be ? Get(options, "relativeTo"). - Handle value_obj; - ASSIGN_RETURN_ON_EXCEPTION( - isolate, value_obj, - JSReceiver::GetProperty(isolate, options, factory->relativeTo_string()), - Object); - // 3. If value is undefined, then - if (value_obj->IsUndefined()) { - // a. Return value. - return value_obj; - } - // 4. Let offsetBehaviour be option. - OffsetBehaviour offset_behaviour = OffsetBehaviour::kOption; - - // 5. Let matchBehaviour be match exactly. - MatchBehaviour match_behaviour = MatchBehaviour::kMatchExactly; - - Handle time_zone_obj = factory->undefined_value(); - Handle offset_string_obj; - ZonedDateTimeRecord result; - Handle calendar; - // 6. If Type(value) is Object, then - if (value_obj->IsJSReceiver()) { - Handle value = Handle::cast(value_obj); - // a. If value has either an [[InitializedTemporalDate]] or - // [[InitializedTemporalZonedDateTime]] internal slot, then - if (value->IsJSTemporalPlainDate() || value->IsJSTemporalZonedDateTime()) { - // i. Return value. - return value; - } - // b. If value has an [[InitializedTemporalDateTime]] internal slot, then - if (value->IsJSTemporalPlainDateTime()) { - Handle date_time_value = - Handle::cast(value); - // i. Return ? CreateTemporalDateTime(value.[[ISOYear]], - // value.[[ISOMonth]], value.[[ISODay]], - // value.[[Calendar]]). - return CreateTemporalDate( - isolate, - {date_time_value->iso_year(), date_time_value->iso_month(), - date_time_value->iso_day()}, - handle(date_time_value->calendar(), isolate)); - } - // c. Let calendar be ? GetTemporalCalendarWithISODefault(value). - ASSIGN_RETURN_ON_EXCEPTION( - isolate, calendar, - GetTemporalCalendarWithISODefault(isolate, value, method_name), Object); - // d. Let fieldNames be ? CalendarFields(calendar, « "day", "hour", - // "microsecond", "millisecond", "minute", "month", "monthCode", - // "nanosecond", "second", "year" »). - Handle field_names = All10UnitsInFixedArray(isolate); - ASSIGN_RETURN_ON_EXCEPTION(isolate, field_names, - CalendarFields(isolate, calendar, field_names), - Object); - // e. Let fields be ? PrepareTemporalFields(value, fieldNames, «»). - Handle fields; - ASSIGN_RETURN_ON_EXCEPTION( - isolate, fields, - PrepareTemporalFields(isolate, value, field_names, - RequiredFields::kNone), - JSTemporalPlainDateTime); - // f. Let dateOptions be ! OrdinaryObjectCreate(null). - Handle date_options = factory->NewJSObjectWithNullProto(); - // g. Perform ! CreateDataPropertyOrThrow(dateOptions, "overflow", - // "constrain"). - CHECK(JSReceiver::CreateDataProperty( - isolate, date_options, factory->overflow_string(), - factory->constrain_string(), Just(kThrowOnError)) - .FromJust()); - // h. Let result be ? InterpretTemporalDateTimeFields(calendar, fields, - // dateOptions). - MAYBE_ASSIGN_RETURN_ON_EXCEPTION_VALUE( - isolate, result.date_time, - InterpretTemporalDateTimeFields(isolate, calendar, fields, date_options, - method_name), - Handle()); - // i. Let offsetString be ? Get(value, "offset"). - ASSIGN_RETURN_ON_EXCEPTION( - isolate, offset_string_obj, - JSReceiver::GetProperty(isolate, value, factory->offset_string()), - Object); - // j. Let timeZone be ? Get(value, "timeZone"). - ASSIGN_RETURN_ON_EXCEPTION( - isolate, time_zone_obj, - JSReceiver::GetProperty(isolate, value, factory->timeZone_string()), - Object); - // k. If timeZone is not undefined, then - if (!time_zone_obj->IsUndefined()) { - // i. Set timeZone to ? ToTemporalTimeZone(timeZone). - Handle time_zone; - ASSIGN_RETURN_ON_EXCEPTION( - isolate, time_zone, - temporal::ToTemporalTimeZone(isolate, time_zone_obj, method_name), - Object); - time_zone_obj = time_zone; - } - - // l. If offsetString is undefined, then - if (offset_string_obj->IsUndefined()) { - // i. Set offsetBehaviour to wall. - offset_behaviour = OffsetBehaviour::kWall; - } - // 6. Else, - } else { - // a. Let string be ? ToString(value). - Handle string; - ASSIGN_RETURN_ON_EXCEPTION(isolate, string, - Object::ToString(isolate, value_obj), Object); - // b. Let result be ? ParseTemporalRelativeToString(string). - MAYBE_ASSIGN_RETURN_ON_EXCEPTION_VALUE( - isolate, result, ParseTemporalRelativeToString(isolate, string), - Handle()); - - // c. Let calendar be ? - // ToTemporalCalendarWithISODefault(result.[[Calendar]]). - ASSIGN_RETURN_ON_EXCEPTION( - isolate, calendar, - ToTemporalCalendarWithISODefault(isolate, result.date_time.calendar, - method_name), - Object); - - // d. Let offsetString be result.[[TimeZoneOffset]]. - offset_string_obj = result.time_zone.offset_string; - - // e. Let timeZoneName be result.[[TimeZoneIANAName]]. - Handle time_zone_name = result.time_zone.name; - - // f. If timeZoneName is not undefined, then - if (!time_zone_name.is_null()) { - // i. If ParseText(StringToCodePoints(timeZoneName), - // TimeZoneNumericUTCOffset) is a List of errors, then - base::Optional parsed = - TemporalParser::ParseTimeZoneNumericUTCOffset(isolate, - time_zone_name); - if (!parsed.has_value()) { - // 1. If ! IsValidTimeZoneName(timeZoneName) is false, throw a - // RangeError exception. - if (!IsValidTimeZoneName(isolate, time_zone_name)) { - THROW_NEW_ERROR_RETURN_VALUE(isolate, - NEW_TEMPORAL_INVALID_ARG_RANGE_ERROR(), - Handle()); - } - // 2. Set timeZoneName to ! CanonicalizeTimeZoneName(timeZoneName). - time_zone_name = CanonicalizeTimeZoneName(isolate, time_zone_name); - } - // ii. Let timeZone be ! CreateTemporalTimeZone(timeZoneName). - Handle time_zone = - temporal::CreateTemporalTimeZone(isolate, time_zone_name) - .ToHandleChecked(); - time_zone_obj = time_zone; - // g. Else, - } else { - // i. Let timeZone be undefined. - time_zone_obj = factory->undefined_value(); - } - - // h. If result.[[TimeZoneZ]] is true, then - if (result.time_zone.z) { - // i. Set offsetBehaviour to exact. - offset_behaviour = OffsetBehaviour::kExact; - // g. Else if offsetString is undefined, then - } else if (offset_string_obj->IsUndefined()) { - // i. Set offsetBehaviour to wall. - offset_behaviour = OffsetBehaviour::kWall; - } - // h. Set matchBehaviour to match minutes. - match_behaviour = MatchBehaviour::kMatchMinutes; - } - // 7. If timeZone is not undefined, then - if (!time_zone_obj->IsUndefined()) { - CHECK(time_zone_obj->IsJSReceiver()); - Handle time_zone = Handle::cast(time_zone_obj); - // a. If offsetBehaviour is option, then - int64_t offset_ns = 0; - if (offset_behaviour == OffsetBehaviour::kOption) { - // i. Set offsetString to ? ToString(offsetString). - Handle offset_string; - ASSIGN_RETURN_ON_EXCEPTION(isolate, offset_string, - Object::ToString(isolate, offset_string_obj), - Object); - // ii. Let offsetNs be ? ParseTimeZoneOffsetString(offset_string). - MAYBE_ASSIGN_RETURN_ON_EXCEPTION_VALUE( - isolate, offset_ns, ParseTimeZoneOffsetString(isolate, offset_string), - Handle()); - // b. Else, - } else { - // i. Let offsetNs be 0. - offset_ns = 0; - } - // Let epochNanoseconds be ? InterpretISODateTimeOffset(result.[[Year]], - // result.[[Month]], result.[[Day]], result.[[Hour]], result.[[Minute]], - // result.[[Second]], result.[[Millisecond]], result.[[Microsecond]], - // result.[[Nanosecond]], offsetBehaviour, offsetNs, timeZone, "compatible", - // "reject", matchBehaviour). - Handle epoch_nanoseconds; - ASSIGN_RETURN_ON_EXCEPTION( - isolate, epoch_nanoseconds, - InterpretISODateTimeOffset(isolate, result.date_time, offset_behaviour, - offset_ns, time_zone, - Disambiguation::kCompatible, Offset::kReject, - match_behaviour, method_name), - Object); - - // e. Return ? CreateTemporalZonedDateTime(epochNanoseconds, timeZone, - // calendar). - return CreateTemporalZonedDateTime(isolate, epoch_nanoseconds, time_zone, - calendar); - } - // 7. Return ? CreateTemporalDate(result.[[Year]], result.[[Month]], - // result.[[Day]], - // calendar). - return CreateTemporalDate(isolate, result.date_time.date, calendar); -} - -// #sec-temporal-defaulttemporallargestunit -Unit DefaultTemporalLargestUnit(const DurationRecord& dur) { - // 1. If years is not zero, return "year". - if (dur.years != 0) return Unit::kYear; - // 2. If months is not zero, return "month". - if (dur.months != 0) return Unit::kMonth; - // 3. If weeks is not zero, return "week". - if (dur.weeks != 0) return Unit::kWeek; - // 4. If days is not zero, return "day". - if (dur.time_duration.days != 0) return Unit::kDay; - // 5dur.. If hours is not zero, return "hour". - if (dur.time_duration.hours != 0) return Unit::kHour; - // 6. If minutes is not zero, return "minute". - if (dur.time_duration.minutes != 0) return Unit::kMinute; - // 7. If seconds is not zero, return "second". - if (dur.time_duration.seconds != 0) return Unit::kSecond; - // 8. If milliseconds is not zero, return "millisecond". - if (dur.time_duration.milliseconds != 0) return Unit::kMillisecond; - // 9. If microseconds is not zero, return "microsecond". - if (dur.time_duration.microseconds != 0) return Unit::kMicrosecond; - // 10. Return "nanosecond". - return Unit::kNanosecond; -} - -// #sec-temporal-differencezoneddatetime -Maybe DifferenceZonedDateTime( - Isolate* isolate, Handle ns1, Handle ns2, - Handle time_zone, Handle calendar, - Unit largest_unit, Handle options, const char* method_name) { - TEMPORAL_ENTER_FUNC(); - - // 1. If ns1 is ns2, then - if (BigInt::CompareToBigInt(ns1, ns2) == ComparisonResult::kEqual) { - // a. Return ! CreateDurationRecord(0, 0, 0, 0, 0, 0, 0, 0, 0, 0). - return Just(CreateDurationRecord(isolate, {0, 0, 0, {0, 0, 0, 0, 0, 0, 0}}) - .ToChecked()); - } - // 2. Let startInstant be ! CreateTemporalInstant(ns1). - Handle start_instant = - temporal::CreateTemporalInstant(isolate, ns1).ToHandleChecked(); - // 3. Let startDateTime be ? - // temporal::BuiltinTimeZoneGetPlainDateTimeFor(timeZone, startInstant, - // calendar). - Handle start_date_time; - ASSIGN_RETURN_ON_EXCEPTION_VALUE( - isolate, start_date_time, - temporal::BuiltinTimeZoneGetPlainDateTimeFor( - isolate, time_zone, start_instant, calendar, method_name), - Nothing()); - // 4. Let endInstant be ! CreateTemporalInstant(ns2). - Handle end_instant = - temporal::CreateTemporalInstant(isolate, ns2).ToHandleChecked(); - // 5. Let endDateTime be ? - // temporal::BuiltinTimeZoneGetPlainDateTimeFor(timeZone, endInstant, - // calendar). - Handle end_date_time; - ASSIGN_RETURN_ON_EXCEPTION_VALUE( - isolate, end_date_time, - temporal::BuiltinTimeZoneGetPlainDateTimeFor( - isolate, time_zone, end_instant, calendar, method_name), - Nothing()); - // 6. Let dateDifference be ? DifferenceISODateTime(startDateTime.[[ISOYear]], - // startDateTime.[[ISOMonth]], startDateTime.[[ISODay]], - // startDateTime.[[ISOHour]], startDateTime.[[ISOMinute]], - // startDateTime.[[ISOSecond]], startDateTime.[[ISOMillisecond]], - // startDateTime.[[ISOMicrosecond]], startDateTime.[[ISONanosecond]], - // endDateTime.[[ISOYear]], endDateTime.[[ISOMonth]], endDateTime.[[ISODay]], - // endDateTime.[[ISOHour]], endDateTime.[[ISOMinute]], - // endDateTime.[[ISOSecond]], endDateTime.[[ISOMillisecond]], - // endDateTime.[[ISOMicrosecond]], endDateTime.[[ISONanosecond]], calendar, - // largestUnit, options). - DurationRecord date_difference; - MAYBE_ASSIGN_RETURN_ON_EXCEPTION_VALUE( - isolate, date_difference, - DifferenceISODateTime( - isolate, - {{start_date_time->iso_year(), start_date_time->iso_month(), - start_date_time->iso_day()}, - {start_date_time->iso_hour(), start_date_time->iso_minute(), - start_date_time->iso_second(), start_date_time->iso_millisecond(), - start_date_time->iso_microsecond(), - start_date_time->iso_nanosecond()}}, - {{end_date_time->iso_year(), end_date_time->iso_month(), - end_date_time->iso_day()}, - {end_date_time->iso_hour(), end_date_time->iso_minute(), - end_date_time->iso_second(), end_date_time->iso_millisecond(), - end_date_time->iso_microsecond(), end_date_time->iso_nanosecond()}}, - calendar, largest_unit, options, method_name), - Nothing()); - - // 7. Let intermediateNs be ? AddZonedDateTime(ns1, timeZone, calendar, - // dateDifference.[[Years]], dateDifference.[[Months]], - // dateDifference.[[Weeks]], 0, 0, 0, 0, 0, 0, 0). - Handle intermediate_ns; - ASSIGN_RETURN_ON_EXCEPTION_VALUE( - isolate, intermediate_ns, - AddZonedDateTime(isolate, ns1, time_zone, calendar, - {date_difference.years, - date_difference.months, - date_difference.weeks, - {0, 0, 0, 0, 0, 0, 0}}, - method_name), - Nothing()); - // 8. Let timeRemainderNs be ns2 − intermediateNs. - Handle time_remainder_ns = - BigInt::Subtract(isolate, ns2, intermediate_ns).ToHandleChecked(); - - // 9. Let intermediate be ? CreateTemporalZonedDateTime(intermediateNs, - // timeZone, calendar). - Handle intermediate = - CreateTemporalZonedDateTime(isolate, intermediate_ns, time_zone, calendar) - .ToHandleChecked(); - - // 10. Let result be ? NanosecondsToDays(ℝ(timeRemainderNs), intermediate). - NanosecondsToDaysResult result; - MAYBE_ASSIGN_RETURN_ON_EXCEPTION_VALUE( - isolate, result, - NanosecondsToDays(isolate, time_remainder_ns, intermediate, method_name), - Nothing()); - - // 11. Let timeDifference be ! BalanceDuration(0, 0, 0, 0, 0, 0, - // result.[[Nanoseconds]], "hour"). - TimeDurationRecord time_difference = - BalanceDuration(isolate, Unit::kHour, - {0, 0, 0, 0, 0, 0, result.nanoseconds}, method_name) - .ToChecked(); - - // 12. Return ! CreateDurationRecord(dateDifference.[[Years]], - // dateDifference.[[Months]], dateDifference.[[Weeks]], result.[[Days]], - // timeDifference.[[Hours]], timeDifference.[[Minutes]], - // timeDifference.[[Seconds]], timeDifference.[[Milliseconds]], - // timeDifference.[[Microseconds]], timeDifference.[[Nanoseconds]]). - time_difference.days = result.days; - return Just(CreateDurationRecord( - isolate, {date_difference.years, date_difference.months, - date_difference.weeks, time_difference}) - .ToChecked()); -} - -// #sec-temporal-roundtemporalinstant -Handle RoundTemporalInstant(Isolate* isolate, Handle ns, - int64_t increment, Unit unit, - RoundingMode rounding_mode); - -// #sec-temporal-differenceinstant -Handle DifferenceInstant(Isolate* isolate, Handle ns1, - Handle ns2, double rounding_increment, - Unit smallest_unit, - RoundingMode rounding_mode); - -Maybe AddDuration(Isolate* isolate, const DurationRecord& dur1, - const DurationRecord& dur2, - Handle relative_to_obj, - const char* method_name) { - TEMPORAL_ENTER_FUNC(); - - Factory* factory = isolate->factory(); - DurationRecord result; - // 1. Let largestUnit1 be ! DefaultTemporalLargestUnit(y1, mon1, w1, d1, h1, - // min1, s1, ms1, mus1). - Unit largest_unit1 = DefaultTemporalLargestUnit(dur1); - // 2. Let largestUnit2 be ! DefaultTemporalLargestUnit(y2, mon2, w2, d2, h2, - // min2, s2, ms2, mus2). - Unit largest_unit2 = DefaultTemporalLargestUnit(dur2); - // 3. Let largestUnit be ! LargerOfTwoTemporalUnits(largestUnit1, - // largestUnit2). - Unit largest_unit = LargerOfTwoTemporalUnits(largest_unit1, largest_unit2); - - // 5. If relativeTo is undefined, then - if (relative_to_obj->IsUndefined()) { - // a. If largestUnit is one of "year", "month", or "week", then - if (largest_unit == Unit::kYear || largest_unit == Unit::kMonth || - largest_unit == Unit::kWeek) { - // i. Throw a RangeError exception. - THROW_NEW_ERROR_RETURN_VALUE(isolate, - NEW_TEMPORAL_INVALID_ARG_RANGE_ERROR(), - Nothing()); - } - // b. Let result be ! BalanceDuration(d1 + d2, h1 + h2, min1 + min2, s1 + - // s2, ms1 + ms2, mus1 + mus2, ns1 + ns2, largestUnit). - result.time_duration = - BalanceDuration( - isolate, largest_unit, - {dur1.time_duration.days + dur2.time_duration.days, - dur1.time_duration.hours + dur2.time_duration.hours, - dur1.time_duration.minutes + dur2.time_duration.minutes, - dur1.time_duration.seconds + dur2.time_duration.seconds, - dur1.time_duration.milliseconds + dur2.time_duration.milliseconds, - dur1.time_duration.microseconds + dur2.time_duration.microseconds, - dur1.time_duration.nanoseconds + dur2.time_duration.nanoseconds}, - method_name) - .ToChecked(); - // c. Return ! CreateDurationRecord(0, 0, 0, result.[[Days]], - // result.[[Hours]], result.[[Minutes]], result.[[Seconds]], - // result.[[Milliseconds]], result.[[Microseconds]], - // result.[[Nanoseconds]]). - return Just(CreateDurationRecord(isolate, {0, 0, 0, result.time_duration}) - .ToChecked()); - // 5. If relativeTo has an [[InitializedTemporalDate]] internal slot, then - } else if (relative_to_obj->IsJSTemporalPlainDate()) { - // a. Let calendar be relativeTo.[[Calendar]]. - Handle relative_to = - Handle::cast(relative_to_obj); - Handle calendar(relative_to->calendar(), isolate); - // b. Let dateDuration1 be ? CreateTemporalDuration(y1, mon1, w1, d1, 0, 0, - // 0, 0, 0, 0). - Handle date_duration1; - ASSIGN_RETURN_ON_EXCEPTION_VALUE( - isolate, date_duration1, - CreateTemporalDuration(isolate, - {dur1.years, - dur1.months, - dur1.weeks, - {dur1.time_duration.days, 0, 0, 0, 0, 0, 0}}), - Nothing()); - // c. Let dateDuration2 be ? CreateTemporalDuration(y2, mon2, w2, d2, 0, 0, - // 0, 0, 0, 0). - Handle date_duration2; - ASSIGN_RETURN_ON_EXCEPTION_VALUE( - isolate, date_duration2, - CreateTemporalDuration(isolate, - {dur2.years, - dur2.months, - dur2.weeks, - {dur2.time_duration.days, 0, 0, 0, 0, 0, 0}}), - Nothing()); - // d. Let dateAdd be ? GetMethod(calendar, "dateAdd"). - Handle date_add; - ASSIGN_RETURN_ON_EXCEPTION_VALUE( - isolate, date_add, - Object::GetMethod(calendar, factory->dateAdd_string()), - Nothing()); - // e. Let intermediate be ? CalendarDateAdd(calendar, relativeTo, - // dateDuration1, undefined, dateAdd). - Handle intermediate; - ASSIGN_RETURN_ON_EXCEPTION_VALUE( - isolate, intermediate, - CalendarDateAdd(isolate, calendar, relative_to, date_duration1, - factory->undefined_value(), date_add), - Nothing()); - // f. Let end be ? CalendarDateAdd(calendar, intermediate, dateDuration2, - // undefined, dateAdd). - Handle end; - ASSIGN_RETURN_ON_EXCEPTION_VALUE( - isolate, end, - CalendarDateAdd(isolate, calendar, intermediate, date_duration2, - factory->undefined_value(), date_add), - Nothing()); - // g. Let dateLargestUnit be ! LargerOfTwoTemporalUnits("day", largestUnit). - Unit date_largest_unit = LargerOfTwoTemporalUnits(Unit::kDay, largest_unit); - // h. Let differenceOptions be ! OrdinaryObjectCreate(null). - Handle difference_options = factory->NewJSObjectWithNullProto(); - // i. Perform ! CreateDataPropertyOrThrow(differenceOptions, "largestUnit", - // dateLargestUnit). - CHECK(JSReceiver::CreateDataProperty( - isolate, difference_options, factory->largestUnit_string(), - UnitToString(isolate, date_largest_unit), Just(kThrowOnError)) - .FromJust()); - - // j. Let dateDifference be ? CalendarDateUntil(calendar, relativeTo, end, - // differenceOptions). - Handle date_difference; - ASSIGN_RETURN_ON_EXCEPTION_VALUE( - isolate, date_difference, - CalendarDateUntil(isolate, calendar, relative_to, end, - difference_options), - Nothing()); - // n. Let result be ! BalanceDuration(dateDifference.[[Days]], h1 + h2, min1 - // + min2, s1 + s2, ms1 + ms2, mus1 + mus2, ns1 + ns2, largestUnit). - result.time_duration = - BalanceDuration( - isolate, largest_unit, - {date_difference->days().Number(), - dur1.time_duration.hours + dur2.time_duration.hours, - dur1.time_duration.minutes + dur2.time_duration.minutes, - dur1.time_duration.seconds + dur2.time_duration.seconds, - dur1.time_duration.milliseconds + dur2.time_duration.milliseconds, - dur1.time_duration.microseconds + dur2.time_duration.microseconds, - dur1.time_duration.nanoseconds + dur2.time_duration.nanoseconds}, - method_name) - .ToChecked(); - // l. Return ! CreateDurationRecord(dateDifference.[[Years]], - // dateDifference.[[Months]], dateDifference.[[Weeks]], result.[[Days]], - // result.[[Hours]], result.[[Minutes]], result.[[Seconds]], - // result.[[Milliseconds]], result.[[Microseconds]], - // result.[[Nanoseconds]]). - return Just( - CreateDurationRecord( - isolate, {date_difference->years().Number(), - date_difference->months().Number(), - date_difference->weeks().Number(), result.time_duration}) - .ToChecked()); - } - // 6. Assert: relativeTo has an [[InitializedTemporalZonedDateTime]] - // internal slot. - DCHECK(relative_to_obj->IsJSTemporalZonedDateTime()); - Handle relative_to = - Handle::cast(relative_to_obj); - // 7. Let timeZone be relativeTo.[[TimeZone]]. - Handle time_zone(relative_to->time_zone(), isolate); - // 8. Let calendar be relativeTo.[[Calendar]]. - Handle calendar(relative_to->calendar(), isolate); - // 9. Let intermediateNs be ? AddZonedDateTime(relativeTo.[[Nanoseconds]], - // timeZone, calendar, y1, mon1, w1, d1, h1, min1, s1, ms1, mus1, ns1). - Handle intermediate_ns; - ASSIGN_RETURN_ON_EXCEPTION_VALUE( - isolate, intermediate_ns, - AddZonedDateTime(isolate, handle(relative_to->nanoseconds(), isolate), - time_zone, calendar, dur1, method_name), - Nothing()); - // 10. Let endNs be ? AddZonedDateTime(intermediateNs, timeZone, calendar, - // y2, mon2, w2, d2, h2, min2, s2, ms2, mus2, ns2). - Handle end_ns; - ASSIGN_RETURN_ON_EXCEPTION_VALUE( - isolate, end_ns, - AddZonedDateTime(isolate, intermediate_ns, time_zone, calendar, dur2, - method_name), - Nothing()); - // 11. If largestUnit is not one of "year", "month", "week", or "day", then - if (!(largest_unit == Unit::kYear || largest_unit == Unit::kMonth || - largest_unit == Unit::kWeek || largest_unit == Unit::kDay)) { - // i. Let diffNs be ! DifferenceInstant(relativeTo.[[Nanoseconds]], endNs, - // 1, "nanosecond", "halfExpand"). - Handle diff_ns = DifferenceInstant( - isolate, handle(relative_to->nanoseconds(), isolate), end_ns, 1, - Unit::kNanosecond, RoundingMode::kHalfExpand); - // ii. Let result be ! BalanceDuration(0, 0, 0, 0, 0, 0, diffNs, - // largestUnit). - result.time_duration = - BalanceDuration( - isolate, largest_unit, - {0, 0, 0, 0, 0, 0, BigInt::ToNumber(isolate, diff_ns)->Number()}, - method_name) - .ToChecked(); - // d. Return ! CreateDurationRecord(0, 0, 0, 0, result.[[Hours]], - // result.[[Minutes]], result.[[Seconds]], result.[[Milliseconds]], - // result.[[Microseconds]], result.[[Nanoseconds]]). - result.time_duration.days = 0; - return Just(CreateDurationRecord(isolate, {0, 0, 0, result.time_duration}) - .ToChecked()); - } - // 12. Return ? DifferenceZonedDateTime(relativeTo.[[Nanoseconds]], endNs, - // timeZone, calendar, largestUnit). - return DifferenceZonedDateTime( - isolate, handle(relative_to->nanoseconds(), isolate), end_ns, time_zone, - calendar, largest_unit, factory->undefined_value(), method_name); -} - -MaybeHandle AddDurationToOrSubtractDurationFromDuration( - Isolate* isolate, Arithmetic operation, Handle duration, - Handle other_obj, Handle options_obj, - const char* method_name) { - // 1. If operation is subtract, let sign be -1. Otherwise, let sign be 1. - double sign = operation == Arithmetic::kSubtract ? -1.0 : 1.0; - - // 2. Set other to ? ToTemporalDurationRecord(other). - DurationRecord other; - MAYBE_ASSIGN_RETURN_ON_EXCEPTION_VALUE( - isolate, other, - temporal::ToTemporalDurationRecord(isolate, other_obj, method_name), - Handle()); - - // 3. Set options to ? GetOptionsObject(options). - Handle options; - ASSIGN_RETURN_ON_EXCEPTION( - isolate, options, GetOptionsObject(isolate, options_obj, method_name), - JSTemporalDuration); - - // 4. Let relativeTo be ? ToRelativeTemporalObject(options). - Handle relative_to; - ASSIGN_RETURN_ON_EXCEPTION( - isolate, relative_to, - ToRelativeTemporalObject(isolate, options, method_name), - JSTemporalDuration); - - // 5. Let result be ? AddDuration(duration.[[Years]], duration.[[Months]], - // duration.[[Weeks]], duration.[[Days]], duration.[[Hours]], - // duration.[[Minutes]], duration.[[Seconds]], duration.[[Milliseconds]], - // duration.[[Microseconds]], duration.[[Nanoseconds]], sign × - // other.[[Years]], sign × other.[[Months]], sign × other.[[Weeks]], sign × - // other.[[Days]], sign × other.[[Hours]], sign × other.[[Minutes]], sign × - // other.[[Seconds]], sign × other.[[Milliseconds]], sign × - // other.[[Microseconds]], sign × other.[[Nanoseconds]], relativeTo). - DurationRecord result; - MAYBE_ASSIGN_RETURN_ON_EXCEPTION_VALUE( - isolate, result, - AddDuration( - isolate, - {duration->years().Number(), - duration->months().Number(), - duration->weeks().Number(), - {duration->days().Number(), duration->hours().Number(), - duration->minutes().Number(), duration->seconds().Number(), - duration->milliseconds().Number(), - duration->microseconds().Number(), - duration->nanoseconds().Number()}}, - {sign * other.years, - sign * other.months, - sign * other.weeks, - {sign * other.time_duration.days, sign * other.time_duration.hours, - sign * other.time_duration.minutes, - sign * other.time_duration.seconds, - sign * other.time_duration.milliseconds, - sign * other.time_duration.microseconds, - sign * other.time_duration.nanoseconds}}, - relative_to, method_name), - Handle()); - - // 6. Return ! CreateTemporalDuration(result.[[Years]], result.[[Months]], - // result.[[Weeks]], result.[[Days]], result.[[Hours]], result.[[Minutes]], - // result.[[Seconds]], result.[[Milliseconds]], result.[[Microseconds]], - // result.[[Nanoseconds]]). - return CreateTemporalDuration(isolate, result).ToHandleChecked(); -} - -} // namespace - -// #sec-temporal.duration.prototype.add -MaybeHandle JSTemporalDuration::Add( - Isolate* isolate, Handle duration, Handle other, - Handle options) { - return AddDurationToOrSubtractDurationFromDuration( - isolate, Arithmetic::kAdd, duration, other, options, - "Temporal.Duration.prototype.add"); -} - -// #sec-temporal.duration.prototype.subtract -MaybeHandle JSTemporalDuration::Subtract( - Isolate* isolate, Handle duration, Handle other, - Handle options) { - return AddDurationToOrSubtractDurationFromDuration( - isolate, Arithmetic::kSubtract, duration, other, options, - "Temporal.Duration.prototype.subtract"); -} - // #sec-temporal.duration.prototype.tojson MaybeHandle JSTemporalDuration::ToJSON( Isolate* isolate, Handle duration) { @@ -8545,15 +7820,17 @@ MaybeHandle JSTemporalCalendar::DateAdd( // duration.[[Hours]], duration.[[Minutes]], duration.[[Seconds]], // duration.[[Milliseconds]], duration.[[Microseconds]], // duration.[[Nanoseconds]], "day"). - TimeDurationRecord balance_result = + TimeDurationRecord balance_result; + MAYBE_ASSIGN_RETURN_ON_EXCEPTION_VALUE( + isolate, balance_result, BalanceDuration( isolate, Unit::kDay, {duration->days().Number(), duration->hours().Number(), duration->minutes().Number(), duration->seconds().Number(), duration->milliseconds().Number(), duration->microseconds().Number(), duration->nanoseconds().Number()}, - method_name) - .ToChecked(); + method_name), + Handle()); DateRecordCommon result; // If calendar.[[Identifier]] is "iso8601", then if (calendar->calendar_index() == 0) { @@ -11077,7 +10354,7 @@ DateTimeRecordCommon RoundISODateTime(Isolate* isolate, } } // namespace - + // // #sec-temporal.plaindatetime.prototype.tostring MaybeHandle JSTemporalPlainDateTime::ToString( Isolate* isolate, Handle date_time, @@ -16217,7 +15494,7 @@ Maybe GetDifferenceSettings( // 4. Let defaultLargestUnit be ! // LargerOfTwoTemporalUnits(smallestLargestDefaultUnit, smallestUnit). Unit default_largest_unit = LargerOfTwoTemporalUnits( - smallest_largest_default_unit, record.smallest_unit); + isolate, smallest_largest_default_unit, record.smallest_unit); // 5. Let largestUnit be ? GetTemporalUnit(options, "largestUnit", unitGroup, // "auto"). MAYBE_ASSIGN_RETURN_ON_EXCEPTION_VALUE( @@ -16250,8 +15527,8 @@ Maybe GetDifferenceSettings( } // 8. If LargerOfTwoTemporalUnits(largestUnit, smallestUnit) is not // largestUnit, throw a RangeError exception. - if (LargerOfTwoTemporalUnits(record.largest_unit, record.smallest_unit) != - record.largest_unit) { + if (LargerOfTwoTemporalUnits(isolate, record.largest_unit, + record.smallest_unit) != record.largest_unit) { THROW_NEW_ERROR_RETURN_VALUE( isolate, NewRangeError(MessageTemplate::kInvalidArgumentForTemporal, diff --git a/src/objects/js-temporal-objects.h b/src/objects/js-temporal-objects.h index b98bc9d151..2ed21f875e 100644 --- a/src/objects/js-temporal-objects.h +++ b/src/objects/js-temporal-objects.h @@ -193,16 +193,6 @@ class JSTemporalDuration V8_WARN_UNUSED_RESULT static MaybeHandle Abs( Isolate* isolate, Handle duration); - // #sec-temporal.duration.prototype.add - V8_WARN_UNUSED_RESULT static MaybeHandle Add( - Isolate* isolate, Handle duration, - Handle other, Handle options); - - // #sec-temporal.duration.prototype.subtract - V8_WARN_UNUSED_RESULT static MaybeHandle Subtract( - Isolate* isolate, Handle duration, - Handle other, Handle options); - // #sec-temporal.duration.prototype.tojson V8_WARN_UNUSED_RESULT static MaybeHandle ToJSON( Isolate* isolate, Handle duration); diff --git a/test/test262/test262.status b/test/test262/test262.status index 61d48851bd..692073819f 100644 --- a/test/test262/test262.status +++ b/test/test262/test262.status @@ -301,6 +301,7 @@ 'built-ins/Temporal/PlainDate/prototype/since/roundingmode-undefined': [FAIL], 'built-ins/Temporal/PlainDate/prototype/since/smallestunit-wrong-type': [FAIL], 'built-ins/Temporal/Duration/prototype/add/argument-string-negative-fractional-units': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/balance-negative-result': [FAIL], # incorect calculation # https://github.com/tc39/test262/pull/3250 @@ -316,23 +317,39 @@ 'built-ins/Temporal/Duration/compare/read-time-fields-before-datefromfields': [FAIL], 'built-ins/Temporal/Duration/compare/relativeto-propertybag-timezone-getoffsetnanosecondsfor-out-of-range': [FAIL], 'built-ins/Temporal/Duration/compare/timezone-getpossibleinstantsfor-iterable': [FAIL], - + 'built-ins/Temporal/Duration/prototype/add/calendar-fields-iterable': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/calendar-temporal-object': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/read-time-fields-before-datefromfields': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-getoffsetnanosecondsfor-out-of-range': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-getoffsetnanosecondsfor-non-integer': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/relativeto-infinity-throws-rangeerror': [FAIL], 'built-ins/Temporal/Duration/prototype/round/relativeto-infinity-throws-rangeerror': [FAIL], 'built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-timezone-getoffsetnanosecondsfor-non-integer': [FAIL], 'built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-timezone-getoffsetnanosecondsfor-out-of-range': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/relativeto-infinity-throws-rangeerror': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-getoffsetnanosecondsfor-non-integer': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-getoffsetnanosecondsfor-out-of-range': [FAIL], 'built-ins/Temporal/Duration/prototype/total/relativeto-infinity-throws-rangeerror': [FAIL], 'built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-timezone-getoffsetnanosecondsfor-non-integer': [FAIL], 'built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-timezone-getoffsetnanosecondsfor-out-of-range': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/timezone-string-datetime': [FAIL], 'built-ins/Temporal/Duration/prototype/round/timezone-string-datetime': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/timezone-string-datetime': [FAIL], 'built-ins/Temporal/Duration/prototype/total/timezone-string-datetime': [FAIL], 'built-ins/Temporal/Duration/prototype/round/calendar-fields-iterable': [FAIL], 'built-ins/Temporal/Duration/prototype/round/calendar-temporal-object': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/calendar-fields-iterable': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/calendar-temporal-object': [FAIL], 'built-ins/Temporal/Duration/prototype/total/calendar-fields-iterable': [FAIL], 'built-ins/Temporal/Duration/prototype/total/calendar-temporal-object': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/timezone-getpossibleinstantsfor-iterable': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/timezone-getpossibleinstantsfor-iterable': [FAIL], 'built-ins/Temporal/Duration/prototype/round/timezone-getpossibleinstantsfor-iterable': [FAIL], 'built-ins/Temporal/Duration/prototype/total/timezone-getpossibleinstantsfor-iterable': [FAIL], # https://github.com/tc39/test262/issues/3262 + 'built-ins/Temporal/Duration/prototype/add/calendar-dateadd-called-with-options-undefined': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/calendar-dateadd-called-with-options-undefined': [FAIL], 'built-ins/Temporal/PlainDate/prototype/toZonedDateTime/calendar-dateadd-called-with-options-undefined': [SKIP], 'built-ins/Temporal/PlainDateTime/prototype/toZonedDateTime/calendar-dateadd-called-with-options-undefined': [SKIP], 'built-ins/Temporal/PlainTime/prototype/toZonedDateTime/calendar-dateadd-called-with-options-undefined': [SKIP], @@ -356,8 +373,10 @@ 'built-ins/Temporal/Calendar/prototype/weekOfYear/argument-plaindatetime': [FAIL], 'built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string': [FAIL], 'built-ins/Temporal/Calendar/prototype/weekOfYear/calendar-datefromfields-called-with-options-undefined': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/balance-negative-time-units': [FAIL], 'built-ins/Temporal/Duration/prototype/add/calendar-dateuntil-called-with-singular-largestunit': [SKIP], 'built-ins/Temporal/Duration/prototype/add/relativeto-string-zoneddatetime': [SKIP], + 'built-ins/Temporal/Duration/prototype/add/relativeto-zoneddatetime-negative-epochnanoseconds': [SKIP], 'built-ins/Temporal/Duration/compare/calendar-dateadd-called-with-options-undefined': [FAIL], 'built-ins/Temporal/Duration/prototype/round/balance-negative-result': [FAIL], 'built-ins/Temporal/Duration/prototype/round/calendar-dateadd-called-with-options-undefined': [FAIL], @@ -365,7 +384,10 @@ 'built-ins/Temporal/Duration/prototype/round/read-time-fields-before-datefromfields': [FAIL], 'built-ins/Temporal/Duration/prototype/round/relativeto-zoneddatetime-negative-epochnanoseconds': [SKIP], 'built-ins/Temporal/Duration/prototype/round/smallestunit-plurals-accepted': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/balance-negative-result': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/balance-negative-time-units': [FAIL], 'built-ins/Temporal/Duration/prototype/subtract/calendar-dateuntil-called-with-singular-largestunit': [SKIP], + 'built-ins/Temporal/Duration/prototype/subtract/read-time-fields-before-datefromfields': [FAIL], 'built-ins/Temporal/Duration/prototype/subtract/relativeto-string-zoneddatetime': [SKIP], 'built-ins/Temporal/Duration/prototype/total/calendar-dateadd-called-with-options-undefined': [FAIL], 'built-ins/Temporal/Duration/prototype/total/calendar-dateuntil-called-with-singular-largestunit': [SKIP], @@ -401,8 +423,25 @@ 'built-ins/Temporal/Duration/compare/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable': [FAIL], 'built-ins/Temporal/Duration/compare/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range': [FAIL], 'built-ins/Temporal/Duration/compare/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/branding': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/calendar-dateadd-called-with-plaindate-instance': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/infinity-throws-rangeerror': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/negative-infinity-throws-rangeerror': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/non-integer-throws-rangeerror': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/options-undefined': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/order-of-operations': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-no-time-units': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-getoffsetnanosecondsfor-not-callable': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-timezone-getoffsetnanosecondsfor-wrong-type': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/relativeto-string-invalid': [FAIL], 'built-ins/Temporal/Duration/prototype/add/relativeto-string-plaindatetime': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/relativeto-string-zoneddatetime-wrong-offset': [FAIL], 'built-ins/Temporal/Duration/prototype/add/relativeto-sub-minute-offset': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/subclassing-ignored': [FAIL], 'built-ins/Temporal/Duration/prototype/round/branding': [FAIL], 'built-ins/Temporal/Duration/prototype/round/calendar-dateadd-called-with-plaindate-instance': [FAIL], 'built-ins/Temporal/Duration/prototype/round/dateuntil-field': [FAIL], @@ -438,8 +477,26 @@ 'built-ins/Temporal/Duration/prototype/round/smallestunit-wrong-type': [FAIL], 'built-ins/Temporal/Duration/prototype/round/subclassing-ignored': [FAIL], 'built-ins/Temporal/Duration/prototype/subtract/argument-string-negative-fractional-units': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/branding': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/calendar-dateadd-called-with-plaindate-instance': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/infinity-throws-rangeerror': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/negative-infinity-throws-rangeerror': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/non-integer-throws-rangeerror': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/options-undefined': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/order-of-operations': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-no-time-units': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-getoffsetnanosecondsfor-not-callable': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-timezone-getoffsetnanosecondsfor-wrong-type': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/relativeto-string-invalid': [FAIL], 'built-ins/Temporal/Duration/prototype/subtract/relativeto-string-plaindatetime': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/relativeto-string-zoneddatetime-wrong-offset': [FAIL], 'built-ins/Temporal/Duration/prototype/subtract/relativeto-sub-minute-offset': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/relativeto-zoneddatetime-negative-epochnanoseconds': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/relativeto-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/subclassing-ignored': [FAIL], 'built-ins/Temporal/Duration/prototype/total/balance-negative-result': [FAIL], 'built-ins/Temporal/Duration/prototype/total/branding': [FAIL], 'built-ins/Temporal/Duration/prototype/total/calendar-dateadd-called-with-plaindate-instance': [FAIL], @@ -923,7 +980,9 @@ 'intl402/Temporal/Calendar/prototype/monthDayFromFields/infinity-throws-rangeerror': [FAIL], 'intl402/Temporal/Calendar/prototype/weekOfYear/infinity-throws-rangeerror': [FAIL], 'intl402/Temporal/Calendar/prototype/yearMonthFromFields/infinity-throws-rangeerror': [FAIL], + 'intl402/Temporal/Duration/prototype/add/relativeto-infinity-throws-rangeerror': [FAIL], 'intl402/Temporal/Duration/prototype/round/relativeto-infinity-throws-rangeerror': [FAIL], + 'intl402/Temporal/Duration/prototype/subtract/relativeto-infinity-throws-rangeerror': [FAIL], 'intl402/Temporal/Duration/prototype/total/relativeto-infinity-throws-rangeerror': [FAIL], 'intl402/Temporal/Instant/prototype/toLocaleString/locales-undefined': [FAIL], 'intl402/Temporal/Instant/prototype/toLocaleString/options-conflict': [FAIL], @@ -983,8 +1042,12 @@ 'built-ins/Temporal/Duration/compare/argument-string-fractional-units-rounding-mode': [FAIL], 'built-ins/Temporal/Duration/compare/calendar-possibly-required': [FAIL], 'built-ins/Temporal/Duration/compare/year-zero': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/argument-string-fractional-units-rounding-mode': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/year-zero': [FAIL], 'built-ins/Temporal/Duration/prototype/round/calendar-possibly-required': [FAIL], 'built-ins/Temporal/Duration/prototype/round/year-zero': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/argument-string-fractional-units-rounding-mode': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/year-zero': [FAIL], 'built-ins/Temporal/Duration/prototype/total/calendar-possibly-required': [FAIL], 'built-ins/Temporal/Duration/prototype/total/year-zero': [FAIL], 'built-ins/Temporal/PlainDate/prototype/since/days-in-month': [FAIL], @@ -1138,8 +1201,10 @@ 'built-ins/Temporal/PlainDateTime/prototype/weekOfYear/basic': [FAIL], 'built-ins/Temporal/Duration/compare/options-wrong-type': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/options-wrong-type': [FAIL], 'built-ins/Temporal/Duration/prototype/round/options-wrong-type': [FAIL], 'built-ins/Temporal/Duration/prototype/round/roundto-invalid-string': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/options-wrong-type': [FAIL], 'built-ins/Temporal/Instant/prototype/round/rounding-direction': [FAIL], 'built-ins/Temporal/Instant/prototype/toString/rounding-direction': [FAIL], 'built-ins/Temporal/PlainDate/prototype/since/options-wrong-type': [FAIL], @@ -1213,6 +1278,9 @@ 'built-ins/Temporal/Duration/compare/timezone-wrong-type': [FAIL], 'built-ins/Temporal/Duration/prototype/add/relativeto-number': [FAIL], 'built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-calendar-number': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-calendar-wrong-type': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/relativeto-wrong-type': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/timezone-wrong-type': [FAIL], 'built-ins/Temporal/Duration/prototype/round/relativeto-number': [FAIL], 'built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-calendar-number': [FAIL], 'built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-calendar-wrong-type': [FAIL], @@ -1220,6 +1288,9 @@ 'built-ins/Temporal/Duration/prototype/round/timezone-wrong-type': [FAIL], 'built-ins/Temporal/Duration/prototype/subtract/relativeto-number': [FAIL], 'built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-calendar-number': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-calendar-wrong-type': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/relativeto-wrong-type': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/timezone-wrong-type': [FAIL], 'built-ins/Temporal/Duration/prototype/total/relativeto-number': [FAIL], 'built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-calendar-number': [FAIL], 'built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-calendar-wrong-type': [FAIL], @@ -1325,8 +1396,16 @@ 'built-ins/Temporal/Duration/compare/timezone-string-leap-second': [FAIL], 'built-ins/Temporal/Duration/compare/timezone-string-year-zero': [FAIL], 'built-ins/Temporal/Duration/from/argument-string-negative-fractional-units': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/argument-object-invalid': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/argument-string': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/basic': [FAIL], 'built-ins/Temporal/Duration/prototype/add/relativeto-leap-second': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/relativeto-month': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/relativeto-order': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/relativeto-required': [FAIL], 'built-ins/Temporal/Duration/prototype/add/relativeto-year': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/timezone-string-leap-second': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/timezone-string-year-zero': [FAIL], 'built-ins/Temporal/Duration/prototype/round/largestunit-smallestunit-default': [FAIL], 'built-ins/Temporal/Duration/prototype/round/largestunit-smallestunit-mismatch': [FAIL], 'built-ins/Temporal/Duration/prototype/round/relativeto-leap-second': [FAIL], @@ -1335,7 +1414,16 @@ 'built-ins/Temporal/Duration/prototype/round/smallestunit': [FAIL], 'built-ins/Temporal/Duration/prototype/round/timezone-string-leap-second': [FAIL], 'built-ins/Temporal/Duration/prototype/round/timezone-string-year-zero': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/argument-object-invalid': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/argument-string': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/basic': [FAIL], 'built-ins/Temporal/Duration/prototype/subtract/relativeto-leap-second': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/relativeto-month': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/relativeto-order': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/relativeto-required': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/relativeto-year': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/timezone-string-leap-second': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/timezone-string-year-zero': [FAIL], 'built-ins/Temporal/Duration/prototype/total/relativeto-leap-second': [FAIL], 'built-ins/Temporal/Duration/prototype/total/timezone-string-leap-second': [FAIL], 'built-ins/Temporal/Duration/prototype/total/timezone-string-year-zero': [FAIL], @@ -1436,8 +1524,10 @@ 'built-ins/Temporal/Calendar/prototype/monthsInYear/argument-calendar-datefromfields-called-with-null-prototype-fields': [FAIL], 'built-ins/Temporal/Calendar/prototype/weekOfYear/argument-calendar-datefromfields-called-with-null-prototype-fields': [FAIL], 'built-ins/Temporal/Calendar/prototype/year/argument-calendar-datefromfields-called-with-null-prototype-fields': [FAIL], + 'built-ins/Temporal/Duration/prototype/add/calendar-dateadd': [FAIL], 'built-ins/Temporal/Duration/prototype/add/relativeto-propertybag-calendar-datefromfields-called-with-null-prototype-fields': [FAIL], 'built-ins/Temporal/Duration/prototype/round/relativeto-propertybag-calendar-datefromfields-called-with-null-prototype-fields': [FAIL], + 'built-ins/Temporal/Duration/prototype/subtract/calendar-dateadd': [FAIL], 'built-ins/Temporal/Duration/prototype/subtract/relativeto-propertybag-calendar-datefromfields-called-with-null-prototype-fields': [FAIL], 'built-ins/Temporal/Duration/prototype/total/relativeto-propertybag-calendar-datefromfields-called-with-null-prototype-fields': [FAIL], 'built-ins/Temporal/PlainDate/compare/argument-calendar-datefromfields-called-with-null-prototype-fields': [FAIL],