Commit graph

99835 commits

Author SHA1 Message Date
Brian Wilkerson b204f82059 Disable fixes, assists, and refactorings in generated files
Change-Id: I5c9f36b0edc270cab774f355eec9183940b7e6ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352380
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-02-15 22:20:58 +00:00
Konstantin Shcheglov a6f8e62290 Macro. Update elements for more code optimized cases, tests.
We don't use `sync*` anymore, return pairs directly.

Support for multiple annotated fields and top-level variables.

Tests for `NamedType` and function reference.

Change-Id: I4713d0038e585f117631620bb902347182e8c43c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352980
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-02-15 22:13:59 +00:00
Devon Carew 8d703d1371 [deps] rev http, markdown, web_socket_channel
Revisions updated by `dart tools/rev_sdk_deps.dart`.

http (f0a02f9..d8b237d):
  d8b237d  2024-02-15  Kevin Moore  [http] Migrate to the latest pkg:web, require Dart 3.3 (dart-lang/http#1132)
  5179d1c  2024-02-01  dependabot[bot]  Bump actions/cache from 3.3.2 to 4.0.0 (dart-lang/http#1125)
  0b803e8  2024-02-01  dependabot[bot]  Bump dart-lang/setup-dart from 1.6.0 to 1.6.2 (dart-lang/http#1124)
  82e0424  2024-01-29  Brian Quinlan  Use preferred flutter version constraints (dart-lang/http#1119)
  ccefa7c  2024-01-17  Brian Quinlan  Support `BaseResponseWithUrl` in `package:cupertino_http` and `package:cronet_http` (dart-lang/http#1110)
  e7a8e25  2024-01-16  Brian Quinlan  Add `BaseResponseWithUrl.url` (dart-lang/http#1109)
  c8f17a6  2024-01-12  Brian Quinlan  Add a contributing guide (dart-lang/http#1115)
  ebd86b9  2024-01-12  Brian Quinlan  Add the ability to get response headers as a `Map<String, List<String>>` (dart-lang/http#1114)
  5c75da6  2024-01-12  Brian Quinlan  Add tests for sending "cookie" and receiving "set-cookie" headers (dart-lang/http#1113)
  c2a6d64  2024-01-12  Alex Li  [cronet_http] ⬇️ Downgrade `minSdkVersion` to 21 (dart-lang/http#1104)
  661f5d6  2024-01-08  Brian Quinlan  Use `package:http_image_provider` in all `Client` implementation examples (dart-lang/http#1089)
  473a892  2024-01-04  Brian Quinlan  Remove the "play-services-cronet" dependency in the example app when building `package:cronet_http_embedded` (dart-lang/http#1103)
  e79ebe1  2024-01-03  Moritz  Fix `labeler.yml` (dart-lang/http#1099)
  73b0b1c  2024-01-01  dependabot[bot]  Bump actions/labeler from 4.3.0 to 5.0.0 (dart-lang/http#1096)
  15ec3ba  2023-12-21  Brian Quinlan  Prepare to publish `package:cronet_http` as 1.0.0 (dart-lang/http#1087)
  26e55c3  2023-12-21  Brian Quinlan  cronet_http: require android API level 28 (dart-lang/http#1088)
  b10f448  2023-12-22  Alex Li  [cronet_http] Enables CI for `cronet_http_embedded` (dart-lang/http#1070)
  a5b8eec  2023-12-18  Brian Quinlan  Prepare to publish cupertino 1.2.0 (dart-lang/http#1080)
  c114aa0  2023-12-15  Brian Quinlan  Add a fake response for PNG images (dart-lang/http#1081)
  db2cb76  2023-12-14  Kevin Moore  Run web tests with wasm with dev Dart sdk (dart-lang/http#1078)
  36f98e9  2023-12-12  Brian Quinlan  Fix a bug where BrowserClient was listed as requiring Flutter (dart-lang/http#1077)
  db7f165  2023-12-07  Brian Quinlan  Provide an example of configuring IOClient with an HttpClient. (dart-lang/http#1074)
  cd748b6  2023-12-04  Brian Quinlan  Document that runWithClient must be called for every isolate (dart-lang/http#1069)
  f585947  2023-12-04  Brian Quinlan  Test persistentConnection with large request bodies (dart-lang/http#984)
  7c05dde  2023-12-04  Brian Quinlan  Add documentation for "no_default_http_client" (dart-lang/http#1068)
  d8983fa  2023-12-04  Brian Quinlan  Add support for setting headers for all requests (dart-lang/http#1060)
  c90496e  2023-12-04  Brian Quinlan  Document how to use replacement `Client` implementations (dart-lang/http#1063)
  c8536e4  2023-12-01  Kevin Moore  [http_client_conformance_tests] Updates to support wasm compilation (dart-lang/http#1064)
  5dd5140  2023-12-01  dependabot[bot]  Bump actions/setup-java from 3 to 4 (dart-lang/http#1065)
  064f510  2023-11-30  Devon Carew  misc cleanup of yaml files (dart-lang/http#1061)
  22f52e2  2023-11-30  Brian Quinlan  Update pubspec.yaml to 0.4.2 (dart-lang/http#1059)
  40a46d8  2023-11-29  Brian Quinlan  Fix a bug where cronet_http sends incorrect HTTP request methods (dart-lang/http#1058)
  c125ed5  2023-11-27  Kevin Moore  [http] Allow pkg:web v0.3.0 (dart-lang/http#1055)
  9fb4cfa  2023-11-22  Kevin Moore  Update lints to latest, etc (dart-lang/http#1048)
  5e84d9f  2023-11-21  Kevin Moore  Update platform-specific imports for wasm (dart-lang/http#1051)
  8c9feb5  2023-11-21  Kevin Moore  [http] Fix type cast for dart2wasm (dart-lang/http#1050)
  a2f0b25  2023-11-21  Kevin Moore  [http] use pkg:web, require Dart 3.2 (dart-lang/http#1049)

markdown (c2b8429..6efe141):
  6efe141  2024-02-14  Kevin Moore  Migrate example to pkg:web, update minimum required Dart version (dart-lang/markdown#582)

web_socket_channel (5241175..3db86bc):
  3db86bc  2024-02-15  Kevin Moore  Require Dart 3.3 and the latest pkg:web (dart-lang/web_socket_channel#326)
  1c4a923  2024-02-01  dependabot[bot]  Bump dart-lang/setup-dart from 1.6.0 to 1.6.2 (dart-lang/web_socket_channel#323)
  041aa3c  2024-01-08  Devon Carew  adjust the HtmlWebSocketChannel ctor parameter type; rev to 2.4.3 (dart-lang/web_socket_channel#320)
  0e8bedc  2024-01-04  Tyler Dunn  Allow pkg:web v0.3.0 (dart-lang/web_socket_channel#306)
  62370cc  2024-01-01  dependabot[bot]  Bump actions/stale from 8.0.0 to 9.0.0 (dart-lang/web_socket_channel#312)
  2a0563f  2023-12-18  Kevin Moore  Prepare release v2.4.1 (dart-lang/web_socket_channel#301)
  906c944  2023-12-14  Kevin Moore  CI: test dev SDK with dart2wasm (dart-lang/web_socket_channel#304)
  a316c53  2023-12-13  Kevin Moore  Rename helper extensions to not collide with pkg:web unreleased (dart-lang/web_socket_channel#303)
  547184a  2023-12-11  Kevin Moore  blast_repo fixes (dart-lang/web_socket_channel#302)
  969bc6c  2023-12-09  Ömer Sinan Ağacan  Fix JS value to Dart conversion when receiving from a web socket (dart-lang/web_socket_channel#298)
  df096a9  2023-11-30  Ömer Sinan Ağacan  Remove removed lints (dart-lang/web_socket_channel#299)
  67bf9a3  2023-11-23  Nate Bosch  Drop some use of ! (dart-lang/web_socket_channel#296)
  d4a8d70  2023-11-22  Kevin Moore  Small tweak (dart-lang/web_socket_channel#295)
  9e80b8d  2023-11-22  Kevin Moore  migrate to pkg web (dart-lang/web_socket_channel#294)

Change-Id: I87c4baa07efc5fc2bb283c7b32e69ad69c5a02aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352960
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2024-02-15 21:16:04 +00:00
Nate Biggs 276aa29762 [dart2js] Clone call receiver for protobuf replacement placeholder.
Adding a reference to node.receiver in the replacement placeholder was modifying its parent pointer eagerly. When running Dart2js with serialization the pointers were reset by the serialization process after the closed world phase. However, when running without serialization the pointer stayed corrupted and lead to a malfomed tree in later phases. This manifested as an error trying to lookup the location (i.e. the kernel Location) of the receiver.

This fixes the issue by cloning the receiver of the call for the placeholder. This avoids updating the original receiver's parent pointer.

Today the receiver is always a VariableGet referencing a variable defined in a surrounding Let scope (this is how the CFE encodes x..a()..b()). We could cast the receiver but to be a bit more resilient I've opted to clone the node. The cloner in the kernel package fails on free variable (i.e. if the variable is not declared in the cloning scope). But in this case we want to simply use the same declaration reference from the cloned node. I've added a cloner that provides that fallback behavior.

I also considered using a closure to lazily create the replacement but closures are expensive and we'd be creating one per field per proto which would be a considerable cost for large programs. There wasn't really a clean way to do the same with a static tearoff.

Change-Id: I7ef0e24a9457cfa9f2e116eb3569b0652d321c08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352563
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2024-02-15 21:01:02 +00:00
Ryan Macnak 6cfb95ce7c [standalone] Fix setting up the kernel isolate's namespace differently.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/54914
Change-Id: I92b4016df7fcc81b7e2bd94e9124574c419cecfb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352686
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-02-15 20:58:28 +00:00
Konstantin Shcheglov 6b6f78212f Macro. Apply code optimizer, update constants.
Change-Id: I3d7958121d4b3dbdd32b5b960b55baa2632b54ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352723
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-02-15 19:58:39 +00:00
Konstantin Shcheglov 6a5d541645 Macro. Fix test_macroGeneratedFile_existedBeforeLinking on Windows.
Change-Id: I91ea4dffa3c318b25a74e9d479abe9accb2326a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352942
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-02-15 19:53:29 +00:00
Mayank Patke d727cb045a [dart2js] Pass closed world to SSA builder.
Issue: #48820
Change-Id: Ifc4e400ff61b610a6b3c3ec40a10dd96e32e4d19
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352782
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2024-02-15 19:44:48 +00:00
Mayank Patke 37363c83c9 [dart2js] Fix type of RandomAccessFileOutputProvider.onFailure.
Issue: #48820
Change-Id: I62e182a5fd974a5dc488c3dc1b08ff8c1aaae9d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352781
Reviewed-by: Nate Biggs <natebiggs@google.com>
2024-02-15 19:44:48 +00:00
Mayank Patke 117cdfd52d [dart2js] Add type arguments to uses of ConstantValueVisitor.
Issue: #48820
Change-Id: Ie655940c3b44f9be5d113a24c9e4221d7181518a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352780
Reviewed-by: Nate Biggs <natebiggs@google.com>
2024-02-15 19:44:48 +00:00
Mayank Patke 44fedd4dbd [dart2js] Improve HInstruction typing.
Some assorted cleanup, mostly to reduce writing `as HPhi`:
* Add HPhi-specific versions of .previous/.next which perform the cast
* Similarly, add an HPhiList subclass of HInstructionList with casting
  getters for the first and last phi
* Shorten some while loops to for loops

It would be nice to improve the typing further, but it's difficult to
do so without incurring overhead from virtual dispatch or
generic/covariant parameter checks - see #54920.

Issue: #29302
Issue: #48820
Issue: #54920
Change-Id: I7af8eceb1538031460207e049014e58776942c03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352684
Reviewed-by: Stephen Adams <sra@google.com>
2024-02-15 19:44:48 +00:00
Sigmund Cherem 9a4d8b47cf [presubmit] first check for formatting errors in bulk.
The motivation behind this CL is performance: currently
PRESUBMIT.py checks for formatting errors a file at a time.
This can be very slow when a CL modifies a lot of files. For
reference, a command-line invocation of `dart format`
takes 2s to check 100 files at once, vs 70s if you run the
command one file at a time.

This change updates PRESUBMIT.py to run `dart format` first
on all the changed files in bulk to determine whether any
has formatting errors. If any formatting error is found, it
goes through the process of checking each file individually
again for formatting errors and compares the result against
the state before a CL's changes (same process as today).
However, if no errors are found, we bypass the slow check
entirely!

To validate the implementation I created a pretend CL with
100 modifications. I leveraged
`tests/language/function_type/test_generator.dart` to touch
100 test files easily. The results were as expected:

  * if all files are formatted properly, the presubmit
    completes now in 4s (was 76s).

  * If all files have formatting errors, the presubmit
    didn't regress beyond the usual observable performance
    variances (150s in both cases).

Notes about the change itself:

  * refactored to compute the set of affected files before
    running the formatting checks

  * refactored to provide some information as data (e.g.
    `excluded_folders`) instead of lambdas (e.g.
    `should_skip`) to support the first change

  * added a bulk option to `HasFormatErrors` to take the
    fast pass

Eventually we could take this a step further and improve the
performance of the failure case. That would require parsing
the output of the bulk run in order to avoid the individual
runs on all files, and only check for the previous version
of the files that indeed required formatting changes.

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

Change-Id: I0cfbd84f6c62eca48ac91449599ef9ac4c1800f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352740
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2024-02-15 19:29:42 +00:00
Derek Xu 628d744391 [dart:developer][VM/Service] Add APIs to dart:developer for recording HTTP profiling information, and for later retrieving that information
The APIs mentioned above are `addHttpClientProfilingData` and
`getHttpClientProfilingData`.

This CL also makes it so that profiling information recorded using
`addHttpClientProfilingData` is included in dart:io service extension
responses.

TEST= pkg/vm_service/test/get_http_profile_test.dart

Change-Id: I892a7a8485369bb92cbb0c086b93498bcec25d5f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341440
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-02-15 18:56:08 +00:00
Srujan Gaddam 9415aba059 Roll package:web to 0.5.0
The only real breaking change since the last roll should
be the IDL update.

Change-Id: I1cdcf2f6acae52d7b644025e9d0e05a5c1ca7609
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352941
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2024-02-15 18:35:12 +00:00
Nicholas Shahan f6ffe00f28 [ddc] Avoid calling addTypeCaches with new types
Some preparation for deleting all the old type system code.

Change-Id: I9319064100ce19a4122612c36781c7e4a71094aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352724
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-02-15 18:28:49 +00:00
Kenzie Schmoll 0cb3fcca48 [developer] Update dart doc for Service.getIsolateId
Change-Id: I487bdd22362c73051d62147bacb5fe35c3f0445b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352500
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2024-02-15 17:48:00 +00:00
Danny Tuppeny 1e11807735 [analysis_server] Fix timeout in LSP-over-Legacy macro integration tests
Change-Id: I6f31fcf03600262a1e9c2af3ac0d1e2e327c3a9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352860
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-02-15 17:34:57 +00:00
Ömer Sinan Ağacan 2bdcfb7035 [dart2wasm] Fix instantiation closure equality
We can't generate a virtual call to `Object.==` in generated code as
`Object.==` may not be added to the dispatch table, even with
`@pragma(wasm:entry-point)`.

Instead this adds a top-level `_runtimeTypeEquals` function that calls
`==` on the `_Type` argument. Effectively this forces adding `_Type.==`
to the dispatch table and calls it virtually.

Fixes #54926.

Change-Id: Ice3306ed00f66c8abedb3ef11b58c15296457eb0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352900
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2024-02-15 17:33:01 +00:00
osaxma d6baf58b74 [pkg/analysis_server]: fix to ignore diagnostic in anylsis_options.yaml
Similar to `ignore for this line` or `ignore for the whole file`, this
adds a new fix to `ignore in analysis_options.yaml`.

The fix will update the `analyzer.errors` to ignore the selected label.

Related issue: https://github.com/dart-lang/sdk/issues/49572

Additionally, this change modified `createAnalysisOptionsFile` to allow
adding errors to the analysis options for testing purposes.

R=paulberry@google.com

Change-Id: I94b700395ce50417dc0411ff2913f9e4ca908c66
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352220
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Osama Alraddadi <osama.alraddadi@gmail.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-02-15 17:23:08 +00:00
Keerti Parthasarathy 3cb120b6d9 Add signature help test for augmentations.
Change-Id: I88dddfd92c48809067663dfee3ab26803f680fd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352685
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-02-15 17:01:01 +00:00
Tess Strickland d348c473b0 [vm] Refactor typed data cid handling.
No changes in cids, just defining kFirstTypedDataCid and
kLastTypedDataCid to avoid assumptions that kTypedDataInt8ArrayCid is
the first one and that kByteDataViewCid comes after the last one
(outside of compile-time checks for possible new typed data cids before
kTypedDataInt8ArrayCid and kByteDataViewCid).

Also defining kNumTypedDataCidRemainders to be used in the place of the
appropriate hardcoded 4s.

TEST=ci

Change-Id: Ic9f937ef0fa670b3331b9079090596d9a120ee15
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352862
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-02-15 15:32:11 +00:00
Parker Lougheed b55ecc907e [sdk/lib] Update SystemHash.smear for improved parameters
The linked README(https://github.com/skeeto/hash-prospector#two-round-functions) has been updated with these parameters that result in a significantly lower bias that other projects have also began adapting.

For context, this function is used internally by `Object.hashAllUnordered`.

Change-Id: I7ca042196bbfdb5abdb28f8d6d9cbca69d21fb2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351920
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Auto-Submit: Parker Lougheed <parlough@gmail.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2024-02-15 15:06:58 +00:00
Martin Kustermann d3d83e639c [vm] Do not bundle dart.lib in the Dart SDK
Users of our standalone embedders we distribute in the Dart SDK should
be using `dart_api_dl.h` (and initialize it from
the `dart:ffi`s `NativeApi.initializeApiDLData`)

If there's any API functions missing, we can add them.

Though we should not Dart C API symbols that are only relevant for
embedders. It requires a custom embedder implementation (which is
outside the scope of what we distribute in Dart SDK)

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

TEST=ci

Change-Id: I6f3842668c59a5dd6fefc6857581995501b9b0e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352820
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-02-15 14:09:37 +00:00
Jens Johansen f8e58737eb [CFE] Add perf event lister tool; more visible warning for benchmarker when scaling is in effect
I do some benchmarking with our benchmarker tool which uses "perf stat"
under the hood.

"perf stat" uses hardware counters, but we have a limited amount of
those. The benchmarker tool asks for 3 event types that will use 3
hardware counters. If there aren't 3 available it will do "scaling" and
only measure what it's asked some percentage of the time so it can still
measure all of the stuff it's asked.

This should be fine. My computer has 4 hardware counters. I think.
Only today I still experienced scaling.
And previously I asked for 4 event types because I had 4 hardware
counters, but then suddenly 1 went missing.

As it turns out another process was using hardware counters.
This CL includes a tool that - at least seeems to - be able to find
other processes using perf events (although it might not be events that
use hardware counters), thus possibly allowing you to kill that or those
process(es). I did, and I now have 4 hardware counters again.

I also made scaling more visible if it happens when using the benchmark
tool. Before it was hidden between other output, not it's also printed
at the end, together with a hint to use the new tool to attempt to fix
it.

Change-Id: Ia51db04a4f25d1d82c3d32b3901cded7d980e7f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352525
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2024-02-15 10:30:09 +00:00
David Morgan dc586994da [macros] Add language tests for nested macros and disallowed macro use.
Nested macros: check that macro impls can themselves use macros.

Disallowed use: check that macros can't be used in the library in which they are declared, or in the same library cycle.

R=jakemac@google.com

Change-Id: I3b12afc27e5784edc217508b7763a9b448229877
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352522
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Morgan :) <davidmorgan@google.com>
Auto-Submit: Morgan :) <davidmorgan@google.com>
2024-02-15 09:42:41 +00:00
Liam Appelbe c3a626f729 [lib] Private API for disabling Isolate.exit().
This is needed to prevent users from closing the platform isolate.

Bug: https://github.com/flutter/flutter/issues/136314
Change-Id: I98ab0a847dad245a1f1d6c16e96f2f4add39a84f
TEST=runtime/vm/isolate_test.cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352760
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2024-02-15 01:18:40 +00:00
Stephen Adams 4df361c3c3 Reapply "[dart2js] Replace phi with controlling condition"
This reverts commit aec3ec0244.

- Corrected 'controlling condition' detection.
- Added test that is incorrectly compiled to infinite loop with incorrect controlling condition detection.

See https://github.com/dart-lang/sdk/issues/54115#issuecomment-1944285230 for an image of part of the CFG for `doWhileLoop` where the condition in B4 was previously mis-identified as controlling `phi(true,false)` at B12.

Issue: #54115
Change-Id: I0d2c2ff83b202071f6d7050d34de8ff25d05cb22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352443
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2024-02-15 01:02:39 +00:00
Sigmund Cherem 2c71cecc0c [tests] update function tests to use Expect.throwsWhen
Change-Id: I0b909305baea9110fd90423850be5850d7a1a83a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351720
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2024-02-15 00:45:52 +00:00
Ryan Macnak a4072803b3 [vm] Avoid data race during Dart_IsolateGroupHeapNewUsedMetric.
Precise new-space usage requires looking at all the TLAB pointers and normally only occurs under a GC safepoint. For external queries coarsen the answer to capacity.

TEST=g3
Bug: b/324221135
Change-Id: I0e83bbcddba21ddf539fb2afdedf2959cef2c078
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352682
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2024-02-14 22:56:49 +00:00
Keerti Parthasarathy 974dfa3071 Finally fix the windows bot failure
Change-Id: I731da6529aebd0679402fa4832ad001b0c1c242e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-02-14 22:37:59 +00:00
Nicholas Shahan b955d6a628 [ddc] Delete variance tests for old DDC types
- These tests rely on the internals of the old type system.
- Copy some expectations to the language suite when it looks like
  there isn't already coverage for the same test.

Change-Id: I63bfa2bc94fb29b4e4f90c3c02cf0943d19764b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352463
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
2024-02-14 22:29:33 +00:00
Konstantin Shcheglov ea8efc6fc1 Augment. Add all library files, fixes search for constructor added by augmentation.
Change-Id: Idb6d489f454a028e7fa971d5b9f46550b5861940
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352683
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-02-14 22:21:32 +00:00
Sigmund Cherem 9a9f23fd35 [tests] update await_for_test to test behavior variations.
This introduces an asyncExpectThrowsWhen to async_helper, similar to
Expect.throwsWhen, to allow specifying semantics under behavior
variations in this test.

We also update await_for_test to no longer skip expectations in dart2js.

Change-Id: Ie147f74f384a0e196e40b75c59fe585f011ede49
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351721
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2024-02-14 21:43:47 +00:00
Sigmund Cherem 050afd650f [expect] introduce Expect.throwsWhen and Expect.throwsTypeErrorWhen
Today, most tests that touch on a behavior variation end up
skipping expectations or the entirety of a test for some
testing configurations.  Moving forward, we'd like skip less
and try to account for the behavior variations if that's
reasonable.

This CL shows an approach to improve our test coverage for
behavior variations. We introduce two new methods to
[Expect] that allow us to conditionally check that a
function throws, depending on variation predicates.

The CL changes expectations for errors that don't occur
when dart2js omits parameter type checks or implicit
downcasts.

Note: originally I had the intention to introduce a name
parameter to `Expect.throws` and `Expect.throwsTypeError` to
avoid introducing a new API. However, because these APIs are
used for testing core language features, such as function
parameters themselves, we decided to keep the use of
features in these APIs as simple as it can be.

CoreLibraryReviewExempt: no public library semantic change - only improving test coverage under variations
Change-Id: I531657622655778491eaca8b37ba69ffaab559fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351340
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2024-02-14 20:12:05 +00:00
Kallen Tu 7a82e8e995 [test_runner] Support new features in Requirements.
Support `checkedExplicitCasts`,`checkedImplicitDowncasts`, `checkedParameters`, `jsNumbers`, and `nativeNumbers`.

dart2js and DDC configs should support `jsNumbers`.
dart2js and dart2wasm (both optimized) do not support checked parameters nor implicit downcasts checks.
dart2wasm optimized does not support explicit cast checks.

This CL adds these features and makes sure certain configs are opting into these features.

Bug: https://github.com/dart-lang/sdk/issues/54798
Change-Id: If61d513569259317b1fb89c27d3fd97e3542697d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352103
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2024-02-14 19:55:51 +00:00
Robert Nystrom 86146ed6cf Bump dart_internal to allow Dart 3.3.
Change-Id: Ie11f05583cedbbb7a0e91e0d6924cc1ca1871561
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352681
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2024-02-14 19:49:32 +00:00
pq 1fad5e41f6 skip computing lints for macro generated augmentations
Fixes: https://github.com/dart-lang/sdk/issues/54875

Change-Id: Ia1e1f54268ffce82b6348b6edf3d1f0c976298fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352461
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-02-14 19:34:37 +00:00
Parker Lougheed 885126e51b [sdk/math] Mark Point, Rectangle, and MutableRectangle as legacy
These can't be deprecated for a while, at least not until 'dart:html' itself is.

In the mean time, we can at least discourage usage of it and direct developers to more appropriate, long-term solutions.

Contributes to https://github.com/dart-lang/sdk/issues/54852

CoreLibraryReviewExempt: Documentation only change that directs developers to more specific, performant, or flexible solutions.
Change-Id: I9d099a49909673f8af23eab480fdd225e56bcab2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351961
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2024-02-14 18:35:17 +00:00
Daco Harkes 9626a2552f [vm/ffi] Fix Pointer deferred materialization on deopt - fix test
This test deoptimizes, so it can't run in AOT.

TEST=runtime/tests/vm/dart/regress_54871_test.dart

Fixes: https://github.com/dart-lang/sdk/issues/54913
Change-Id: Ida2c67f20c8cf879db2cc9424f3d37535b76370d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352660
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
2024-02-14 17:18:18 +00:00
Keerti Parthasarathy 4ef3c33932 Fix navigation test on windows
Change-Id: I4689e92cc32ca24c3204270bf378ec35d707d4bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352480
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-02-14 15:48:39 +00:00
Daco Harkes 9968419f50 [deps] Roll dart-lang/native
Manuall roll for https://github.com/dart-lang/native/pull/964.

TEST=pkg/dartdev/test/native_assets/

Change-Id: Ie1e762ed57971db105cc9d6d5fa21e9f99e76453
Cq-Include-Trybots: luci.dart.try:pkg-win-release-try,pkg-win-release-arm64-try,pkg-mac-release-try,pkg-mac-release-arm64-try,pkg-linux-release-try,pkg-linux-release-arm64-try,pkg-linux-debug-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352642
Reviewed-by: Moritz Sümmermann <mosum@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2024-02-14 15:32:59 +00:00
Daco Harkes db762108fb [vm/ffi] Fix Pointer deferred materialization on deopt
`Pointer`s were not handled in deferred materialization of objects
on deoptimizations. This lead to the address field being written as a
tagged value, causing the actual address to be smitagged.
Subsequent uses of those addresses would lead to segfaults.

This CL handles the `Pointer`s manually to deal with the untagged
address.

`--trace-deoptimization-verbose` before this CL:

```
Deoptimizing [...]
    _typedDataBase@8050071 <- Pointer: address=0x7ffff7488081
    null Field @ offset(8) <- 140736616678128
    null Field @ offset(16) <- TypeArguments: (H39d2e3b4) [Type: Never]
```

after this CL:

```
Deoptimizing [...]
    _typedDataBase@8050071 <- Pointer: address=0x7fa2c0a88081
    pointer@data <- 0x7fa29c16c0e0
    pointer@type_args <- TypeArguments: (H39d2e3b4) [Type: Never]
```

TEST=runtime/tests/vm/dart/regress_54871_test.dart
TEST=tests/ffi/structs_test.dart with --hot-reload-rollback-test-mode
     and --optimization-counter-threshold=50

Closes: https://github.com/dart-lang/sdk/issues/54871
Change-Id: I13b6404c8b098643b8ac0f59ee8e9bc635f33b8d
Cq-Include-Trybots: luci.dart.try:vm-reload-rollback-linux-debug-x64-try,vm-reload-rollback-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352300
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2024-02-14 14:15:16 +00:00
Jens Johansen 29782f8750 [CFE] Add a few helper utils
These ease my life slightly.
Examples:

Compile to executable to get faster runs:
```
out/ReleaseX64/dart-sdk/bin/dart compile exe pkg/front_end/tool/gitformat_cl.dart -o ~/bin/format_cl
out/ReleaseX64/dart-sdk/bin/dart compile exe pkg/front_end/tool/git_branch_helper.dart -o ~/bin/gitbranch
```

Now I can format my entire CL with
```
$ format_cl
Using file:///path/to/dart-sdk/sdk/out/ReleaseX64/dart
stdout> Formatted 3 files (0 changed) in 0.35 seconds.
```

and get info about my branching with
```
$ gitbranch
├── origin/main
│   ├── add_a_few_cfe_util_tools [ahead 2]
```

Change-Id: I2e89196ab702660a1486894d22678e3cd0c07994
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352641
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2024-02-14 13:56:18 +00:00
Martin Kustermann af1b5b8044 [dart2wasm] Switch binaryen optimization levels from -O3 to -Os
We want dart2wasm be comparable to dart2js / dart2aot, the ladder two
are much more conservative with inlining compared to current dart2wasm.

The -O3 is described in the binaryen sources as agressive for
performance and therefore willing to compromise code size.

The -Os is more nuanced: It will perform many optimizations that are
done in -O3 (and e.g. not in -O2) but it will make inlining less
agressive.

This reduces flute compile-time by 10% and code size by 10%
This benchmark results are mixed (some things get faster, some things
slower). Naturally there'll be specialized micro benchmarks that
get hit hard by this.

Where performance matters we should rather make dart2wasm use better
inlining heuristics and annotate code with
`@pragma('wasm:prefer-inline')`

Change-Id: Idf7e75e4e385629c9cec66359efe0afe50db3e72
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352523
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-02-14 13:45:13 +00:00
Martin Kustermann 2f0bbd9c09 [dart2wasm] Roll binaryen to newer version
The newer version will contain optimizations that remove `array.len`
instructions of arrays that have a known length

Change-Id: I52a302fdfdc757e082c762c89cbcb68123025795
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352524
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-02-14 13:41:46 +00:00
Parker Lougheed d1553ffda6 [cfe] Focus nullable subtype error messages
Now that the types in the message were recently adjusted to include the '?', I think it's beneficial to focus on what the underlying problem is rather than the syntax.

Change-Id: I7e59ea3cc2ce618fe46052a9c5e04a973a5f6ab9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349581
Auto-Submit: Parker Lougheed <parlough@gmail.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2024-02-14 13:22:29 +00:00
Martin Kustermann 5d664b4bd4 [dart2wasm] Avoid using allowInterop in Promise<->Future conversion
The dart closures for the then/onError callbacks we use on a JS promise
will not flow back into dart. There's therefore no reason to use the
very heavyweight `allowInterop` mechanism.

This makes (after [0]) asynchronous calls to JS from Dart more than 2x
as fast.

This also aligns the `promiseToFuture` implementation with the extension on
`JSPromise` (see sdk/lib/_internal/wasm/lib/js_interop_patch.dart)
modulo the fact that the API doesn't work on interop types but Dart
types and needs therefore the full JS<->Dart conversion.

=> Maybe it would make sense to deprecate `promiseToFuture` / not offer it
in dart2wasm and make users use instead the extension on `JSPromise`
instead?

[0] https://dart-review.googlesource.com/c/sdk/+/352520

Change-Id: Ibc80bf083e7ec817f000257d6995108954060277
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352521
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2024-02-14 11:48:15 +00:00
Daco Harkes 13532be38c [deps] Stop auto-rolling dart-lang/native
We're expecting to do multiple breaking changes to native_assets_cli
and native_assets_builder in the foreseeable future. So lets not break
the roller script for DEPS.

Change-Id: I6829de8d11e381fa2c56a974400ac636ec9e84cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350925
Reviewed-by: Moritz Sümmermann <mosum@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2024-02-14 10:49:09 +00:00
Srujan Gaddam f20cd26533 Update JSExport docs to refer to createJSInteropWrapper
Also cleans up some wording and better explains all the possible
features of the annotation.

CoreLibraryReviewExempt: Docs for backend-specific library.
Change-Id: Id5f3e1ea09d2ceaf9f727eb7885b38319b978dd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352441
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2024-02-14 00:36:25 +00:00
kzrnm 47c93a9396 Fix path on Windows test
R=kustermann@google.com, mit@google.com, rmacnak@google.com

Bug: https://github.com/dart-lang/sdk/issues/54903
Change-Id: I132ef3385cdde03ab73df194414a38f9fd9927a9
Cq-Include-Trybots: luci.dart.try:pkg-win-release-try,pkg-win-release-arm64-try,pkg-mac-release-try,pkg-mac-release-arm64-try,pkg-linux-release-try,pkg-linux-release-arm64-try,pkg-linux-debug-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352240
Reviewed-by: Ben Konyi <bkonyi@google.com>
Auto-Submit: Kzrnm <gengesa@gmail.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2024-02-14 00:27:52 +00:00