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

[Temporal] Add Calendar.prototype.dateFromFields

Also add AO: RegulateISODate, ResolveISOMonth, ISODateFromFields

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.datefromfields
https://tc39.es/proposal-temporal/#sec-temporal-regulateisodate
https://tc39.es/proposal-temporal/#sec-temporal-resolveisomonth
https://tc39.es/proposal-temporal/#sec-temporal-isodatefromfields

Note:
This is only the non-intl version. The intl version in
https://tc39.es/proposal-temporal/#sup-temporal.calendar.prototype.datefromfields
will be implemented in later cl.

Bug: v8:11544
Change-Id: I493dc60694421e9908eb5d785fdb8b07fc968699
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3408462Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79793}
parent 908e7ac7
...@@ -302,8 +302,6 @@ TO_BE_IMPLEMENTED(TemporalTimeZonePrototypeGetPreviousTransition) ...@@ -302,8 +302,6 @@ TO_BE_IMPLEMENTED(TemporalTimeZonePrototypeGetPreviousTransition)
TO_BE_IMPLEMENTED(TemporalTimeZonePrototypeToJSON) TO_BE_IMPLEMENTED(TemporalTimeZonePrototypeToJSON)
/* Temporal.Calendar */ /* Temporal.Calendar */
/* Temporal #sec-temporal.calendar.prototype.datefromfields */
TO_BE_IMPLEMENTED(TemporalCalendarPrototypeDateFromFields)
/* Temporal #sec-temporal.calendar.prototype.yearmonthfromfields */ /* Temporal #sec-temporal.calendar.prototype.yearmonthfromfields */
TO_BE_IMPLEMENTED(TemporalCalendarPrototypeYearMonthFromFields) TO_BE_IMPLEMENTED(TemporalCalendarPrototypeYearMonthFromFields)
/* Temporal #sec-temporal.calendar.prototype.monthdayfromfields */ /* Temporal #sec-temporal.calendar.prototype.monthdayfromfields */
...@@ -404,6 +402,17 @@ TO_BE_IMPLEMENTED(TemporalZonedDateTimePrototypeToLocaleString) ...@@ -404,6 +402,17 @@ TO_BE_IMPLEMENTED(TemporalZonedDateTimePrototypeToLocaleString)
JSTemporal##T ::METHOD(isolate, obj, args.atOrUndefined(isolate, 1))); \ JSTemporal##T ::METHOD(isolate, obj, args.atOrUndefined(isolate, 1))); \
} }
#define TEMPORAL_PROTOTYPE_METHOD2(T, METHOD, name) \
BUILTIN(Temporal##T##Prototype##METHOD) { \
HandleScope scope(isolate); \
const char* method = "Temporal." #T ".prototype." #name; \
CHECK_RECEIVER(JSTemporal##T, obj, method); \
RETURN_RESULT_OR_FAILURE( \
isolate, \
JSTemporal##T ::METHOD(isolate, obj, args.atOrUndefined(isolate, 1), \
args.atOrUndefined(isolate, 2))); \
}
#define TEMPORAL_PROTOTYPE_METHOD3(T, METHOD, name) \ #define TEMPORAL_PROTOTYPE_METHOD3(T, METHOD, name) \
BUILTIN(Temporal##T##Prototype##METHOD) { \ BUILTIN(Temporal##T##Prototype##METHOD) { \
HandleScope scope(isolate); \ HandleScope scope(isolate); \
...@@ -785,6 +794,7 @@ TEMPORAL_GET_BIGINT_AFTER_DIVID(Instant, EpochMicroseconds, nanoseconds, 1000, ...@@ -785,6 +794,7 @@ TEMPORAL_GET_BIGINT_AFTER_DIVID(Instant, EpochMicroseconds, nanoseconds, 1000,
// Calendar // Calendar
TEMPORAL_CONSTRUCTOR1(Calendar) TEMPORAL_CONSTRUCTOR1(Calendar)
TEMPORAL_PROTOTYPE_METHOD2(Calendar, DateFromFields, dateFromFields)
TEMPORAL_ID_BY_TO_STRING(Calendar) TEMPORAL_ID_BY_TO_STRING(Calendar)
TEMPORAL_PROTOTYPE_METHOD1(Calendar, DaysInMonth, daysInMonth) TEMPORAL_PROTOTYPE_METHOD1(Calendar, DaysInMonth, daysInMonth)
TEMPORAL_PROTOTYPE_METHOD1(Calendar, DaysInWeek, daysInWeek) TEMPORAL_PROTOTYPE_METHOD1(Calendar, DaysInWeek, daysInWeek)
......
This diff is collapsed.
...@@ -92,6 +92,11 @@ class JSTemporalCalendar ...@@ -92,6 +92,11 @@ class JSTemporalCalendar
Isolate* isolate, Handle<JSTemporalCalendar> calendar, Isolate* isolate, Handle<JSTemporalCalendar> calendar,
Handle<Object> temporal_date_like); Handle<Object> temporal_date_like);
// #sec-temporal.calendar.prototype.datefromfields
V8_WARN_UNUSED_RESULT static MaybeHandle<JSTemporalPlainDate> DateFromFields(
Isolate* isolate, Handle<JSTemporalCalendar> calendar,
Handle<Object> fields, Handle<Object> options);
// #sec-temporal.calendar.prototype.tostring // #sec-temporal.calendar.prototype.tostring
static MaybeHandle<String> ToString(Isolate* isolate, static MaybeHandle<String> ToString(Isolate* isolate,
Handle<JSTemporalCalendar> calendar, Handle<JSTemporalCalendar> calendar,
......
...@@ -471,15 +471,8 @@ ...@@ -471,15 +471,8 @@
'built-ins/Temporal/Calendar/prototype/dateAdd/throw-range-error-from-ToTemporalDate': [FAIL], 'built-ins/Temporal/Calendar/prototype/dateAdd/throw-range-error-from-ToTemporalDate': [FAIL],
'built-ins/Temporal/Calendar/prototype/dateAdd/throw-range-error-from-ToTemporalDuration': [FAIL], 'built-ins/Temporal/Calendar/prototype/dateAdd/throw-range-error-from-ToTemporalDuration': [FAIL],
'built-ins/Temporal/Calendar/prototype/dateAdd/throw-type-error-from-GetOptionsObject': [FAIL], 'built-ins/Temporal/Calendar/prototype/dateAdd/throw-type-error-from-GetOptionsObject': [FAIL],
'built-ins/Temporal/Calendar/prototype/dateFromFields/branding': [FAIL],
'built-ins/Temporal/Calendar/prototype/dateFromFields/fields-not-object': [FAIL],
'built-ins/Temporal/Calendar/prototype/dateFromFields/infinity-throws-rangeerror': [FAIL],
'built-ins/Temporal/Calendar/prototype/dateFromFields/overflow-invalid-string': [FAIL],
'built-ins/Temporal/Calendar/prototype/dateFromFields/overflow-undefined': [FAIL], 'built-ins/Temporal/Calendar/prototype/dateFromFields/overflow-undefined': [FAIL],
'built-ins/Temporal/Calendar/prototype/dateFromFields/overflow-wrong-type': [FAIL], 'built-ins/Temporal/Calendar/prototype/dateFromFields/overflow-wrong-type': [FAIL],
'built-ins/Temporal/Calendar/prototype/dateFromFields/throws-range-error': [FAIL],
'built-ins/Temporal/Calendar/prototype/dateFromFields/throws-type-error': [FAIL],
'built-ins/Temporal/Calendar/prototype/dateFromFields/throw-type-error-from-GetOptionsObject': [FAIL],
'built-ins/Temporal/Calendar/prototype/dateFromFields/with-year-monthCode-day': [FAIL], 'built-ins/Temporal/Calendar/prototype/dateFromFields/with-year-monthCode-day': [FAIL],
'built-ins/Temporal/Calendar/prototype/dateFromFields/with-year-monthCode-day-need-constrain': [FAIL], 'built-ins/Temporal/Calendar/prototype/dateFromFields/with-year-monthCode-day-need-constrain': [FAIL],
'built-ins/Temporal/Calendar/prototype/dateFromFields/with-year-month-day': [FAIL], 'built-ins/Temporal/Calendar/prototype/dateFromFields/with-year-month-day': [FAIL],
...@@ -518,23 +511,18 @@ ...@@ -518,23 +511,18 @@
'built-ins/Temporal/Calendar/prototype/day/infinity-throws-rangeerror': [FAIL], 'built-ins/Temporal/Calendar/prototype/day/infinity-throws-rangeerror': [FAIL],
'built-ins/Temporal/Calendar/prototype/day/month-day': [FAIL], 'built-ins/Temporal/Calendar/prototype/day/month-day': [FAIL],
'built-ins/Temporal/Calendar/prototype/dayOfWeek/basic': [FAIL], 'built-ins/Temporal/Calendar/prototype/dayOfWeek/basic': [FAIL],
'built-ins/Temporal/Calendar/prototype/dayOfWeek/calendar-fields-iterable': [FAIL],
'built-ins/Temporal/Calendar/prototype/dayOfWeek/calendar-temporal-object': [FAIL], 'built-ins/Temporal/Calendar/prototype/dayOfWeek/calendar-temporal-object': [FAIL],
'built-ins/Temporal/Calendar/prototype/dayOfWeek/infinity-throws-rangeerror': [FAIL], 'built-ins/Temporal/Calendar/prototype/dayOfWeek/infinity-throws-rangeerror': [FAIL],
'built-ins/Temporal/Calendar/prototype/dayOfYear/basic': [FAIL], 'built-ins/Temporal/Calendar/prototype/dayOfYear/basic': [FAIL],
'built-ins/Temporal/Calendar/prototype/dayOfYear/calendar-fields-iterable': [FAIL],
'built-ins/Temporal/Calendar/prototype/dayOfYear/calendar-temporal-object': [FAIL], 'built-ins/Temporal/Calendar/prototype/dayOfYear/calendar-temporal-object': [FAIL],
'built-ins/Temporal/Calendar/prototype/dayOfYear/infinity-throws-rangeerror': [FAIL], 'built-ins/Temporal/Calendar/prototype/dayOfYear/infinity-throws-rangeerror': [FAIL],
'built-ins/Temporal/Calendar/prototype/daysInMonth/basic': [FAIL], 'built-ins/Temporal/Calendar/prototype/daysInMonth/basic': [FAIL],
'built-ins/Temporal/Calendar/prototype/daysInMonth/calendar-fields-iterable': [FAIL],
'built-ins/Temporal/Calendar/prototype/daysInMonth/calendar-temporal-object': [FAIL], 'built-ins/Temporal/Calendar/prototype/daysInMonth/calendar-temporal-object': [FAIL],
'built-ins/Temporal/Calendar/prototype/daysInMonth/infinity-throws-rangeerror': [FAIL], 'built-ins/Temporal/Calendar/prototype/daysInMonth/infinity-throws-rangeerror': [FAIL],
'built-ins/Temporal/Calendar/prototype/daysInWeek/basic': [FAIL], 'built-ins/Temporal/Calendar/prototype/daysInWeek/basic': [FAIL],
'built-ins/Temporal/Calendar/prototype/daysInWeek/calendar-fields-iterable': [FAIL],
'built-ins/Temporal/Calendar/prototype/daysInWeek/calendar-temporal-object': [FAIL], 'built-ins/Temporal/Calendar/prototype/daysInWeek/calendar-temporal-object': [FAIL],
'built-ins/Temporal/Calendar/prototype/daysInWeek/infinity-throws-rangeerror': [FAIL], 'built-ins/Temporal/Calendar/prototype/daysInWeek/infinity-throws-rangeerror': [FAIL],
'built-ins/Temporal/Calendar/prototype/daysInYear/basic': [FAIL], 'built-ins/Temporal/Calendar/prototype/daysInYear/basic': [FAIL],
'built-ins/Temporal/Calendar/prototype/daysInYear/calendar-fields-iterable': [FAIL],
'built-ins/Temporal/Calendar/prototype/daysInYear/calendar-temporal-object': [FAIL], 'built-ins/Temporal/Calendar/prototype/daysInYear/calendar-temporal-object': [FAIL],
'built-ins/Temporal/Calendar/prototype/daysInYear/infinity-throws-rangeerror': [FAIL], 'built-ins/Temporal/Calendar/prototype/daysInYear/infinity-throws-rangeerror': [FAIL],
'built-ins/Temporal/Calendar/prototype/day/string': [FAIL], 'built-ins/Temporal/Calendar/prototype/day/string': [FAIL],
...@@ -548,7 +536,6 @@ ...@@ -548,7 +536,6 @@
'built-ins/Temporal/Calendar/prototype/fields/repeated-throw': [FAIL], 'built-ins/Temporal/Calendar/prototype/fields/repeated-throw': [FAIL],
'built-ins/Temporal/Calendar/prototype/fields/reverse': [FAIL], 'built-ins/Temporal/Calendar/prototype/fields/reverse': [FAIL],
'built-ins/Temporal/Calendar/prototype/inLeapYear/basic': [FAIL], 'built-ins/Temporal/Calendar/prototype/inLeapYear/basic': [FAIL],
'built-ins/Temporal/Calendar/prototype/inLeapYear/calendar-fields-iterable': [FAIL],
'built-ins/Temporal/Calendar/prototype/inLeapYear/calendar-temporal-object': [FAIL], 'built-ins/Temporal/Calendar/prototype/inLeapYear/calendar-temporal-object': [FAIL],
'built-ins/Temporal/Calendar/prototype/inLeapYear/infinity-throws-rangeerror': [FAIL], 'built-ins/Temporal/Calendar/prototype/inLeapYear/infinity-throws-rangeerror': [FAIL],
'built-ins/Temporal/Calendar/prototype/mergeFields/arguments-empty-object': [FAIL], 'built-ins/Temporal/Calendar/prototype/mergeFields/arguments-empty-object': [FAIL],
...@@ -589,7 +576,6 @@ ...@@ -589,7 +576,6 @@
'built-ins/Temporal/Calendar/prototype/month/infinity-throws-rangeerror': [FAIL], 'built-ins/Temporal/Calendar/prototype/month/infinity-throws-rangeerror': [FAIL],
'built-ins/Temporal/Calendar/prototype/month/month-day-throw-type-error': [FAIL], 'built-ins/Temporal/Calendar/prototype/month/month-day-throw-type-error': [FAIL],
'built-ins/Temporal/Calendar/prototype/monthsInYear/basic': [FAIL], 'built-ins/Temporal/Calendar/prototype/monthsInYear/basic': [FAIL],
'built-ins/Temporal/Calendar/prototype/monthsInYear/calendar-fields-iterable': [FAIL],
'built-ins/Temporal/Calendar/prototype/monthsInYear/calendar-temporal-object': [FAIL], 'built-ins/Temporal/Calendar/prototype/monthsInYear/calendar-temporal-object': [FAIL],
'built-ins/Temporal/Calendar/prototype/monthsInYear/infinity-throws-rangeerror': [FAIL], 'built-ins/Temporal/Calendar/prototype/monthsInYear/infinity-throws-rangeerror': [FAIL],
'built-ins/Temporal/Calendar/prototype/month/string': [FAIL], 'built-ins/Temporal/Calendar/prototype/month/string': [FAIL],
...@@ -607,7 +593,6 @@ ...@@ -607,7 +593,6 @@
'built-ins/Temporal/Calendar/prototype/weekOfYear/cross-year': [FAIL], 'built-ins/Temporal/Calendar/prototype/weekOfYear/cross-year': [FAIL],
'built-ins/Temporal/Calendar/prototype/weekOfYear/infinity-throws-rangeerror': [FAIL], 'built-ins/Temporal/Calendar/prototype/weekOfYear/infinity-throws-rangeerror': [FAIL],
'built-ins/Temporal/Calendar/prototype/year/basic': [FAIL], 'built-ins/Temporal/Calendar/prototype/year/basic': [FAIL],
'built-ins/Temporal/Calendar/prototype/year/calendar-fields-iterable': [FAIL],
'built-ins/Temporal/Calendar/prototype/year/calendar-temporal-object': [FAIL], 'built-ins/Temporal/Calendar/prototype/year/calendar-temporal-object': [FAIL],
'built-ins/Temporal/Calendar/prototype/year/infinity-throws-rangeerror': [FAIL], 'built-ins/Temporal/Calendar/prototype/year/infinity-throws-rangeerror': [FAIL],
'built-ins/Temporal/Calendar/prototype/yearMonthFromFields/branding': [FAIL], 'built-ins/Temporal/Calendar/prototype/yearMonthFromFields/branding': [FAIL],
...@@ -926,7 +911,6 @@ ...@@ -926,7 +911,6 @@
'built-ins/Temporal/PlainDate/from/argument-plaindate': [FAIL], 'built-ins/Temporal/PlainDate/from/argument-plaindate': [FAIL],
'built-ins/Temporal/PlainDate/from/argument-plaindatetime': [FAIL], 'built-ins/Temporal/PlainDate/from/argument-plaindatetime': [FAIL],
'built-ins/Temporal/PlainDate/from/argument-string': [FAIL], 'built-ins/Temporal/PlainDate/from/argument-string': [FAIL],
'built-ins/Temporal/PlainDate/from/calendar-fields-iterable': [FAIL],
'built-ins/Temporal/PlainDate/from/calendar-temporal-object': [FAIL], 'built-ins/Temporal/PlainDate/from/calendar-temporal-object': [FAIL],
'built-ins/Temporal/PlainDate/from/infinity-throws-rangeerror': [FAIL], 'built-ins/Temporal/PlainDate/from/infinity-throws-rangeerror': [FAIL],
'built-ins/Temporal/PlainDate/from/limits': [FAIL], 'built-ins/Temporal/PlainDate/from/limits': [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