Commit Graph

105700 Commits

Author SHA1 Message Date
Ryan Macnak cb59df7acf [vm, ffi] Better handle errors that are not unhandled exceptions during FFI callbacks.
Before this change, an error reaching an FFI callback would attempt to execute the normal invocation stub from the beginning in the FFI callback's frame, which quickly crashes. After this change, the runtime recognizes this marker use of the invocation stub and returns to the FFI callback function instead.

TEST=ffi/unwind
Bug: https://github.com/dart-lang/sdk/issues/39487
Change-Id: I477cfcfc236e6cf518ebfe52860ba49e466ebf8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409562
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-02-19 09:40:34 -08:00
Paul Berry a864586f3c Remove OWNERS file for the CFE team.
The code that was previously owned by the CFE team (OWNERS_CFE) is now
owned by the Dart Model team (OWNERS_MODEL). Accordingly, we don't
need OWNERS_CFE anymore.

Change-Id: I1ede4fbf5a0d29c5d328cc870c75c8a5ec7f217c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410620
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-02-19 09:33:31 -08:00
Danny Tuppeny 84e6ed0784 [dds/dap] Fix a race in DAP startup code that caused flaky tests
We start isolates paused so that we can send breakpoints before any code runs. This means we need to resume after initialization is complete.

It's important we don't try to resume multiple times during initialization (regardless of the order of isolate events or whether the isolate was found when we queried for isolates during connection).. This is done with the flag `startupHandled`.

One code path was not taking this flag into account, which meant multiple resumes were still possible. This seemed to occur on Linux during test runs (I've noticed the order of events being different on Linux in the past).

This change extracts the checking of `startupHandled` before sending `readyToResume` and uses it in all places that handle this kind of startup resume.

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

Change-Id: Ie2679fc806ab3edf007259298da82dbc8b802a6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410760
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2025-02-19 08:23:28 -08:00
Lasse R.H. Nielsen f4cadd5a5a Retired inference-using-bounds and wildcard-variables experiments.
Change-Id: I5dcc0c7d2b148eb88e6382118d6fc8ee4c9a9489
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407022
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2025-02-19 05:25:10 -08:00
Martin Kustermann b8993db4c7 [dart2wasm] Take advantage of slices of a json string being ASCII
Sometimes json strings contain escape characters. If they do, then a
slower path function is triggered. This CL makes that slower part also
take advantage of ASCII property (in a similar way as we do if the
entire json string is ASCII).

CoreLibraryReviewExempt: Changes only non user visible internals.
Change-Id: Ib055a579778b5ba58a9680da1b34624b095af22f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410501
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-02-19 05:05:11 -08:00
Lasse R.H. Nielsen aab7621900 Remove some multitest runtime-tests.
Change-Id: I8fb69fecbe67236a4cbad9c1eb899a31a26a1ba3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410002
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2025-02-19 04:21:42 -08:00
Keerti Parthasarathy dd93f6fae0 Fix for create constructor for Widget with private fields.
Fixes https://github.com/dart-lang/sdk/issues/56182

Change-Id: I25a94dbb5af5dda4db1fde9494783df215587fd5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410520
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2025-02-18 21:48:29 -08:00
DEPS Autoroller c6077da0da Roll BoringSSL from bef0b8b4424d to 8c6b0c04f19f (15 revisions)
https://boringssl.googlesource.com/boringssl.git/+log/bef0b8b4424d..8c6b0c04f19f

2025-02-14 davidben@google.com runner: Switch back to filippo.io/mlkem768 for now
2025-02-13 davidben@google.com runner: Include the name of the message we failed to parse
2025-02-13 davidben@google.com runnner: Switch to Go's crypto/ecdh module
2025-02-13 davidben@google.com Switch to Go standard library functions where available
2025-02-13 davidben@google.com Fix include spelling in spake2plus.cc
2025-02-13 davidben@google.com Revert "Speed up sha512 on x86" and update comments
2025-02-13 filippo@golang.org Add ".git" hint to Go module name
2025-02-13 davidben@google.com Bump version for BCR
2025-02-13 davidben@google.com Clarify that sigalg configuration does not impact TLS 1.0/1.1
2025-02-13 davidben@google.com Update dependencies
2025-02-12 bbe@google.com Remove ocsp_revocation_status.h and ocsp_verify_result.h
2025-02-11 davidben@google.com Fix up ClientHello parser errors
2025-02-11 davidben@google.com Add SSL_parse_client_hello
2025-02-11 bbe@google.com use public header instead of internal for ocsp
2025-02-11 bbe@google.com Make CheckOCSP public api

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/boringssl-dart-sdk
Please CC dart-engprod@google.com,dart-vm-gardener@grotations.appspotmail.com,dart-vm-team@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in BoringSSL: https://crbug.com/boringssl/new
To file a bug in Dart SDK: https://github.com/dart-lang/sdk/issues

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

Tbr: dart-vm-gardener@grotations.appspotmail.com
Change-Id: Ie0f6cd4cd05b8d596ac81b428027bc56f56ef626
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410141
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-02-18 21:24:48 -08:00
Brian Wilkerson f0561dcdb9 [migration] refactoring_manager.dart and handler_rename.dart
Change-Id: I9294afbec0d472fb87c595d0e9c9b9ca2a2cc838
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410444
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-02-18 17:17:12 -08:00
Mayank Patke 6acaf9b8f4 [dart2js] Account for late sentinels in trivial inference results.
Fixes: #49599
Fixes: #55058
Fixes: #60115
Change-Id: I66673b6e467b54428e8d5ba317eec8aa3248645f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258961
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2025-02-18 16:50:18 -08:00
Mayank Patke 3df2adc587 [dart2js] Add failing tests for #49599, #55058, #60115.
Bug: #49599
Bug: #55058
Bug: #60115
Change-Id: I5e7022179a0d64b92304aec31a5732bb4b00db16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258960
Reviewed-by: Stephen Adams <sra@google.com>
2025-02-18 16:50:18 -08:00
pq 4d8b46848b [element model] migrate error_verifier (enclosing element getters)
Cleans up getters as per our discussion.

Sorry for the delay on this one!

Change-Id: I3eabce599d5ea4696c7c478b0ca3aedb4097a5eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410661
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-02-18 16:40:36 -08:00
pq 6810733aa9 [element model] migrate override_verifier
Change-Id: Iecbdd76990da0dbb25a4263dea5d3ecac7be4d71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410442
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Phil Quitslund <pquitslund@google.com>
2025-02-18 16:32:59 -08:00
Paul Berry 1511cbe8bb Ensure appropriate code review of changes to the analyzer public API.
This change uses Gerrit OWNERS file syntax (documented here:
https://gerrit.googlesource.com/plugins/find-owners/+/HEAD/src/main/resources/Documentation/syntax.md?pli=1)
to ensure that any changes affecting pkg/analyzer/api.txt will be
reviewed by the developer experience team (or one of the last resort
global reviewers), rather than the Dart Model team.

Since changes to the analyzer that affect its public API will
inevitably affect both .dart files in pkg/analyzer (or
pkg/_fe_analyzer_shared) as well as pkg/analyzer/api.txt, this
ownership change ensures that any change affecting the analyzer public
API will be reviewed both by a member of the Dart Model team and by a
member of the developer experience team.

Change-Id: I07527efe1fa7aa3f1d75488c1800410c2aaaa6ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410660
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-02-18 16:27:56 -08:00
Konstantin Shcheglov 999f39e908 Elements. Remove FindElement fields where possible.
Change-Id: Iea32d103f433d88c70de837bba09435b6f52d11a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410580
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-02-18 14:29:23 -08:00
Sam Rawlins bfaf70f194 DAS plugins: Document writing quick fixes
Change-Id: I38dc64d8ff9f59dd9e45d30715a08233f4891b74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410563
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-02-18 14:17:10 -08:00
FMorschel 2048190cb1 [DAS] Makes encapsulate field work with final
R=scheglov@google.com

Fixes: https://github.com/dart-lang/sdk/issues/60154
Change-Id: I45c887169672e3cdbce4aea95000996c09e8123b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410460
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
2025-02-18 14:02:43 -08:00
Sam Rawlins 26477120ba Bump dartdoc to f0d2276e57c96717e625964ea0385a30f2237e62
This is a commit from Jan 31 - I'm doing small bumps until we catch up
to the present.

Change-Id: Ic501dd45661992edd5e87ddb58a6cf14eb7b7ef3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410600
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-02-18 13:21:12 -08:00
Nate Biggs 773cf6b1d5 [ddc] Fix issues with duplicate library name aliases.
The attached bug shows an issue users have been encountering where a constructor seems to be undefined. It turns out this is because DDC is trying to read the constructor from the wrong library.

This is happening because both 'package:dio' and a sister package 'package:dio_web_adapter' both contain a library with the same path: 'src/adapter.dart'. 'BrowserHttpClientAdapter' the class they are trying to reference is defined in 'package:dio/src/adapter.dart'. However, due to a naming collision, their import is referencing 'package:dio_web_adapter/src/adapter.dart'.

This naming collision happens because of the logic in '_jsLibraryAlias'. By truncating the start of the import URI (i.e. 'dio/' and 'dio_web_adapter/') the two libraries map to the same alias. This alias is then used to as the key in the AMD module export object and since both libraries are in the same module, only the second one gets exported.

This code may have been written with the assumption that libraries from different packages would always be in different modules (in which case the shortened paths shouldn't collide) but this is not the case. The fix is to use the full import URI including the package name.

In writing the attached modular test I discovered another issue that only affects es6 imports. The ScopedId resolver was not considering NameSpecifier as a declaration point for variables. This lead to a similar name collision since the import alias's name was also being derived from a truncated import URI. In the test, both 'f1/foo.dart' and 'f2/foo.dart' were being imported 'as foo'. Now one is 'as foo' and the other is 'as foo$'.

The first issue affects both AMD and es6 while the second issue only affects es6. The modular tests run with es6 so the new test fails if either of these fixes is not in place.

The new DDC module system is not affected by either issue since it doesn't use NameSpecifiers and it uses the full import URI as a string to register libraries rather than a shortened alias.

Tested on TGP and with a local Flutter application.

Bug: https://github.com/dart-lang/sdk/issues/56498
Change-Id: I5bdb945cfbe615874b40e2fc4ebba31b661cf3b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410260
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2025-02-18 13:08:50 -08:00
Martin Kustermann 997066e2cd [dart2wasm] Avoid lazy initialization checks for certain performance critical globals
The Dart language semantics requires global / static fields to be lazily
initialized on first access.

Though if the initializer expression does not have any side-effects, an
implementation may take the liberty to initialize a global earlier. The
downside of that is that if the initializer (despite being side-effect
free) is costly, the startup cost may suffer.

We introduce a `@pragma('wasm:initialize-at-startup')` that allows us to
explicitly opt-into running a global field's initializer at starutp.

This will mean we don't have to pay the lazy-initialization cost at
access time anymore. So when we before did this:
```
  block X
    global.get GX
    br_on_non_null
    call initializer
  end
```
we now do this:
```
  global.get GX
```
we also get rid of the initializer function.

We start to make use of this pragma in 3 places:

  * hash map code that checks for deleted marker
  * double to string cache
  * string interning cache

Change-Id: I172ecda33fad8fab1a02b48b16784f8a9c89d205
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410340
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-02-18 13:06:43 -08:00
Kallen Tu ef2dcd5f48 [parser] Initial parsing of dot shorthands.
Doing some initial work for parsing dot shorthands.

The listeners in the CFE and analyzer will report an extra error if the experiment is not turned on. The compilation should still fail and produce errors, but it won't crash.

If you turn on the experiment, the parsing will crash, but I'd like to get this in so I can modularly work on the CFE and analyzer separately.

Bug: https://github.com/dart-lang/sdk/issues/59758, https://github.com/dart-lang/sdk/issues/59835
Change-Id: I262b0bd5cffc8e5e04ac79c76454b6e355779ade
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409540
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2025-02-18 12:45:53 -08:00
Paul Berry a0b38184e2 Remove OWNERS file for the analyzer team.
The code that was previously owned by the analyzer team
(OWNERS_ANALYZER) is now owned by either the Dart Model team
(OWNERS_MODEL) or the developer experience team
(OWNERS_DEVELOPER_EXPERIENCE). Accordingly, we don't need
OWNERS_ANALYZER anymore.

Change-Id: I9a4d2e2462a15ba9ec8f3046cdca77ba9d3af13c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410564
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-02-18 12:24:57 -08:00
Devon Carew bd2ac5fe9b [deps] rev http, i18n, tools
Revisions updated by `dart tools/rev_sdk_deps.dart`.

http (https://github.com/dart-lang/http/compare/e28f9f5..900da9f):
  900da9f  2025-02-13  Simon Binder  Fix browser clients in workers (dart-lang/http#1715)

i18n (https://github.com/dart-lang/i18n/compare/189c228..06a664f):
  06a664f  2025-02-18  Moritz  Remove `package:js` dependency (dart-lang/i18n#946)

tools (https://github.com/dart-lang/tools/compare/750b4ad..b51f39d):
  b51f39d0  2025-02-18  Parker Lougheed  [package_config] Fix incorrect error message when validating parameters in `LanguageVersion.new` (dart-lang/tools#2017)

Change-Id: I8ff7b42069d8a979107f3f68449fa2614db8c9c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410561
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2025-02-18 11:27:40 -08:00
Kallen Tu 411ca9ceac [cfe] Issue 60121: Fix bug with isWildcard flag for formals.
The `isWildcard` flag for formals was being set as `false` since it
was checking that the parameter was `_` after the formal was
lowered already into something like `#wc0#formal`.

Tested: Existing VM tests that have been updated.
Fixes: https://github.com/dart-lang/sdk/issues/60121
Bug: https://github.com/dart-lang/sdk/issues/60121
Change-Id: I4df96d47ef8b6af8ece634360d14a19d1cb9d916
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410161
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2025-02-18 11:24:48 -08:00
Sam Rawlins 78eedc40c3 Bump dartdoc to 56934b7d567d1301ae6ad79aed9fc6f3e9fd15e3
Fixes https://github.com/dart-lang/dartdoc/issues/3969

A patch is attached for internal preparation.

Change-Id: I750ea3b488a0fd241087b543ac520cb17349d7fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410162
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-02-18 11:08:30 -08:00
Konstantin Shcheglov 4140c5fb0a Elements. Migrate ElementsTypesMixin to TypeImpl.
Change-Id: Icb33629c0eb6482089e73b30a0dfeb073f1058d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410560
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-02-18 10:54:08 -08:00
Ryan Macnak 12be1f79d2 [vm] Test active mutator stealing works with dart:concurrent locks.
- Add Monitor.notifyAll.
 - Refactor Mutex.runLocked to unlock if interrupted by unwind error.
 - Fix skipped DLRT_ExitHandleScope during an unwind error.

TEST=vm/dart/isolates/many_isolates_blocked_at_monitor_test
Bug: https://github.com/dart-lang/sdk/issues/55991
CoreLibraryReviewExempt: VM-only experimental library
Change-Id: I7a37544436e22158e45ee44567600fcf7ff7d7b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409561
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2025-02-18 10:33:14 -08:00
Konstantin Shcheglov 0e1b8f7261 Elements. Migrate LibraryAnalyzer.
Change-Id: Ia383ddfc11798365dd3c0ca456161e04c355c46d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410240
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2025-02-18 09:48:59 -08:00
Johnni Winther c714269f51 [analyzer] Migrate ElementDeclarationResult
Change-Id: Iaa18a32075e2dc92d47378d90cfb801bc5884473
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/408702
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2025-02-18 08:22:51 -08:00
Devon Carew 1039490228 [deps] bring in dart-lang/i18n; update intl benchmark and sdk usage
Change-Id: Ic0b7558fb7caf3f8d8ac9a1f460345de45d563f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410080
Auto-Submit: Devon Carew <devoncarew@google.com>
Reviewed-by: Moritz Sümmermann <mosum@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2025-02-18 08:03:22 -08:00
Martin Kustermann 5e8bd02433 [dart2wasm] Make json parser use cache of boxed integers <=255
Many json files may have small integer numbers in them. Both dart2js and
VM don't need to actually box those small numbers as they have small
tagged integer support. Though dart2wasm boxes all integers when they
flow into top types.

=> We can use a cache of boxed integer numbers <= 255.

It does seem to overall improve json decoding benchmarks and
will reduce memory usage / pressure on the GC.

Change-Id: I026831e0f0841ae84a66652c0cc0e4689a4ab75e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410000
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2025-02-18 04:16:29 -08:00
Martin Kustermann 6273c19a78 [dart2wasm] Also intern json string keys in fused utf-8+json decoder
In the optimistic case of the json object key strings being ascii
we can also intern them in the fused decoder.

Change-Id: Ifab222a4fc521e18855fe762400e75f32959f24a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410401
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2025-02-18 04:02:02 -08:00
Chloe Stefantsova 64aae0ef17 [cfe] Remove outdated TODO
Change-Id: If257f679942b8d9bf694b08684be338330858572
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410420
Auto-Submit: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2025-02-18 03:01:15 -08:00
Ömer Sinan Ağacan 5da354f46e [dart2wasm] Don't compile catch blocks multiple times for JS exceptions
Currently when a Dart `catch` block can catch both Dart and JS
exceptions, we compile the `catch` body once in a Wasm `catch` block,
once in a Wasm `catch_all` block.

This is because a Dart exception needs to be caught in a `catch` with
the right tag, to be able to get the exception and stack trace values,
and JS exceptions need to be caught in `catch_all` and they come without
error values and stack traces.

With this CL we generate one Wasm block per Dart `catch` block. Wasm
`catch` and `catch_all` blocks only do type tests and jump to the right
Wasm `block` when a type test passes.

This allows using the same block for multiple Wasm `catch` and
`catch_all` blocks.

When jumping to the block for a Dart `catch` we pass the error value and
stack trace to the block. As before, when the caught exception is a JS
exception, we pass an empty `JavaScriptError` as the error value and the
call stack of the Dart `catch` as the stack trace.

We also replace Wasm `rethrow` instruction with `throw` when compiling
Dart `rethrow` statements. This change is necessary as the blocks for
Dart `catch` blocks are no longer enclosed by a Wasm `try`, and it also
makes it easier to switch to the new exception handling proposal, which
doesn't have a `rethrow` instruction.

This changes Wasm exceptions reported to the console in uncaught
exceptions, but when we switch to the new exception handling
instructions we will recover the stack traces, as `throw_ref` doesn't
update the stack trace of the error value.

Change-Id: I732c0192af158611d5f0a584182a48b0e13ff83a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410321
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2025-02-18 02:40:17 -08:00
Ömer Sinan Ağacan 26f08dd036 [wasm_builder] Replace parts with libs
Parts make it difficult to see dependencies between files and which
files can be imported. Replace them with libs.

Change-Id: I0a07b48bc3c4a545a420f3efae23f61c4918bdcf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410400
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2025-02-18 02:35:11 -08:00
Martin Kustermann 282ea5868b [dart2wasm] Make json parser use JS parseFloat() directly instead of double.parse()
The `double.parse()` function first runs a regular expression over the
string to validate it's a valid string representation of a double.

Though the json parser does this kind of validation itself, so we can
avoid this regexp match and call the JavaScript `parseFloat()` function
directly.

Change-Id: Ib2c2c4789d63b75b9a24eac5b5ee2b3483c65327
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410320
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-02-17 04:57:30 -08:00
Johnni Winther d3f28d77d1 [cfe] Support parts with imports/parts
This is a part of the enhanced-parts feature needed for further progress on the Builder model migration where patch libraries should be handled as patch parts.

Change-Id: I253b471df56ce383eaf5de18b3287ec3cc161005
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409700
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2025-02-17 03:40:08 -08:00
Martin Kustermann 5c0c426780 [dart2wasm] Improve double.toString() cache
=> We use wasm arrays to represent the cache used for
   stringifcation of doubles.
=> We store unboxed doubles as cache keys and thereby make the cache
   have a cache-hit if the double value is the same (before it was a
   cache-hit if the double box was identical).

Change-Id: Id944f45188f29659b7704a7db5b321aafbe8c9ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410001
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2025-02-17 01:45:36 -08:00
Brian Wilkerson b7178c2b58 [migration] element_visitors.dart
Change-Id: I85b6e19575a1a8695982bf8349fc88c84ace2645
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410241
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-02-14 21:28:52 -08:00
Brian Wilkerson 0c423637b6 [migration] namespace.dart
Change-Id: I87d287cd73e34b3797258e27e4b80e57942bd7c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410163
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-02-14 21:28:39 -08:00
DEPS Autoroller e94b75a007 Roll Fuchsia SDK from 27.20250211.3.1 to 27.20250214.4.1
If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/fuchsia-sdk-dart-sdk
Please CC fuchsia-3p-engprod@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Fuchsia SDK: https://bugs.fuchsia.dev/p/fuchsia/issues/list
To file a bug in Dart SDK: https://github.com/dart-lang/sdk/issues

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-x64-try;luci.dart.try:vm-fuchsia-release-arm64-try
Change-Id: I5a4c65a5f1f7a3de7b8d0124a72819ac83120b10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410140
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Zijie He <zijiehe@google.com>
Reviewed-by: Zijie He <zijiehe@google.com>
2025-02-14 20:34:20 -08:00
Sam Rawlins b77b1f2277 DAS plugins: Add docs for writing a plugin.
Here we provide docs specifically for writing a plugin, using a plugin, and we
improve the text about writing rules.

Change-Id: I3fcfbc50609054158e5bdf964499005a79b4fba8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410160
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-02-14 17:26:01 -08:00
Paul Berry ca2d428f99 Add an OWNERS file for the new Dart Model team
Moving forward, the Dart Model team will own the following packages:
- _fe_analyzer_shared
- analyzer
- analyzer_cli
- analyzer_utilities
- front_end
- frontend_server
- kernel
- testing

In follow-up CLs I will create an OWNERS file for the developer
experience team, and then remove the OWNERS files for the old analyzer
and CFE teams.

Change-Id: Id7cf38ea41a6d3f9ca44f43fae1f310426a31e29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409841
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2025-02-14 15:51:17 -08:00
Brian Wilkerson 02f86848ee [migration] etract_method.dart
Change-Id: I683d58f131fb610cd343e9446a2abf1466313b75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410143
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-02-14 15:49:46 -08:00
Paul Berry d960dcd43c Add an OWNERS file for the Developer Experience team
Moving forward, the Developer Experience team will own the following
packages:
- analysis_server
- analysis_server_client
- analysis_server_plugin
- analyzer_plugin
- language_server_protocol
- linter
- meta
- server_plugin
- telemetry

In follow-up CLs I will create an OWNERS file for the Dart Model team,
and then remove the OWNERS files for the old analyzer and CFE teams.

Change-Id: Icc52ca75e92baf9d05de211e9e3f6c36fb19b71e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409860
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
2025-02-14 15:29:40 -08:00
Paul Berry a2718d9fab Add a machine-generated summary of the analyzer public API.
The summary is checked into source control in
`pkg/analyzer/api.txt`. It contains an entry for each type
declaration, extension, function, method, getter, or setter that is
part of the analyzer API, as well as the types of all functions,
methods, getters, and setters, and all type declarations referenced by
those types.

The tool `pkg/analyzer/tool/api/generate.dart` regenerates
`api.txt`. The test `pkg/analyzer/tool/api/generate_test.dart` checks
that generation of `api.txt` is up to date.

The intention is that `api.txt` will serve as an audit trail to (a)
detect unintentional changes to the analyzer public API, and (b) help
ensure that the developer experience team reviews intentional changes
to the analyzer public API. Once an appropriate OWNERS file has been
set up for the developer experience team, I intend to add an ownership
rule to require developer experience team review for this file.

The structure of the file is hierarchical, with top level nodes
representing libraries URIs, children of those nodes representing top
level elements declared or exported by those libraries, and
grandchildren of those nodes representing members of type
declarations.

If a type is considered part of the API, but it isn't exported by an
analyzer public API library (e.g., the type `Namespace`, which is
declared in `package:analyzer/src/dart/resolver/scope.dart`, but part
of the analyzer API due being exposed by
`LibraryElement.exportNamespace`, `LibraryElement.publicNamespace`,
`LibraryImportElement.namespace`, and so on), then it is listed under
the URI of the library that declares it.

If a type is not considered part of the API, but it is declared inside
`package:analyzer` and it is referenced by something in the API (e.g.,
`Workspace`, which is a private analyzer class but is the type of
`ContextRoot.workspace`), then instead of listing the members of the
type declaration, `api.txt` simply says `(non-public)` after the entry
for the type.

If a type is not considered part of the API, and it is not declared
inside `package:analyzer`, but it is referenced by something in the
API (e.g., `WatchEvent`, which comes from `package:watcher` but is
used in the type of `ResourceWatcher.changes`), then instead of
listing the members of the type declaration, `api.txt` simply says
`(referenced)` after the entry for the type.

If there are two distinct declarations in `api.txt` with the same name
(e.g., the two declarations of `AnalysisContext` from
`package:analyzer/dart/analysis/analysis_context.dart` and
`package:analyzer/src/generated/engine.dart`), then they are
disambiguated by appending an `@` symbol followed by an integer.

Change-Id: Ia2c856e79feebabb74aeb26f57c0a1eea7c63f68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/409862
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-02-14 15:27:51 -08:00
Paul Berry 197bbbd7d9 Ignore TODOs in analysis_server_plugin.
Some time ago, the analyzer team decided to adopt the convention of
using `TODO` comments to document long term issues that should persist
in the codebase, and `FIXME` comments to document short term issues
that need immediate attention.

Accordingly, it makes sense to suppress `TODO` comments from being
surfaced to the IDE "problems" view (since there can be a lot of them,
and they're not immediately actionable).  This makes VSCode's
"problems" view much more usable in "tree" mode.

(See also https://dart-review.googlesource.com/c/sdk/+/295662, which
made the corresponding change to the `analysis_server` and `analyzer`
packages, https://dart-review.googlesource.com/c/sdk/+/325121, which
made the corresponding change to the `linter` package, and
https://dart-review.googlesource.com/c/sdk/+/358980, which made the
corresponding change to the `analyzer_plugin` package).

Change-Id: I916c8c7f435d06c1b0bd871ef3829d58c9242218
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410060
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-02-14 15:02:16 -08:00
Konstantin Shcheglov 7964d55940 Elements. Migrate TopLevelDeclarations.
Change-Id: I9bdcf6ac8c26bfa2eb50de8efd8c2a3a3538403a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410200
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-02-14 14:46:37 -08:00
Brian Wilkerson c38b8bb007 [migration] abstract_rename.dart
Change-Id: I90dc69640a15a8cdf14dc7fa2fb486f30e547445
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410181
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-02-14 14:38:29 -08:00
Konstantin Shcheglov 8059463c11 Elements. Migrate ConstructorInitializerResolver.
Change-Id: I4dda1c61082cec54638c2f9a523a7639e33821d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/410120
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2025-02-14 13:06:09 -08:00