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

[Temporal] Add ZonedDateTime to(Instant|Plain(Date)?(Time)?)

Also change some AO's return type from MaybeHandle to Handle
and call ToHandleChecked() on the right spot.

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.toinstant
https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.toplaindate
https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.toplaintime
https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.toplaindatetime

Bug: v8:11544
Change-Id: I140b6a7053d00837bc48fb70980d69778715c0c9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3385603
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80788}
parent e85a0243
...@@ -108,14 +108,6 @@ TO_BE_IMPLEMENTED(TemporalZonedDateTimePrototypeEquals) ...@@ -108,14 +108,6 @@ TO_BE_IMPLEMENTED(TemporalZonedDateTimePrototypeEquals)
TO_BE_IMPLEMENTED(TemporalZonedDateTimePrototypeToString) TO_BE_IMPLEMENTED(TemporalZonedDateTimePrototypeToString)
/* Temporal #sec-temporal.zonedddatetimeprototype.tojson */ /* Temporal #sec-temporal.zonedddatetimeprototype.tojson */
TO_BE_IMPLEMENTED(TemporalZonedDateTimePrototypeToJSON) TO_BE_IMPLEMENTED(TemporalZonedDateTimePrototypeToJSON)
/* Temporal #sec-temporal.zoneddatetime.prototype.toinstant */
TO_BE_IMPLEMENTED(TemporalZonedDateTimePrototypeToInstant)
/* Temporal #sec-temporal.zoneddatetime.prototype.toplaindate */
TO_BE_IMPLEMENTED(TemporalZonedDateTimePrototypeToPlainDate)
/* Temporal #sec-temporal.zoneddatetime.prototype.toplaintime */
TO_BE_IMPLEMENTED(TemporalZonedDateTimePrototypeToPlainTime)
/* Temporal #sec-temporal.zoneddatetime.prototype.toplaindatetime */
TO_BE_IMPLEMENTED(TemporalZonedDateTimePrototypeToPlainDateTime)
/* Temporal.Duration */ /* Temporal.Duration */
/* Temporal #sec-temporal.duration.compare */ /* Temporal #sec-temporal.duration.compare */
...@@ -614,8 +606,12 @@ TEMPORAL_PROTOTYPE_METHOD0(ZonedDateTime, ToPlainMonthDay, toPlainMonthDay) ...@@ -614,8 +606,12 @@ TEMPORAL_PROTOTYPE_METHOD0(ZonedDateTime, ToPlainMonthDay, toPlainMonthDay)
TEMPORAL_PROTOTYPE_METHOD0(ZonedDateTime, GetISOFields, getISOFields) TEMPORAL_PROTOTYPE_METHOD0(ZonedDateTime, GetISOFields, getISOFields)
TEMPORAL_PROTOTYPE_METHOD0(ZonedDateTime, OffsetNanoseconds, offsetNanoseconds) TEMPORAL_PROTOTYPE_METHOD0(ZonedDateTime, OffsetNanoseconds, offsetNanoseconds)
TEMPORAL_PROTOTYPE_METHOD0(ZonedDateTime, Offset, offset) TEMPORAL_PROTOTYPE_METHOD0(ZonedDateTime, Offset, offset)
TEMPORAL_VALUE_OF(ZonedDateTime)
TEMPORAL_PROTOTYPE_METHOD0(ZonedDateTime, StartOfDay, startOfDay) TEMPORAL_PROTOTYPE_METHOD0(ZonedDateTime, StartOfDay, startOfDay)
TEMPORAL_PROTOTYPE_METHOD0(ZonedDateTime, ToInstant, toInstant)
TEMPORAL_PROTOTYPE_METHOD0(ZonedDateTime, ToPlainDate, toPlainDate)
TEMPORAL_PROTOTYPE_METHOD0(ZonedDateTime, ToPlainTime, toPlainTime)
TEMPORAL_PROTOTYPE_METHOD0(ZonedDateTime, ToPlainDateTime, toPlainDateTime)
TEMPORAL_VALUE_OF(ZonedDateTime)
// Duration // Duration
BUILTIN(TemporalDurationConstructor) { BUILTIN(TemporalDurationConstructor) {
......
This diff is collapsed.
...@@ -737,6 +737,23 @@ class JSTemporalZonedDateTime ...@@ -737,6 +737,23 @@ class JSTemporalZonedDateTime
V8_WARN_UNUSED_RESULT static MaybeHandle<JSTemporalZonedDateTime> StartOfDay( V8_WARN_UNUSED_RESULT static MaybeHandle<JSTemporalZonedDateTime> StartOfDay(
Isolate* isolate, Handle<JSTemporalZonedDateTime> zoned_date_time); Isolate* isolate, Handle<JSTemporalZonedDateTime> zoned_date_time);
// #sec-temporal.zoneddatetime.prototype.toinstant
V8_WARN_UNUSED_RESULT static MaybeHandle<JSTemporalInstant> ToInstant(
Isolate* isolate, Handle<JSTemporalZonedDateTime> zoned_date_time);
// #sec-temporal.zoneddatetime.prototype.toplaindate
V8_WARN_UNUSED_RESULT static MaybeHandle<JSTemporalPlainDate> ToPlainDate(
Isolate* isolate, Handle<JSTemporalZonedDateTime> zoned_date_time);
// #sec-temporal.zoneddatetime.prototype.toplaintime
V8_WARN_UNUSED_RESULT static MaybeHandle<JSTemporalPlainTime> ToPlainTime(
Isolate* isolate, Handle<JSTemporalZonedDateTime> zoned_date_time);
// #sec-temporal.zoneddatetime.prototype.toplaindatetime
V8_WARN_UNUSED_RESULT static MaybeHandle<JSTemporalPlainDateTime>
ToPlainDateTime(Isolate* isolate,
Handle<JSTemporalZonedDateTime> zoned_date_time);
DECL_PRINTER(JSTemporalZonedDateTime) DECL_PRINTER(JSTemporalZonedDateTime)
TQ_OBJECT_CONSTRUCTORS(JSTemporalZonedDateTime) TQ_OBJECT_CONSTRUCTORS(JSTemporalZonedDateTime)
...@@ -777,8 +794,7 @@ DECLARE_CALENDAR_ABSTRACT_OPERATION(EraYear) ...@@ -777,8 +794,7 @@ DECLARE_CALENDAR_ABSTRACT_OPERATION(EraYear)
#undef DECLARE_CALENDAR_ABSTRACT_OPERATION #undef DECLARE_CALENDAR_ABSTRACT_OPERATION
// #sec-temporal-getiso8601calendar // #sec-temporal-getiso8601calendar
V8_WARN_UNUSED_RESULT MaybeHandle<JSTemporalCalendar> GetISO8601Calendar( Handle<JSTemporalCalendar> GetISO8601Calendar(Isolate* isolate);
Isolate* isolate);
// #sec-temporal-builtintimezonegetplaindatetimefor // #sec-temporal-builtintimezonegetplaindatetimefor
V8_WARN_UNUSED_RESULT MaybeHandle<JSTemporalPlainDateTime> V8_WARN_UNUSED_RESULT MaybeHandle<JSTemporalPlainDateTime>
......
...@@ -1345,7 +1345,6 @@ ...@@ -1345,7 +1345,6 @@
'built-ins/Temporal/ZonedDateTime/prototype/subtract/timezone-getoffsetnanosecondsfor-not-callable': [FAIL], 'built-ins/Temporal/ZonedDateTime/prototype/subtract/timezone-getoffsetnanosecondsfor-not-callable': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/subtract/timezone-getoffsetnanosecondsfor-out-of-range': [FAIL], 'built-ins/Temporal/ZonedDateTime/prototype/subtract/timezone-getoffsetnanosecondsfor-out-of-range': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/subtract/timezone-getoffsetnanosecondsfor-wrong-type': [FAIL], 'built-ins/Temporal/ZonedDateTime/prototype/subtract/timezone-getoffsetnanosecondsfor-wrong-type': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toInstant/branding': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toJSON/balance-negative-time-units': [FAIL], 'built-ins/Temporal/ZonedDateTime/prototype/toJSON/balance-negative-time-units': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toJSON/branding': [FAIL], 'built-ins/Temporal/ZonedDateTime/prototype/toJSON/branding': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toJSON/negative-epochnanoseconds': [FAIL], 'built-ins/Temporal/ZonedDateTime/prototype/toJSON/negative-epochnanoseconds': [FAIL],
...@@ -1357,26 +1356,9 @@ ...@@ -1357,26 +1356,9 @@
'built-ins/Temporal/ZonedDateTime/prototype/toJSON/year-format': [FAIL], 'built-ins/Temporal/ZonedDateTime/prototype/toJSON/year-format': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/branding': [FAIL], 'built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/branding': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/return-string': [FAIL], 'built-ins/Temporal/ZonedDateTime/prototype/toLocaleString/return-string': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toPlainDate/branding': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/balance-negative-time-units': [FAIL], 'built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/balance-negative-time-units': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/branding': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/negative-epochnanoseconds': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/plain-custom-timezone': [FAIL], 'built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/plain-custom-timezone': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/timezone-getoffsetnanosecondsfor-non-integer': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/timezone-getoffsetnanosecondsfor-not-callable': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/timezone-getoffsetnanosecondsfor-out-of-range': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toPlainDateTime/timezone-getoffsetnanosecondsfor-wrong-type': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toPlainDate/timezone-getoffsetnanosecondsfor-non-integer': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toPlainDate/timezone-getoffsetnanosecondsfor-not-callable': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toPlainDate/timezone-getoffsetnanosecondsfor-out-of-range': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toPlainDate/timezone-getoffsetnanosecondsfor-wrong-type': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toPlainTime/balance-negative-time-units': [FAIL], 'built-ins/Temporal/ZonedDateTime/prototype/toPlainTime/balance-negative-time-units': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toPlainTime/branding': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toPlainTime/negative-epochnanoseconds': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toPlainTime/timezone-getoffsetnanosecondsfor-non-integer': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toPlainTime/timezone-getoffsetnanosecondsfor-not-callable': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toPlainTime/timezone-getoffsetnanosecondsfor-out-of-range': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toPlainTime/timezone-getoffsetnanosecondsfor-wrong-type': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/balance-negative-time-units': [FAIL], 'built-ins/Temporal/ZonedDateTime/prototype/toString/balance-negative-time-units': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/branding': [FAIL], 'built-ins/Temporal/ZonedDateTime/prototype/toString/branding': [FAIL],
'built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-invalid-string': [FAIL], 'built-ins/Temporal/ZonedDateTime/prototype/toString/calendarname-invalid-string': [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