Commit Graph

1060 Commits

Author SHA1 Message Date
Frank Tang
cfbe175eda Revert "[Temporal] Add add/subtract to Duration"
This reverts commit a10194cf82.

Reason for revert: Merge conflict break build

Original change's description:
> [Temporal] Add add/subtract to Duration
>
> Also implement AOs: ToRelativeTemporalObject, AddDuration, AddDurationToOrSubtractDurationFromDuration,
>  ParseTemporalRelativeToString, DefaultTemporalLargestUnit,
> DifferenceZonedDateTime
>
> Spec Text:
> https://tc39.es/proposal-temporal/#sec-temporal.duration.prototype.add
> https://tc39.es/proposal-temporal/#sec-temporal.duration.prototype.subtract
> https://tc39.es/proposal-temporal/#sec-temporal-adddurationtoorsubtractdurationfromduration
> https://tc39.es/proposal-temporal/#sec-temporal-addduration
> https://tc39.es/proposal-temporal/#sec-temporal-torelativetemporalobject
> https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalrelativetostring
> https://tc39.es/proposal-temporal/#sec-temporal-defaulttemporallargestunit
> https://tc39.es/proposal-temporal/#sec-temporal-differencezoneddatetime
>
> Bug: v8:11544
> Change-Id: Id2eff50d7f810042e1b7c53c49a09f9e489d5460
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3699301
> Commit-Queue: Frank Tang <ftang@chromium.org>
> Reviewed-by: Adam Klein <adamk@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#81650}

Bug: v8:11544
Change-Id: Ia40c6f47d7cf6255b0ad6f2f70571b79c7e2d7af
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3756742
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81651}
2022-07-11 23:52:43 +00:00
Frank Tang
a10194cf82 [Temporal] Add add/subtract to Duration
Also implement AOs: ToRelativeTemporalObject, AddDuration, AddDurationToOrSubtractDurationFromDuration,
 ParseTemporalRelativeToString, DefaultTemporalLargestUnit,
DifferenceZonedDateTime

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.duration.prototype.add
https://tc39.es/proposal-temporal/#sec-temporal.duration.prototype.subtract
https://tc39.es/proposal-temporal/#sec-temporal-adddurationtoorsubtractdurationfromduration
https://tc39.es/proposal-temporal/#sec-temporal-addduration
https://tc39.es/proposal-temporal/#sec-temporal-torelativetemporalobject
https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalrelativetostring
https://tc39.es/proposal-temporal/#sec-temporal-defaulttemporallargestunit
https://tc39.es/proposal-temporal/#sec-temporal-differencezoneddatetime

Bug: v8:11544
Change-Id: Id2eff50d7f810042e1b7c53c49a09f9e489d5460
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3699301
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81650}
2022-07-11 23:01:43 +00:00
Frank Tang
320844e059 [Temporal] Add round to PlainDateTime and ZoneDateTime
Also change InterpretISODateTimeOffset parameter type.
Add AOs: ToTemporalDateTimeRoundingIncrement
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.round
https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.round
https://tc39.es/proposal-temporal/#sec-temporal-totemporaldatetimeroundingincrement

Bug: v8:11544
Change-Id: I1a74ed165b3643467d8d894fd16fd59217ba8063
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3749374
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81649}
2022-07-11 22:58:24 +00:00
Frank Tang
51e70bd82c [test262] Roll test262
b458b9f0..3ddfa0cd

Bug: v8:7834
Change-Id: Ic60850ed5d5a2126b76c09747a969002781f17f8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3752614
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81618}
2022-07-08 20:28:50 +00:00
Frank Tang
a72b10aaab [Temporal] Mark passed test to fix build.
Bug: v8:11544
No-Tree-Checks: true
Change-Id: I12b093da9f9f4f63bc67b1efaeefb735b8a6c5e4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3741001
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Auto-Submit: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81508}
2022-07-04 07:04:59 +00:00
Frank Tang
7a4a6cc6a8 [Temporal] Add toJSON, toString and non-intl version of toLocaleString to ZonedDateTime
Also add AOs: FormatISOTimeZoneOffsetString, TemporalZonedDateTimeToString, ToShowTimeZoneNameOption, ToShowOffsetOption,

Update FormatTimeZoneOffsetString to use ToZeroPaddedDecimalString

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.tojson
https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.tolocalestring
https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.tostring
https://tc39.es/proposal-temporal/#sec-temporal-formatisotimezoneoffsetstring
https://tc39.es/proposal-temporal/#sec-temporal-temporalzoneddatetimetostring
https://tc39.es/proposal-temporal/#sec-temporal-toshowtimezonenameoption
https://tc39.es/proposal-temporal/#sec-temporal-toshowoffsetoption

The intl version of toLocaleString is not implemented in this CL yet


Bug: v8:11544
Change-Id: Id7e4f72b63864857b0b3fa8dc8dfcba0b5949faa
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3688848
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81507}
2022-07-02 06:46:27 +00:00
Frank Tang
adb111b776 [Temporal] Fix PlainTime/PlainDateTime toString bugs
Bug: v8:11544
Change-Id: Iaf3d673c9746badadae082121402e723d3704189
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3719087
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81506}
2022-07-02 06:40:07 +00:00
Frank Tang
e61e019481 [Temporal] Add since/until to Instant
Also add AOs: GetTemporalUnit, NegateTemporalRoundingMode,
MaximumTemporalDurationRoundingIncrement, GetDifferenceSettings,
DifferenceInstant, DifferenceTemporalInstant

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.instant.prototype.since
https://tc39.es/proposal-temporal/#sec-temporal.instant.prototype.until
https://tc39.es/proposal-temporal/#sec-temporal-gettemporalunit
https://tc39.es/proposal-temporal/#sec-temporal-negatetemporalroundingmode
https://tc39.es/proposal-temporal/#sec-temporal-maximumtemporaldurationroundingincrement
https://tc39.es/proposal-temporal/#sec-temporal-getdifferencesettings
https://tc39.es/proposal-temporal/#sec-temporal-differenceinstant
https://tc39.es/proposal-temporal/#sec-temporal-differencetemporalinstant

Bug: v8:11544
Change-Id: Iabcc452304366132b03bb82529159c7553c610b3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3722456
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81502}
2022-07-02 02:13:02 +00:00
Frank Tang
a63e2ddfb4 [Temporal] Add toString to Duration
Add AOs: MoveRelativeZonedDateTime,  DaysUntil, MoveRelativeDate,
RoundDuration,

Also fix bugs in CalendarDateAdd, TemporalDurationToString, IsValidDuration

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.duration.prototype.tostring
https://tc39.es/proposal-temporal/#sec-temporal-moverelativezoneddatetime
https://tc39.es/proposal-temporal/#sec-temporal-daysuntil
https://tc39.es/proposal-temporal/#sec-temporal-moverelativedate
https://tc39.es/proposal-temporal/#sec-temporal-roundduration

Bug: v8:11544
Change-Id: I351cdb88a930f3f7b48f351549d390e5bd02d91e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3715381
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81501}
2022-07-02 01:47:22 +00:00
Frank Tang
8a14d953e2 [Temporal] Sync to PR1953 and PR1917 to fix bugs.
https://github.com/tc39/proposal-temporal/pull/1917
https://github.com/tc39/proposal-temporal/pull/1953

Bug: v8:11544
Change-Id: I667980e312248ccbaf826d4e3104fb1ddabef890
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3721464
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81453}
2022-06-30 02:36:57 +00:00
Frank Tang
1a5cfc20e1 [Temporal] Add toJSON, toString, and non-intl toLocaleString to Instant
Also add AOs: FormatISOTimeZoneOffsetString, TemporalInstantToString,
GetUnsignedRoundingMode, ApplyUnsignedRoundingMode, RoundTemporalInstant

Also update the RoundNumberToIncrement implementation and a BigInt version.

Fix the test setup in test/mjsunit/temporal/instant-to-json.js since fromEpochSeconds and fromEpochMilliseconds do not take BigInt

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.instant.prototype.tojson
https://tc39.es/proposal-temporal/#sec-temporal.instant.prototype.tolocalestring
https://tc39.es/proposal-temporal/#sec-temporal.instant.prototype.tostring
https://tc39.es/proposal-temporal/#sec-temporal-temporalinstanttostring
https://tc39.es/proposal-temporal/#sec-temporal-formatisotimezoneoffsetstring
https://tc39.es/proposal-temporal/#sec-temporal-getunsignedroundingmode
https://tc39.es/proposal-temporal/#sec-temporal-applyunsignedroundingmode
https://tc39.es/proposal-temporal/#sec-temporal-roundtemporalinstant
https://tc39.es/proposal-temporal/#sec-temporal-roundnumbertoincrement

This does NOT implement the intl version of toLocaleString
specified in (notice the "sup" not "sec" after #) yet.
https://tc39.es/proposal-temporal/#sup-temporal.instant.prototype.tolocalestring

Bug: v8:11544
Change-Id: I807afd5bf550d2a65a4732a8e536056eea79cf8f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3696483
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81428}
2022-06-29 08:31:17 +00:00
Frank Tang
9262713316 [Temporal] Add round to PlainTime
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.plaintime.prototype.round

Bug: v8:11544
Change-Id: I564cec6fdc030e3d39a9798c047534228f670dc6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3692428
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81427}
2022-06-29 08:29:07 +00:00
Frank Tang
7fa468c3c4 [test262] Roll test262
b1f49b5c46..b458b9f0c2

Bug: v8:7834
Change-Id: I6191d4533ae2046b3b132b62397bcefa597320f6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3724328
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81367}
2022-06-24 23:51:49 +00:00
Frank Tang
cd7100e9aa [Temporal] Add add/subtract to PlainYearMonth
Also add AOs: AddDurationToOrSubtractDurationFromPlainYearMonth,
CreateNegatedDurationRecord

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth.prototype.add
https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth.prototype.subtract
https://tc39.es/proposal-temporal/#sec-temporal-adddurationtoorsubtractdurationfromplainyearmonth

Also see https://github.com/tc39/proposal-temporal/pull/2281

Bug: v8:11544
Change-Id: I5ca6acc82dad07a8dd202de02bca5a16e585e84c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3697180
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81228}
2022-06-18 00:35:02 +00:00
Frank Tang
08c18bfc2e [Temporal] Add compare and equals to ZonedDateTime
Also add AOs: TimeZoneEquals

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.compare
https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.equals
https://tc39.es/proposal-temporal/#sec-temporal-timezoneequals

Bug: v8:11544
Change-Id: Ibcd1e42d72f86f16e0f5ddb1fd589bbe7ab2225c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3709217
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81227}
2022-06-18 00:02:01 +00:00
Frank Tang
bb70895e49 [Temporal] Add Instant.prototype.round
Also add AOs: ToTemporalRoundingMode, ToSmallestTemporalUnit,
ToTemporalRoundingIncrement, RoundHalfAwayFromZero,
RoundNumberToIncrement, RoundTemporalInstant

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.instant.prototype.round
https://tc39.es/proposal-temporal/#sec-temporal-totemporalroundingmode
https://tc39.es/proposal-temporal/#sec-temporal-tosmallesttemporalunit
https://tc39.es/proposal-temporal/#sec-temporal-totemporalroundingincrement
https://tc39.es/proposal-temporal/#sec-temporal-roundhalfawayfromzero
https://tc39.es/proposal-temporal/#sec-temporal-roundnumbertoincrement
https://tc39.es/proposal-temporal/#sec-temporal-roundtemporalinstant

Bug: v8:11544
Change-Id: I37750f166e6b5597db16574d2ce4d5f92065a7b0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3566671
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81212}
2022-06-17 01:55:52 +00:00
Frank Tang
2506d6ca1c [Temporal] Add from to ZonedDateTime
Also implement AOs: ParseTemporalZonedDateTimeString, ToTemporalZonedDateTime

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.from
https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalzoneddatetimestring
https://tc39.es/proposal-temporal/#sec-temporal-totemporalzoneddatetime

Sync ToTemporalOffset and ToTemporalDisambiguation to latest spec to take undefined.
https://tc39.es/proposal-temporal/#sec-temporal-totemporaloffset
https://tc39.es/proposal-temporal/#sec-temporal-totemporaldisambiguation

Bug: v8:11544
Change-Id: I4137725155201b025066538ce337f6ae4749dc5e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3699684
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81200}
2022-06-15 22:28:52 +00:00
Frank Tang
39296d3cab [Intl] Stage Intl Number Format v3 API
Stage 3 proposal

flag --harmony-intl-number-format-v3

Spec: https://github.com/tc39/proposal-intl-numberformat-v3
R2T: https://groups.google.com/a/chromium.org/g/blink-dev/c/vy6rCuh3r_0/m/1Q2FHx9hBAAJ
Design Doc: https://docs.google.com/document/d/19jAogPBb6W4Samt8NWGZKu47iv0_KoQhBvLgQH3xvr8/edit
https://docs.google.com/document/d/14zxGub6Os6nARzH6XstOZX05w2537sZo_ZSSlGjGpBM/edit#heading=h.86ckkob9p59r
https://chromestatus.com/feature/5707621009981440

Bug: v8:10776
Change-Id: I81d0385b09c283628c7c36096d26e07a817888a1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3703471
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81198}
2022-06-15 21:33:12 +00:00
Frank Tang
fe53fc04d2 [intl] Implement NumberFormat v8 string input handling
Design Document:
https://docs.google.com/document/d/14zxGub6Os6nARzH6XstOZX05w2537sZo_ZSSlGjGpBM/edit#


Bug: v8:10776
Change-Id: I506eadcf70f6855a79601a7cb1ce47849cfc066a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3594118
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81168}
2022-06-15 04:23:14 +00:00
Frank Tang
b66d08241d [Temporal] Add non-intl toLocaleString to Duration
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.duration.prototype.tolocalestring

This does NOT implement the intl version of toLocale in (noteice 'sup'
vs 'sec' after #)
https://tc39.es/proposal-temporal/#sup-temporal.duration.prototype.tolocalestring
since the details is not specified yet.

Bug: v8:11544
Change-Id: I7f5a2e9766005d1a7f6409d428ca53b5a38a3960
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3696482
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81167}
2022-06-15 04:01:43 +00:00
Frank Tang
8bd3a441ae [test262] Roll test262
8f5c7aed0..b1f49b5c

Bug: v8:7834
Change-Id: Icb4ab0c9b26962ed60ba30419f3976ddf05e91e4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3704910
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81165}
2022-06-14 23:40:12 +00:00
Frank Tang
25c264f894 [Temporal] Add with to ZonedDateTime
Add AOs: ToTemporalOffset and InterpretISODateTimeOffset

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.with
https://tc39.es/proposal-temporal/#sec-temporal-totemporaloffset
https://tc39.es/proposal-temporal/#sec-temporal-interpretisodatetimeoffset

Bug: v8:11544
Change-Id: I8b757386596d0d73a73e8e9aa2d52cd72b90a95a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3692939
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81053}
2022-06-09 20:21:53 +00:00
Frank Tang
cddfa0c5ce [Temporal] Add compare/equals to YearMonth and MonthDay
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth.compare
https://tc39.es/proposal-temporal/#sec-temporal.plainmonthday.compare
https://tc39.es/proposal-temporal/#sec-temporal.plainmonthday.prototype.equals

Bug: v8:11544
Change-Id: Ia03946e0e183ec9b0a8130515607c29a32a8b265
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3673418
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80986}
2022-06-07 23:53:27 +00:00
Frank Tang
dc88fb92ed [Temporal] Add toString to PlainDateTime
Implement AOs: RoundISODateTime
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.tostring
https://tc39.es/proposal-temporal/#sec-temporal-roundisodatetime

Bug: v8:11544
Change-Id: Ib0318be8047bb01e593a43cef4405caa5979d1af
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3687568
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80985}
2022-06-07 23:52:23 +00:00
Frank Tang
e781520367 [Temporal] Add withPlainDate to ZonedDateTime
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.withplaindate

Bug: v8:11544
Change-Id: I8d7099906c04eae0e29ff0dabd48b736a07305d6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3692432
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80984}
2022-06-07 23:51:21 +00:00
Frank Tang
fdde51c674 [Temporal] Add Instant.prototype.(add|subtract)
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.instant.prototype.add
https://tc39.es/proposal-temporal/#sec-temporal.instant.prototype.subtract

Also fix bug in IsValidEpochNanoseconds

Bug: v8:11544
Change-Id: Ied605c9de4ee38a18e2356a89e3a69d534a004d1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3617394
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80983}
2022-06-07 23:44:12 +00:00
Frank Tang
5828eb4254 [Temporal] Add ZonedDateTime.prototype.(add|subtract)
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.add
https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.subtract

Bug: v8:11544
Change-Id: If4e1f71a05a0d1e88829bf219d4f90bd7a343877
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3617392
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80960}
2022-06-06 21:15:55 +00:00
Frank Tang
6d33cb89a4 [Temporal] Add Instant.(compare|prototype.equals)
Also implement AO: CompareEpochNanoseconds
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.instant.compare
https://tc39.es/proposal-temporal/#sec-temporal.instant.prototype.equals

Bug: v8:11544
Change-Id: I953a890250ff0bf29cd24e4638bf17ceb5f9bb2f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3382057
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80959}
2022-06-06 17:44:42 +00:00
Frank Tang
8436df4b68 [Temporal] Add ZonedDateTime.prototype.hoursInDay
Also add AOs: AddISODate, RegulateISODate

Change the return type of GetISO8601Calendar from MaybeHandle to Handle since it will never throw exception.

Spec Text:
https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.hoursinday
https://tc39.es/proposal-temporal/#sec-temporal-addisodate
https://tc39.es/proposal-temporal/#sec-temporal-regulateisodate

Bug: v8:11544
Change-Id: Id0b59e2818a095ee9390de2302501888fd93ca2b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3564937
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80958}
2022-06-06 15:57:56 +00:00
Frank Tang
7627b400c9 [Temporal] Add PlainTime.prototype.(add|subtract)
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.plaintime.prototype.add
https://tc39.es/proposal-temporal/#sec-temporal.plaintime.prototype.subtract

Bug: v8:11544
Change-Id: I0d684eec9eebfd26eceb6bb4c360025a33bd4c3c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3617390
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80957}
2022-06-06 15:56:54 +00:00
Frank Tang
9b4b64c282 [Temporal] Add PlainDateTime.prototype.(add|subtract)
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.add
https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.subtract

Bug: v8:11544
Change-Id: Ib76b090a62a932931ab48cb5814ce1f1050fae10
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3617391
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80956}
2022-06-06 15:55:44 +00:00
Frank Tang
88b644717f [Temporal] Add PlainDate.prototype.(add|subtract)
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.plaindate.prototype.add
https://tc39.es/proposal-temporal/#sec-temporal.plaindate.prototype.subtract

Bug: v8:11544
Change-Id: Iacb4b9ba7d481005d14e2e4d42e2422133f5ab42
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3617389
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80955}
2022-06-06 15:49:55 +00:00
Frank Tang
c61c73ad0d [Temporal] Add toJSON and non-intl version ot toLocaleString to PlainDateTime
Implement AO: TemporalDateTimeToString
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.tojson
https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.tolocalestring

https://tc39.es/proposal-temporal/#sec-temporal-temporaldatetimetostring

Bug: v8:11544
Change-Id: I170fa13822d87cfd668bd4cd8df50476f00c86f8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3672001
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80793}
2022-05-28 19:17:45 +00:00
Frank Tang
8ea33c9f54 [Temporal] Add PlainTime toString and non-intl toLocaleString
Also implement AOs:
ToTemporalRoundingMode, ToSmallestTemporalUnit, RoundNumberToIncrement, RoundTime, ToSecondsStringPrecision

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.plaintime.prototype.tostring
https://tc39.es/proposal-temporal/#sec-temporal.plaintime.prototype.tolocalestring
https://tc39.es/proposal-temporal/#sec-temporal-totemporalroundingmode
https://tc39.es/proposal-temporal/#sec-temporal-tosmallesttemporalunit
https://tc39.es/proposal-temporal/#sec-temporal-roundnumbertoincrement
https://tc39.es/proposal-temporal/#sec-temporal-roundtime
https://tc39.es/proposal-temporal/#sec-temporal-tosecondsstringprecision

Bug: v8:11544
Change-Id: I47ea27e966232e89bab48bf15a48c2c00ce5e160
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3665937
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80792}
2022-05-28 19:05:25 +00:00
Frank Tang
6fdea7b040 [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: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80788}
2022-05-27 23:03:08 +00:00
Frank Tang
e85a0243ce [Temporal] Add PlainDate(Time)?.(compare|prototype.equals)
Also add AO CalendarEquals, CompareISODateTime

Remove Isolate from CompareISODate argument
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.plaindate.compare
https://tc39.es/proposal-temporal/#sec-temporal.plaindate.prototype.equals
https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.compare
https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.equals
https://tc39.es/proposal-temporal/#sec-temporal-calendarequals
https://tc39.es/proposal-temporal/#sec-temporal-compareisodatetime

Bug: v8:11544
Change-Id: I5505c7923e3c1f76d44e292135b489ea20fbf13c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3534458
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80787}
2022-05-27 23:02:04 +00:00
Frank Tang
17087937da [Temporal] Add Plain(YearMonth|MonthDay).prototype.toPlainDate
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth.prototype.toplaindate
https://tc39.es/proposal-temporal/#sec-temporal.plainmonthday.prototype.toplaindate

Bug: v8:11544
Change-Id: I506efe3fa3685f621596fa34301a73d8c57ded38
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3566114
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80783}
2022-05-27 17:32:24 +00:00
Frank Tang
4ad4ba1dff [Temporal] Add Plain(Date)?Time.prototype.with
Refactor ToTemporalTimeRecord to a new routine
ToTemporalTimeRecordOrPartialTime to share code with ToPartilTime
Change the return type of ToTemporalTimeRecord, RegulateTime

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.plaintime.prototype.with
https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.with
https://tc39.es/proposal-temporal/#sec-temporal-topartialtime

Bug: v8:11544
Change-Id: I214147f497a405ee48e264833c7c0b9401596c01
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3665269
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80769}
2022-05-27 04:00:13 +00:00
Frank Tang
86a219d9c9 [Temporal] Add Duration.prototype.with
Also add AO: ToPartialDuration
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal-topartialduration
https://tc39.es/proposal-temporal/#sec-temporal.duration.prototype.with

Bug: v8:11544
Change-Id: I43282f5285a3c884229445547add6db2cde4fbe4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3380102
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80767}
2022-05-27 00:53:03 +00:00
Frank Tang
1b13172df3 [Temporal] Add PlainDateTime.prototype.withPlainDate
Also add AO: ConsolidateCalendars

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.withplaindate
https://tc39.es/proposal-temporal/#sec-temporal-consolidatecalendars

Bug: v8:11544
Change-Id: I98084f7cc92a837f6401a88ad10389a7c5df8b3d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3563541
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80764}
2022-05-26 20:42:09 +00:00
Frank Tang
cc8b442773 [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/+/3538670
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80757}
2022-05-26 04:45:19 +00:00
Frank Tang
06d61bd575 [Temporal] Add ZonedDateTime.prototype.startOfDay
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.startofday

Bug: v8:11544
Change-Id: I475e03fa9ba43290896a906524414cfbddd1f7bb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3385610
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80754}
2022-05-25 18:19:08 +00:00
Frank Tang
3ba8390cb9 [Temporal] Add PlainTime.(compare|prototype.equals)
Also add AO: CompareTemporalTime

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.plaintime.compare
https://tc39.es/proposal-temporal/#sec-temporal.plaintime.prototype.equals
https://tc39.es/proposal-temporal/#sec-temporal-comparetemporaltime

Bug: v8:11544
Change-Id: I8e2a320c2e296558e1fb15ef6e855e6b6a14ece2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3538669
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80732}
2022-05-25 03:10:23 +00:00
Frank Tang
702f874a3b [Temporal] Add PlainDateTime.prototype.toPlain(Date|Time)
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.toplaindate
https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.toplaintime

Bug: v8:11544
Change-Id: Ifb7115823d1d3d1ff53806f1b376d69302e00ae1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3385761
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80731}
2022-05-25 01:17:21 +00:00
Frank Tang
38e56036dd [Temporal] Add PlainTime.prototype.toZonedDateTime
Spec Text: https://tc39.es/proposal-temporal/#sec-temporal.plaintime.prototype.tozoneddatetime

Bug: v8:11544
Change-Id: I147b1d21b4728520c5667a30548ec77f71d7445a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3554456
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80730}
2022-05-24 22:10:12 +00:00
Frank Tang
fc50b033e3 [Temporal] Add PlainDate.prototype.toZonedDateTime
Spec Text: https://tc39.es/proposal-temporal/#sec-temporal.plaindate.prototype.tozoneddatetime

Bug: v8:11544
Change-Id: I758e46efdc33cfc3f336e5c595a402123ae6c485
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3535920
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80709}
2022-05-24 07:54:30 +00:00
Frank Tang
8516c9bed5 [Temporal] Add Plain(Date|YearMonth|MonthDay).prototype.with
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.plaindate.prototype.with
https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth.prototype.with
https://tc39.es/proposal-temporal/#sec-temporal.plainmonthday.prototype.with

Bug: v8:11544
Change-Id: I311d6246646ce18503804352bc95a374af3d8c6e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3565014
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80708}
2022-05-24 06:04:35 +00:00
Frank Tang
a663b1ff66 [Temporal] Add PlainDate toPlainDateTime
Spec Text: https://tc39.es/proposal-temporal/#sec-temporal.plaindate.prototype.toplaindatetime

Bug: v8:11544
Change-Id: Ie86a5d8a2f1206a44d0e74638392ae26e0f8e900
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3534454
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80707}
2022-05-24 05:13:47 +00:00
Frank Tang
3c53e9adae [Temporal] Add PlainDateTime.prototype.withPlainTime
Spec text:
https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.withplaintime

Bug: v8:11544
Change-Id: I5277fb88675bb6d99b028a289329db06b95cc003
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3565026
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80706}
2022-05-24 05:11:48 +00:00
Frank Tang
2fc37ae5e2 [Temporal] Syntax error if DateExtendedYear is -000000
Sync to PR2036
https://github.com/tc39/proposal-temporal/pull/2036

Treat -000000 in DateExtendedYear as syntax error

Bug: v8:11544
Change-Id: I8cf7a506e85ad2b74d572142d646f3f98cd8bffa
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3633620
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80705}
2022-05-24 04:58:31 +00:00
Frank Tang
05f3596f80 [Temporal] Add PlainDateTime.prototype.toZonedDateTime
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.tozoneddatetime

Bug: v8:11544
Change-Id: Ic4464e6d4521fb7e006164933df4f38c5d3115b1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3554666
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80685}
2022-05-21 01:38:55 +00:00
Frank Tang
a90169d304 [Temporal] Add Instant.prototype.toZonedDateTime(ISO)?
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.instant.prototype.tozoneddatetime
https://tc39.es/proposal-temporal/#sec-temporal.instant.prototype.tozoneddatetimeiso

Bug: v8:11544
Change-Id: I452dfbf027e5d58edde9f9691519204ff29d8082
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3382058
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80684}
2022-05-21 01:30:26 +00:00
Frank Tang
4cf301722c [Temporal] Add PlainYearMonth.from
Also Add AOs: ToTemporalYearMonth, YearMonthFromFields, ParseTemporalYearMonthString

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth.from
https://tc39.es/proposal-temporal/#sec-temporal-totemporalyearmonth
https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalyearmonthstring
https://tc39.es/proposal-temporal/#sec-temporal-yearmonthfromfields

Bug: v8:11544
Change-Id: I04b30a4159142a996c765c542f19e66bee593e4e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3538666
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80683}
2022-05-21 01:19:45 +00:00
Frank Tang
9473a5e987 [Temporal] Add toJSON to PlainTime
Bug: v8:11544
Change-Id: Iaf440009b2abdf9e90de3ed0e6e02eb35060a65b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3437889
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80682}
2022-05-21 01:14:05 +00:00
Frank Tang
db2dc63535 [Temporal] Add ZonedDateTime.prototype.withPlainTime
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime.prototype.withplaintime

Bug: v8:11544
Change-Id: I1c35c1105c9f2cc051d3b17718f52170fbee2a5f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3565027
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80681}
2022-05-21 01:04:45 +00:00
Frank Tang
a2f22f4355 [Temporal] Add PlainDate(Time)? toPlain*Month*
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.plaindate.prototype.toplainmonthday
https://tc39.es/proposal-temporal/#sec-temporal.plaindate.prototype.toplainyearmonth
https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.toplainyearmonth
https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.prototype.toplainmonthday


Bug: v8:11544
Change-Id: Ia97de3b4dde183ae4ee514deb4d13da5d5ff9bae
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3534451
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80680}
2022-05-21 00:26:07 +00:00
Frank Tang
71fb98092b [Temporal] Add ZonedDateTime.prototype.* forward to calendar
Implement the following methods of ZonedDateTime
year, month, monthCode, day, dayOfWeek, dayOfYear, weekOfYear,
daysInWeek, daysInMonth, daysInYear, monthsInYear, inLeapYear,
era, eraYear

Also implement corresponding AOs (CalendarXXX).

Spec Text:
https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.year
https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.month
https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.monthcode
https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.day
https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.dayofweek
https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.dayofyear
https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.weekofyear
https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.daysinweek
https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.daysinmonth
https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.daysinyear
https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.monthsinyear
https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.inleapyear
https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.era
https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.erayear

Bug: v8:11544
Change-Id: I7d7008a719f0109836834d170c5f52b49c3ffb7e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3565028
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80678}
2022-05-20 23:07:26 +00:00
Frank Tang
74aa5e7d68 [Temporal] Add Temporal.Duration.prototype.toJSON
Also add AO: TemporalDurationToString

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.duration.prototype.tojson
https://tc39.es/proposal-temporal/#sec-temporal-temporaldurationtostring

Bug: v8:11544
Change-Id: I7dfdb5458b88646a4ac7b7713e7c8e63352f7539
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3438375
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80677}
2022-05-20 22:38:35 +00:00
Frank Tang
caccea8d09 [Temporal] Add PlainMonthDay.from
Also add AOs: ParseTemporalMonthDayString, MonthDayFromFields,
ToTemporalMonthDay
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.plainmonthday.from
https://tc39.es/proposal-temporal/#sec-temporal-totemporalmonthday
https://tc39.es/proposal-temporal/#sec-temporal-parsetemporalmonthdaystring
https://tc39.es/proposal-temporal/#sec-temporal-monthdayfromfields

Bug: v8:11544
Change-Id: I971b5a0f43b9dbeefe38ebe28035f7c9b1a617ff
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3538664
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80676}
2022-05-20 22:34:05 +00:00
Frank Tang
c68336252d [Temporal] Add Plain(Date|MonthDay|YearMonth).*.to(Locale)?String
Spec Text:
https://tc39.es/proposal-temporal/#sup-temporal.plaindate.prototype.tostring
https://tc39.es/proposal-temporal/#sup-temporal.plaindate.prototype.tolocalestring
https://tc39.es/proposal-temporal/#sup-temporal.plainmonthday.prototype.tostring
https://tc39.es/proposal-temporal/#sup-temporal.plainmonthday.prototype.tolocalestring
https://tc39.es/proposal-temporal/#sup-temporal.plainyearmonth.prototype.tostring
https://tc39.es/proposal-temporal/#sup-temporal.plainyearmonth.prototype.tolocalestring

Implement toString/toLocaleString as non-intl version.

Because toString took options bag in Temporal, we cannot use the
same way how we handle Date.prototype.toLocaleString() for non-intl
build by just forwarding to it's toString implementation.
Change built-ins-defintions.h to always has built-ins for
*.toLocaleString , not just in intl build.
Change src/init/bootstrapper.cc away of the toLocaleString forward
to toString approach.

Implement the non-intl version of ToLocaleString in js-temporal-objects.cc for
Temporal.Plain(Date|YearMonth|MonthDay)


Bug: v8:11544
Change-Id: I202bcf28ef05ed03c337475300cfdfd18b52ffb3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3656137
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80675}
2022-05-20 20:35:35 +00:00
Frank Tang
5354d8a1c6 [Temporal] Add PlainYearMonth.prototype.toJSON
Also add AOs: TemporalYearMonthToString

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth.prototype.tojson
https://tc39.es/proposal-temporal/#sec-temporal-temporalyearmonthtostring

Bug: v8:11544
Change-Id: Ibe8bd20ae5eb5b7721e50cf5386c20d8d23e18e6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3437894
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80627}
2022-05-19 05:06:23 +00:00
Frank Tang
0b44a86009 [Temporal] Add PlainMonthDay.prototype.toJSON
Also add AO: TemporalMonthDayToString

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.plainmonthday.prototype.tojson
https://tc39.es/proposal-temporal/#sec-temporal-temporalmonthdaytostring

Bug: v8:11544
Change-Id: Ibbc5b28a9c73474f7edc1b67c9beabf5bca54dbc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3437891
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80624}
2022-05-19 02:44:13 +00:00
Frank Tang
a5697616eb [Temporal] Add PlainDate.prototype.toJSON
Also add AOs: PadISOYear, FormatCalendarAnnotation, TemporalDateToString
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.plaindate.prototype.tojson
https://tc39.es/proposal-temporal/#sec-temporal-padisoyear
https://tc39.es/proposal-temporal/#sec-temporal-formatcalendarannotation
https://tc39.es/proposal-temporal/#sec-temporal-temporaldatetostring

Change the ISODateTimeWithinLimits from
-8.64 × 10^21 - 8.64 × 10^16, 8.64 × 10^21 + 8.64 × 10^16
to
-8.64 × 10^21 - 8.64 × 10^13, 8.64 × 10^21 + 8.64 × 10^13
per https://github.com/tc39/proposal-temporal/pull/1723

Change to use AppendCStringLiteral instead of AppendCharacter when
appropriate.

Bug: v8:11544
Change-Id: I01f22657b2c3e5aacbea790593d7e9f60076ec74
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3438379
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80622}
2022-05-19 01:22:23 +00:00
Frank Tang
972d7e5abf [Temporal] Add TimeZone getOffset(Nanoseconds|String)For
Also add the non-intl version of AO
GetIANATimeZoneOffsetNanoseconds which only implement for UTC.
(intl version implement other tz come later)

Also fix bug in JSTemporalTimeZone::offset_nanoseconds() that
"1000000L * offset_milliseconds()" may overflow int32_t before returning as int64_t by first casting offset_milliseconds() to int64_t in the operation so the whole formula is calculating under 64 bits not 32 bits. This bug fix some  *timezone-string-datetime tests.

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.timezone.prototype.getoffsetnanosecondsfor
https://tc39.es/proposal-temporal/#sec-temporal.timezone.prototype.getoffsetstringfor
https://tc39.es/proposal-temporal/#sec-temporal-getianatimezoneoffsetnanoseconds

Bug: v8:11544
Change-Id: I2227dbfc8d6ed3ef83edcef5a9b903b8642b5902
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3534622
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80606}
2022-05-18 07:15:48 +00:00
Frank Tang
4819584a2c [Temporal] Implement the iso8601 part of Calendar.prototype.era(Year)?
Spec text:
https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.era
https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.erayear

Notice this only implement the "iso8601" calendar and we will implement the
code for other calendar later by calling ICU with other Calendar methods.
This CL reduce the differences of testing result between ALWAYS and no_i18n
because the code in no_i18n will not call Calendar era or eraYear and therefore
passed the test even w/o this CL but the ALWAYS tests will cause Temporal
object to internal call era and eraYear and therefore fail if w/o this CL.

Bug: v8:11544
Change-Id: I921fbfbbd26473c238024161eb58b096c38b881b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3641938
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80513}
2022-05-13 09:01:23 +00:00
Frank Tang
988aa5139f [Temporal] Sync w/ PR2028
Sync to spec changes in
PR2028 Consistently call observable operations with undefined options
https://github.com/tc39/proposal-temporal/pull/2028

Bug: v8:11544
Change-Id: I850761e76ba1bb33f6c3b655a71163d1b68bb4c8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3633618
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80433}
2022-05-09 23:09:34 +00:00
Frank Tang
d36c7f1f8a [Temporal] Add TimeZone.prototype.getPossibleInstantsFor
Also add the basic version of GetIANATimeZoneEpochValue AO which only
implement UTC. Verison to support other TimeZone will come later w/ intl
work which depends on ICU.

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.timezone.prototype.getpossibleinstantsfor
https://tc39.es/proposal-temporal/#sec-temporal-getianatimezoneepochvalue

Bug: v8:11544
Change-Id: Ib603530d1c70f7a2b85691860a815d44b48eece2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3624980
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80406}
2022-05-07 00:25:33 +00:00
Frank Tang
187ecb8b72 Reland "[Temporal] Add TimeZone get*Transition and getPlainDateTimeFor"
This is a reland of commit 4251c285e6

Change the test262.status by moving test which passing on no_i18n
but not on ALWAYS:
1) Change the [FAIL] of that test in the ALWAYS section to [SKIP].
2) Add the same test the no_i18n section as [PASS]

Original change's description:
> [Temporal] Add TimeZone get*Transition and getPlainDateTimeFor
>
> Also add non-intl (only support UTC) version of AO:
> GetIANATimeZoneNextTransition, GetIANATimeZonePreviousTransition
> (support of other timezone in Intl will come later)
>
> Spec Text:
> https://tc39.es/proposal-temporal/#sec-temporal.timezone.prototype.getplaindatetimefor
> https://tc39.es/proposal-temporal/#sec-temporal.timezone.prototype.getnexttransition
> https://tc39.es/proposal-temporal/#sec-temporal.timezone.prototype.getprevioustransition
> https://tc39.es/proposal-temporal/#sec-temporal-getianatimezonenexttransition
> https://tc39.es/proposal-temporal/#sec-temporal-getianatimezoneprevioustransition
>
>
> Bug: v8:11544
> Change-Id: I17d5a60638dcd8543e5d9f22c6560b311f2f402a
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3534450
> Commit-Queue: Frank Tang <ftang@chromium.org>
> Reviewed-by: Adam Klein <adamk@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#80383}

Bug: v8:11544
Change-Id: Ieddadbc9d0708bda24f88dd2083b0dbe7dc1b9f3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3632607
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80405}
2022-05-06 20:30:53 +00:00
Frank Tang
9ae5bfa5b9 Reland "[Temporal] Add Calendar.prototype.yearMonthFromFields"
This is a reland of commit 2b140a9f96

Original change's description:
> [Temporal] Add Calendar.prototype.yearMonthFromFields
>
> Add AO: IsValidISOMonth, RegulateISOYearMonth, ISOYearMonthFromFields
> Spec Text:
> https://tc39.es/proposal-temporal/#sec-temporal-isvalidisomonth
> https://tc39.es/proposal-temporal/#sec-temporal-regulateisoyearmonth
> https://tc39.es/proposal-temporal/#sec-temporal-isoyearmonthfromfields
> https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.yearmonthfromfields
>
>
> Bug: v8:11544
> Change-Id: I1baadbbe54fb0c3fd45750eddb13b790465c3a3b
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3408773
> Commit-Queue: Frank Tang <ftang@chromium.org>
> Reviewed-by: Adam Klein <adamk@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#80384}

Bug: v8:11544
Change-Id: Ic5831c7094cd235526d93010cd722110f2951d77
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3631706
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80399}
2022-05-06 15:01:23 +00:00
Michael Achenbach
9b3bd2c81a Revert "[Temporal] Add TimeZone get*Transition and getPlainDateTimeFor"
This reverts commit 4251c285e6.

Reason for revert: Fails on CI bots:
https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Linux/46503/overview

Original change's description:
> [Temporal] Add TimeZone get*Transition and getPlainDateTimeFor
>
> Also add non-intl (only support UTC) version of AO:
> GetIANATimeZoneNextTransition, GetIANATimeZonePreviousTransition
> (support of other timezone in Intl will come later)
>
> Spec Text:
> https://tc39.es/proposal-temporal/#sec-temporal.timezone.prototype.getplaindatetimefor
> https://tc39.es/proposal-temporal/#sec-temporal.timezone.prototype.getnexttransition
> https://tc39.es/proposal-temporal/#sec-temporal.timezone.prototype.getprevioustransition
> https://tc39.es/proposal-temporal/#sec-temporal-getianatimezonenexttransition
> https://tc39.es/proposal-temporal/#sec-temporal-getianatimezoneprevioustransition
>
>
> Bug: v8:11544
> Change-Id: I17d5a60638dcd8543e5d9f22c6560b311f2f402a
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3534450
> Commit-Queue: Frank Tang <ftang@chromium.org>
> Reviewed-by: Adam Klein <adamk@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#80383}

Bug: v8:11544
Change-Id: Icfbb643578ac028b06aa07c3ac6bbce030f49390
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3630079
Auto-Submit: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#80386}
2022-05-06 06:13:12 +00:00
Michael Achenbach
4dc48c7841 Revert "[Temporal] Add Calendar.prototype.yearMonthFromFields"
This reverts commit 2b140a9f96.

Reason for revert: Need to revert parent CL.

Original change's description:
> [Temporal] Add Calendar.prototype.yearMonthFromFields
>
> Add AO: IsValidISOMonth, RegulateISOYearMonth, ISOYearMonthFromFields
> Spec Text:
> https://tc39.es/proposal-temporal/#sec-temporal-isvalidisomonth
> https://tc39.es/proposal-temporal/#sec-temporal-regulateisoyearmonth
> https://tc39.es/proposal-temporal/#sec-temporal-isoyearmonthfromfields
> https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.yearmonthfromfields
>
>
> Bug: v8:11544
> Change-Id: I1baadbbe54fb0c3fd45750eddb13b790465c3a3b
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3408773
> Commit-Queue: Frank Tang <ftang@chromium.org>
> Reviewed-by: Adam Klein <adamk@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#80384}

Bug: v8:11544
Change-Id: I1d93a25ee36b08d7a0bc86937d5b0a18ab6cdf86
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3632098
Auto-Submit: Michael Achenbach <machenbach@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#80385}
2022-05-06 06:12:10 +00:00
Frank Tang
2b140a9f96 [Temporal] Add Calendar.prototype.yearMonthFromFields
Add AO: IsValidISOMonth, RegulateISOYearMonth, ISOYearMonthFromFields
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal-isvalidisomonth
https://tc39.es/proposal-temporal/#sec-temporal-regulateisoyearmonth
https://tc39.es/proposal-temporal/#sec-temporal-isoyearmonthfromfields
https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.yearmonthfromfields


Bug: v8:11544
Change-Id: I1baadbbe54fb0c3fd45750eddb13b790465c3a3b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3408773
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80384}
2022-05-06 00:30:29 +00:00
Frank Tang
4251c285e6 [Temporal] Add TimeZone get*Transition and getPlainDateTimeFor
Also add non-intl (only support UTC) version of AO:
GetIANATimeZoneNextTransition, GetIANATimeZonePreviousTransition
(support of other timezone in Intl will come later)

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.timezone.prototype.getplaindatetimefor
https://tc39.es/proposal-temporal/#sec-temporal.timezone.prototype.getnexttransition
https://tc39.es/proposal-temporal/#sec-temporal.timezone.prototype.getprevioustransition
https://tc39.es/proposal-temporal/#sec-temporal-getianatimezonenexttransition
https://tc39.es/proposal-temporal/#sec-temporal-getianatimezoneprevioustransition


Bug: v8:11544
Change-Id: I17d5a60638dcd8543e5d9f22c6560b311f2f402a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3534450
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80383}
2022-05-06 00:29:09 +00:00
Frank Tang
3f10a72c2f [Temporal] Use MAYBE_ASSIGN_RETURN_ON_EXCEPTION_VALUE
1. Move the use of MAYBE_RETURN to MAYBE_ASSIGN_RETURN_ON_EXCEPTION_VALUE
if possible.
2. Remove some MYABE_RETURN in the wrong spot and therefore fix some tests.
3. Change Intl::GetTimeZoneIndex() to return Maybe<int32_t> as index and use
< 0 value to indicate not getting index to make the function signature
simpler.

Bug: v8:11544
Change-Id: I685cbff142e9dea69ef316a1bc180730aef5aec8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3625839
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80379}
2022-05-05 18:29:29 +00:00
Frank Tang
c8c0632388 [Temporal] Add Calendar.prototype.dateAdd
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.dateadd

is not yet implemented.

Note: The intl version stated in
https: //tc39.es/proposal-temporal/#sup-temporal.calendar.prototype.dateadd
Bug: v8:11544
Change-Id: Id7fd043d234f559c0e03bdf3f0f31d8bc91da27f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3609208
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80364}
2022-05-05 07:29:30 +00:00
Frank Tang
904b372be3 [Temporal] (Calendar|TimeZone).prototype.toJSON
Also change the macro to pass method name directly to CHECK_RECEIVER()
Remove MACROs which has up to only two usage.
Sync with changes in
https://github.com/tc39/proposal-temporal/pull/1693

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.tojson
https://tc39.es/proposal-temporal/#sec-temporal.timezone.prototype.tojson

Bug: v8:11544
Change-Id: I31f4ef6f725462da885893f1266d30590098b031
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3438378
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80363}
2022-05-05 06:02:39 +00:00
Frank Tang
bf54cc83a5 [Temporal] Add monthDayFromFields to Calendar
Add AO: ISOMonthDayFromFields
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.monthdayfromfields
https://tc39.es/proposal-temporal/#sec-temporal-isomonthdayfromfields

Bug: v8:11544
Change-Id: I8a04a8e61af8abdb902de33efbf5635b8e8300aa
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3408576
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80360}
2022-05-04 23:02:58 +00:00
Frank Tang
10bbb38fed [Temporal] Add Temporal.Calendar.prototype.month
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.month

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

Bug: v8:11544
Change-Id: Ibbbb00faa0bdb4d49784cd9aae69fb779d95f924
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3531554
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80359}
2022-05-04 21:35:58 +00:00
Frank Tang
2dd3cc3054 [Temporal] Add TimeZone.prototype.getInstantFor
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal-totemporaldatetime
https://tc39.es/proposal-temporal/#sec-temporal-totemporaldisambiguation

Bug: v8:11544
Change-Id: Ibb38f807386c4e213bfd2bb568911a96a17cf1be
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3623196
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80350}
2022-05-04 00:00:37 +00:00
Frank Tang
08a5a57311 [Temporal] Add Temporal.Calendar.prototype.monthCode
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.monthcode

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

Bug: v8:11544
Change-Id: I52dfc1bda6d2ed8c0aba735c64d7ae8227844ed1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3531555
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80348}
2022-05-03 21:07:47 +00:00
Frank Tang
97122a4838 [Temporal] Add Temporal.Calendar.prototype.day
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.day

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

Bug: v8:11544
Change-Id: If56182cf65b3b8cc91ed843f0e20edeb6a065954
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3531556
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80347}
2022-05-03 19:58:20 +00:00
Camillo Bruni
e3e8ea5d65 [flags] Rename --opt to --turbofan
To be consistent with the all the other tiers and avoid confusion, we
rename --opt to ---turbofan, and --always-opt to --always-turbofan.

Change-Id: Ie23dc8282b3fb4cf2fbf73b6c3d5264de5d09718
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3610431
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Jakob Linke <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80336}
2022-05-03 12:10:30 +00:00
Frank Tang
f09026a6f2 [Temporal] Add PlainDateTime.from
Also add AOs: ToTemporalDateTime, ParseTemporalDateTimeString,
InterpretTemporalDateTimeFields

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime.from
https://tc39.es/proposal-temporal/#sec-temporal-totemporaldatetime
https://tc39.es/proposal-temporal/#sec-temporal-parsetemporaldatetimestring
https://tc39.es/proposal-temporal/#sec-temporal-interprettemporaldatetimefields

Bug: v8:11544
Change-Id: I3cf5c7c0f876dd8f384d62a47d7b24d8780bf03f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3538667
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80240}
2022-04-27 23:39:04 +00:00
Frank Tang
2ae06b31b5 [test262] Roll test262
33a5433d..8f5c7aed09

Bug: v8:7834
Change-Id: I0b1419127becef463044a5c1b62fb45a2a9569ac
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3606546
Commit-Queue: Frank Tang <ftang@chromium.org>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80232}
2022-04-27 17:18:51 +00:00
Frank Tang
f47452080c [intl] NumberFormat v3 sync w/ spec PR 85 and 91
PR85 https://github.com/tc39/proposal-intl-numberformat-v3/pull/85
Throw RangeError while roundingIncrement is not 1 and
minimumFractionDigits != maximumFractionDigits
Test by new test cases in intl/number-format/rounding-increment-v3.js

Add more unit test to check the resolved options of roundingIncrement,
minimumFractionDigits, and maximumFractionDigits.

PR91 https://github.com/tc39/proposal-intl-numberformat-v3/pull/91
Throw TypeError instead of RangeError while roundingIncrement is not 1
and RoundingType is not fractionDigits
Test by intl402/NumberFormat/constructor-roundingIncrement-invalid.js
in test262

Bug: v8:10776
Change-Id: I071bfe8b3e844c5999144d74bb5f79ea9811e37b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3603059
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80196}
2022-04-26 20:50:43 +00:00
Frank Tang
9143c55387 [Temporal] Add Temporal.Duration.from
Also add AOs:
IsIntegralNumber, ToIntegerWithoutRounding, ToTemporalDurationRecord,
ToTemporalDuration, ParseTemporalDurationString, CreateDurationRecord

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.duration.from
https://tc39.es/ecma262/#sec-isintegralnumber
https://tc39.es/proposal-temporal/#sec-temporal-totemporaldurationrecord
https://tc39.es/proposal-temporal/#sec-temporal-totemporalduration
https://tc39.es/proposal-temporal/#sec-temporal-parsetemporaldurationstring
https://tc39.es/proposal-temporal/#sec-temporal-createdurationrecord

Bug: v8:11544
Change-Id: I0f4176921e088bd2f2fd48ddd28f22f3b454bd3b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3379233
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80195}
2022-04-26 20:09:13 +00:00
Frank Tang
07601b124e [Temporal] Add Calendar.prototype.dateUntil
Also add AOs: ToLargestTemporalUnit, ToISODayOfYear, RegulateISODate,
AddISODate, DifferenceISODate

Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.dateuntil
https://tc39.es/proposal-temporal/#sec-temporal-tolargesttemporalunit
https://tc39.es/proposal-temporal/#sec-temporal-toisodayofyear
https://tc39.es/proposal-temporal/#sec-temporal-regulateisodate
https://tc39.es/proposal-temporal/#sec-temporal-addisodate
https://tc39.es/proposal-temporal/#sec-temporal-differenceisodate

Bug: v8:11544
Change-Id: I03a28bf07ddfae036491e49cb06278d050ddebf6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3534620
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80166}
2022-04-26 06:49:32 +00:00
Frank Tang
5c3627754e [Temporal] Add Calendar.prototype.fields
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.fields


Bug: v8:11544
Change-Id: I8df987ddbbf08372da637d7c4620c428fce97cae
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3534619
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80127}
2022-04-22 21:50:26 +00:00
Frank Tang
3ae42771de [intl] Fix arm64-N5X failure in NumberFormat v3 due to precision issue
Use the new ICU 71-1 API

Precision::incrementExact
https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/classicu_1_1number_1_1Precision.html#aedfb413e5a37c69868594c870a87134b

Change-Id: I6d8841e5a07972d1be36026ce150eb83dbf300e7
Cq-Include-Trybots: luci.v8.try:v8_android_arm64_n5x_rel_ng
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3430378
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80126}
2022-04-22 21:42:15 +00:00
legendecas
9135859a91 [ShadowRealm] Implement ShadowRealm.prototype.importValue
As per https://tc39.es/ecma262/#sec-hostimportmoduledynamically defined,
referencingScriptOrModule in HostImportModuleDynamically can be a Script
Record, a Module Record, or null.
So to https://tc39.es/proposal-shadowrealm/#sec-shadowrealmimportvalue,
the HostImportModuleDynamicallyCallback is been invoked with a `null`
resource_name. This may not be considered a breaking change as the
parameter resource_name is defined as Local<Value>.

Updates d8's DoHostImportModuleDynamically to handle null resource_name,
and resolve the dynamically imported specifier relative to the executing
script's origin. In this way, we have to set ModuleEmbedderData.origin
even if the JavaScript source to be evaluated is Script. Also, a
ModuleEmbedderData is created for each ShadowRealm to separate their
module maps from the initiator context's.

Bug: v8:11989
Change-Id: If70fb140657da4f2dd92eedfcc4515211602aa46
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3522883
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Chengzhong Wu <legendecas@gmail.com>
Cr-Commit-Position: refs/heads/main@{#80118}
2022-04-22 15:04:26 +00:00
Frank Tang
7a919fe25f [Temporal] Add ZoneDateTime.prototype.offset*
Spec Text:
https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.offset
https://tc39.es/proposal-temporal/#sec-get-temporal.zoneddatetime.prototype.offsetnanoseconds

Bug: v8:11544
Change-Id: Ia88d96b038117a8e528ff9d0cdb9a07fb7cbcda5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3385606
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80096}
2022-04-21 20:24:35 +00:00
Frank Tang
c9617b66fd [test262] Roll test262
d7c0a207..33a5433d

Bug: v8:7834
Change-Id: I2c10e4470bf02de864666fa7410ce472a42b8359
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3585357
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80006}
2022-04-18 18:10:46 +00:00
Shu-yu Guo
1ac9280d50 Do not consult Symbol.species when constructing TypedArray from TypedArrays
Bug: v8:12744
Change-Id: I3e356c16554e8bc19afc06b18f4afd7fed2f228e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3563540
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Auto-Submit: Shu-yu Guo <syg@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79833}
2022-04-06 18:57:18 +00:00
Frank Tang
519267b325 [Temporal] Add Calendar.prototype.mergeFields
Add AO: DefaultMergeFields
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.mergefields
https://tc39.es/proposal-temporal/#sec-temporal-defaultmergefields


Bug: v8:11544
Change-Id: I270f8bffb79e57ef50736ae7ce87cfa53f9cafb1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3388428
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79795}
2022-04-06 05:30:23 +00:00
Frank Tang
dda56765dc [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/+/3408462
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79793}
2022-04-06 02:59:03 +00:00
Shu-yu Guo
908e7ac767 [typedarray] Remove per-iteration detach check in TypedArray.prototype.set
Bug: v8:12750, v8:11111
Change-Id: I3e9947ec8e2883364178b497a49299a3a96332e4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3569879
Reviewed-by: Marja Hölttä <marja@chromium.org>
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79792}
2022-04-06 02:28:33 +00:00
Shu-yu Guo
f3dfbe59ed [typedarray] Remove per-comparator call detach check in TypedArray.prototype.sort
For the normative change, see https://github.com/tc39/ecma262/pull/2723

Bug: v8:12750, v8:11111
Change-Id: I8e8a2e9b443622b20bb5a4c2d453f782dfbd2ed6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3570865
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Reviewed-by: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79789}
2022-04-06 00:56:03 +00:00
Shu-yu Guo
a464158091 Roll Test262
4c7c24646a..d7c0a2076c

Bug: v8:7834, v8:10776, v8:11544, v8:12744, v8:12750
Change-Id: I782a347833af3418ff5c15562ae24f213375b539
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3573067
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Auto-Submit: Shu-yu Guo <syg@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79788}
2022-04-05 23:12:03 +00:00
Frank Tang
b214cb7d72 [Temporal] Add Calendar.prototype.daysInWeek
Spec Text:
https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.daysinweek

Note- this is only the non-intl version. intl version in
https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.daysinweek
will be implemented in later cl.

Bug: v8:11544
Change-Id: If54733ae7c902b4d189fc22b0800942f8748981c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3439186
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79721}
2022-04-02 01:50:20 +00:00
Frank Tang
63f9f0fab5 [Temporal] Add Calendar.prototype.daysInMonth
Spect Text:
https://tc39.es/proposal-temporal/#sec-temporal.calendar.prototype.daysinmonth

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

Bug: v8:11544
Change-Id: Id5d426d9c5fe1db94c15433afbad443c7056abe3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3441703
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79720}
2022-04-01 22:22:30 +00:00