Commit graph

93227 commits

Author SHA1 Message Date
Ryan Macnak acd374ccf9 [test] Add missing gen_snapshot flags to vm-aot-android-release-arm_x64.
Compare Flutter build.

Change-Id: I1b4cba825f8b81620a30af7751c084e34e978712
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320705
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-08-14 22:56:38 +00:00
Parker Lougheed d2bae29d84 [analyzer] Enable highlighting in docs for yaml diagnostics
Change-Id: Ifc0cf843603547c586c7d0d43828b56a3e8d5114
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-14 22:35:05 +00:00
Paul Berry d31689ae2f Flow analysis: unify field promotions when joining SSA nodes.
Flow analysis implements field promotion using an extension of SSA
(static single assignment) analysis.

In traditional SSA, an analysis phase assigns a collection of SSA
nodes to each local variable in the program, such that each SSA node
represents a region of control flow in which there are no assignments
to the variable, and no control flow joins that might affect the
variable's value. Each local variable read expression is therefore
associated with an SSA node, establishing the invariant that two reads
that share the same SSA node are known to produce identical results.

In flow analysis, SSA nodes are also assigned to property get
expressions, with a similar invariant: two property gets that share
the same SSA node are known to produce identical results. To ensure
soundness, flow analysis generally only considers a property get
expression to be promoted if the get has the same SSA node as a
previous type test.

There's an exception, though: if a property get is associated with an
SSA node that arose from a control flow join, it may be appropriate to
consider it promoted, if the SSA nodes that were joined are both
considered to be promoted. For example, consider the code below:

    class C {
      final int? _i;
      C(this._i);
    }
    f(bool b, C c1, C c2) {
      C c3;
      if (b) {
        c3 = c1;
        if (c3._i == null) return;
      } else {
        c3 = c2;
        if (c3._i == null) return;
      } // (1)
      print(c3._i + 1); // (2)
    }

At (2), it makes sense to consider `c3._i` to be promoted, because
`c3._i` was type checked in both control flow paths leading up to the
join point at (1). However, since those two control flow paths contain
different assignments to `c3`, at the time that the join point (1) is
analyzed, flow analysis assigns a fresh SSA node to `c3._i`, distinct
from the two SSA nodes that were type checked.

To ensure that the promotion is preserved, a new method is introduced,
`SsaNode._join`, which creates the fresh SSA node and updates the
newly created flow model to preserve the promotion. The bulk of the
heavy lifting is done by `SsaNode._joinProperties`, which recursively
walks the `_promotableProperties` maps of the two SSA nodes being
joined, creating fresh promotions for all the properties that should
have their promotions preserved.

This required plumbing some new parameters through
`VariableModel.join` (which calls `SsaNode._join`), so that
`SsaNode._joinProperties` can find the promotion information along the
two incoming control flow paths, and can create fresh promotions for
the outgoing control flow path.

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

Change-Id: I6e53b3363ab5d769bef1b96f0ccd380fa2ca39df
Bug: https://github.com/dart-lang/sdk/issues/53146
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320580
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-08-14 21:27:59 +00:00
Konstantin Shcheglov a8580d3bd3 Extension types. Check implemented non-extension type agsinst representation, not erasure.
See https://github.com/dart-lang/language/pull/3262

Change-Id: I3ee081f43e4b3bf5159450fa94be2ab1672539de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320700
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-14 21:03:58 +00:00
Konstantin Shcheglov b9c1578737 Prepare to publish analyzer 6.2.0 and _fe_analyzer_shared 64.0.0
Change-Id: I02474a58dabd12ea9a4d5a0f2dca8d3de49f35f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320680
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-14 20:32:30 +00:00
Devon Carew 5110db7cb9 [deps] rev lints, protobuf, test, webdev
Revisions updated by `dart tools/rev_sdk_deps.dart`.

lints (1e0245e..54cd7a0):
  54cd7a0  2023-08-11  Parker Lougheed  Cleanup docs and links (#142)

protobuf (217c030..a852ba4):
  a852ba4  2023-08-14  Ömer Sinan Ağacan  Release protobuf-3.1.0, protoc_plugin-21.1.0 (#868)
  8505c58  2023-08-14  Ömer Sinan Ağacan  Generate constructor arguments again, add a flag to disable (#855)

test (9b1828f..bc0a992):
  bc0a992d  2023-08-11  Nate Bosch  Remove always null observatoryUrl for browsers (#2079)

webdev (f8f752c..19aad27):
  19aad27b  2023-08-11  Elliott Brooks  Reset DWDS to version 20.0.2-wip after release (#2193)
  20cc6d3d  2023-08-10  Elliott Brooks  Prepare DWDS for release to version 20.0.1 (#2192)
  9e352670  2023-08-10  Elliott Brooks  Prepare DWDS for release to version 20.0.0 (#2191)
  bc008840  2023-08-10  Bernardo Ferrari  Update `file` dependency. (#2185)
  afbd6401  2023-08-10  Elliott Brooks  Re-enable events_test with fix (#2189)
  1f1efa35  2023-08-10  Elliott Brooks  Fix Flutter crash by catching WipError on resume and mapping to RPC error (#2188)

Change-Id: I159fc1b35b60bab9909f287a9c9f85b624993fb0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320640
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-08-14 19:28:30 +00:00
Alexander Aprelev 987dbe0b72 Revert "[vm/win] Use wide-character api for local hostname on Windows."
This reverts commit 7bdbc0560e as it makes dart crash on Windows 7 and earlier.

Bug: https://github.com/flutter/flutter/issues/130554
Change-Id: I61224ea89aec968465e2bc4fa1dafe0eca215677
TEST=ci
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320620
Auto-Submit: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2023-08-14 19:17:21 +00:00
Ryan Macnak e95e7b8e96 [vm, gc] Mark through new-space.
- Initial and final marking no longer visit all of new-space, reducing the STW pause for major GC.
 - A scavenge during concurrent marking must forward / filter objects in the marking worklist that are moved / collected, increasing the STW pause for minor GC.
 - Unreachable intergenerational cycles and weak references are collected in the next mark-sweep instead of first requiring enough scavenges to promote the whole cycle or weak target into old-space.
 - Artificial minor GCs are no longer needed to avoid memory leaks from back-to-back major GCs.
 - reachabilityBarrier is now just a count of major GCs.

TEST=ci
Change-Id: I8c2c64b120766571b62d3bd8dab37ae81c2dca98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319583
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2023-08-14 18:16:05 +00:00
Parker Lougheed 0140ecd9dd [analyzer] Clarify obsolete colon separator diagnostic messaging
Clarify that the diagnostic applies to optional named parameters, that support is already removed, and showcase the symbols themselves for extra clarity.

Change-Id: I0920793452bb8b0aaba04cbc96e89bb8acd571c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320442
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-14 16:44:03 +00:00
Erik Ernst f15404e908 Correct libraryExport to use configurableUri
Bug: https://github.com/dart-lang/sdk/issues/53214
Change-Id: Idb0756d0c666c8126f5bbb7247b0e40791f28e39
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320560
Commit-Queue: Erik Ernst <eernst@google.com>
Auto-Submit: Erik Ernst <eernst@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2023-08-14 16:33:19 +00:00
Ömer Sinan Ağacan 332f874bd0 [dart2wasm] Make implementation libraries part of core to hide internals
Previously we had started to move core patch files to libraries for
better code organization.

However moving implementation classes to separate libraries required
making the implementation types and internal members public.

This has two problems:

1. The members can be accessed by end users via `dynamic`.
2. More importantly, because those public internal members can impact
   TFA results.

We don't care about (1) too much, but (2) is important.

So in this CL we make the libraries part of `core` again, while keeping
the file structure the same when possible.

With implementation files listed as "patches" they can still have their
own imports, but hey won't be importing each other as they're all part
of the same library.

This is the first CL in series that merges `_boxed_int` and
`_boxed_double` libraries back to `core`, and `_typed_data` back to
`typed_data`. Follow-up CLs will merge the other libraries back to
`core`.

The conventions for files is:

- Files that patch core types are named `..._patch.dart`.

- Implementation classes are in separate files. Names of the
  implementation files is either the implementation class name (e.g.
  `boxed_double.dart` for `_BoxedDouble`), or when implementing multiple
  class, name of the library being implemented (e.g. `typed_data.dart`).

Following these conventions, `double.dart` is renamed to
`double_patch.dart`.

Because we lose namespacing for helpers, the helper intrinsics like
`double` `_toInt` are moved to class members, as before.

One problem in the current CL is that in `libraries.yaml`, when I
`include` a target, I can't add more `core` patches to the included
target, the patch section overrides the included patches. I don't know
if this is a bug yet. If it is, we can refactor `libraries.yaml` after
it's fixed.

Tested: Changes covered by existing tests.
Change-Id: Iba7d81d383deff61aad521000f0ca9cf9276dcfb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319500
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-08-14 11:09:10 +00:00
Johnni Winther 915173dc59 [cfe] Pass enablePatterns to textualOutline
This add support for patterns in textual outline by requiring callers
to pass an 'enablePatterns' flags. For incremental compilation this is
derive from the previously built library. For the textual outline suite
this is derived from the experimental flags.

Change-Id: Iebf420162c83808e2d0e2acb6e7fc147fec5c617
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320520
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-08-14 10:42:03 +00:00
Johnni Winther 59c3ab312b [cfe] Allow FormatterCrash for unreleased features
This extracts the FolderOptions and TestOptions logic from suite.dart
to be shared with other test suites. The former is used to allow
the textual outline suite to have a formatter crash while a feature
is not yet released. These crashes have caused quite a bit of churn
in the early development of new features.

Change-Id: Iac607ea8fc1c8ae0ba9dd0397bccb9a11fbae9a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319982
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2023-08-14 07:27:27 +00:00
Liam Appelbe 5c723e996e [vm/ffi] Weak RawReceivePorts and NativeCallables
Bug: https://github.com/dart-lang/sdk/issues/49083
Change-Id: I9643fe54e46042021146a19e6ec1c1d967cd6496
Fixes: https://github.com/dart-lang/sdk/issues/49083
CoreLibraryReviewExempt: The isolate and FFI packages are VM-only
TEST=raw_port_test.dart and async_void_function_callbacks_test.dart
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/314360
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-08-14 02:30:11 +00:00
Nate Bosch a0d93bb19e Bump collection to 1ed009ea55434f58747209458a21faf8693fc6f7
Changes:
```
> git log --format="%C(auto) %h %s" 0a2885a..1ed009e
 https://dart.googlesource.com/collection.git/+/1ed009e Make sure .sample()'s result is randomized in more cases (302)
 https://dart.googlesource.com/collection.git/+/0707609 Fix changelog and version (303)
 https://dart.googlesource.com/collection.git/+/8bcb6af Add IterableExtension.shuffled (298)

```

Diff: https://dart.googlesource.com/collection.git/+/0a2885a90717cc9322faaa6a7365b69e06b531dc..1ed009ea55434f58747209458a21faf8693fc6f7/
Change-Id: I76585a20df8aacdf2fcba465c91181e748b5c0c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320380
Commit-Queue: Devon Carew <devoncarew@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Auto-Submit: Nate Bosch <nbosch@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2023-08-12 01:50:57 +00:00
Nicholas Shahan 0c8224cf2f [ddc] Temporarily allow safeStr() to handle null
This change is intended to be a temporary fix until the broken
internal test is fixed.

Change-Id: I0f6c334bd54c605306318b95836e91755252580f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320340
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-08-12 00:31:55 +00:00
Brian Wilkerson 083b3e5150 Update the generated diagnostic docs
This should fix one of the issues turning the bots red.

Change-Id: I5729e1f4cb8dd12b33391113166581d5d6618e67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320260
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-11 22:55:35 +00:00
Brian Wilkerson 0239101041 Convert more KeywordContributor methods
Change-Id: I9cbf77e115b77d635f1bec3c046fb38749ea76c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320080
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-08-11 21:38:31 +00:00
Konstantin Shcheglov 5d4b6cd1b1 Extension types. Index references, tests.
Change-Id: I58cb75b19741784617da8aac82984876de3f81a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320220
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-08-11 21:36:27 +00:00
Ryan Macnak 45bc417d7d [vm] Fail describing errno if memfd_create fails for any reason except ENOMEM.
Avoids the VM later failing with a misleading "Out of Memory" message when allocation fails for lack of available file descriptors.

Cf. 78732b243e

TEST=ulimit
Change-Id: I2edbcf98cc8e30f70e6b0efe63b2d301fb03e191
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320180
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-08-11 21:30:17 +00:00
Konstantin Shcheglov 7bf5cf5abe Extension types. Methods / getters redeclare getters / methods.
Change-Id: I477728d33c04e33040ca51341654ae61529e7d2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320181
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-11 21:16:10 +00:00
Alexander Aprelev 2cd2bed059 [gardening] Make standalone/package/package_isolate_test a no-op in AOT.
The test relies on spawning some other dart helper scripts, which is not supported for AOT tests at the moment.

BUG=https://github.com/dart-lang/sdk/issues/53195
TEST=ci

Change-Id: Id083440227f5cf446c296c9ca561ab2147c0da75
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320200
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-08-11 21:06:10 +00:00
Nate Biggs 779fe017ba [dart2js] Add Dart web speciailized expectation helpers.
There are many failing Dart2JS language/library tests due to differences in backend implementations.

We want to adopt a strategy that allows us to make explicit the different expectations we have of each backend.

This adds logic for the 2 most common causes of these backend related failures (numbers and implicit checks) but we can add more of these as we discover more use cases.

This is an iteration on https://dart-review.googlesource.com/c/sdk/+/293463 attempting to integrate feedback from that change.

Change-Id: Ie3a1954066199695d92881497e940385467c9a12
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311780
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2023-08-11 20:59:30 +00:00
Kallen Tu adb68f4bb0 [analyzer] Provide better errors for invalid .length access in const expressions.
Add a new error message `CONST_EVAL_PROPERTY_ACCESS` for when we try to get 'length' on anything that's not a `String`.

This adds more specific errors for string length that would've went to the catch-all error at the end of `_getConstantValue` before. It should be more clear now what the error is.

Fixes https://github.com/dart-lang/sdk/issues/47273, https://github.com/dart-lang/sdk/issues/52833

Bug: https://github.com/dart-lang/sdk/issues/52833, https://github.com/dart-lang/sdk/issues/47273
Change-Id: I1f5daed82be00c6a8ecd43384d7ff9e59219cbb4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319160
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-08-11 20:08:31 +00:00
Konstantin Shcheglov 0ce9ae9204 Extension types. Report when multiple representation fields.
Change-Id: I8d920ecdb04bb8b27f83b3126c8106682f613a02
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320124
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-11 19:48:01 +00:00
Konstantin Shcheglov 1c2934d42f Extension types. Report an error if the representation field has a modifier.
Change-Id: Ied3e14f67a4aad18b11c17f0ed8d986f95a3c9f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320123
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2023-08-11 18:41:12 +00:00
Devon Carew accf5a5807 [deps] rev dartdoc, ffi, http, test, tools
Revisions updated by `dart tools/rev_sdk_deps.dart`.

dartdoc (e8d00c0..5cfb1f3):
  5cfb1f36  2023-08-07  Sam Rawlins  Bump to analyzer 6.1.0 (#3474)

ffi (f01dfca..e2c01a9):
  e2c01a9  2023-08-08  Slava Egorov  Expose pointer to free from allocators (#203)

http (7e9ed12..9f167a7):
  9f167a7  2023-08-08  Alex James  Remove example test from java_http (#1001)

test (5d571d6..9b1828f):
  9b1828f4  2023-08-09  Nate Bosch  Send a MessagePort to host on frame startup (#2072)
  ae2ab1ee  2023-08-08  Jacob MacDonald  publish test_core v0.5.6 (#2076)
  2e9bba21  2023-08-08  Jacob MacDonald  fix failing casts when talking to minified apps from the host (#2075)

tools (f14bf2e..295ff92):
  295ff92  2023-08-10  Elias Yishak  Fix empty string for `CLIENT_ID` from being sent when user decides to opt in (#144)
  bc6c9f0  2023-08-09  Elias Yishak  Clean up on dart docs across all dart files under lib (#142)

Change-Id: I75147259ce51f240c1dc359896ec7709bada288f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319783
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Devon Carew <devoncarew@google.com>
2023-08-11 18:40:39 +00:00
Alexander Aprelev f22d82f70e [gardening] Fix standalone/package/* tests.
BUG=https://github.com/dart-lang/sdk/issues/46528
TEST=standalone/package

Change-Id: Id8d99afef86df3f676bf54d62b047c2d9b4747fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319905
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-08-11 18:15:11 +00:00
Ryan Macnak f763d12190 [vm, gc] Remove flag to disable write barrier elimination.
- This causes inconsistency between AppJIT trained kernel service including eliminating barriers but the runtime compensation being disabled.
 - The barrier elimination in the SuspendState stubs cannot be disabled.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/52990
Change-Id: I4c5c7817a51f303d6f3bdbea8c15ad23a3e57735
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319906
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-08-11 17:56:57 +00:00
Keerti Parthasarathy f3acac0b5a Add an option to format code to BulkFixProcessor
Change-Id: Ie069b5e16ccf0c13c1f61cd38690b20968b7c907
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319868
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-11 17:53:28 +00:00
Alexander Aprelev fe547cfac8 [gardening] Remove Crash entries for standalone/io tests that actually pass.
TEST=ci

Change-Id: I3228db7490735dd36265fac6549376a4e83910e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319907
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-08-11 17:27:29 +00:00
Paul Berry 907e705307 Flow analysis: use a more precise split point for refutable patterns.
Previously, the flow control logic for patterns didn't use the
`FlowModel.split` or `FlowModel.unsplit` methods at all. This meant
that if a control flow join point occurred in pattern logic, flow
analysis would consider the split point to be whatever split point was
established by the enclosing expression or statement. In the case of
an if-case statement, it would consider the split point to be at the
beginning of the scrutinee expression.

Split points are used by flow analysis for the sole purpose of
ensuring that joins propagate type promotions the same way in dead
code as they do in live code (so that users introducing temporary
`throw` expressions or `return` statements into their code do not have
to deal with nuisance compile errors in the (now dead) code that
follows. The consequence of flow analysis considering the split point
to be at the beginning of the scrutinee expression is that if the
scrutinee expression is proven to always throw, then joins that arise
from the pattern or guard may not behave consistently with how they
would have behaved otherwise. For example:

    int getInt(Object o) => ...;
    void consumeInt(int i) { ... }
    test(int? i) {
      if (
          // (1)
          getInt('foo')
          case
              // (2)
              int()
          // (3)
          when i == null) {
      } else {
        // (4)
        consumeInt(i);
      }
    }

In the above code, there is a join point at (4), joining control flows
from (a) the situation where the pattern `int()` failed to match, and
(b) the situation where `i == null` evaluated to `false` (and hence
`i` is promoted to non-nullable `int`). Since the return type of
`getInt` is `int`, it's impossible for the pattern `int()` to fail, so
at the join point, control flow path (a) is considered
unreacable. Therefore the promotion from control flow path (b) is
kept, and so the call to `consumeInt` is valid.

In order to decide whether to preserve promotions from one of the
control flow paths leading up to a join, flow analysis only considers
reachability relative to the corresponding split point. Prior to this
change, the split point in question occurred at (1), so if the
expression `getInt('foo')` had been replaced with `getInt(throw
UnimplementedError())`, flow analysis would have considered both
control flow paths (a) and (b) to be unreachable relative to the split
point, so it would not have preserved the promotion from (b), and
there would have been a compile time error in the (now dead) call to
`consumeInt`.

This change moves the split point from (1) to (2), so that changing
`getInt('foo')` to `getInt(throw UnimplementedError())` no longer
causes any change in type promotion behavior.

The implementation of this change is to add calls to `FlowModel.split`
and `FlowModel.unsplit` around all top-level patterns. At first glance
this might appear to affect the behavior of all patterns, but actually
the only user-visible effect is on patterns in if-case statements,
because:

- In switch statements and switch expressions, there is already a
  split point before each case.

- In irrefutable patterns, there is no user-visible effect, because
  irrefutable patterns cannot fail to match, and therefore don't do
  any control flow joins.

This change allows the split points for patterns to be determined by a
simple syntactic rule, which will facilitate some refactoring of split
points that I am currently working on.

Change-Id: I55573ba5c28b2f2e6bba8731f9e3b02613b6beb2
Bug: https://github.com/dart-lang/sdk/issues/53167
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319381
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-08-11 17:09:49 +00:00
Konstantin Shcheglov c9684e54e8 Extension types. Compute notSimplyBounded flag.
Change-Id: I18f40aab9ca163b248c0d5555ce9cfdfa3e9efe2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320120
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-11 16:39:53 +00:00
Konstantin Shcheglov fd61717401 Extension types. Adjust isNullable(), only potentially nullable.
Change-Id: I382394267de3eaab6314d006ed32dbcf53d4d9b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320100
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-11 16:29:33 +00:00
Alexander Aprelev 61111a5af1 [ssl/mac] Avoid unnecessary allocations of x509 certificates, fix leak.
BUG=https://github.com/dart-lang/sdk/issues/53113
TEST=leaks --atExit -- xcodebuild/DebugARM64/dart --sound-null-safety -Dtest_runner.configuration=vm-mac-debug-arm64 --packages=$DH/.dart_tool/package_config.json $DH/tests/standalone/io/https_bad_certificate_test.dart

Change-Id: Ie9ba76a507c42879206929a42071c0a1a8c6ceaa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319080
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-08-11 16:28:46 +00:00
Anna Gringauze 8f4e5c8194 [ddc] Fix runtime failure on evaluation of expressions that use JS interop and extension types
Incremental compiler only runs procedure transformations during expression compilation, as opposed to modular library transformations
that are run during initial compilation stage on libraries (including JS interop-related transformations).


In this CL:

- Add implementation of `performTransformationsOnProcedure` to dev compiler target
  - runs JS interop-related transformations on a procedure.
- Add related expression evaluation tests
  - expressions using JS interop and extension types.

Closes: https://github.com/dart-lang/sdk/issues/53048
Change-Id: I085920db9c3af4c680283c574087d8901c99dfcf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319585
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2023-08-11 16:15:00 +00:00
Parker Lougheed 410c394374 [analyzer] Mark DEFAULT_LIST_CONSTRUCTOR as removed
Follow-up to https://dart-review.googlesource.com/c/sdk/+/276770

Change-Id: I583d19e3fab99594a12083381cc98cd1e453efcf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319641
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-11 14:54:58 +00:00
Parker Lougheed 0360930dbc [changelog] Add optional named parameter separator breaking change
Fixes https://github.com/dart-lang/sdk/issues/52491

Bug: https://github.com/dart-lang/sdk/issues/52491
Change-Id: Ief94acb7a3ba75ea555718e017e39ce2c418b41e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320020
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2023-08-11 14:49:32 +00:00
Parker Lougheed 80fb7b3f9d [release] Update changelog with stable patch notes
Change-Id: I5bbf530c55be59c0a7b23d5d035d266d19eecd5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320040
Commit-Queue: Kevin Chisholm <kevinjchisholm@google.com>
Reviewed-by: Kevin Chisholm <kevinjchisholm@google.com>
2023-08-11 14:43:13 +00:00
Tess Strickland 4af0a59e8c [benchmarks] Change the MemoryCopy memcpy benchmarks to use memmove.
While our benchmarks don't involve overlapping memory between source
and destination, general methods for copying between TypedData must.
Thus, our benchmark for using the C interface via FFI must use memmove
instead of memcpy.

To avoid having to update our benchmark configurations, the name of
that benchmark is unchanged.

In addition, this CL adds filtering for benchmark names and turning on
and off specific outputs for quick comparisons when running manually.

Change-Id: I20616549d8bc9ab481884846d3f13df20a3c854e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319981
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-08-11 13:17:17 +00:00
Oleh Prypin 6bd0bb4fec Revert "[dart2js] Use symbols for isolate tags"
This reverts commit 58f4b3a7a6.

Reason for revert: Causes build failures in google3 - b/295404395

Original change's description:
> [dart2js] Use symbols for isolate tags
>
> All supported browsers have JavaScript Symbols so use Symbols.
> Avoiding string property names should fix a bug where separate
> programs running in separate iframes arrive at using the same
> property.
>
> Issue: #53154
> Change-Id: I470dc47de3ad381aeab670cf62d62e53f2e72873
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319865
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Commit-Queue: Stephen Adams <sra@google.com>

Issue: #53154
Change-Id: I581fe08aee6ac9e2d74e813641a942223553cf5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319980
Auto-Submit: Oleh Prypin <oprypin@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Oleh Prypin <oprypin@google.com>
2023-08-11 12:48:31 +00:00
Johnni Winther 1c12ac639f [cfe] Compute instantiated representation type
TEST=pkg/front_end/testcases/inline_class/extension_types/representation_type.dart

Change-Id: I384c7b68513ccf8426a41029622b8c0913197cd2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319481
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-08-11 10:32:00 +00:00
Jens Johansen a445fae681 [parser] Fix issue 52954 about nested record destructuring with shorthand
Fixes https://github.com/dart-lang/sdk/issues/52954

Change-Id: I41e229380ccc16aa8bab0696fa79ca701a43220f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/317681
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-08-11 09:19:31 +00:00
Aske Simon Christensen 1e3689cfa7 [dart2wasm] Fix isSubtype case of type parameter vs FutureOr
Change-Id: I3b6186426af231473fe2d93afcc787ffef6d3a97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319760
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-08-11 09:08:32 +00:00
Aske Simon Christensen 64dd387d09 [dart2wasm] Fix normalization of nullable FutureOr
Change-Id: I471534ef458fe5ba79996534015fa1d14983cbb3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318922
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-08-11 09:08:32 +00:00
Aske Simon Christensen 0c1bb28ad4 [dart2wasm] Special runtime type classes for special interface types
Adds special representations of runtime types for the interface types
`Object`, `Function` and `Record`. With this change, all types with
non-interface subtypes have special representations, which avoids some
special cases down the line.

Change-Id: I61b4da20fa1cc62d42e1770278a3272028c9e2a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/318681
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-08-11 09:08:32 +00:00
Martin Kustermann 166c5d7b41 [vm] Add test for dart:developer registerExtension() method
There was a bugfix in [0] to ensure the passed closure is invoked in the
right zone, but it was missing a test.

There seems to be also no other tests of `registerExtension()`.
=> So we'll add a test in this CL.

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

Issue https://github.com/dart-lang/sdk/issues/53178
Issue https://github.com/flutter/flutter/issues/93676

TEST=dart/flutter_regress_93676_test

Change-Id: Ibfdf15026b36beff1db9cef30c69a052b9efc77d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319940
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2023-08-11 08:18:30 +00:00
Stephen Adams 58f4b3a7a6 [dart2js] Use symbols for isolate tags
All supported browsers have JavaScript Symbols so use Symbols.
Avoiding string property names should fix a bug where separate
programs running in separate iframes arrive at using the same
property.

Issue: #53154
Change-Id: I470dc47de3ad381aeab670cf62d62e53f2e72873
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319865
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-08-10 23:42:16 +00:00
Konstantin Shcheglov ab7f49166e Extension types. Report deferred superinterfaces.
Change-Id: Ie767ce5e96953d83edeeb3331bea0aecfc5f51a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319904
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-08-10 23:17:35 +00:00
Konstantin Shcheglov f6db810b96 Extension types. Report CONFLICTING_METHOD_AND_FIELD and CompileTimeErrorCode.CONFLICTING_FIELD_AND_METHOD.
Change-Id: I3ebf1f2f767f2b64cf47e2c80473b086695d20d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/319869
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-08-10 22:54:26 +00:00