diff --git a/src/builtins/builtins-temporal.cc b/src/builtins/builtins-temporal.cc index b106eb0a7a..c7ccbf285f 100644 --- a/src/builtins/builtins-temporal.cc +++ b/src/builtins/builtins-temporal.cc @@ -64,8 +64,6 @@ TO_BE_IMPLEMENTED(TemporalPlainTimePrototypeUntil) TO_BE_IMPLEMENTED(TemporalPlainTimePrototypeSince) /* Temporal #sec-temporal.plaintime.prototype.round */ TO_BE_IMPLEMENTED(TemporalPlainTimePrototypeRound) -/* Temporal #sec-temporal.plaintime.prototype.toplaindatetime */ -TO_BE_IMPLEMENTED(TemporalPlainTimePrototypeToPlainDateTime) /* Temporal #sec-temporal.plaintime.prototype.tolocalestring */ TO_BE_IMPLEMENTED(TemporalPlainTimePrototypeToLocaleString) /* Temporal #sec-temporal.plaintime.prototype.tostring */ @@ -432,6 +430,7 @@ TEMPORAL_PROTOTYPE_METHOD1(PlainTime, ToZonedDateTime, toZonedDateTime) TEMPORAL_METHOD2(PlainTime, Compare) TEMPORAL_PROTOTYPE_METHOD1(PlainTime, Equals, equals) TEMPORAL_PROTOTYPE_METHOD0(PlainTime, GetISOFields, getISOFields) +TEMPORAL_PROTOTYPE_METHOD1(PlainTime, ToPlainDateTime, toPlainDateTime) TEMPORAL_VALUE_OF(PlainTime) TEMPORAL_PROTOTYPE_METHOD0(PlainTime, ToJSON, toJSON) diff --git a/src/objects/js-temporal-objects.cc b/src/objects/js-temporal-objects.cc index d596456c0c..fb09bf346f 100644 --- a/src/objects/js-temporal-objects.cc +++ b/src/objects/js-temporal-objects.cc @@ -9628,6 +9628,36 @@ MaybeHandle JSTemporalPlainTime::From( return temporal::ToTemporalTime(isolate, item_obj, overflow, method_name); } +// #sec-temporal.plaintime.prototype.toplaindatetime +MaybeHandle JSTemporalPlainTime::ToPlainDateTime( + Isolate* isolate, Handle temporal_time, + Handle temporal_date_like) { + // 1. Let temporalTime be the this value. + // 2. Perform ? RequireInternalSlot(temporalTime, + // [[InitializedTemporalTime]]). + // 3. Set temporalDate to ? ToTemporalDate(temporalDate). + Handle temporal_date; + ASSIGN_RETURN_ON_EXCEPTION( + isolate, temporal_date, + ToTemporalDate(isolate, temporal_date_like, + "Temporal.PlainTime.prototype.toPlainDateTime"), + JSTemporalPlainDateTime); + // 4. Return ? CreateTemporalDateTime(temporalDate.[[ISOYear]], + // temporalDate.[[ISOMonth]], temporalDate.[[ISODay]], + // temporalTime.[[ISOHour]], temporalTime.[[ISOMinute]], + // temporalTime.[[ISOSecond]], temporalTime.[[ISOMillisecond]], + // temporalTime.[[ISOMicrosecond]], temporalTime.[[ISONanosecond]], + // temporalDate.[[Calendar]]). + return temporal::CreateTemporalDateTime( + isolate, + {{temporal_date->iso_year(), temporal_date->iso_month(), + temporal_date->iso_day()}, + {temporal_time->iso_hour(), temporal_time->iso_minute(), + temporal_time->iso_second(), temporal_time->iso_millisecond(), + temporal_time->iso_microsecond(), temporal_time->iso_nanosecond()}}, + handle(temporal_date->calendar(), isolate)); +} + // #sec-temporal.plaintime.prototype.getisofields MaybeHandle JSTemporalPlainTime::GetISOFields( Isolate* isolate, Handle temporal_time) { diff --git a/src/objects/js-temporal-objects.h b/src/objects/js-temporal-objects.h index fa5956217c..13dc4c80d3 100644 --- a/src/objects/js-temporal-objects.h +++ b/src/objects/js-temporal-objects.h @@ -478,6 +478,11 @@ class JSTemporalPlainTime V8_WARN_UNUSED_RESULT static MaybeHandle GetISOFields( Isolate* isolate, Handle plain_time); + // #sec-temporal.plaintime.prototype.toplaindatetime + V8_WARN_UNUSED_RESULT static MaybeHandle + ToPlainDateTime(Isolate* isolate, Handle plain_time, + Handle temporal_date); + // #sec-temporal.now.plaintimeiso V8_WARN_UNUSED_RESULT static MaybeHandle NowISO( Isolate* isolate, Handle temporal_time_zone_like); diff --git a/test/mjsunit/mjsunit.status b/test/mjsunit/mjsunit.status index d9cdd0b2e0..da2e59e87c 100644 --- a/test/mjsunit/mjsunit.status +++ b/test/mjsunit/mjsunit.status @@ -400,9 +400,6 @@ # BUG(v8:12561) 'spread-large-map': [SKIP], - # BUG(v8:12907) - 'temporal/plain-date-time-to-plain-time': [SKIP], - # Flaky tests due to GC interferring with optimization. 'compiler/regress-crbug-1323114': [SKIP], }], # 'gc_stress' diff --git a/test/test262/test262.status b/test/test262/test262.status index 82eb1acdb8..b5ec74307e 100644 --- a/test/test262/test262.status +++ b/test/test262/test262.status @@ -1121,18 +1121,6 @@ 'built-ins/Temporal/PlainTime/prototype/subtract/subclassing-ignored': [FAIL], 'built-ins/Temporal/PlainTime/prototype/toLocaleString/branding': [FAIL], 'built-ins/Temporal/PlainTime/prototype/toLocaleString/return-string': [FAIL], - 'built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-plaindatetime': [FAIL], - 'built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-with-utc-designator': [FAIL], - 'built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-non-integer': [FAIL], - 'built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-not-callable': [FAIL], - 'built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-out-of-range': [FAIL], - 'built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-zoneddatetime-timezone-getoffsetnanosecondsfor-wrong-type': [FAIL], - 'built-ins/Temporal/PlainTime/prototype/toPlainDateTime/basic': [FAIL], - 'built-ins/Temporal/PlainTime/prototype/toPlainDateTime/branding': [FAIL], - 'built-ins/Temporal/PlainTime/prototype/toPlainDateTime/calendar-datefromfields-called-with-options-undefined': [FAIL], - 'built-ins/Temporal/PlainTime/prototype/toPlainDateTime/calendar-fields-iterable': [FAIL], - 'built-ins/Temporal/PlainTime/prototype/toPlainDateTime/calendar-temporal-object': [FAIL], - 'built-ins/Temporal/PlainTime/prototype/toPlainDateTime/infinity-throws-rangeerror': [FAIL], 'built-ins/Temporal/PlainTime/prototype/toString/branding': [FAIL], 'built-ins/Temporal/PlainTime/prototype/toString/fractionalseconddigits-invalid-string': [FAIL], 'built-ins/Temporal/PlainTime/prototype/toString/fractionalseconddigits-nan': [FAIL], @@ -1667,7 +1655,6 @@ 'intl402/Temporal/PlainTime/prototype/toLocaleString/options-undefined': [FAIL], 'intl402/Temporal/PlainTime/prototype/toLocaleString/resolved-time-zone': [FAIL], 'intl402/Temporal/PlainTime/prototype/toLocaleString/timezone-getoffsetnanosecondsfor-not-callable': [FAIL], - 'intl402/Temporal/PlainTime/prototype/toPlainDateTime/infinity-throws-rangeerror': [FAIL], 'intl402/Temporal/PlainYearMonth/compare/infinity-throws-rangeerror': [FAIL], 'intl402/Temporal/PlainYearMonth/prototype/equals/infinity-throws-rangeerror': [FAIL], 'intl402/Temporal/PlainYearMonth/prototype/since/infinity-throws-rangeerror': [FAIL], @@ -1838,7 +1825,6 @@ 'built-ins/Temporal/PlainTime/prototype/subtract/argument-object-invalid': [FAIL], 'built-ins/Temporal/PlainTime/prototype/subtract/argument-string-fractional-units-rounding-mode': [FAIL], 'built-ins/Temporal/PlainTime/prototype/subtract/options-ignored': [FAIL], - 'built-ins/Temporal/PlainTime/prototype/toPlainDateTime/year-zero': [FAIL], 'built-ins/Temporal/PlainTime/prototype/toString/basic': [FAIL], 'built-ins/Temporal/PlainTime/prototype/toString/fractionalseconddigits-auto': [FAIL], 'built-ins/Temporal/PlainTime/prototype/toString/fractionalseconddigits-number': [FAIL], @@ -2012,7 +1998,6 @@ 'built-ins/Temporal/PlainDateTime/prototype/withPlainDate/non-compatible-calendars-throw': [FAIL], 'built-ins/Temporal/PlainDateTime/prototype/with/string-throws': [FAIL], 'built-ins/Temporal/PlainDateTime/prototype/with/timezone-throws': [FAIL], - 'built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-invalid': [FAIL], 'built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-invalid': [FAIL], 'built-ins/Temporal/Duration/compare/options-wrong-type': [FAIL], @@ -2268,10 +2253,7 @@ 'built-ins/Temporal/PlainTime/prototype/since/argument-number': [FAIL], 'built-ins/Temporal/PlainTime/prototype/since/argument-wrong-type': [FAIL], 'built-ins/Temporal/PlainTime/prototype/since/plaintime-propertybag-no-time-units': [FAIL], - 'built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-number': [FAIL], 'built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-propertybag-calendar-number': [FAIL], - 'built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-propertybag-calendar-wrong-type': [FAIL], - 'built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-wrong-type': [FAIL], 'built-ins/Temporal/PlainTime/prototype/toPlainDateTime/limits': [FAIL], 'built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-propertybag-calendar-number': [FAIL], 'built-ins/Temporal/PlainTime/prototype/until/argument-number': [FAIL],