Commit graph

97710 commits

Author SHA1 Message Date
Jonas Termansen f4f557345c [infra] Reland "Begin RBE Linux x64 support."
Bug: b/296994239
Change-Id: I179cc7729846885ee952d26082a1e615a46a30b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331923
Commit-Queue: Jonas Termansen <sortie@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-10-24 14:36:19 +00:00
Chloe Stefantsova 439b79fb80 [cfe] Report contravariant type variable use in extension types
Closes https://github.com/dart-lang/sdk/issues/53803
Part of https://github.com/dart-lang/sdk/issues/49731

Change-Id: I348f6c84aa61eddae306faa96a560b4960724462
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331242
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2023-10-24 13:43:35 +00:00
Martin Kustermann f45815883e [gardening] Remove lib{,_2}/mirrors/typedef_test
This test has flaked on our CI but actually it's consistently failing
because we do not represent `typedef`s in a reflective way in the VM
since switching to kernel (because they used to be desguared on kernel
level).

So this has not been working for a long time, let's remove this test.

Issue https://github.com/dart-lang/sdk/issues/44489

Change-Id: I36e8d8aee7a7736e8afc5741b01d10429ac0d7a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331941
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2023-10-24 12:17:03 +00:00
Ömer Sinan Ağacan 1b426ea6f8 [dart2wasm] Fix string array copy in UTF8 decoder
Bug introduced with [1] and broke the Flutter engine [2].

[1]: https://dart-review.googlesource.com/c/sdk/+/331187
[2]: https://github.com/flutter/flutter/issues/137120

Change-Id: I334db1bbf1440b53b7a7856f16a0e116d82efae5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331922
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-10-24 12:02:48 +00:00
Chloe Stefantsova 75920dd24b [cfe] Report error on trailing comma in extension type declarations
Part of https://github.com/dart-lang/sdk/issues/53625
Part of https://github.com/dart-lang/sdk/issues/49731

Change-Id: I793ef6329d99b1a4e829491f454f42c2ede941b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331185
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-10-24 11:59:22 +00:00
Chloe Stefantsova 67d45616c6 [cfe] Report error on bottom type used as representation type
Closes https://github.com/dart-lang/sdk/issues/53824
Part of https://github.com/dart-lang/sdk/issues/49731

Change-Id: I79776eb4f8b736f518898adff1078461895269f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331660
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2023-10-24 10:28:09 +00:00
Jens Johansen 216d98555c [CFE] Mark strong/extension_types/inherited_representation_field as semiFuzzFailureOnForceRebuildBodies
Closes https://github.com/dart-lang/sdk/issues/53805

Change-Id: I093d32a9b2a9fbf26fef475e18a1fb67d575758e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331880
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2023-10-24 10:01:58 +00:00
sgrekhov 5315b1dc6b [co19] Roll co19 to 5d40729f9d7e6c97d7449a7647e1aab6e76f1818
2023-10-23 sgrekhov22@gmail.com Fixes dart-lang/co19#2319. Fix roll failures (dart-lang/co19#2321)
2023-10-23 sgrekhov22@gmail.com dart-lang/co19#1400. [Extension types] Add more top types tests (dart-lang/co19#2322)
2023-10-18 sgrekhov22@gmail.com dart-lang/co19#1400. [Extension types] Add more superinterfaces tests (dart-lang/co19#2315)
2023-10-18 sgrekhov22@gmail.com dart-lang/co19#2291. Add more Link.createSync() tests. Part 2 (dart-lang/co19#2316)
2023-10-17 sgrekhov22@gmail.com Fixes dart-lang/co19#2304. Add more `Object` member tests (dart-lang/co19#2312)
2023-10-17 sgrekhov22@gmail.com dart-lang/co19#2313. Fix expected static type in upper_bound_A01_t05.dart (dart-lang/co19#2314)

Change-Id: Id5279b7bad5e45c7e8a5d2fa7cbffe49bd1b2093
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331860
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-10-24 09:24:32 +00:00
Chloe Stefantsova 9e36a864ee [cfe] Report errors on super formal parameters in extension types
Closes https://github.com/dart-lang/sdk/issues/53212
Part of https://github.com/dart-lang/sdk/issues/49731

Change-Id: I4f209ab220bb0a47328a60d91e66a891d8fc1362
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331048
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-10-24 08:43:39 +00:00
Devon Carew 4c59616508 [deps] rev package:protobuf
This brings in ~18 new commits:

c559fe5273..050c1620a9

Change-Id: I72fddb8feae2d794c890b4ada87b170f493738f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331743
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2023-10-23 21:21:30 +00:00
Paul Berry 6c9dbb35b5 Front end: fix promotion of fields accessed through mixin applications.
When a field is declared in a mixin, the front end creates a synthetic
getter in the mixin application class that gets the value of the mixed
in field. So if a piece of code accesses the mixed in field through
the mixin application class rather than through the mixin directly,
the resolved member is the synthetic getter rather than a field.

In order to ensure that the field remains promotable even if it is
accessed through the mixin application, the logic in
`OperationsCfe.isPropertyPromotable` needs to be changed so that it
doesn't treat these synthetic getters as non-promotable. The old logic
was essentially this:

1. If the property is not private, it's not promotable.

2. Otherwise, if the property is listed in
   `FieldNonPromotabilityInfo.fieldNameInfo`, it's not
   promotable. (This happens either if the property is not promotable
   for an intrinsic reason, such as being a non-final field or a
   concrete getter, or if it has the same name as a non-promotable
   property elsewhere in the library).

3. Otherwise, if the property is a getter that was lowered from an
   abstract field, it's promotable.

4. Otherwise, if the property is a getter that was lowered from a late
   field, it's promotable.

5. Otherwise, the property isn't promotable. (This was intended to
   cover the case where the property is an abstract getter
   declaration).

(Although conditions 3 and 4 were tested first, since they are more
efficient to test).

It turns out that once conditions 1-2 have been ruled out, the
property must have been declared as a method (which is being torn
off), a private abstract getter, or a (possibly abstract) non-external
private final field. Of these three possibilities, only the last is
promotable. So this can be simplified to:

(conditions 1-2 as above)

3. Otherwise, if the property is a method tear-off, it's not promotable.

4. Otherwise, if the property is an abstract getter, it's not promotable.

5. Otherwise, the property is promotable.

This makes the logic easier to follow, since conditions 1-4 are now
all reasons for non-promotability (rather than a mix of promotability
and non-promotability reasons). It also conveniently addresses the
problem with fields accessed through mixin applications, since they
aren't excluded by any of conditions 1-4.

(We still test conditions 3 and 4 first, since they are more efficient
to test.)

Fixes #53742.
Fixes #53617.
Fixes #53436.

Change-Id: I64df269c2a4a0714f9be239d832b61f4fb6a1a43
Bug: https://github.com/dart-lang/sdk/issues/53742
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330168
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-10-23 20:24:34 +00:00
Ben Konyi 51dde069b2 [ package:dds ] Prepare for 3.0.0 release
- Fixes typo in CHANGELOG.md
- Reverts vm_service version bump to ^12.0.0 as it's not needed for this
  breaking change

Change-Id: Ib9251dac0af4958d72fcb341490643bfe0f7a21a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331800
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-10-23 19:38:33 +00:00
Brian Quinlan 4122919684 Remove documentation that indicates that the maximum received datagram size is 64K.
Bug:https://github.com/dart-lang/sdk/issues/31733
CoreLibraryReviewExempt:documentation-only
Change-Id: Icde611deb9a0172a5caacf518e9ce01904baf8ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331422
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-10-23 19:37:40 +00:00
Sergey G. Grekhov 09fc3f9554 [io/doc] Improve Link.createSync() documentation
Change-Id: I70c593ca2b7f9ba6b7cc94886f622f4af5dd20fd
CoreLibraryReviewExempt: documentation update
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330620
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-10-23 19:15:57 +00:00
Konstantin Shcheglov 775500e9ac Macro. Refactor named vs other types.
Change-Id: Ia4b1d0be6d7299b4e06c8071d262e606b9d439c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331721
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-10-23 19:05:28 +00:00
Ömer Sinan Ağacan 405a03909c [dart2wasm] Optimize UTF8 decoder when decoding a native array
Intercept all `Utf8Decoder.convert` calls to check the input type and
call the right UTF8 decoder function.

This currently only optimizes `U8List` parsing, and only the fastest
path where the input is an ASCII string. Follow-up CLs will optimize JS
typed array parsing by calling browser's UTF8 decoder and the slow paths
of non-ASCII and malformed buffers.

Results from an internal benchmark extracted from a real use case:

Before:

    Parse(RunTime):     330,500 us.

After:

    Parse(RunTime):     90,310 us.  (-72%)

dart2js -O4 results of the same benchmark:

    Parse(RunTime):     234,250 us.

Change-Id: I470697a9eb516e1e031e9b865ddb29e8f25569bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331187
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
2023-10-23 18:36:52 +00:00
Stephen Adams 0a436b7005 Reapply "[typed_data] Deprecate UnmodifiableUint8ListView and friends"
This reverts commit 4918d3ef8c.

`@Deprecated` annotations have been commented out.

CoreLibraryReviewExempt: reviewed as https://dart-review.googlesource.com/c/sdk/+/321922
TEST=ci
Bug: #53785
Change-Id: I3239251c2aba5f188aa947f0ff0208271d6be5cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331741
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2023-10-23 18:14:33 +00:00
Ömer Sinan Ağacan fa7c42a84d [dart2wasm] Small optimizations and simplifications in string and convert patches
Change-Id: I3838f052cff13734cd5612785a5724454231be8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331183
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-10-23 18:08:22 +00:00
Danny Tuppeny 9e753794cb [analsysis_server] Fix missing types on record fields in LSP completion detail
Fixes https://github.com/Dart-Code/Dart-Code/issues/4788

Change-Id: Iaa57a5e486dac6c1978b8576b4855f8c3e8955f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330107
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-10-23 17:08:27 +00:00
Danny Tuppeny ae78a3d8e5 [analysis_server] Don't show private static members in completion outside of library
Fixes https://github.com/Dart-Code/Dart-Code/issues/4772

Change-Id: I5a033b7464c2325f4f5db309254392e0ec337d07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329605
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-10-23 17:06:18 +00:00
Ben Konyi 08b4f49249 Split package:vm_service into package:vm_service and package:vm_service_interface
To reduce the headache associated with adding parameters to VM service
APIs, VmServiceInterface has been removed from package:vm_service and
pulled into its own dedicated package:vm_service_interface. This will
help reduce the need for major version bumps of package:vm_service,
which requires manual version bumps through >8 packages in order to make
the latest version available to flutter_tools and DevTools.

This separation of the VmService client from the interface will reduce
the frequency of major version bumps to `package:vm_service` as adding
optional parameters to existing APIs would cause implementers of the
interface to break.

package:vm_service continues to expose a copy of the contents of package:vm_service_interface to avoid breaking google3 rolls until package:dwds can migrate to package:vm_service_interface. package:vm_service will not be published until this copy is removed.

This change also includes:
 - some code cleanup and modernization to both the code generator and
   generated code
 - >=3.0.0 SDK version requirement to allow for new language features

Change-Id: Ib1859c1b4e153fef7ee1f91e67e881bbf42652c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330500
Reviewed-by: Derek Xu <derekx@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-10-23 17:00:10 +00:00
Alexander Thomas d37620ed03 Revert "[infra] Begin RBE Linux x64 support."
This reverts commit 9a11fe517c.

Reason for revert: broke the build for some users.

Original change's description:
> [infra] Begin RBE Linux x64 support.
>
> Bug: b/296994239
> Change-Id: I0ddf9a1beb2996ac67b59779b8b8113432434786
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331282
> Reviewed-by: William Hesse <whesse@google.com>
> Commit-Queue: Jonas Termansen <sortie@google.com>
> Reviewed-by: Alexander Thomas <athom@google.com>

Bug: b/296994239
Change-Id: Id70259b9357790581f11f105516ff0c6c63ab1ac
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331780
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-10-23 16:45:47 +00:00
Ryan Macnak 166ab61c4e [vm] Honor --disassemble_relative for adrp.
TEST=vm/dart/disassemble_determinism_test
Bug: https://github.com/dart-lang/sdk/issues/52967
Change-Id: Ibbe2a35d55fe4d97c57e1a73889a93a0a904a741
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331580
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-10-23 16:45:39 +00:00
Derek Xu 4918d3ef8c Revert "[typed_data] Deprecate UnmodifiableUint8ListView and friends"
This reverts commit b657773d58.

Reason for revert: blocking Dart SDK -> Engine roll (https://github.com/flutter/flutter/issues/137054)

Original change's description:
> [typed_data] Deprecate UnmodifiableUint8ListView and friends
>
> This is the first of several steps to remove the unmodifiable views for typed data classes. The end goal is that dart2js has only one class implementing `Uint8List` so that `Uint8List` accesses can always be compiled down to JavaScript code that directly uses indexed property accesses (`a[i]`).
>
> This first step deprecates the unmodifiable view classes to help prevent their use in new code, and adds `asUnmodifiableView()` methods as a replacement for the small number of places that use the classes.
>
> The next steps (see #53785) are to remove uses of the unmodifiable view classes from the SDK. Once this is complete the classes themselves can be removed.
>
> TEST=ci
>
> Issue: #53218
> Issue: #53785
>
> Change-Id: I04d4feb0d9f1619e6eee65236e559f5e6adf2661
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321922
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
> Reviewed-by: Lasse Nielsen <lrn@google.com>
> Commit-Queue: Stephen Adams <sra@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Ömer Ağacan <omersa@google.com>

Issue: #53218
Issue: #53785
Change-Id: I0bb042269f9ff8e5cd69619cf97b60c79ea98cbf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331680
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-10-23 15:03:25 +00:00
Danny Tuppeny 9f9d5045b4 [analysis_server] Don't send ranges on snippet completions if they're same as defaults
See https://github.com/dart-lang/sdk/issues/53501

Change-Id: Ia8956ab1477dcd5c4146cc3358477f43571defbf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331280
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-10-23 15:01:37 +00:00
Jonas Termansen 9a11fe517c [infra] Begin RBE Linux x64 support.
Bug: b/296994239
Change-Id: I0ddf9a1beb2996ac67b59779b8b8113432434786
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331282
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-10-23 14:42:59 +00:00
Alexander Thomas c1bdc9bade [dartdev] Fix incorrect license header
Bug: b/286184681
Change-Id: Ia96e14d885a23e041a0bf96cb46976d90ec9228c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331285
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Auto-Submit: Alexander Thomas <athom@google.com>
2023-10-23 13:58:20 +00:00
Vyacheslav Egorov 539ef1fe55 [vm] Fix synthetic line number program
This fixes off by one in the line number program
generation noticed when using perf-annotate.

We were not emitting the row covering last comments
and those rows were were emitting were slightly off.

TEST=profiled code and looked at perf-annotate output

Change-Id: Ia0fe2fa2c830a1be8f6a129c84af01755c19e59a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331284
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2023-10-23 13:54:04 +00:00
Alexander Thomas 565afe4237 [wasm_builder] Remove duplicate LICENSE file
The top level LICENSE file already covers wasm_builder and this is not
meant to be published separately from the Dart SDK right now.

Bug: b/286184681
Change-Id: Id11bdf5c4939a94e1074d94b803e3281f0d2c153
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331049
Auto-Submit: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-10-23 12:16:14 +00:00
Nate Biggs 849459109a [dart2js] Remove dump info metadata memory overhead from emitter phase.
We recently added the ability to pass a `--write-dump-info-data=` flag to Dart2JS's emitter phase which will serialize the necessary metadata to run dump info as a standalone phase of the compiler.

This extra metadata was incurring an overhead since we were maintaining JS AST nodes longer in order to extract metadata out of them. With this change we get rid of that overhead. The nodes are only retained until they printed and then any references to them are freed.

After this change the memory usage of the emitter phase is the same with or without the `--write-dump-info-data=` flag. There is still however some additional overhead in runtime. This is of course unavoidable as we are doing extra work to serialize the data.

Change-Id: Ib45a0e1de96d41503cbd76217b841ff013ac0655
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331000
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2023-10-21 02:18:48 +00:00
Nate Biggs 671e58c268 [dart2js] Decouple closed world and serialization.
Change-Id: Idf9420eb1d461b9a2cff90354cfbfee601b75ae8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330861
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-10-21 02:18:48 +00:00
Nate Biggs 05e356d5bf [dart2js] Remove indexed entity classes.
Given the change to use serialization indexing, these classes aren't necessary anymore. We can use the base entity and J- impls directly.

Change-Id: I1074429ca7165fa1dbf740cab96a1b432cdd0a3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326500
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-10-21 02:18:48 +00:00
Konstantin Shcheglov 7d66c0ed53 Macro. Run declarations phase on methods.
Change-Id: I001e44abb7df10bdc390eb86d89009c055c96cdb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331217
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-10-21 00:59:25 +00:00
Nate Biggs 232d716474 [dart2js] Use Dart2JS serialization indexing instead of element map indexing for element model entities.
The element map indexing system adds complexity to our element model with little benefit. Serialization already has its own indexing logic that we now reuse for entities.

Some things to note:
1) Libraries are still assigned an index. We only use that index in one place in the namer to disambiguate members. I now assign these indices as a late final field when adding the libraries to the element map.
2) The sizes of serialized files get slightly bigger since serialization indexing uses "addresses" rather than incrementing numbers for the indices. This effect is very minimal (<4MB+ for the largest programs).
3) "Late" members (constructor and generator bodies) which are created during codegen must be tracked and registered separately. Before the index was used to determine which entities were "late".

I see a very small memory improvement across all phases because of this change. There is also a small regression in runtime because the entity map queries are hash map lookups instead of list index lookups now. I think this very small regression is worth the reduced complexity in the compiler.

If we care about getting that time regression back we can add an "IndexedEntityMixin" with a late final index member that the registry would set/manage internally and would allow it to go back to tracking entities in a List. The field should be private so it would only be used for this purpose. This would only be necessary if we find the added time overhead of the map lookups to be too much.

Change-Id: Idd6d22bfc6ab61943a07feb58b35287d50e7d72e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326461
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2023-10-21 00:31:34 +00:00
Nate Biggs 0b1bad9ffc [dart2js] Refactor serialization indices.
Simplifies indices management for serialization by reusing the same indexing readers/writers for each phase. This way the caches are shared across all the phases and we can decouple the indices with any specific data read.

This fixes an issue that prevented the indices from being used in certain read/write patterns. None of our current usages of these indices exhibited this pattern but later changes I have planned do run into this issue.

This new pattern is also more resilient to sharding/parallel data files. Previously there could be collisions if two files were written in "parallel" (such as the codegen shards) and later their address spaces had to be merged. Now we do the address space merging at read time when we have full knowledge of the parallel files and can therefore avoid collisions.

Change-Id: Iff4c1461e734fc00f251d81f9fff1b9db83484d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326460
Reviewed-by: Stephen Adams <sra@google.com>
2023-10-21 00:31:34 +00:00
Konstantin Shcheglov cbdbc19903 Macro. Run declarations phase and merge.
Change-Id: I85cbf7bc56c80226ab8f195088038d9af319deda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331440
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-10-20 20:48:48 +00:00
Brian Wilkerson de04e693c9 Convert (and move) some older style completion tests
I found the old style of tests difficult to read and even harder to
debug, so I decided to convert them. Fortunately, a small conversion
program did most of the work.

I didn't change the actual test code except in a couple of places where
the tests were failing because the test code produced diagnostics beyond
those expected for incomplete code (such as unreferenced variables).

As much as possible I kept the original pass/fail sense of the test.
There were a few tests that were failing because the expectations were
just wrong, so in those cases I allowed the test to pass with the right
expectations. I tried to verify the expectations of the tests, but I'm
sure I missed some.

Change-Id: I80b7f914e75012562d3423cc6eb242bb8be11cc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331215
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-10-20 20:32:29 +00:00
Ryan Macnak 95e1de4f38 [vm] Fix Windows ARM64 MSVC build.
TEST=--no-clang
Change-Id: I7e7da1afd13337f73230f3ded1f800c6ed7c969e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331420
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-10-20 19:45:49 +00:00
Sigmund Cherem d358abfd1f [web] do not run most 'pkg' suite on web compilers
Many tests under `pkg`, like `pkg/js_ast` and `pkg/analyzer_cli` are
meant to run as unit tests in the Dart VM. These were also being run in
dart2js and causing flakiness because they took a long time to build on
our CQ.

Locally some of these tests compile in under 5s, but we see the
compile-time vary among the bots a lot. I've observed cases close to 30s
and some that reach the 1-minute timeout cutoff. Flakiness data show
that this is happening between 5-7% of the runs, especially on linux
bots.

This CL stops running these tests on the dart2js configuration by
changing which subset of the `pkg` suite is provided to dart2js. It also
adjusts the .status file to skip a few suites for convenience on local
testing only. This allows developers locally to run `test.py -n... pkg`
without worrying about filtering out skipped suites.

Addendum: after discussions on the CL we decided not to cmpletely drop
coverage of js_ast tests on JS to ensure it can be used in browser
environments in the future. To support this we made made the tests
cheaper by removing the dependency on package:test. They will now only
be run in a single configuration, which is all we need for this purpose.
We can reevaluate and remove this if we continue to see timeouts.

Change-Id: Idf0dbdd37e412ef71ba117ec979cb1e52585c431
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330704
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2023-10-20 19:08:17 +00:00
Konstantin Shcheglov a49fc34461 Macro. Skip testing with native executables if cannot compile.
https://buganizer.corp.google.com/issues/306663458

Change-Id: I147857c46871912df88a04fd4de55cd76922e885
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331214
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-10-20 17:28:01 +00:00
Konstantin Shcheglov 5b5aee35bb Macro. Dispose macro instances after running them.
Change-Id: Idc2138fe900ad5666f0110d9f3ed8da9cc95ec91
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331213
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-10-20 17:19:39 +00:00
Stephen Adams b657773d58 [typed_data] Deprecate UnmodifiableUint8ListView and friends
This is the first of several steps to remove the unmodifiable views for typed data classes. The end goal is that dart2js has only one class implementing `Uint8List` so that `Uint8List` accesses can always be compiled down to JavaScript code that directly uses indexed property accesses (`a[i]`).

This first step deprecates the unmodifiable view classes to help prevent their use in new code, and adds `asUnmodifiableView()` methods as a replacement for the small number of places that use the classes.

The next steps (see #53785) are to remove uses of the unmodifiable view classes from the SDK. Once this is complete the classes themselves can be removed.

TEST=ci

Issue: #53218
Issue: #53785

Change-Id: I04d4feb0d9f1619e6eee65236e559f5e6adf2661
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321922
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2023-10-20 17:14:48 +00:00
Zijie He 19bee4c09b [Fuchsia] Really running cfv2 test
Though it's still failing, the test-script integration has pretty much
finished.

```=== 298 tests passed, 40 failed ===```

Errors are mainly

```
Exhausted heap space, trying to allocate 32 bytes.
../../runtime/vm/object.cc: 2854: error: Out of memory.
```

This change requires https://crrev.com/c/4913284 and
`"fuchsia_sdk_version": "version:15.20231007.2.1",`
in DEPS.

Bug: #38752
Change-Id: I92a387f4289fce7d05d84e483560729301541c1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330025
Commit-Queue: Zijie He <zijiehe@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-10-20 17:08:31 +00:00
Konstantin Shcheglov 37cd536430 Macro. Support for running pre-compiled native executables.
Change-Id: I79c8c6bb02d683c3ec5d384323a77622f2b3d4dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330996
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-10-20 15:54:28 +00:00
Konstantin Shcheglov 0ce6ee3b3f Use for-each statement, not 'forEach' method.
When running flutter_elements benchmark.
Timings in ms, for 'Compute benchmark results' that does filtering.

JIT
forEach: 549 530 546
for-each statement: 360 353 326

AOT
forEach: 419 410 425
for-each statement: 277 272 270

Change-Id: I5a38b9f7fef022327d6369089dcc8190508ffa24
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330983
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-10-20 15:32:49 +00:00
Sam Rawlins 1dc0eb05ea analyzer: Fix FieldDeclaration doc comment.
See the current busted docs that interpret angle brackets as HTML:
https://pub.dev/documentation/analyzer/latest/dart_ast_ast/FieldDeclaration-class.html

Also the comment at the end is outdated; removing it is the most clear
path, I think.

Change-Id: I7ce165801add5f1d6936ec242d0f2ddb2bfbf525
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331320
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-10-20 14:57:25 +00:00
Lasse R.H. Nielsen 0234a8f17f Fix bad link in updated docs.
CoreLibraryReviewExempt: Comment only.
Change-Id: Ibaec3812e430ba0c8644315fba062bca62f3c173
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331241
Auto-Submit: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-10-20 14:47:26 +00:00
Daco Harkes a4f7b2c5e0 [gardening][dartdev] Fix lint in dart create
New lints added https://dart-review.googlesource.com/c/sdk/+/330997
include implicit_call_tearoffs.

Update the template to adhere to the lint.

TEST=pkg/dartdev/test/commands/create_integration_test

Change-Id: I0133748e42e713b022027bedbc1b0c9eb581536c
Cq-Include-Trybots: luci.dart.try:pkg-mac-release-try,pkg-mac-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331186
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-10-20 10:34:08 +00:00
Lasse R.H. Nielsen 0ecb9ba545 Update documentation on fromEnvironment constructors.
CoreLibraryReviewExempt: Comments only.
Change-Id: If2e080764bc98ee6cb7fe31dffe12c66144c7352
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331182
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-10-20 07:57:18 +00:00
Sigmund Cherem cd959f4b45 [dart2js] cleanup golden test.
Unfortuantely this golden test is set up to test two configurations, the
default dump-info and a experimental kernel-first dump-info. The latter
wants to reuse the same expectations to ensure the output is the same,
but it's configuration confuses how `dump_info_test.dart -g` works. If
it sees a discrepancy it will duplicate the expectation and add a new
one instead of updating the old one.

I haven't investigated the best way to fix that, but for now, this CL
remerges the expectation so that we continue to only have one copy of
the expectations.

Change-Id: I5d2781b85ae92e8e83b6a4c395a7353bcbcca17a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331321
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Auto-Submit: Sigmund Cherem <sigmund@google.com>
2023-10-20 00:06:18 +00:00