Commit cc8b4427 authored by Frank Tang's avatar Frank Tang Committed by V8 LUCI CQ

[Temporal] Add PlainTime.prototype.toPlainDateTime

Spec Text: https://tc39.es/proposal-temporal/#sec-temporal.plaintime.prototype.toplaindatetime

Bug: v8:11544
Change-Id: I95bab9814471bb9347101d654f6dc902159f8fe3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3538670Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80757}
parent 9c4f57f6
......@@ -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)
......
......@@ -9628,6 +9628,36 @@ MaybeHandle<JSTemporalPlainTime> JSTemporalPlainTime::From(
return temporal::ToTemporalTime(isolate, item_obj, overflow, method_name);
}
// #sec-temporal.plaintime.prototype.toplaindatetime
MaybeHandle<JSTemporalPlainDateTime> JSTemporalPlainTime::ToPlainDateTime(
Isolate* isolate, Handle<JSTemporalPlainTime> temporal_time,
Handle<Object> temporal_date_like) {
// 1. Let temporalTime be the this value.
// 2. Perform ? RequireInternalSlot(temporalTime,
// [[InitializedTemporalTime]]).
// 3. Set temporalDate to ? ToTemporalDate(temporalDate).
Handle<JSTemporalPlainDate> 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<JSReceiver> JSTemporalPlainTime::GetISOFields(
Isolate* isolate, Handle<JSTemporalPlainTime> temporal_time) {
......
......@@ -478,6 +478,11 @@ class JSTemporalPlainTime
V8_WARN_UNUSED_RESULT static MaybeHandle<JSReceiver> GetISOFields(
Isolate* isolate, Handle<JSTemporalPlainTime> plain_time);
// #sec-temporal.plaintime.prototype.toplaindatetime
V8_WARN_UNUSED_RESULT static MaybeHandle<JSTemporalPlainDateTime>
ToPlainDateTime(Isolate* isolate, Handle<JSTemporalPlainTime> plain_time,
Handle<Object> temporal_date);
// #sec-temporal.now.plaintimeiso
V8_WARN_UNUSED_RESULT static MaybeHandle<JSTemporalPlainTime> NowISO(
Isolate* isolate, Handle<Object> temporal_time_zone_like);
......
......@@ -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'
......
......@@ -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],
......
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