// Copyright 2021 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_OBJECTS_JS_TEMPORAL_OBJECTS_H_ #define V8_OBJECTS_JS_TEMPORAL_OBJECTS_H_ #include "src/execution/isolate.h" #include "src/heap/factory.h" #include "src/objects/objects.h" // Has to be the last include (doesn't have include guards): #include "src/objects/object-macros.h" namespace v8 { namespace internal { #include "torque-generated/src/objects/js-temporal-objects-tq.inc" #define DECLARE_TEMPORAL_INLINE_GETTER_SETTER(field) \ inline void set_##field(int32_t field); \ inline int32_t field() const; #define DECLARE_TEMPORAL_TIME_INLINE_GETTER_SETTER() \ DECLARE_TEMPORAL_INLINE_GETTER_SETTER(iso_hour) \ DECLARE_TEMPORAL_INLINE_GETTER_SETTER(iso_minute) \ DECLARE_TEMPORAL_INLINE_GETTER_SETTER(iso_second) \ DECLARE_TEMPORAL_INLINE_GETTER_SETTER(iso_millisecond) \ DECLARE_TEMPORAL_INLINE_GETTER_SETTER(iso_microsecond) \ DECLARE_TEMPORAL_INLINE_GETTER_SETTER(iso_nanosecond) #define DECLARE_TEMPORAL_DATE_INLINE_GETTER_SETTER() \ DECLARE_TEMPORAL_INLINE_GETTER_SETTER(iso_year) \ DECLARE_TEMPORAL_INLINE_GETTER_SETTER(iso_month) \ DECLARE_TEMPORAL_INLINE_GETTER_SETTER(iso_day) #define TEMPORAL_UNIMPLEMENTED(T) \ { \ printf("TBW %s\n", __PRETTY_FUNCTION__); \ UNIMPLEMENTED(); \ } class JSTemporalPlainDate; class JSTemporalPlainMonthDay; class JSTemporalPlainYearMonth; class JSTemporalCalendar : public TorqueGeneratedJSTemporalCalendar { public: // #sec-temporal.calendar V8_WARN_UNUSED_RESULT static MaybeHandle Constructor( Isolate* isolate, Handle target, Handle new_target, Handle identifier); // #sec-temporal.calendar.prototype.year V8_WARN_UNUSED_RESULT static MaybeHandle Year( Isolate* isolate, Handle calendar, Handle temporal_date_like); // #sec-temporal.calendar.prototype.dateadd V8_WARN_UNUSED_RESULT static MaybeHandle DateAdd( Isolate* isolate, Handle calendar, Handle date, Handle durations, Handle options); // #sec-temporal.calendar.prototype.daysinyear V8_WARN_UNUSED_RESULT static MaybeHandle DaysInYear( Isolate* isolate, Handle calendar, Handle temporal_date_like); // #sec-temporal.calendar.prototype.dayofweek V8_WARN_UNUSED_RESULT static MaybeHandle DayOfWeek( Isolate* isolate, Handle calendar, Handle temporal_date_like); // #sec-temporal.calendar.prototype.dayofyear V8_WARN_UNUSED_RESULT static MaybeHandle DayOfYear( Isolate* isolate, Handle calendar, Handle temporal_date_like); // #sec-temporal.calendar.prototype.monthsinyear V8_WARN_UNUSED_RESULT static MaybeHandle MonthsInYear( Isolate* isolate, Handle calendar, Handle temporal_date_like); // #sec-temporal.calendar.prototype.inleapyear V8_WARN_UNUSED_RESULT static MaybeHandle InLeapYear( Isolate* isolate, Handle calendar, Handle temporal_date_like); // #sec-temporal.calendar.prototype.dateuntil V8_WARN_UNUSED_RESULT static MaybeHandle DateUntil( Isolate* isolate, Handle calendar, Handle one, Handle two, Handle options); // #sec-temporal.calendar.prototype.daysinmonth V8_WARN_UNUSED_RESULT static MaybeHandle DaysInMonth( Isolate* isolate, Handle calendar, Handle temporal_date_like); // #sec-temporal.calendar.prototype.daysinweek V8_WARN_UNUSED_RESULT static MaybeHandle DaysInWeek( Isolate* isolate, Handle calendar, Handle temporal_date_like); // #sec-temporal.calendar.prototype.datefromfields V8_WARN_UNUSED_RESULT static MaybeHandle DateFromFields( Isolate* isolate, Handle calendar, Handle fields, Handle options); // #sec-temporal.calendar.prototype.monthdayfromfields V8_WARN_UNUSED_RESULT static MaybeHandle MonthDayFromFields(Isolate* isolate, Handle calendar, Handle fields, Handle options); // #sec-temporal.calendar.prototype.yearmonthfromfields V8_WARN_UNUSED_RESULT static MaybeHandle YearMonthFromFields(Isolate* isolate, Handle calendar, Handle fields, Handle options); // #sec-temporal.calendar.prototype.mergefields V8_WARN_UNUSED_RESULT static MaybeHandle MergeFields( Isolate* isolate, Handle calendar, Handle fields, Handle additional_fields); // #sec-temporal.calendar.prototype.monthcode V8_WARN_UNUSED_RESULT static MaybeHandle MonthCode( Isolate* isolate, Handle calendar, Handle temporal_date_like); // #sec-temporal.calendar.prototype.month V8_WARN_UNUSED_RESULT static MaybeHandle Month( Isolate* isolate, Handle calendar, Handle temporal_date_like); // #sec-temporal.calendar.prototype.day V8_WARN_UNUSED_RESULT static MaybeHandle Day( Isolate* isolate, Handle calendar, Handle temporal_date_like); // #sec-temporal.calendar.prototype.weekofyear V8_WARN_UNUSED_RESULT static MaybeHandle WeekOfYear( Isolate* isolate, Handle calendar, Handle temporal_date_like); // #sec-temporal.calendar.prototype.tostring V8_WARN_UNUSED_RESULT static MaybeHandle ToString( Isolate* isolate, Handle calendar, const char* method_name); #ifdef V8_INTL_SUPPORT V8_WARN_UNUSED_RESULT static MaybeHandle Era( Isolate* isolate, Handle calendar, Handle temporal_date_like); V8_WARN_UNUSED_RESULT static MaybeHandle EraYear( Isolate* isolate, Handle calendar, Handle temporal_date_like); #endif // V8_INTL_SUPPORT DECL_PRINTER(JSTemporalCalendar) DEFINE_TORQUE_GENERATED_JS_TEMPORAL_CALENDAR_FLAGS() DECL_INT_ACCESSORS(calendar_index) TQ_OBJECT_CONSTRUCTORS(JSTemporalCalendar) }; class JSTemporalDuration : public TorqueGeneratedJSTemporalDuration { public: // #sec-temporal.duration V8_WARN_UNUSED_RESULT static MaybeHandle Constructor( Isolate* isolate, Handle target, Handle new_target, Handle years, Handle months, Handle weeks, Handle days, Handle hours, Handle minutes, Handle seconds, Handle milliseconds, Handle microseconds, Handle nanoseconds); // #sec-temporal.duration.compare V8_WARN_UNUSED_RESULT static MaybeHandle Compare(Isolate* isolate, Handle one, Handle two, Handle options); // #sec-temporal.duration.from V8_WARN_UNUSED_RESULT static MaybeHandle From( Isolate* isolate, Handle item); // #sec-get-temporal.duration.prototype.sign V8_WARN_UNUSED_RESULT static MaybeHandle Sign( Isolate* isolate, Handle duration); // #sec-get-temporal.duration.prototype.blank V8_WARN_UNUSED_RESULT static MaybeHandle Blank( Isolate* isolate, Handle duration); // #sec-temporal.duration.prototype.negated V8_WARN_UNUSED_RESULT static MaybeHandle Negated( Isolate* isolate, Handle duration); // #sec-temporal.duration.prototype.abs 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.round V8_WARN_UNUSED_RESULT static MaybeHandle Round( Isolate* isolate, Handle duration, Handle round_to_obj); // #sec-temporal.duration.prototype.total V8_WARN_UNUSED_RESULT static MaybeHandle Total( Isolate* isolate, Handle duration, Handle total_of); // #sec-temporal.duration.prototype.tojson V8_WARN_UNUSED_RESULT static MaybeHandle ToJSON( Isolate* isolate, Handle duration); // #sec-temporal.duration.prototype.tolocalestring V8_WARN_UNUSED_RESULT static MaybeHandle ToLocaleString( Isolate* isolate, Handle duration, Handle locales, Handle options); // #sec-temporal.duration.prototype.tostring V8_WARN_UNUSED_RESULT static MaybeHandle ToString( Isolate* isolate, Handle duration, Handle options); // #sec-temporal.duration.prototype.with V8_WARN_UNUSED_RESULT static MaybeHandle With( Isolate* isolate, Handle duration, Handle temporal_duration_like); DECL_PRINTER(JSTemporalDuration) TQ_OBJECT_CONSTRUCTORS(JSTemporalDuration) }; class JSTemporalInstant : public TorqueGeneratedJSTemporalInstant { public: // #sec-temporal-instant-constructor V8_WARN_UNUSED_RESULT static MaybeHandle Constructor( Isolate* isolate, Handle target, Handle new_target, Handle epoch_nanoseconds); // #sec-temporal.now.instant V8_WARN_UNUSED_RESULT static MaybeHandle Now( Isolate* isolate); // #sec-temporal.instant.fromepochseconds V8_WARN_UNUSED_RESULT static MaybeHandle FromEpochSeconds( Isolate* isolate, Handle epoch_seconds); // #sec-temporal.instant.fromepochmilliseconds V8_WARN_UNUSED_RESULT static MaybeHandle FromEpochMilliseconds(Isolate* isolate, Handle epoch_milliseconds); // #sec-temporal.instant.fromepochmicroseconds V8_WARN_UNUSED_RESULT static MaybeHandle FromEpochMicroseconds(Isolate* isolate, Handle epoch_microseconds); // #sec-temporal.instant.fromepochnanoeconds V8_WARN_UNUSED_RESULT static MaybeHandle FromEpochNanoseconds(Isolate* isolate, Handle epoch_nanoseconds); // #sec-temporal.instant.prototype.round V8_WARN_UNUSED_RESULT static MaybeHandle Round( Isolate* isolate, Handle instant, Handle round_to); // #sec-temporal.instant.from V8_WARN_UNUSED_RESULT static MaybeHandle From( Isolate* isolate, Handle item); // #sec-temporal.instant.prototype.tozoneddatetime V8_WARN_UNUSED_RESULT static MaybeHandle ToZonedDateTime(Isolate* isolate, Handle instant, Handle item); // #sec-temporal.instant.prototype.tozoneddatetimeiso V8_WARN_UNUSED_RESULT static MaybeHandle ToZonedDateTimeISO(Isolate* isolate, Handle instant, Handle item); // #sec-temporal.instant.compare V8_WARN_UNUSED_RESULT static MaybeHandle Compare(Isolate* isolate, Handle one, Handle two); // #sec-temporal.instant.prototype.equals V8_WARN_UNUSED_RESULT static MaybeHandle Equals( Isolate* isolate, Handle instant, Handle other); // #sec-temporal.instant.prototype.add V8_WARN_UNUSED_RESULT static MaybeHandle Add( Isolate* isolate, Handle instant, Handle temporal_duration_like); // #sec-temporal.instant.prototype.subtract V8_WARN_UNUSED_RESULT static MaybeHandle Subtract( Isolate* isolate, Handle instant, Handle temporal_duration_like); // #sec-temporal.instant.prototype.tojson V8_WARN_UNUSED_RESULT static MaybeHandle ToJSON( Isolate* isolate, Handle instant); // #sec-temporal.instant.prototype.tolocalestring V8_WARN_UNUSED_RESULT static MaybeHandle ToLocaleString( Isolate* isolate, Handle instant, Handle locales, Handle options); // #sec-temporal.instant.prototype.tostring V8_WARN_UNUSED_RESULT static MaybeHandle ToString( Isolate* isolate, Handle instant, Handle options); // #sec-temporal.instant.prototype.until V8_WARN_UNUSED_RESULT static MaybeHandle Until( Isolate* isolate, Handle instant, Handle other, Handle options); // #sec-temporal.instant.prototype.since V8_WARN_UNUSED_RESULT static MaybeHandle Since( Isolate* isolate, Handle instant, Handle other, Handle options); DECL_PRINTER(JSTemporalInstant) TQ_OBJECT_CONSTRUCTORS(JSTemporalInstant) }; class JSTemporalPlainDate : public TorqueGeneratedJSTemporalPlainDate { public: // #sec-temporal-createtemporaldate V8_WARN_UNUSED_RESULT static MaybeHandle Constructor( Isolate* isolate, Handle target, Handle new_target, Handle iso_year, Handle iso_month, Handle iso_day, Handle calendar_like); // #sec-temporal.plaindate.compare V8_WARN_UNUSED_RESULT static MaybeHandle Compare(Isolate* isolate, Handle one, Handle two); // #sec-temporal.plaindate.prototype.equals V8_WARN_UNUSED_RESULT static MaybeHandle Equals( Isolate* isolate, Handle plain_date, Handle other); // #sec-temporal.plaindate.prototype.withcalendar V8_WARN_UNUSED_RESULT static MaybeHandle WithCalendar( Isolate* isolate, Handle plain_date, Handle calendar_like); // #sec-temporal.plaindate.prototype.toplaindatetime V8_WARN_UNUSED_RESULT static MaybeHandle ToPlainDateTime(Isolate* isolate, Handle plain_date, Handle temporal_time); // #sec-temporal.plaindate.prototype.with V8_WARN_UNUSED_RESULT static MaybeHandle With( Isolate* isolate, Handle plain_date, Handle temporal_duration_like, Handle options); // #sec-temporal.plaindate.from V8_WARN_UNUSED_RESULT static MaybeHandle From( Isolate* isolate, Handle item, Handle options); // #sec-temporal.plaindate.prototype.add V8_WARN_UNUSED_RESULT static MaybeHandle Add( Isolate* isolate, Handle plain_date, Handle temporal_duration_like, Handle options); // #sec-temporal.plaindate.prototype.subtract V8_WARN_UNUSED_RESULT static MaybeHandle Subtract( Isolate* isolate, Handle plain_date, Handle temporal_duration_like, Handle options); // #sec-temporal.plaindate.prototype.until V8_WARN_UNUSED_RESULT static MaybeHandle Until( Isolate* isolate, Handle plain_date, Handle other, Handle options); // #sec-temporal.plaindate.prototype.since V8_WARN_UNUSED_RESULT static MaybeHandle Since( Isolate* isolate, Handle plain_date, Handle other, Handle options); // #sec-temporal.plaindate.prototype.getisofields V8_WARN_UNUSED_RESULT static MaybeHandle GetISOFields( Isolate* isolate, Handle plain_date); // #sec-temporal.plaindate.prototype.toplainyearmonth V8_WARN_UNUSED_RESULT static MaybeHandle ToPlainYearMonth(Isolate* isolate, Handle plain_date); // #sec-temporal.plaindate.prototype.toplainmonthday V8_WARN_UNUSED_RESULT static MaybeHandle ToPlainMonthDay(Isolate* isolate, Handle plain_date); // #sec-temporal.plaindate.prototype.tozoneddatetime V8_WARN_UNUSED_RESULT static MaybeHandle ToZonedDateTime(Isolate* isolate, Handle plain_date, Handle item); // #sec-temporal.now.plaindate V8_WARN_UNUSED_RESULT static MaybeHandle Now( Isolate* isolate, Handle calendar_like, Handle temporal_time_zone_like); // #sec-temporal.now.plaindateiso V8_WARN_UNUSED_RESULT static MaybeHandle NowISO( Isolate* isolate, Handle temporal_time_zone_like); // #sec-temporal.plaindate.prototype.tostring V8_WARN_UNUSED_RESULT static MaybeHandle ToString( Isolate* isolate, Handle plain_date, Handle options); // #sec-temporal.plaindate.prototype.tojson V8_WARN_UNUSED_RESULT static MaybeHandle ToJSON( Isolate* isolate, Handle plain_date); // #sec-temporal.plaindate.prototype.tolocalestring V8_WARN_UNUSED_RESULT static MaybeHandle ToLocaleString( Isolate* isolate, Handle plain_date, Handle locales, Handle options); DECL_PRINTER(JSTemporalPlainDate) DEFINE_TORQUE_GENERATED_JS_TEMPORAL_YEAR_MONTH_DAY() DECLARE_TEMPORAL_DATE_INLINE_GETTER_SETTER() TQ_OBJECT_CONSTRUCTORS(JSTemporalPlainDate) }; class JSTemporalPlainDateTime : public TorqueGeneratedJSTemporalPlainDateTime { public: // #sec-temporal-createtemporaldatetime V8_WARN_UNUSED_RESULT static MaybeHandle Constructor( Isolate* isolate, Handle target, Handle new_target, Handle iso_year, Handle iso_month, Handle iso_day, Handle hour, Handle minute, Handle second, Handle millisecond, Handle microsecond, Handle nanosecond, Handle calendar_like); // #sec-temporal.plaindatetime.prototype.withplaintime V8_WARN_UNUSED_RESULT static MaybeHandle WithPlainTime(Isolate* isolate, Handle date_time, Handle temporal_time_like); // #sec-temporal.plaindatetime.prototype.withcalendar V8_WARN_UNUSED_RESULT static MaybeHandle WithCalendar(Isolate* isolate, Handle date_time, Handle calendar_like); // #sec-temporal.plaindatetime.from V8_WARN_UNUSED_RESULT static MaybeHandle From( Isolate* isolate, Handle item, Handle options); // #sec-temporal.plaindatetime.compare V8_WARN_UNUSED_RESULT static MaybeHandle Compare(Isolate* isolate, Handle one, Handle two); // #sec-temporal.plaindatetime.prototype.equals V8_WARN_UNUSED_RESULT static MaybeHandle Equals( Isolate* isolate, Handle plain_date, Handle other); // #sec-temporal.plaindatetime.prototype.toplainyearmonth V8_WARN_UNUSED_RESULT static MaybeHandle ToPlainYearMonth(Isolate* isolate, Handle date_time); // #sec-temporal.plaindatetime.prototype.toplainmonthday V8_WARN_UNUSED_RESULT static MaybeHandle ToPlainMonthDay(Isolate* isolate, Handle date_time); // #sec-temporal.plaintime.prototype.tozoneddatetime V8_WARN_UNUSED_RESULT static MaybeHandle ToZonedDateTime(Isolate* isolate, Handle date_time, Handle temporal_time_zone_like, Handle options_obj); // #sec-temporal.plaindatetime.prototype.withplaindate V8_WARN_UNUSED_RESULT static MaybeHandle WithPlainDate(Isolate* isolate, Handle date_time, Handle temporal_date_date_like); // #sec-temporal.plaindatetime.prototype.getisofields V8_WARN_UNUSED_RESULT static MaybeHandle GetISOFields( Isolate* isolate, Handle date_time); // #sec-temporal.plaindatetime.prototype.with V8_WARN_UNUSED_RESULT static MaybeHandle With( Isolate* isolate, Handle date_time, Handle temporal_date_time_like, Handle options); // #sec-temporal.plaindatetime.prototype.tojson V8_WARN_UNUSED_RESULT static MaybeHandle ToJSON( Isolate* isolate, Handle date_time); // #sec-temporal.plaindatetime.prototype.tolocalestring V8_WARN_UNUSED_RESULT static MaybeHandle ToLocaleString( Isolate* isolate, Handle date_time, Handle locales, Handle options); // #sec-temporal.plaindatetime.prototype.tostring V8_WARN_UNUSED_RESULT static MaybeHandle ToString( Isolate* isolate, Handle date_time, Handle options); // #sec-temporal.plaindatetime.prototype.round V8_WARN_UNUSED_RESULT static MaybeHandle Round( Isolate* isolate, Handle date_time, Handle round_to); // #sec-temporal.plaindatetime.prototype.until V8_WARN_UNUSED_RESULT static MaybeHandle Until( Isolate* isolate, Handle date_time, Handle other, Handle options); // #sec-temporal.plaindatetime.prototype.since V8_WARN_UNUSED_RESULT static MaybeHandle Since( Isolate* isolate, Handle date_time, Handle other, Handle options); // #sec-temporal.plaindatetime.prototype.add V8_WARN_UNUSED_RESULT static MaybeHandle Add( Isolate* isolate, Handle date_time, Handle temporal_duration_like, Handle options); // #sec-temporal.plaindatetime.prototype.subtract V8_WARN_UNUSED_RESULT static MaybeHandle Subtract( Isolate* isolate, Handle date_time, Handle temporal_duration_like, Handle options); // #sec-temporal.now.plaindatetime V8_WARN_UNUSED_RESULT static MaybeHandle Now( Isolate* isolate, Handle calendar_like, Handle temporal_time_zone_like); // #sec-temporal.now.plaindatetimeiso V8_WARN_UNUSED_RESULT static MaybeHandle NowISO( Isolate* isolate, Handle temporal_time_zone_like); // #sec-temporal.plaindatetime.prototype.toplaindate V8_WARN_UNUSED_RESULT static MaybeHandle ToPlainDate( Isolate* isolate, Handle date_time); // #sec-temporal.plaindatetime.prototype.toplaintime V8_WARN_UNUSED_RESULT static MaybeHandle ToPlainTime( Isolate* isolate, Handle date_time); DECL_PRINTER(JSTemporalPlainDateTime) DEFINE_TORQUE_GENERATED_JS_TEMPORAL_YEAR_MONTH_DAY() DEFINE_TORQUE_GENERATED_JS_TEMPORAL_HOUR_MINUTE_SECOND() DEFINE_TORQUE_GENERATED_JS_TEMPORAL_SECOND_PARTS() DECLARE_TEMPORAL_DATE_INLINE_GETTER_SETTER() DECLARE_TEMPORAL_TIME_INLINE_GETTER_SETTER() TQ_OBJECT_CONSTRUCTORS(JSTemporalPlainDateTime) }; class JSTemporalPlainMonthDay : public TorqueGeneratedJSTemporalPlainMonthDay { public: // ##sec-temporal.plainmonthday V8_WARN_UNUSED_RESULT static MaybeHandle Constructor( Isolate* isolate, Handle target, Handle new_target, Handle iso_month, Handle iso_day, Handle calendar_like, Handle reference_iso_year); // #sec-temporal.plainmonthday.from V8_WARN_UNUSED_RESULT static MaybeHandle From( Isolate* isolate, Handle item, Handle options); // #sec-temporal.plainmonthday.prototype.equals V8_WARN_UNUSED_RESULT static MaybeHandle Equals( Isolate* isolate, Handle month_day, Handle other); // #sec-temporal.plainmonthday.prototype.with V8_WARN_UNUSED_RESULT static MaybeHandle With( Isolate* isolate, Handle month_day, Handle temporal_month_day_like, Handle options); // #sec-temporal.plainmonthday.prototype.toplaindate V8_WARN_UNUSED_RESULT static MaybeHandle ToPlainDate( Isolate* isolate, Handle month_day, Handle item); // #sec-temporal.plainmonthday.prototype.getisofields V8_WARN_UNUSED_RESULT static MaybeHandle GetISOFields( Isolate* isolate, Handle month_day); // #sec-temporal.plainmonthday.prototype.tostring V8_WARN_UNUSED_RESULT static MaybeHandle ToString( Isolate* isolate, Handle month_day, Handle options); // #sec-temporal.plainmonthday.prototype.tojson V8_WARN_UNUSED_RESULT static MaybeHandle ToJSON( Isolate* isolate, Handle month_day); // #sec-temporal.plainmonthday.prototype.tolocalestring V8_WARN_UNUSED_RESULT static MaybeHandle ToLocaleString( Isolate* isolate, Handle plain_date, Handle locales, Handle options); DECL_PRINTER(JSTemporalPlainMonthDay) DEFINE_TORQUE_GENERATED_JS_TEMPORAL_YEAR_MONTH_DAY() DECLARE_TEMPORAL_DATE_INLINE_GETTER_SETTER() TQ_OBJECT_CONSTRUCTORS(JSTemporalPlainMonthDay) }; class JSTemporalPlainTime : public TorqueGeneratedJSTemporalPlainTime { public: // #sec-temporal-plaintime-constructor V8_WARN_UNUSED_RESULT static MaybeHandle Constructor( Isolate* isolate, Handle target, Handle new_target, Handle hour, Handle minute, Handle second, Handle millisecond, Handle microsecond, Handle nanosecond); // #sec-temporal.plaintime.compare V8_WARN_UNUSED_RESULT static MaybeHandle Compare(Isolate* isolate, Handle one, Handle two); // #sec-temporal.plaintime.prototype.equals V8_WARN_UNUSED_RESULT static MaybeHandle Equals( Isolate* isolate, Handle plain_date, Handle other); // #sec-temporal.plaintime.from V8_WARN_UNUSED_RESULT static MaybeHandle From( Isolate* isolate, Handle item, Handle options); // #sec-temporal.plaintime.prototype.tozoneddatetime V8_WARN_UNUSED_RESULT static MaybeHandle ToZonedDateTime(Isolate* isolate, Handle plain_time, Handle item); // #sec-temporal.plaintime.prototype.add V8_WARN_UNUSED_RESULT static MaybeHandle Add( Isolate* isolate, Handle plain_time, Handle temporal_duration_like); // #sec-temporal.plaintime.prototype.subtract V8_WARN_UNUSED_RESULT static MaybeHandle Subtract( Isolate* isolate, Handle plain_time, Handle temporal_duration_like); // #sec-temporal.plaintime.prototype.until V8_WARN_UNUSED_RESULT static MaybeHandle Until( Isolate* isolate, Handle plain_time, Handle other, Handle options); // #sec-temporal.plaintime.prototype.since V8_WARN_UNUSED_RESULT static MaybeHandle Since( Isolate* isolate, Handle plain_time, Handle other, Handle options); // #sec-temporal.plaintime.prototype.round V8_WARN_UNUSED_RESULT static MaybeHandle Round( Isolate* isolate, Handle plain_time, Handle round_to); // #sec-temporal.plaintime.prototype.getisofields 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.plaintime.prototype.with V8_WARN_UNUSED_RESULT static MaybeHandle With( Isolate* isolate, Handle plain_time, Handle temporal_time_like, Handle options); // #sec-temporal.now.plaintimeiso V8_WARN_UNUSED_RESULT static MaybeHandle NowISO( Isolate* isolate, Handle temporal_time_zone_like); // #sec-temporal.plaintime.prototype.tojson V8_WARN_UNUSED_RESULT static MaybeHandle ToJSON( Isolate* isolate, Handle plain_time); // #sec-temporal.plaintime.prototype.tostring V8_WARN_UNUSED_RESULT static MaybeHandle ToString( Isolate* isolate, Handle plain_time, Handle options); // #sec-temporal.plaintime.prototype.tolocalestring V8_WARN_UNUSED_RESULT static MaybeHandle ToLocaleString( Isolate* isolate, Handle plain_time, Handle locales, Handle options); DECL_PRINTER(JSTemporalPlainTime) DEFINE_TORQUE_GENERATED_JS_TEMPORAL_HOUR_MINUTE_SECOND() DEFINE_TORQUE_GENERATED_JS_TEMPORAL_SECOND_PARTS() DECLARE_TEMPORAL_TIME_INLINE_GETTER_SETTER() TQ_OBJECT_CONSTRUCTORS(JSTemporalPlainTime) }; class JSTemporalPlainYearMonth : public TorqueGeneratedJSTemporalPlainYearMonth { public: // ##sec-temporal.plainyearmonth V8_WARN_UNUSED_RESULT static MaybeHandle Constructor(Isolate* isolate, Handle target, Handle new_target, Handle iso_year, Handle iso_month, Handle calendar_like, Handle reference_iso_day); // #sec-temporal.plainyearmonth.from V8_WARN_UNUSED_RESULT static MaybeHandle From( Isolate* isolate, Handle item, Handle options); // #sec-temporal.plainyearmonth.compare V8_WARN_UNUSED_RESULT static MaybeHandle Compare(Isolate* isolate, Handle one, Handle two); // #sec-temporal.plainyearmonth.prototype.equals V8_WARN_UNUSED_RESULT static MaybeHandle Equals( Isolate* isolate, Handle year_month, Handle other); // #sec-temporal.plainyearmonth.prototype.with V8_WARN_UNUSED_RESULT static MaybeHandle With( Isolate* isolate, Handle year_month, Handle temporal_year_month_like, Handle options); // #sec-temporal.plainyearmonth.prototype.toplaindate V8_WARN_UNUSED_RESULT static MaybeHandle ToPlainDate( Isolate* isolate, Handle year_month, Handle item); // #sec-temporal.plainyearmonth.prototype.getisofields V8_WARN_UNUSED_RESULT static MaybeHandle GetISOFields( Isolate* isolate, Handle year_month); // #sec-temporal.plainyearmonth.prototype.add V8_WARN_UNUSED_RESULT static MaybeHandle Add( Isolate* isolate, Handle year_month, Handle temporal_duration_like, Handle options); // #sec-temporal.plainyearmonth.prototype.subtract V8_WARN_UNUSED_RESULT static MaybeHandle Subtract( Isolate* isolate, Handle year_month, Handle temporal_duration_like, Handle options); // #sec-temporal.plainyearmonth.prototype.until V8_WARN_UNUSED_RESULT static MaybeHandle Until( Isolate* isolate, Handle year_month, Handle other, Handle options); // #sec-temporal.plaindyearmonth.prototype.since V8_WARN_UNUSED_RESULT static MaybeHandle Since( Isolate* isolate, Handle year_month, Handle other, Handle options); // #sec-temporal.plainyearmonth.prototype.tostring V8_WARN_UNUSED_RESULT static MaybeHandle ToString( Isolate* isolate, Handle year_month, Handle options); // #sec-temporal.plainyearmonth.prototype.tojson V8_WARN_UNUSED_RESULT static MaybeHandle ToJSON( Isolate* isolate, Handle year_month); // #sec-temporal.plainyearmonth.prototype.tolocalestring V8_WARN_UNUSED_RESULT static MaybeHandle ToLocaleString( Isolate* isolate, Handle plain_date, Handle locales, Handle options); // Abstract Operations DECL_PRINTER(JSTemporalPlainYearMonth) DEFINE_TORQUE_GENERATED_JS_TEMPORAL_YEAR_MONTH_DAY() DECLARE_TEMPORAL_DATE_INLINE_GETTER_SETTER() TQ_OBJECT_CONSTRUCTORS(JSTemporalPlainYearMonth) }; class JSTemporalTimeZone : public TorqueGeneratedJSTemporalTimeZone { public: // #sec-temporal.now.timezone V8_WARN_UNUSED_RESULT static MaybeHandle Now( Isolate* isolate); // #sec-temporal.timezone V8_WARN_UNUSED_RESULT static MaybeHandle Constructor( Isolate* isolate, Handle target, Handle new_target, Handle identifier); // #sec-temporal.timezone.prototype.getinstantfor V8_WARN_UNUSED_RESULT static MaybeHandle GetInstantFor( Isolate* isolate, Handle time_zone, Handle dateTime, Handle options); // #sec-temporal.timezone.prototype.getplaindatetimefor V8_WARN_UNUSED_RESULT static MaybeHandle GetPlainDateTimeFor(Isolate* isolate, Handle time_zone, Handle instance, Handle calendar_like); // #sec-temporal.timezone.prototype.getnexttransition V8_WARN_UNUSED_RESULT static MaybeHandle GetNextTransition( Isolate* isolate, Handle time_zone, Handle starting_point); // #sec-temporal.timezone.prototype.getprevioustransition V8_WARN_UNUSED_RESULT static MaybeHandle GetPreviousTransition( Isolate* isolate, Handle time_zone, Handle starting_point); // #sec-temporal.timezone.prototype.getpossibleinstantsfor V8_WARN_UNUSED_RESULT static MaybeHandle GetPossibleInstantsFor( Isolate* isolate, Handle time_zone, Handle date_time); // #sec-temporal.timezone.prototype.getoffsetnanosecondsfor V8_WARN_UNUSED_RESULT static MaybeHandle GetOffsetNanosecondsFor( Isolate* isolate, Handle time_zone, Handle instance); // #sec-temporal.timezone.prototype.getoffsetstringfor V8_WARN_UNUSED_RESULT static MaybeHandle GetOffsetStringFor( Isolate* isolate, Handle time_zone, Handle instance); // #sec-temporal.timezone.prototype.tostring static MaybeHandle ToString(Isolate* isolate, Handle time_zone, const char* method_name); DECL_PRINTER(JSTemporalTimeZone) DEFINE_TORQUE_GENERATED_JS_TEMPORAL_TIME_ZONE_FLAGS() DEFINE_TORQUE_GENERATED_JS_TEMPORAL_TIME_ZONE_SUB_MILLISECONDS() DECL_BOOLEAN_ACCESSORS(is_offset) DECL_INT_ACCESSORS(offset_milliseconds_or_time_zone_index) DECLARE_TEMPORAL_INLINE_GETTER_SETTER(offset_milliseconds) DECLARE_TEMPORAL_INLINE_GETTER_SETTER(offset_sub_milliseconds) int32_t time_zone_index() const; static constexpr int32_t kUTCTimeZoneIndex = 0; int64_t offset_nanoseconds() const; void set_offset_nanoseconds(int64_t offset_nanoseconds); MaybeHandle id(Isolate* isolate) const; TQ_OBJECT_CONSTRUCTORS(JSTemporalTimeZone) }; class JSTemporalZonedDateTime : public TorqueGeneratedJSTemporalZonedDateTime { public: // #sec-temporal.zoneddatetime V8_WARN_UNUSED_RESULT static MaybeHandle Constructor( Isolate* isolate, Handle target, Handle new_target, Handle epoch_nanoseconds, Handle time_zone_like, Handle calendar_like); // #sec-temporal.zoneddatetime.from V8_WARN_UNUSED_RESULT static MaybeHandle From( Isolate* isolate, Handle item, Handle options); // #sec-temporal.zoneddatetime.compare V8_WARN_UNUSED_RESULT static MaybeHandle Compare(Isolate* isolate, Handle one, Handle two); // #sec-temporal.zoneddatetime.prototype.equals V8_WARN_UNUSED_RESULT static MaybeHandle Equals( Isolate* isolate, Handle zoned_date_time, Handle other); // #sec-temporal.zoneddatetime.prototype.with V8_WARN_UNUSED_RESULT static MaybeHandle With( Isolate* isolate, Handle zoned_date_time, Handle temporal_zoned_date_time_like, Handle options); // #sec-temporal.zoneddatetime.prototype.withcalendar V8_WARN_UNUSED_RESULT static MaybeHandle WithCalendar(Isolate* isolate, Handle zoned_date_time, Handle calendar_like); // #sec-temporal.zoneddatetime.prototype.withplaindate V8_WARN_UNUSED_RESULT static MaybeHandle WithPlainDate(Isolate* isolate, Handle zoned_date_time, Handle plain_date_like); // #sec-temporal.zoneddatetime.prototype.withplaintime V8_WARN_UNUSED_RESULT static MaybeHandle WithPlainTime(Isolate* isolate, Handle zoned_date_time, Handle plain_time_like); // #sec-temporal.zoneddatetime.prototype.withtimezone V8_WARN_UNUSED_RESULT static MaybeHandle WithTimeZone(Isolate* isolate, Handle zoned_date_time, Handle time_zone_like); // #sec-get-temporal.zoneddatetime.prototype.hoursinday V8_WARN_UNUSED_RESULT static MaybeHandle HoursInDay( Isolate* isolate, Handle zoned_date_time); // #sec-temporal.zoneddatetime.prototype.round V8_WARN_UNUSED_RESULT static MaybeHandle Round( Isolate* isolate, Handle zoned_date_time, Handle round_to); // #sec-temporal.zoneddatetime.prototype.until V8_WARN_UNUSED_RESULT static MaybeHandle Until( Isolate* isolate, Handle date_time, Handle other, Handle options); // #sec-temporal.zoneddatetime.prototype.since V8_WARN_UNUSED_RESULT static MaybeHandle Since( Isolate* isolate, Handle date_time, Handle other, Handle options); // #sec-temporal.zoneddatetime.prototype.add V8_WARN_UNUSED_RESULT static MaybeHandle Add( Isolate* isolate, Handle zoned_date_time, Handle temporal_duration_like, Handle options); // #sec-temporal.zoneddatetime.prototype.subtract V8_WARN_UNUSED_RESULT static MaybeHandle Subtract( Isolate* isolate, Handle zoned_date_time, Handle temporal_duration_like, Handle options); // #sec-temporal.zoneddatetime.prototype.getisofields V8_WARN_UNUSED_RESULT static MaybeHandle GetISOFields( Isolate* isolate, Handle zoned_date_time); // #sec-temporal.zoneddatetime.prototype.toplainyearmonth V8_WARN_UNUSED_RESULT static MaybeHandle ToPlainYearMonth(Isolate* isolate, Handle zoned_date_time); // #sec-temporal.zoneddatetime.prototype.toplainmonthday V8_WARN_UNUSED_RESULT static MaybeHandle ToPlainMonthDay(Isolate* isolate, Handle zoned_date_time); // #sec-temporal.now.zoneddatetime V8_WARN_UNUSED_RESULT static MaybeHandle Now( Isolate* isolate, Handle calendar_like, Handle temporal_time_zone_like); // #sec-temporal.now.zoneddatetimeiso V8_WARN_UNUSED_RESULT static MaybeHandle NowISO( Isolate* isolate, Handle temporal_time_zone_like); // #sec-get-temporal.zoneddatetime.prototype.offsetnanoseconds V8_WARN_UNUSED_RESULT static MaybeHandle OffsetNanoseconds( Isolate* isolate, Handle zoned_date_time); // #sec-get-temporal.zoneddatetime.prototype.offset V8_WARN_UNUSED_RESULT static MaybeHandle Offset( Isolate* isolate, Handle zoned_date_time); // #sec-temporal.zoneddatetime.prototype.startofday V8_WARN_UNUSED_RESULT static MaybeHandle StartOfDay( Isolate* isolate, Handle zoned_date_time); // #sec-temporal.zoneddatetime.prototype.toinstant V8_WARN_UNUSED_RESULT static MaybeHandle ToInstant( Isolate* isolate, Handle zoned_date_time); // #sec-temporal.zoneddatetime.prototype.toplaindate V8_WARN_UNUSED_RESULT static MaybeHandle ToPlainDate( Isolate* isolate, Handle zoned_date_time); // #sec-temporal.zoneddatetime.prototype.toplaintime V8_WARN_UNUSED_RESULT static MaybeHandle ToPlainTime( Isolate* isolate, Handle zoned_date_time); // #sec-temporal.zoneddatetime.prototype.toplaindatetime V8_WARN_UNUSED_RESULT static MaybeHandle ToPlainDateTime(Isolate* isolate, Handle zoned_date_time); // #sec-temporal.zoneddatetime.prototype.tojson V8_WARN_UNUSED_RESULT static MaybeHandle ToJSON( Isolate* isolate, Handle zoned_date_time); // #sec-temporal.zoneddatetime.prototype.tolocalestring V8_WARN_UNUSED_RESULT static MaybeHandle ToLocaleString( Isolate* isolate, Handle zoned_date_time, Handle locales, Handle options); // #sec-temporal.zoneddatetime.prototype.tostring V8_WARN_UNUSED_RESULT static MaybeHandle ToString( Isolate* isolate, Handle zoned_date_time, Handle options); DECL_PRINTER(JSTemporalZonedDateTime) TQ_OBJECT_CONSTRUCTORS(JSTemporalZonedDateTime) }; namespace temporal { struct DateRecord { int32_t year; int32_t month; int32_t day; }; struct TimeRecord { int32_t hour; int32_t minute; int32_t second; int32_t millisecond; int32_t microsecond; int32_t nanosecond; }; struct DateTimeRecord { DateRecord date; TimeRecord time; }; // #sec-temporal-createtemporaldatetime V8_WARN_UNUSED_RESULT MaybeHandle CreateTemporalDateTime(Isolate* isolate, const DateTimeRecord& date_time, Handle calendar); // #sec-temporal-createtemporaltimezone MaybeHandle CreateTemporalTimeZone( Isolate* isolate, Handle identifier); // #sec-temporal-createtemporalinstant V8_WARN_UNUSED_RESULT MaybeHandle CreateTemporalInstant( Isolate* isolate, Handle target, Handle new_target, Handle epoch_nanoseconds); V8_WARN_UNUSED_RESULT MaybeHandle CreateTemporalInstant( Isolate* isolate, Handle epoch_nanoseconds); // #sec-temporal-calendaryear #define DECLARE_CALENDAR_ABSTRACT_OPERATION(Name) \ V8_WARN_UNUSED_RESULT MaybeHandle Calendar##Name( \ Isolate* isolate, Handle calendar, \ Handle date_like); DECLARE_CALENDAR_ABSTRACT_OPERATION(Year) DECLARE_CALENDAR_ABSTRACT_OPERATION(Month) DECLARE_CALENDAR_ABSTRACT_OPERATION(MonthCode) DECLARE_CALENDAR_ABSTRACT_OPERATION(Day) DECLARE_CALENDAR_ABSTRACT_OPERATION(DayOfWeek) DECLARE_CALENDAR_ABSTRACT_OPERATION(DayOfYear) DECLARE_CALENDAR_ABSTRACT_OPERATION(WeekOfYear) DECLARE_CALENDAR_ABSTRACT_OPERATION(DaysInWeek) DECLARE_CALENDAR_ABSTRACT_OPERATION(DaysInMonth) DECLARE_CALENDAR_ABSTRACT_OPERATION(DaysInYear) DECLARE_CALENDAR_ABSTRACT_OPERATION(MonthsInYear) DECLARE_CALENDAR_ABSTRACT_OPERATION(InLeapYear) #ifdef V8_INTL_SUPPORT DECLARE_CALENDAR_ABSTRACT_OPERATION(Era) DECLARE_CALENDAR_ABSTRACT_OPERATION(EraYear) #endif // V8_INTL_SUPPORT #undef DECLARE_CALENDAR_ABSTRACT_OPERATION // #sec-temporal-getiso8601calendar Handle GetISO8601Calendar(Isolate* isolate); // #sec-temporal-builtintimezonegetplaindatetimefor V8_WARN_UNUSED_RESULT MaybeHandle BuiltinTimeZoneGetPlainDateTimeFor(Isolate* isolate, Handle time_zone, Handle instant, Handle calendar, const char* method_name); V8_WARN_UNUSED_RESULT MaybeHandle InvokeCalendarMethod( Isolate* isolate, Handle calendar, Handle name, Handle temporal_like); V8_WARN_UNUSED_RESULT MaybeHandle ToTemporalCalendar( Isolate* isolate, Handle temporal_calendar_like, const char* method_name); V8_WARN_UNUSED_RESULT MaybeHandle ToTemporalTimeZone( Isolate* isolate, Handle temporal_time_zone_like, const char* method_name); V8_WARN_UNUSED_RESULT MaybeHandle IsInvalidTemporalCalendarField( Isolate* isolate, Handle string, Handle field_names); // #sec-temporal-getbuiltincalendar V8_WARN_UNUSED_RESULT MaybeHandle GetBuiltinCalendar( Isolate* isolate, Handle id); MaybeHandle BuiltinTimeZoneGetInstantForCompatible( Isolate* isolate, Handle time_zone, Handle date_time, const char* method_name); // For Intl.DurationFormat // #sec-temporal-time-duration-records struct TimeDurationRecord { double days; double hours; double minutes; double seconds; double milliseconds; double microseconds; double nanoseconds; // #sec-temporal-createtimedurationrecord static Maybe Create(Isolate* isolate, double days, double hours, double minutes, double seconds, double milliseconds, double microseconds, double nanoseconds); }; // #sec-temporal-duration-records // Cannot reuse DateDurationRecord here due to duplicate days. struct DurationRecord { double years; double months; double weeks; TimeDurationRecord time_duration; // #sec-temporal-createdurationrecord static Maybe Create(Isolate* isolate, double years, double months, double weeks, double days, double hours, double minutes, double seconds, double milliseconds, double microseconds, double nanoseconds); }; // #sec-temporal-topartialduration Maybe ToPartialDuration( Isolate* isolate, Handle temporal_duration_like_obj, const DurationRecord& input); // #sec-temporal-isvalidduration bool IsValidDuration(Isolate* isolate, const DurationRecord& dur); } // namespace temporal } // namespace internal } // namespace v8 #include "src/objects/object-macros-undef.h" #endif // V8_OBJECTS_JS_TEMPORAL_OBJECTS_H_