Commit Graph

87 Commits

Author SHA1 Message Date
Luis Fernando Pardo Sixtos 2020cfbe66 [decorators] Support private auto-accessors
Support for the accessor keywords for private class fields as part of
the decorators proposal.

Changes to AST:

- Add an AUTO_ACCESSOR value to the ClassLiteralProperty::Kind enum.
- Add an AutoAccessorInfo class to be used in ClassLiteralProperty
  objects of kind AUTO_ACCESSOR to hold the information about the
  generated getters/setters and backing storage.
- Add AutoAccessorGetterBody and AutoAccessorSetterBody statements to
  implement the logic of generated getters and setters.

Changes to Parser:
- Add logic to parse the "accessor" keyword and throw when used on non
  field class properties.
- Add preparser logic to mock the function scopes and variable
  declarations required for the generated getters/setters.
- Add parser logic to synthetically create statements for the
  generated setters/getters. 

Changes to the Bytecode Generator:
- Add logic to BuildClassLiteral to build auto accessor storage
  private names.
- Add logic to set the generated getters/setters in the accessor pair.
- Add logic to initialize the accessor storage in BuildClassProperty.
- Add AutoAccessorGetterBody and AutoAccessorSetterBody visitors.

Tests:
- Add parsing-unittests for parsing converage.
- Add test262 tests for functionality coverage.
- Add test-debug test for devtools support coverage.

Bug: 42202709
Change-Id: Ibb9bee3bbd0c09341108856f969e0c22bbb8b9cc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5547688
Reviewed-by: Seth Brenith <seth.brenith@microsoft.com>
Commit-Queue: Luis Pardo <lpardosixtos@microsoft.com>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#95612}
2024-08-13 19:35:08 +02:00
Philip Chimento 3b89be9c5d Temporal: Fix Japanese era test
This mistakenly used a previous name for the helper function. Also adds
a couple of debugging messages.
2024-07-29 14:17:24 +02:00
André Bargull 7f81bb2126 Allow canonical era codes for Japanese era test 2024-07-25 11:59:15 -07:00
André Bargull a238ad6a1e Move test for dates before start of the Japanese era into a new file
See also <https://github.com/tc39/proposal-temporal/issues/2865>
requesting for more information how this case should actually be
handled.
2024-07-25 11:59:15 -07:00
André Bargull 0ff7881d75 Use explicit relative paths 2024-07-10 16:02:53 +02:00
Philip Chimento cb13595617 Temporal: Add staging test to check June 2024 API removals
This test should trip if an implementation forgets to perform the removals
that reached consensus in June 2024. (Although such an implementation
would technically comply with the specification, if you really need to do
that, please open an issue on the Temporal proposal repo rather than just
skiplisting this test.)
2024-07-05 10:43:53 +02:00
Philip Chimento bbfcfd59b0 Temporal: Port staging tests that require non-ISO calendar or non-UTC time zone
As in the previous commit, without custom calendars and time zones, some
functionality cannot be tested on implementations that don't have any
other calendars and time zones than iso8601 and UTC.

Some of the staging tests fall in this category. We take the opportunity
to port these into proper tests, in the intl402/ folder.
2024-07-05 10:43:53 +02:00
Philip Chimento efc7424844 Temporal: Don't use getISOFields() in other tests
Previously getISOFields() was used to get the exact value of the
[[Calendar]] and [[TimeZone]] internal slots, as well as to get the
reference ISO year for PlainMonthDay and reference ISO day for
PlainYearMonth.

Use calendarId and timeZoneId for the former and toString() for the
latter.
2024-07-05 10:43:53 +02:00
Philip Chimento 9671c4a613 Temporal: Test adjustments for removing calendar and time zone objects 2024-07-05 10:43:53 +02:00
Philip Chimento 7d970fbe4e Temporal: Remove fake West Coast and Samoa time zones from TemporalHelpers
It's no longer possible to fake built-in time zones using custom objects.
So testing DST shifts will have to use real built-in time zones. Replace
TemporalHelpers.springForwardFallBackTimeZone with America/Vancouver (it
was modelled on the DST transitions in 2000) and
TemporalHelpers.crossDateLineTimeZone with Pacific/Apia (it was modelled
on the 2011 switch to the other side of the international date line.)

These tests have to move to the intl402/ folder since non-Intl-aware
implementations are allowed (but not required) to support any built-in
time zones other than UTC.
2024-07-05 10:43:53 +02:00
Philip Chimento c728e6d89e Temporal: Fix tests that unnecessarily create TimeZone or Calendar instances
In many cases we created a TimeZone or Calendar instance from a built-in
time zone or calendar. These tests can be trivially adapted to just use
the string ID.
2024-07-05 10:43:53 +02:00
Philip Chimento ea2268aa43 Temporal: Remove tests directly relating to custom calendar and time zones
These are tests that just won't apply anymore without custom calendars and
time zones.
2024-07-05 10:43:53 +02:00
Philip Chimento 1213ab17ec Temporal: Remove getCalendar and getTimeZone methods
Temporarily replace them with getISOFields().calendar/timeZone just to
keep the tests running until we remove Calendar and TimeZone objects
altogether.

See: tc39/proposal-temporal#2826
2024-07-05 10:43:53 +02:00
Philip Chimento c22fbc7b45 Temporal: Port staging tests that use next/previousTransition
See: tc39/proposal-temporal#2826
2024-07-05 10:43:53 +02:00
Philip Chimento 3f805a1383 Temporal: Test calendar canonicalization in Temporal
Following the upstream ECMA-402 change tested in the previous commit, add
test coverage for the corresponding functionality in Temporal. Fix one
test that was erroneous.
2024-07-04 11:14:16 +02:00
Philip Chimento 6626b60df6 Temporal: Make U+2212 MINUS SIGN invalid in ISO strings
These are the test adjustments corresponding to the normative PR
https://github.com/tc39/ecma262/pull/3334 which reached consensus at the
June 2024 TC39 meeting.
2024-07-03 08:50:57 -07:00
Shu-yu Guo 29c6f7028a [top-level-await] Sync implementation with spec text
The module evaluation machinery has undergone non-trivial refactoring
since implementation. Sync up the comments and code for maintenance.

Notably,

- Actually use the kEvaluatingAsync status (previously conflated under
  kEvaluated)
- [[IsAsyncEvaluating]] -> [[IsAsyncEvaluation]]
- GatherAsyncParentCompletions -> GatherAvailableAncestors
- async -> has_toplevel_await
- kAsyncModule -> kModuleWithTopLevelAwait

Bug: 347060515
Change-Id: Ia2c35d5b42ee9f58db841cdfcaef9d17b018c9c6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5636701
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94591}
2024-06-21 23:23:02 +02:00
Philip Chimento 58df8fb22a Temporal: Remove methods with ISO-named pairs
See tc39/proposal-temporal#2846
2024-06-13 22:04:16 +02:00
Philip Chimento 3c28e3a359 Temporal: Remove Plain/ZonedDateTime to PlainYearMonth/MonthDay APIs
See tc39/proposal-temporal#2848
2024-06-13 22:04:16 +02:00
Philip Chimento 1c900ca59c Temporal: Remove epoch seconds and epoch microseconds APIs
See: tc39/proposal-temporal#2849
2024-06-13 22:04:16 +02:00
Philip Chimento a9c223c60e Temporal: Remove withPlainDate() methods
See tc39/proposal-temporal#2847.
2024-06-13 22:04:16 +02:00
Philip Chimento ea4945c66f Temporal: Remove tests using relativeTo in Duration.p.add/subtract
See tc39/proposal-temporal#2825. This is a mass removal of tests that use
this functionality, in a separate commit for ease of review. Further
adjustments will be made in the following commit.
2024-06-13 13:54:46 +02:00
André Bargull 2496577225
Fix strict mode errors in Temporal staging test (#4100) 2024-05-30 16:07:35 +02:00
Luis Fernando Pardo Sixtos e394ebb6fc [decorators] Add flag, accessor keyword and token
This change doesn't do any functionality changes.

Bug: 42202709
Change-Id: I613b96b6e7630e10748e31162080a61e7da4c2a1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5542951
Commit-Queue: Luis Pardo <lpardosixtos@microsoft.com>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94086}
2024-05-27 09:22:09 +02:00
test262-merge-bot 0eb7f6eccb
Merge branch 'main' into chromium-export-7eb56ce860 2024-05-19 12:19:57 +02:00
Rezvan Mahdavi Hezaveh 081808bebd [explicit-resource-management] Add adopt and defer
This CL adds adopt() and defer() to DisposableStack
prototype.

Bug: 42203506
Change-Id: I556b96a0cf42595acdd483b0a02aef9ca41bd0bc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5512877
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Rezvan Mahdavi Hezaveh <rezvan@chromium.org>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93930}
2024-05-15 23:18:28 +02:00
Rezvan Mahdavi Hezaveh fb7ab87dd5 [explicit-resource-management] Add move and disposed getter
This CL adds move() function and a getter for disposed to
DisposableStack prototype.

Bug: 42203506
Change-Id: I8d7750b1d4aa199ebeb997bde7fe6d06c9ccbff0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5528992
Commit-Queue: Rezvan Mahdavi Hezaveh <rezvan@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93931}
2024-05-15 13:19:32 -07:00
Philip Chimento e02220badd Temporal: Move some round() and total() tests out of staging
Including tests for every possible combination of largest and smallest
unit, for each type of relativeTo (undefined, PlainDate, ZonedDateTime).
2024-05-14 09:24:12 +02:00
Philip Chimento 96e31e7e28 Temporal: Tests for round() and since()/until() using the same code path
This should produce all the same results (except for a change to weeks
balancing in round(), which is now more consistent with since()/until())
but leads to different observable user code calls.

See https://github.com/tc39/proposal-temporal/issues/2742
2024-05-14 09:24:12 +02:00
Rezvan Mahdavi Hezaveh 9b4c6577f6 [explicit-resource-management] Add DisposableStack constructor, use
and dispose method

This CL adds DisposableStack constructor, use() and dispose() methods
as developer exposed methods. Also, this CL fixed the use
of `using` keyword with `null` and `undefined` and adds tests for them.

Bug: 42203506
Change-Id: If50b9e33d9cbb3de2be41dc81e656d9d202b8fa8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5498999
Commit-Queue: Rezvan Mahdavi Hezaveh <rezvan@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93807}
2024-05-09 00:18:17 +02:00
Rezvan Mahdavi Hezaveh 27b6e4500f [explicit-resource-management]Add exception handling to sync ERM
This CL adds exception handling to the implementation of sync
explicit management proposal.

Bug: v8:13559
Change-Id: I2f4ffea432057b753634c2af4801f9dc48edac43
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5405985
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Rezvan Mahdavi Hezaveh <rezvan@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93620}
2024-04-26 20:18:23 +02:00
Philip Chimento d865ffeb2d Use correct keys in non-iso-calendars.js
Using Object.keys() of the expected values in each case decouples these
tests.
2024-04-10 08:37:31 -07:00
Philip Chimento bce41ea609 Reduce locale-dependence in non-iso-calendars.js
Previously, this test checked for a particular format. This would break
depending on which engine executed it. Instead, test for the presence of
particular types and their values in the output of formatToParts().

(There's an existing comment which suggests that this should already have
been testing formatToParts().)
2024-04-10 08:37:31 -07:00
Philip Chimento 9537de33af Remove performance logging from non-iso-calendars.js staging test
The performance logging was left over from when this test lived in the
proposal-temporal repo. It was already switched off anyway.
2024-04-10 08:37:31 -07:00
Adam Shaw 6c35fba9b2 adjust tests for round-zdt-day bugfix 2024-04-08 18:24:26 -07:00
Rezvan Mahdavi Hezaveh db7c0d1499 [explicit-resource-management] Add using in bytecode generator
This CL adds `using` to bytecode generator. This CL does not include exception handling and JSDisposableStack methods.
Also, since `using` and `const` have the same behavior (except for disposing resources), we add required checks to the existing code.

Bug: v8:13559
Change-Id: I1d169859cc2a3e16c7cc9078219d5e4a466f4560
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5270855
Commit-Queue: Rezvan Mahdavi Hezaveh <rezvan@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93014}
2024-03-25 19:18:58 +01:00
Rezvan Mahdavi Hezaveh 45e740928f [test262] Add staging test for RegExp named groups (search)
This CL adds a staging test for testing test262 bot.

Bug: v8:13173
Change-Id: Id8982a3d18bca219133f672736064e4d57d6da59
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5294455
Reviewed-by: Liviu Rau <liviurau@chromium.org>
Commit-Queue: Liviu Rau <liviurau@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92372}
2024-02-16 18:21:13 +01:00
Rezvan Mahdavi Hezaveh 903f7fc74d [test262] Add staging test for RegExp named groups (replace)
This CL adds a staging test for testing test262 bot.

Bug: v8:13173
Change-Id: Id24a5b5665bbc491acd59c16ede80d6780bbd4b2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5293730
Commit-Queue: Liviu Rau <liviurau@google.com>
Reviewed-by: Liviu Rau <liviurau@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92363}
2024-02-16 16:18:20 +01:00
Rezvan Mahdavi Hezaveh 6f7ae1f311 [test262] Add new staging test for RegExp named groups
This CL adds a staging test for testing test262 bot.

Bug: v8:13173
Change-Id: I7f3d3aa3fbcf30b08cf3ebf2c61a683b7d2cf7c6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5281634
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Liviu Rau <liviurau@google.com>
Cr-Commit-Position: refs/heads/main@{#92345}
2024-02-15 16:48:14 +01:00
Igor Sheludko f742eb092d [test262] Add a new staging test for Array.p.flatMap
Bug: v8:14306
Change-Id: Ibc7a04288a0c31bfcf601aa864e02b6c067045c2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5259306
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92174}
2024-02-05 15:05:01 +01:00
Philip Chimento 99d5bc8c1b Temporal: Limit duration years, months, and weeks to <2³² each 2024-01-31 08:22:05 -08:00
Philip Chimento 092337c8d0 Temporal: Adapt tests to upper bound on time portion of durations
Adapts or removes tests that relied on creating durations that are now out
of range. Adds new tests for maximum in-range and minimum out-of-range
durations.
2024-01-31 08:22:05 -08:00
Justin Grant a1ba783ca3 Add 402 staging tests: Islamic & Persian calendars
Tests the changes in https://github.com/tc39/proposal-temporal/pull/2743
2024-01-12 16:42:31 -08:00
Rezvan Mahdavi Hezaveh 467a0fe68f [test262] Add staging tests for isSubsetOf set method
This CL adds three tests to staging directory of test262.

Bug: v8:13556
Change-Id: Id6e468a0fa29528350a10c94e9dd19c2835788e8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5055866
Reviewed-by: Liviu Rau <liviurau@chromium.org>
Commit-Queue: Liviu Rau <liviurau@google.com>
Cr-Commit-Position: refs/heads/main@{#91139}
2023-11-27 18:49:17 +01:00
Philip Chimento e43e20a885 Temporal: Remove BigInt arithmetic and loops in BalanceDurationRelative
A few results change because the algorithm previously used for rounding
didn't always add duration units to dates in RFC 5545 order, and we also
introduce a special case for rounding with largestUnit years or months and
smallestUnit weeks.
2023-11-16 11:08:42 -08:00
Philip Chimento 93304c7571 Tests for Duration rounding bug when rounding crosses a unit boundary
See https://github.com/tc39/proposal-temporal/issues/2563

The old behaviour was encoded in one test in staging, but the behaviour of
largestUnit in duration rounding has changed since that test was written.
Therefore I'm assuming that toString() should've been updated when that
happened.
2023-11-14 10:03:45 -08:00
Liviu Rau 8162f8c58f [test262] Add set method tests to staging
Reland https://crrev.com/c/4913993

This CL adds three tests from test methods tests to staging
directory with correct format.

Bug: v8:13556
Change-Id: I93817eb84e077436071dbae98bc800dd58851f91
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4983674
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Liviu Rau <liviurau@google.com>
Cr-Commit-Position: refs/heads/main@{#90645}
2023-10-27 19:28:54 +02:00
Justin Grant 0c87a86b58 Disallow sub-minute annotations in Instant strings
Adds tests that verify that Instant strings cannot include offset time
zone annotations with sub-minute units.

Also removes a few staging test cases that, due to a polyfill bug, were
incorrectly passing.
2023-08-10 15:45:34 +02:00
Justin Grant 66f3959c14 Remove a sub-minute offset test
There was one remaining Temporal test that was parsing an ISO string
with a sub-minute offset into a Temporal.TimeZone. A polyfill bug was
allowing this test case to pass, even though after
tc39/proposal-temporal#2607 it should have failed.

This commit removes the bad test case.
2023-08-09 11:37:39 -07:00
Justin Grant 6f146e6f30 Limit offset time zones to minute precision
Modify/add tests for https://github.com/tc39/proposal-temporal/pull/2607
2023-07-18 17:44:19 +02:00