Commit graph

45013 commits

Author SHA1 Message Date
Nate Biggs ad2708d071 [dart2js] Delete modular compilation step.
The Dart2JS team has agreed that this mode of compilation is no longer worth investing in at this time and its existence adds some overhead to other feature work so it is worth fully removing. In the future we may revisit this mode of compilation. Below is some more context for any future exploration in this space.

What didn't work with modular analysis:
- current modular analysis was computing impacts, which were dense (50% of the size of kernel)
- using it moved work to a modular phase, and cut Phase1 in half however end-to-end time was not better
- data overhead was very high
- it made it much harder to maintain invariants throughout the pipeline: the data is tightly coupled with the kernel AST, making it hard to make late modifications to the AST.

How to potentially make it better:
- make the data much more sparse
- make the data more independent from the kernel AST so that transformations are not breaking
- reduce the critical path in a more substantial way.

Note: We retain and ignore the commandline flags used for modular analysis in order to avoid breaking build pipelines that were passing them. We may remove these at a later date.

Change-Id: If574ce2358280ab5fedd89c62665328601e72e22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333360
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2023-11-03 00:11:50 +00:00
Konstantin Shcheglov c753f25160 Add negative dart:_wasm test, fix SdkLibrary.isInternal
While doing a previous CL, noticed that we don't actually report
the corresponding error.

Change-Id: I77ae11de6f6e84b3625b13db803e846966c806d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333641
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-11-02 21:50:29 +00:00
Konstantin Shcheglov f3cd5c1473 Macro. More ordering for declarations phase.
Change-Id: I01e528a0f077367929e9e631992644b198165d6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333581
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-11-02 21:37:41 +00:00
Danny Tuppeny a18a24c16c [analysis_server] Update + test for LSP readme being up-to-date with implemented methods
Change-Id: I4c25da38da937d76c4a1b1c9ba1e6318f16c1046
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333400
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-11-02 20:59:20 +00:00
Kallen Tu 988c301109 [analyzer] Issue 53927: Disallow final fields to be used in a const context.
Context: Added a field check in https://dart-review.googlesource.com/c/sdk/+/312347 which the goal back then was to cut down on more unnecessary errors, but this seemed to have caused a regression elsewhere.

Reverting this part of the change and other related tests.

Bug: https://github.com/dart-lang/sdk/issues/53927
Change-Id: I0774e050c73e677347caad836dd59c9cba71d044
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333240
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-11-02 20:46:20 +00:00
Konstantin Shcheglov c2ef69dff5 Update resolveFile2() to accept File instead of String.
Change-Id: I5ded2930457ef963fa3e53895ae3b46ace2b75c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333700
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-11-02 20:15:42 +00:00
Sam Rawlins 5f24a631c7 linter: Add first three 'known limitation' texts to docs
Change-Id: Id6f1c95614e7de039866da40659ab7de7928faee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-11-02 16:22:01 +00:00
Danny Tuppeny d1a1a273ee [analysis_server] Migrate some LSP tests off old marker functions
No functional changes, just moves the snippets tests and a few others off the old marker functions to the new TestCode class for consistency.

With this change, there are approximately 15 remaining instances of "withoutMarkers" to remove (inc. the declaration).

Change-Id: I7f11992bb9ce47740adf6972ed097cabbd011607
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333520
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-11-02 16:18:01 +00:00
Daco Harkes e16bb210d2 [vm/ffi] Optimize @Native calls
This CL removes static fields for storing the `@Native`'s function
addresses. Instead, the function addresses are stored in the object
pool for all archs except for ia32. ia32 has no AOT and no AppJit
snapshots, so the addresses are directly embedded in the code.

This CL removes the closure wrapping for `@Native`s. Instead of
`pointer.asFunctionInternal()()` where `asFunction` returns a closure
which contains the trampoline, the function is compiled to a body
which contains the trampoline `Native()`. This is possible for
`@Native`s because the dylib and symbol names are known statically.

Doing the compilation in kernel_to_il instead of a CFE transform
enables supporting static linking later. (The alternative would have
been to transform in the cfe to a `@pragma('vm:cachable-idempotent')`
instead of constructing the IL in kernel_to_il.

To enable running resolution in ia32 in kernel_to_il.cc, the
resolution function has been made available via
`runtime/lib/ffi_dynamic_library.h`.

Because the new calls are simply static calls, the TFA can figure
out const arguments flowing to these calls. This leads to constant
locations in the parameters to FfiCalls. So, this CL also introduces
logic to move constants into `NativeLocation`s.

TEST=runtime/vm/compiler/backend/il_test.cc
TEST=tests/ffi/function_*_native_(leaf_)test.dart
TEST=pkg/vm/testcases/transformations/ffi/ffinative_compound_return.dart

Closes: https://github.com/dart-lang/sdk/issues/47625
Closes: https://github.com/dart-lang/sdk/issues/51618
Change-Id: Ic5d017005dedcedea40c455c4d24dbe774f91603
CoreLibraryReviewExempt: Internal FFI implementation changes
Cq-Include-Trybots: luci.dart.try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64c-try,vm-aot-win-release-x64-try,vm-appjit-linux-debug-x64-try,vm-asan-linux-release-x64-try,vm-checked-mac-release-arm64-try,vm-eager-optimization-linux-release-ia32-try,vm-eager-optimization-linux-release-x64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-fuchsia-release-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-linux-debug-ia32-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-mac-debug-arm64-try,vm-mac-debug-x64-try,vm-msan-linux-release-x64-try,vm-reload-linux-debug-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-ubsan-linux-release-x64-try,vm-win-debug-arm64-try,vm-win-debug-x64-try,vm-win-debug-x64c-try,vm-win-release-ia32-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284300
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-11-02 16:00:53 +00:00
pq 600acad478 start using getAnalysisOptionsForFile
Baby steps w/ context locator. Some TODOs show how this will thread through the driver into the library analyzer.

Change-Id: I95f3047929c2bea6e7d5c1c9dc217c40ca9e4eef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333302
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-11-02 15:51:59 +00:00
Danny Tuppeny 4d9c40860f [analysis_server] Add support for LSP Document Links for example/api links
This extracts the code that finds "examples/api" paths in code from the navigation code so that it can be re-used by LSP's DocumentLink request.

This allows the links to be more visible in the editor (they are underlined and clearly clickable like hyperlinks, whereas definition required you to hover and hold Ctrl before you'd seen an underline in VS Code).

Example: https://github.com/Dart-Code/Dart-Code/assets/1078012/be9db467-dbc9-4206-9dd5-f8ca72d95596

There may be an argument for making this more general (so that links other than example/api could be detected) but for now the goal was to make these existing links more obvious.

Fixes https://github.com/Dart-Code/Dart-Code/issues/4186

Change-Id: Id00425175b24394e565e13406ea4bac5691d2c72
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333082
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-11-02 15:51:49 +00:00
Ömer Sinan Ağacan 12e0690dfe [dart2wasm] Generate inline code for int ~/ operator
The implementation of `~/` is a bit more complicated than other
operators as it needs to handle some special cases, so we currently
don't generate inline code for it.

This causes generating indirect calls to `~/` in some cases even when
the static Dart type of the arguments are `int`s, see [1] for details.

Update the intrinsic matcher to specially handle this operator by
calling `_BoxedInt._truncDiv`, which is then inlined.

This leads to huge performance wins in [2] as typed data `length`
getters currently compiled to indirect calls to `~/`.

[1]: https://github.com/dart-lang/sdk/issues/53921
[2]: https://dart-review.googlesource.com/c/sdk/+/328920

Change-Id: I92d89db76af38b1f843e25a841074f00ff2ef30a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333381
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-11-02 14:46:37 +00:00
Chloe Stefantsova d003570453 [cfe] Include dill in propagating errors in redirecting factories
Redirecting factory chains may include a mix of source- and dill-
factory builders. The error propagation should work in that case too.

This is a follow-up to
https://dart-review.googlesource.com/c/sdk/+/332403/comment/14b70a92_c6e1a91e/

Part of https://github.com/dart-lang/sdk/issues/49731

Change-Id: I74be2a47260c2c24c2fc871b7f1521546f056a03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333162
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2023-11-02 13:38:52 +00:00
Johnni Winther 12c4e22a4d [cfe] Handle various cases ExtensionType
Handles ExtensionType in inference of MapLiteral, inference of
ObjectPattern, and exhaustiveness.

TEST=tests/extension_type/*

Change-Id: I3284da2c69d875e192cf3f004ee1156e1aedd98b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333160
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-11-02 10:42:48 +00:00
Ömer Sinan Ağacan fb54ea5f3f [dart2wasm] Remove old special case in binary op intrinsic matching
Change-Id: I1643d2fe8c6b920084a832be2d698d6c48f26eab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333380
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-11-02 10:38:04 +00:00
Jake Macdonald 21b00d337b Add experimental release version for macros of 3.3.
Now that some basic support has landed internally, this will help to keep language versions more consistent for targets using macros, which will make SDK rolls easier.

Change-Id: Ifb9bb3def161edb3974cfc68271daad8a12707b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333200
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2023-11-02 09:38:12 +00:00
pq 66569eb894 share options with a common context root
Lays the stage to acquire options from files during error verification.

Change-Id: I3b715a93e99fc3bc6f33f736e8b38c06b8c1cd4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333126
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-11-01 22:03:21 +00:00
Brian Wilkerson 8de066a4b0 Share the visibility tracker and suggest local functions
Sharing the visibility tracker this way prevents shadowed elements from
being suggested and improves performance.

Most of these changes can be reverted once the local reference
contributor has been removed.

Change-Id: Ib156ae56455e8d85a31163f9e59ce4dd93f5920b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333124
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-11-01 16:21:19 +00:00
Chloe Stefantsova 3c4a74bc38 [cfe] Separate inference and error reporting in super parameters of extension type constructors
This is a follow-up to
https://dart-review.googlesource.com/c/sdk/+/331048/comment/fbe89f66_bcf80d94/

Part of https://github.com/dart-lang/sdk/issues/49731

Change-Id: I989cc3d3031e0bc4e66be1e28454443f918d20e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333003
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2023-11-01 12:52:30 +00:00
Chloe Stefantsova 8b01baab71 [cfe] Perform checks on factories of extension type declarations
Closes https://github.com/dart-lang/sdk/issues/53209
Closes https://github.com/dart-lang/sdk/issues/53140
Part of https://github.com/dart-lang/sdk/issues/49731

Change-Id: Ia94b1e85d6775efc23bf732441fa66d4de1de515
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332403
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2023-11-01 10:14:49 +00:00
Chloe Stefantsova dd3705d5e8 [cfe] Allow extension types implement Object
This is a prerequisite to the implementation of
https://github.com/dart-lang/language/pull/3434

Closes https://github.com/dart-lang/sdk/issues/53840
Part of https://github.com/dart-lang/sdk/issues/49731

Change-Id: Ib3bb5961cd8c4919cbc8c8ba37ac4d76fb72a3de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333000
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-11-01 09:26:30 +00:00
pq e2aa60ddf3 context_builder refactoring copies
Copies of context building bits for context creation refactoring work.

Change-Id: I2ee8d7e03a33bb6f450c190ad59459bbf87cef62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333122
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-11-01 04:17:41 +00:00
Konstantin Shcheglov 0544ecba9a Macro. Support for mixins.
Change-Id: Icab52054c230ab97c3129b0bb32ed3ad55740fbc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333046
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-10-31 23:54:49 +00:00
Johnni Winther 72f1591f29 [cfe] Use getTypeAsInstanceOf instead of getInterfaceTypeAsInstanceOfClass
The changes calls to getInterfaceTypeAsInstanceOfClass (et al.) to
getTypeAsInstanceOf to ensure that we take extension types into account.

Change-Id: I7d732cdae8494002b44561cb02c49d58dd0ba67b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332920
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2023-10-31 22:30:50 +00:00
Ben Konyi 8b3d93234d [ package:vm_service ] Migrate Observatory HTTP service invocation tests
Also adds READMEs to some test sub-directories.

Change-Id: Ibf48654bcb43d7d52bd3bc0d2ab6afabc1ea3df6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333100
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2023-10-31 19:54:28 +00:00
Ben Konyi 94f8809607 [ package:vm_service ] Migrate more Observatory tests
Change-Id: I2d653fcc98087feaff79fa1adb2e4293085e959c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332642
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-10-31 19:49:42 +00:00
Danny Tuppeny 939e081d43 [analysis_server] Include inlay hints for type arguments in "if case"
Previously we only added the type args in constructor invocations, this changes to any named type without explicit type args.

Fixes https://github.com/Dart-Code/Dart-Code/issues/4712

Change-Id: I11a6a96bf34c7e4acff93607a922401d2f0eed83
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332960
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2023-10-31 17:46:58 +00:00
Ryan Macnak 573fad4ff0 [test] Cleanup building Fuchsia packages/components.
Build one package with three elf_test_runner components: one for each of the binaries that the test harness invokes on the target. (Though currently only tests that use "dart" are setup.)

Create includable CML shards for the capabilites required by the AOT and JIT VMs.

Fold test_runner's fuchsia_cfv2.dart back into fuchsia.dart.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/38752
Change-Id: I7bd8d43d184cbcb11903c7aed77ce31fb30cb894
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332451
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zijie He <zijiehe@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-10-31 17:11:51 +00:00
pq 2e723075b8 + analysis options map
A simple (if provisional) implementation of an analysis options map.

🚧 Datastructure, API and implementation all subject to change.

Change-Id: I94d311d17df3f60b6e36437d37df84ce5091e0fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332369
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-10-31 16:30:41 +00:00
Jake Macdonald 26d4251bff handle org-dartlang-augmentation uris
Bug: https://github.com/dart-lang/sdk/issues/53913
Change-Id: I40a1bba7a303977ddb6b47c2c7725895858e69b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333060
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-10-31 16:10:38 +00:00
Konstantin Shcheglov 3e7f464778 Macro. Test some of the required application order rules.
Change-Id: Iab1e9b8769d2f95a1e06926f86e95d2735fc6837
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332840
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-10-31 15:54:30 +00:00
Ben Konyi 290a675add [ package:vm_service ] Migrate service extension tests
Change-Id: If589d96d7d9549456f43fc9ed96a692737a711fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332501
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2023-10-31 15:53:44 +00:00
Alexander Markov f54ecbdf31 [vm,dart2wasm] Fix tree shaking of extension types used only in type literals
TEST=pkg/vm/testcases/transformations/type_flow/transformer/extension_type.dart
TEST=co19/LanguageFeatures/Extension-types/superinterfaces_of_extension_type_A08_t02

Fixes https://github.com/dart-lang/sdk/issues/53812

Issue: https://github.com/dart-lang/sdk/issues/49737
Change-Id: I80237a1240905a52805f5b3e7bd857ed96773609
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332450
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-10-31 14:59:29 +00:00
Chloe Stefantsova c688bc8e6d [cfe] Implement relaxed rule on representation/implemented types
Closes https://github.com/dart-lang/sdk/issues/53867
Part of https://github.com/dart-lang/sdk/issues/49731

Change-Id: I1a286a8f507e92f85a79acb18d124d3322e1daa5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332961
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-10-31 13:17:58 +00:00
Ömer Sinan Ağacan 9ed368c2e1 [dart2wasm] Use only JS strings in JSCM
Refactor libraries so that JSCM will only use `JSStringImpl` class for
strings.

The goal is to disentangle the native string classes and `JSStringImpl`
and start testing `JSStringImpl` in isolation.

Changes:

- `dart:_string` is no longer available in JSCM.

- Make `int.toString` external to allow patching it differently in JSCM
  and normal modes.

  `toString` implementations are in `boxed_int_to_string.dart` patch
  files.

- `int.parse` now uses JS `parseInt`. However `parseInt` is not
  compatible with Dart's `int.parse` so this will cause some more test
  failures in JSCM for now.

- Any dependencies to `dart:_string` from JSCM `dart:convert` are
  removed. The library implementation now uses JS `TextDecoder` for
  UTF-8 decoding.

  Note: `TextDecoder` is not available on d8, so text decoding tests
  will fail on d8.

  JSON encoding and decoding in `dart:convert` will be updated in a
  follow-up CL.

- Compiler (translator, constant generator, code generator etc.) is
  updated to allocate the `JSStringImpl`s in JSCM.

Initially this will make some JSCM test fail as `int` parsing is not
quite right, those will be fixed in follow-up CLs.

Co-authored-by: Joshua Litt <joshualitt@google.com>
Change-Id: I366e06f44cdc369d28fe47b24015234260304399
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332680
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-10-31 12:58:26 +00:00
Johnni Winther 9732bcab6a [cfe] Add ClassMember.memberKind and .getTearOff
This adds the functionality to ClassMember that enables us to
fully compute the ExtensionTypeAccessTarget.

Change-Id: I62dd5e24f664c2edd70c2fe794f66595cc017173
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332427
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2023-10-31 10:07:57 +00:00
Nate Biggs 171c1334cc [dart2js] Add 'main-only' option to dump info diff tool.
Change-Id: Ibabfd4eb9de5820365772c4b75d5ed0624b148a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332640
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2023-10-30 22:49:09 +00:00
Mayank Patke b034a909a6 [dart2js] Avoid discarding type tests during SSA with
--experiment-null-safety-checks

Change-Id: If3e2465103494d4772b1f8b71e7c57ae83b3e036
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332371
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2023-10-30 22:08:47 +00:00
Paul Berry d8732e9820 When field promotion fails, report all reasons via context messages.
Previously, if field promotion failed both because the language
version was less than 3.2, *and* for some other reason(s), the
analyzer and CFE only reported the other reason(s). The rationale was
that this was better than reporting just that the language version was
less than 3.2, because if a user upgraded their language version to
3.2 in an attempt to get field promotion to work, and *then* found out
that the property in question was unpromotable for some other reason,
that could be quite frustrating.

With this change, if field promotion fails both because the language
version is less than 3.2 and for some other reason, the analyzer and
CFE report *all* the reasons.

Change-Id: Ib5d3a4621273c1e80d66b66b456119f9053e18b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332485
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-10-30 21:31:51 +00:00
Konstantin Shcheglov 8d51998088 Issue 53839. Clear cached priority results during _clearLibraryContextAfterException().
Bug: https://github.com/dart-lang/sdk/issues/53839
Change-Id: I7de4e5b518b51239d4bd0251286960e619e6bc6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332747
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-10-30 20:13:20 +00:00
Ryan Macnak 4fa5cadb36 [test] Switch Fuchsia testing to CFv2.
Bug: https://github.com/dart-lang/sdk/issues/38752
Change-Id: Id6519937cfa8430249d576c99aeb6bdb9f97dbb7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332481
Reviewed-by: Zijie He <zijiehe@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-10-30 20:03:40 +00:00
Keerti Parthasarathy 25002f0f01 MissingDependencyValidator: Do not generate error for package self import.
Change-Id: I40f248698d2348492fc3def783d0fbb26e84119f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332641
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2023-10-30 19:04:39 +00:00
Daco Harkes 14d0c0e7c5 [cfe/ffi] Test _nativeEffect for @Natives
In a follow up, we will remove the transform from `@Native` to
`_asFunctionInternal`. However, we need to ensure that we keep
emitting `_nativeEffect` for struct return values classes if
`@Native`s are the only place instances are created.

The follow up CL will change the expect files.

TEST=pkg/vm/test/transformations/ffi_test

Bug: https://github.com/dart-lang/sdk/issues/47625
Change-Id: I1685683f48f1d16d6d10606f541f13e17d8583fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332800
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
2023-10-30 18:51:21 +00:00
Daco Harkes f5983e4214 [ffi] Update some FfiNative docs to Native
The old FfiNatives have been deprecated for a while.

TEST=Only comments updated.

Change-Id: Ideb6e904841e5162d30df479e83b463b94682afe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332780
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-10-30 18:43:14 +00:00
Konstantin Shcheglov 2cc328db0b Increment DATA_VERSION after https://dart-review.googlesource.com/c/sdk/+/332370
Bug: https://github.com/flutter/flutter/issues/137540
Change-Id: I1a32c36fb492325ae35445c0d4fee889c4a90db9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332446
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-10-30 17:55:55 +00:00
Nate Biggs 991f1aa248 [cfe] Add offset serialization to remaining Expression nodes without them.
Expressions missing offsets were:
- LogicalExpression
- ConditionalExpression
- Not
- BlockExpression
- Instantiation
- TypedefTearOff*

* I'm not sure how TypedefTearOff is actually being used, I don't see reference to it in the VM runtime. Unless the CFE lowers it before the VM gets it.

I also added a test on `binary.md` that ensures all expressions include a file offset in their serialized format. This can be expanded to statements if offsets are added to the remaining statement nodes without offsets.

TEST=Added binary_md_git_test.dart to ensure all expressions contain offset data going forward.


Change-Id: Ieaf80545f388b209f76be44db86ef07e80c8ad66
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331540
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2023-10-30 16:05:27 +00:00
Daco Harkes 3283d4e2cb [test] Delete merge conflict files
Introduced in https://dart-review.googlesource.com/c/sdk/+/290760.

Change-Id: Ibea3d1147e30d040cbf828c20ffe3bee69380a05
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332682
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
2023-10-30 12:36:38 +00:00
Ilya Yanok 8c55f3eb0b Revert "[analyzer] simplify the libraries.dart file"
This reverts commit 29979649bd.

Reason for revert: makes `promiseToFuture` not exported from `dart:html`, see b/295129286

Original change's description:
> [analyzer] simplify the libraries.dart file
>
> Cleanup and re-landing of https://dart-review.googlesource.com/c/sdk/+/317803.
>
> Change-Id: I9fd679fdb111895ce662ecbe6d0fc5844909c3bc
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332441
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Commit-Queue: Devon Carew <devoncarew@google.com>

Change-Id: Id93b4a1d4bdea706ae10cfb089319514a0238a7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332683
Reviewed-by: Alexander Thomas <athom@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Ilya Yanok <yanok@google.com>
2023-10-30 11:22:27 +00:00
Johnni Winther f900eb95b7 Enable extension types in package:web and dart:js_interop
This uses the allowed_experiments.json to opt package:web and
dart:js_interop in to the inline-class experiment (the extension
types feature) for early access and development.

Change-Id: Ieb828b654f2320b147a3c48bbb4a142da1c18380
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332421
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-10-30 10:58:45 +00:00
Nate Biggs 5403dc4927 [dart2js] Remove unused NonConstantValue.
The only constructor invocation of `NonConstantValue` is in the deserializer. Which means we're never creating any of these objects to serialize.

Also remove unused `handleClosureCall` method in `pkg/compiler/lib/src/inferrer/builder.dart`

Change-Id: I04e492bc4824795dd8fc109ee7464be56b27cb93
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332500
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2023-10-28 04:17:16 +00:00