Commit graph

87686 commits

Author SHA1 Message Date
Sigmund Cherem
c41cec8f50 [dart2js] migrate world.dart
Change-Id: Ib0bc169bc58675e9202a35fd232cf24f1dfac1e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262278
Reviewed-by: Nate Biggs <natebiggs@google.com>
2022-10-03 17:49:56 +00:00
Sigmund Cherem
9768f74c59 [dart2js] migrate resolution_listener.dart
Change-Id: I4fcb759ce8b65a59952506ff83462b92859c13eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262275
Reviewed-by: Nate Biggs <natebiggs@google.com>
2022-10-03 17:49:56 +00:00
Sigmund Cherem
7ab05daa4b [dart2js] prepare resolution_listener.dart
Change-Id: Ic69113e3640985283dc5ba292b060b9bdbe229d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262274
Reviewed-by: Nate Biggs <natebiggs@google.com>
2022-10-03 17:49:56 +00:00
Konstantin Shcheglov
b861b0c1e1 Issue 50096. Use Glob with the parent Folder.
Bug: https://github.com/dart-lang/sdk/issues/50096
Change-Id: I777364acd34e0ad248d4d99a31f45315487557e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262269
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-10-03 16:37:18 +00:00
Konstantin Shcheglov
998daf1fc1 Issue 50103. Report equal record typed const Set elements, Map keys.
Bug: https://github.com/dart-lang/sdk/issues/50103
Change-Id: Id8c709ca2cccadb517932097dec0d4224085f597
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262361
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-10-03 16:27:13 +00:00
Johnni Winther
00f85bbb6c [vm,wasm] Share patch libraries
This shares patch libraries between vm and wasm.

The shared libraries are those previously shared as parts, except
the libraries that need private access to other patch libraries.

Change-Id: I69598a0d2ede5138e9ce33fb59dfa46c987eb38a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262320
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2022-10-03 15:50:19 +00:00
Dan Chevalier
003ea967a5 Bump DevTools DEP to 2.18.0
Change-Id: I2982ddd363d46fcb1bbb3f8137f89a0cb83178f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262400
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-10-03 15:33:04 +00:00
Danny Tuppeny
8941837fb7 [analysis_server] Prevent "Extract Method" refactor showing up for function declarations
Fixes https://github.com/Dart-Code/Dart-Code/issues/4165.

Change-Id: I799220fffabfa39af1b2fd3039cb2de903f90c72
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262348
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-10-03 15:08:48 +00:00
Martin Kustermann
aa4339a9f3 Allow tab-completion of commands, expression types and named sets
This CL extends the heapsnapshot analysis CLI with tab-completion support
for commands, options, filenames, expression types and named sets.

This makes it much more comfortable to use the tool.

TEST=runtime/tools/heapsnapshot/test/completion_test

Change-Id: Iea48b4bd12651a60add6206a92ce06823cbd754a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262243
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-10-03 14:58:58 +00:00
Martin Kustermann
f7808a1aeb [gardening] Ensure unboxed fields are considered non-nullable with concrete cid.
Closes https://github.com/dart-lang/sdk/issues/50110

TEST=vm/dart{,_2}/regression_50110_test

Change-Id: I2f0c06febf55dbf20ca96213a0c5941c2f3ef1a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262344
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-10-03 12:36:18 +00:00
Daco Harkes
b113fffb65 Reland "[vm/ffi] Throw on returning Error in Handle"
Fix: Check handle contents for Smi.
Closes: https://github.com/flutter/flutter/issues/112726

Orignal CL description:

Makes `Dart_Handle` FFI returns behave as the following snippet:

```
Dart_Handle ExampleSnippet() {
  Dart_Handle result = ...;
  if (Dart_IsError(result)) {
    Dart_PropagateError(result);
  }
  return result;
}
```

Also makes FFI consistent with Dart_NativeFunctions, which will
automatically throw upon return if Dart_SetReturnValue set the result
to an error.

`UnhandledExceptions` cannot flow out into Dart generated code. So,
the implementation needs to be in `FfiCallInstr::EmitNativeCode`.

Using `Dart_IsError` is slow compared to a machine code class id
check. So, we should do the handle unwrapping and class id check in
machine code.

Unwrapping Handles in machine code is only safe when the GC is
guaranteed to not run: Either (1) in `kThreadInGenerated`, or (2) in
`kThreadInNative`, but only when transitioned into safepoint. So, the
handle cannot be unwrapped immediately after the FFI call in machine code. We first need to transition back to generated.

This means we need to transition again to native to do the actual
`Dart_PropagateError` call. We can do so without the stub in JIT
because we never return with normal control flow.

Performance impact of this change is within benchmark noise in both
JIT and AOT.
Size impact is 42 bytes on x64, which is 10% in AOT and 12% in JIT.

For more numbers see: go/dart-ffi-handle-error

TEST=runtime/bin/ffi_test/ffi_test_functions_vmspecific.cc
TEST=tests/ffi/vmspecific_handle_test.dart

Closes: https://github.com/dart-lang/sdk/issues/49936
Change-Id: Id8edfd841a7d6246438386007d83747868a0a151
Cq-Include-Trybots: luci.dart.try:vm-canary-linux-debug-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-kernel-gcc-linux-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-x64c-try,vm-kernel-msvc-windows-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-tsan-linux-release-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-mac-release-arm64-try,vm-kernel-precomp-win-debug-x64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262342
Reviewed-by: Martin Kustermann <kustermann@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-10-03 12:25:08 +00:00
Johnni Winther
2c3b2e2c45 [cfe] Pass --no-sound-null-safety explicitly
This prepares for changing sound null safety default.

Closes https://github.com/dart-lang/sdk/issues/50102

Change-Id: I88aa7994dd5542895c829d7777dd42d3b9438a29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262321
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2022-10-03 11:52:58 +00:00
Jens Johansen
92b97fe6fb [parser] Field formal parameter with explicit record type
Fixes https://github.com/dart-lang/sdk/issues/50007

Change-Id: I4cce2fd49db9a71b344d5d3e3ea1e0a941a434ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262200
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-10-03 07:14:26 +00:00
Paul Berry
06847c34fb Adjust patterns parsing tests to follow analyzer conventions
See test naming conventions here:
https://github.com/dart-lang/sdk/blob/main/pkg/analyzer/doc/implementation/tests.md

This is a rename-only change; this is not clear from the diff due to
sort order changes.

Change-Id: Ia84ca7b188f4bb21f8cfce60e037be792adcdc87
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262022
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-10-02 16:38:50 +00:00
Zach Anderson
2742d90033 Revert "[vm/ffi] Throw on returning Error in Handle"
This reverts commit d9c442bce8.

Reason for revert: https://github.com/flutter/flutter/issues/112726

Original change's description:
> [vm/ffi] Throw on returning `Error` in `Handle`
>
> Makes `Dart_Handle` FFI returns behave as the following snippet:
>
> ```
> Dart_Handle ExampleSnippet() {
>   Dart_Handle result;
>   if (Dart_IsError(result)) {
>     Dart_PropagateError(result);
>   }
>   return result;
> }
> ```
>
> Also makes FFI consistent with Dart_NativeFunctions, which will
> automatically throw upon return if Dart_SetReturnValue set the result
> to an error.
>
> `UnhandledExceptions` cannot flow out into Dart generated code. So,
> the implementation needs to be in `FfiCallInstr::EmitNativeCode`.
>
> Using `Dart_IsError` is slow compared to a machine code class id
> check. So, we should do the handle unwrapping and class id check in
> machine code.
>
> Unwrapping Handles in machine code is only safe when the GC is
> guaranteed to not run: Either (1) in `kThreadInGenerated`, or (2) in
> `kThreadInNative`, but only when transitioned into safepoint. So, the
> handle cannot be unwrapped immediately after the FFI call in machine code. We first need to transition back to generated.
>
> This means we need to transition again to native to do the actual
> `Dart_PropagateError` call. We can do so without the stub in JIT
> because we never return with normal control flow.
>
> Performance impact of this change is within benchmark noise in both
> JIT and AOT.
> Size impact is 42 bytes on x64, which is 10% in AOT and 12% in JIT.
>
> For more numbers see: go/dart-ffi-handle-error
>
> TEST=runtime/bin/ffi_test/ffi_test_functions_vmspecific.cc
> TEST=tests/ffi/vmspecific_handle_test.dart
>
> Closes: https://github.com/dart-lang/sdk/issues/49936
> Change-Id: Ie8fabeb6d53bc80689541bc4470cb37ee2200581
> Cq-Include-Trybots: luci.dart.try:vm-canary-linux-debug-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-kernel-gcc-linux-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-x64c-try,vm-kernel-msvc-windows-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-tsan-linux-release-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-mac-release-arm64-try,vm-kernel-precomp-win-debug-x64c-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261603
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Daco Harkes <dacoharkes@google.com>

TBR=kustermann@google.com,rmacnak@google.com,dacoharkes@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I94cc63de16b54db2b0a4f92759c39a1e569b8e63
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Cq-Include-Trybots: luci.dart.try:vm-canary-linux-debug-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-kernel-gcc-linux-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-x64c-try,vm-kernel-msvc-windows-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-tsan-linux-release-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-mac-release-arm64-try,vm-kernel-precomp-win-debug-x64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262270
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2022-09-30 21:51:59 +00:00
Sergey G. Grekhov
cb45aa8a93 [co19] Roll co19_2 to bb3d5399f6335011231cd57b127748bee81f2b40
2022-09-30 sgrekhov22@gmail.com Fixes dart-lang/co19#1478. Failures of the new co19_2 roll fixed. (dart-lang/co19#1480)
2022-09-28 sgrekhov22@gmail.com dart-lang/co19#195. RawDatagramSocket tests fixed (dart-lang/co19#1465)
2022-08-31 sgrekhov22@gmail.com dart-lang/co19#1405. Don't use deprecated API in co19_2 tests (dart-lang/co19#1409)
2022-08-31 sgrekhov22@gmail.com dart-lang/co19#1405. co19_2. BytesBuilder tests moved from dart:io to dart:typed_data (dart-lang/co19#1411)
2022-08-23 sgrekhov22@gmail.com dart-lang/co19#1394. Add missing compile-error (dart-lang/co19#1397)
2022-08-03 sgrekhov22@gmail.com dart-lang/co19#1129. In case of DIRECT connection don't expect any proxy routine called (dart-lang/co19#1385)
2022-07-29 sgrekhov22@gmail.com dart-lang/co19#673. IFrame tests that don't actually test IFrame removed (dart-lang/co19#1381)
2022-07-27 sgrekhov22@gmail.com Fixes dart-lang/co19#1376. Broken co19_2 test fixed (dart-lang/co19#1377)
2022-07-12 sgrekhov22@gmail.com Fixes dart-lang/co19#1356. Add analyzer errors on references to not included library parts (dart-lang/co19#1359)
2022-07-05 sgrekhov22@gmail.com Fixes dart-lang/co19#1309. Update error expectations according to the current behavior (dart-lang/co19#1351)
2022-07-04 sgrekhov22@gmail.com Fixes dart-lang/co19#1343. Use correct 'part' and 'part of' directives (dart-lang/co19#1350)
2022-07-01 sgrekhov22@gmail.com Fixes dart-lang/co19#1313. Pre-nnbd tests for focus_A01_t01 and blur_A01_t01 updated to their version in master (dart-lang/co19#1345)

Change-Id: Iec8355f25b2c87b3dd83d84d2bab95812bbd0686
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262204
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2022-09-30 21:12:33 +00:00
Joshua Litt
29de68d38e [dart2wasm] Correctly handle null when jsifying maps.
Change-Id: Ibda04bf6012447dcab86079da8d4d41771e8e9bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262102
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2022-09-30 21:09:29 +00:00
Konstantin Shcheglov
577e34df43 Report MISSING_VARIABLE_PATTERN for SwitchStatement with SwitchPatternCase(s).
Change-Id: Iefec21f16fc85467ba2c8ad7b34cbe7438c3d025
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262264
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-09-30 20:53:29 +00:00
Brian Wilkerson
578e350fd4 Reduce the use of streams in data-driven fixes
In addition to making the code cleaner, I expect that this will also
improve performance. Unfortunately, we don't have anything in place to
measure or monitor the performance of correction producers, so I can't
prove that.

Change-Id: Iac640c57ccafe68ef522fd3fe807abc4f66f6a86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262263
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-09-30 19:31:48 +00:00
Kallen Tu
646886c968 Type Socket in _HttpConnection to avoid dynamic invocations.
Change-Id: I55b4312dcf6f2af79f183f21b8d2722f62f0aece
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258515
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-09-30 19:29:56 +00:00
Konstantin Shcheglov
c73228abaf Report an error when a variable pattern binds in one branch of logical-or, but not in another.
Only check for if-case is implements for now.

Change-Id: I57d1b8b33fbe2bf7adc848b5d607ff99b878b479
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262101
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-09-30 18:53:26 +00:00
Brian Wilkerson
74a5cf758f Enhance create-local-variable to work with records
Change-Id: Iedbcdebe79b3c4ef2ce1205fb7605c1106ac852d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262262
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-09-30 18:24:16 +00:00
Joshua Litt
c6b141e9e5 [dart2wasm] Fix bug in dartify.
Change-Id: Ia922d3ac6e3849db13877259c65c7d8d884c5828
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262100
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2022-09-30 18:14:07 +00:00
Brian Wilkerson
53447c990f Enhance add-type-annotation to handle record types
Change-Id: I684820c9368f282039a93f34571afb014fb476a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262260
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-09-30 17:04:46 +00:00
Brian Wilkerson
06c5592b9c Enhance change-type-annotation to support record types
Change-Id: Ib5bbdec16c88858cda4f1739ad92a4c68e598a6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262261
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-09-30 17:04:16 +00:00
Sigmund Cherem
dad1db4e20 [dart2js] remove unused helpers
These helper methods were used by generated code long ago, before
Dart 2 I believe.  There appears to be no uses of these methods in
our code generation today (last use in the compiler was removed in https://dart-review.googlesource.com/c/sdk/+/75300/2/pkg/compiler/lib/src/common_elements.dart 4 years ago), so I believe we can remove them.

Change-Id: I09647000e4b2643a54246cb77a6d0d06b78abeb3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260961
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2022-09-30 16:21:46 +00:00
Ahmed Ashour
9b4cda1bfd [analysis_server] DataDriven: allow replacedBy from a package to another one
Bug: #48204
Change-Id: Id13f038e39e9e150e1d6b21bcdde25bb815b15a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241004
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-09-30 15:30:57 +00:00
Johnni Winther
599836a2c5 [cfe,vm] Make patch parts into actual parts
This changes the VM patch files to use parts explicitly, making
handling of patch libraries similar to regular libraries.

Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try

Change-Id: I6280d62edba3d12a1f77ae6a7f64e1e9b5d18227
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224949
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-09-30 15:25:11 +00:00
Konstantin Shcheglov
4b134e4b14 Simplify TypeMemberContributor.
There is no need to put data into local variables, and invoke
something for the InterfaceType. We can call it directly at the end
of each branch.

Change-Id: Iee0d2304fb45b526604f2c6bd6a81363820d5909
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262103
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-09-30 14:32:41 +00:00
Brian Wilkerson
a30a4dc860 Update make_variable_nullable fix to work with records
Change-Id: I77d6db6f79d2bc83e16b406c9b2804cbe2164974
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262021
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-09-30 14:19:51 +00:00
Martin Kustermann
ed5ad5c087 Add CLI tool for analyzing Dart VM heapsnapshots
This CL adds an interactive command line tool to analyze
heapsnapshots generated by the Dart VM.

The tool works by operating on sets of objects. It supports operations
like users, transitive closure, union, ...

An example usage that loads snapshot, finds all live objects, finds
the empty lists in them and prints retainers of the empty lists:

    ```
    % dart bin/explore.dart

    (hsa) load foo.heapsnapshot

    (hsa) all = closure roots
    (hsa) stat all
          size       count     class
      --------   --------  --------
       43861 kb    8371    _Uint8List dart:typed_data
         ...
      --------   --------  --------
      108904 kb  400745

    (hsa) empty-lists = dfilter (filter all _List) ==0
    (hsa) empty-growable-lists = filter (users empty-lists) _GrowableList

    (hsa) retain empty-growable-lists
    There are 5632 retaining paths of
    _GrowableList (dart:core)
    ⮑ ・UnlinkedLibraryImportDirective.configurations (package:analyzer/src/dart/analysis/unlinked_data.dart)
        ⮑ ﹢_List (dart:core)
            ⮑ ・...
    ```

For now the tool lives only in dart-lang/sdk.

TEST=pkg/heapsnapshot/test/*_test.dart

Change-Id: I671c2e3ca770e1a5aa3e590e850a5694070b4c3a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261100
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-09-30 14:15:01 +00:00
Ahmed Ashour
8eb8e61e1e [analysis_server] DataDrive replacedByto handle removed constructors
Fixes #50011

Change-Id: I30670f88562216ffe057b0e4de7e93d50a414fe0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260761
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-09-30 13:58:08 +00:00
Daco Harkes
d9c442bce8 [vm/ffi] Throw on returning Error in Handle
Makes `Dart_Handle` FFI returns behave as the following snippet:

```
Dart_Handle ExampleSnippet() {
  Dart_Handle result;
  if (Dart_IsError(result)) {
    Dart_PropagateError(result);
  }
  return result;
}
```

Also makes FFI consistent with Dart_NativeFunctions, which will
automatically throw upon return if Dart_SetReturnValue set the result
to an error.

`UnhandledExceptions` cannot flow out into Dart generated code. So,
the implementation needs to be in `FfiCallInstr::EmitNativeCode`.

Using `Dart_IsError` is slow compared to a machine code class id
check. So, we should do the handle unwrapping and class id check in
machine code.

Unwrapping Handles in machine code is only safe when the GC is
guaranteed to not run: Either (1) in `kThreadInGenerated`, or (2) in
`kThreadInNative`, but only when transitioned into safepoint. So, the
handle cannot be unwrapped immediately after the FFI call in machine code. We first need to transition back to generated.

This means we need to transition again to native to do the actual
`Dart_PropagateError` call. We can do so without the stub in JIT
because we never return with normal control flow.

Performance impact of this change is within benchmark noise in both
JIT and AOT.
Size impact is 42 bytes on x64, which is 10% in AOT and 12% in JIT.

For more numbers see: go/dart-ffi-handle-error

TEST=runtime/bin/ffi_test/ffi_test_functions_vmspecific.cc
TEST=tests/ffi/vmspecific_handle_test.dart

Closes: https://github.com/dart-lang/sdk/issues/49936
Change-Id: Ie8fabeb6d53bc80689541bc4470cb37ee2200581
Cq-Include-Trybots: luci.dart.try:vm-canary-linux-debug-try,vm-ffi-android-debug-arm64c-try,vm-ffi-android-debug-arm-try,vm-kernel-gcc-linux-try,vm-kernel-linux-debug-x64-try,vm-kernel-linux-debug-x64c-try,vm-kernel-msvc-windows-try,vm-kernel-optcounter-threshold-linux-release-x64-try,vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-tsan-linux-release-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-precomp-ffi-qemu-linux-release-riscv64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-mac-release-arm64-try,vm-kernel-precomp-win-debug-x64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261603
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-09-30 13:29:51 +00:00
Paul Berry
175385825a Migration: clean up handling of type substitutions.
Previously, when the migration tool needed to change one type variable
to another during a substitution, it created a DecortedType to
represent the substitution using
`DecoratedType._forTypeParameterSubstitution`.  This was problematic
because the resulting DecoratedType had a null nullability `node`.
This in turn forced nearly every reference to `DecoratedType.node` to
be followed by a `!` operator.

With this change, we now have a new base class, `SubstitutedType`,
which can either be a `DecoratedType` (representing a fully general
substitution) or a `_TypeVariableReplacement` (representing a simple
change from one type variable to another).  This paves the way for a
follow-up CL that will make `DecoratedType.node` non-nullable.

Change-Id: I7fdaef57994c7678ecd517ab4fe84d00f0d81424
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261941
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-09-30 13:14:31 +00:00
Tess Strickland
fef905cbe2 [build] Remove linker flags to create empty section in AOT runtime.
These linker flags are causing issues with the Dart->Flutter roll,
and so I'm removing them for now until we can figure out how to
reintroduce them later.

To avoid overwriting section contents, even at a much reduced
amount, I also reland the clang DEPS revert in CL 256208.

TEST=pkg/dartdev/test/commands/compile_test

Bug: https://github.com/flutter/flutter/issues/112687
Change-Id: I35d3ff6a2a0a46e2f589469fb47bca5f9ca6df1d
Cq-Include-Trybots: luci.dart.try:analyzer-mac-release-try,dart-sdk-mac-arm64-try,dart-sdk-mac-try,pkg-mac-release-arm64-try,pkg-mac-release-try,vm-kernel-precomp-mac-product-x64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262161
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2022-09-30 12:48:59 +00:00
Sergey G. Grekhov
21d2935dad [co19] Roll co19 to 7f9c5d2552ae31efc6f8105b7202496755e9661f
2022-09-29 sgrekhov22@gmail.com dart-lang/co19#195. Description some of RawDatagramSocket tests improved (dart-lang/co19#1473)
2022-09-28 49699333+dependabot[bot]@users.noreply.github.com Bump actions/setup-java from 3.5.0 to 3.5.1 (dart-lang/co19#1470)
2022-09-23 sgrekhov22@gmail.com Fixes dart-lang/co19#1468. [Records]. Numerous typos fixed (dart-lang/co19#1469)
2022-09-23 sgrekhov22@gmail.com dart-lang/co19#1399. [Records] Primitive equality tests added (dart-lang/co19#1466)

Change-Id: Ib538f7946b4cc1d98971e20adb9ebdc5d4243bf3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262140
Reviewed-by: Alexander Thomas <athom@google.com>
2022-09-30 07:18:22 +00:00
Stephen Adams
f7809873f4 [dart2js] Add RecordType
Add RecordType to the dart2js DartType hierarchy.
The RecordShape is made explicit so that processing the record type usually means processing the list of field types.
This pattern of shape + combined-fields will be used elsewhere, e.g. constants.

Filled out some uses of ir.RecordType until it gets converted to a dart2js DartType.


Change-Id: I6aa4d4a920cbb0e4f37e7079bc4d9d10e366a849
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261581
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2022-09-30 04:59:49 +00:00
Brian Wilkerson
4b4f58b674 Suggest members from Object when completing a record property access
Looks like we might need a feature to cause record fields to be suggested
before Object members. Hard to say though without tests. Anyway, that's
a task for another CL.

Change-Id: I123d6953b1ed10ac926885ce2b1a4d5926a908ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262024
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-09-30 00:04:58 +00:00
Nicholas Shahan
457d9fe537 [web] Remove implicit casts from dynamic in DDC
DDC:
Adding return types avoids casts on the returned values and
using JS foreign functions avoids the cast when setting the
value during truncation as well as avoiding the extra
method dispatch for setting and getting elements.

Dart2js:
Updated the return types for consistency but the dynamic
return type was already being inferred to avoid casts.

Change-Id: Ic9abaffd8dee3d12793d5083c78d35a9ada47527
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261787
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-09-29 23:22:29 +00:00
Ahmed Ashour
ae435d7cfc [analysis_server] associate UNDEFINED_IDENTIFIER with ImportLibrary.forExtensionMember
Fixes #50042

Change-Id: Id714445c50bbe1df1db873179772b42b08b72560
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260706
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-09-29 21:50:48 +00:00
Devon Carew
9db5174b64 [deps] rev dartdoc, html, intl, mime, and usage
dartdoc (62bc150..866338f):
  866338f1  2022-09-29  Sam Rawlins  Bump to 6.1.2 (#3198)

html (8243e96..faafebf):
  faafebf  2022-09-29  Devon Carew  Merge pull request #188 from dart-lang/update_readme
  d27b898  2022-09-29  Devon Carew  Merge pull request #189 from dart-lang/update_ci
  5a0be75  2022-09-29  Devon Carew  update to our current CI best practices
  4185afd  2022-09-29  Devon Carew  add markdown badges to the readme

intl (5464b3b..7639a15):
  7639a15  2022-09-27  Nate Bosch  Simplify the IntlStream class (#494)
  a4b44a9  2022-09-27  Lasse R.H. Nielsen  Cleanup of `var this.`, dynamic parameters, and more (#497)

mime (0a75a41..bf041aa):
  bf041aa  2022-09-26  Devon Carew  update action versions; add dependabot config (#69)

usage (e287a72..9a98c89):
  9a98c89  2022-09-29  Devon Carew  whitespace change to the LICENSE file (#182)
  cf284c7  2022-09-29  Kevin Moore  analysis options and lint cleanup (#183)

Change-Id: I0a6bd0de7bc75cd84b20e1de6f0463544ac68a70
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262020
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Auto-Submit: Devon Carew <devoncarew@google.com>
2022-09-29 21:25:38 +00:00
Konstantin Shcheglov
42c58c100a Add missed 'typeArguments' to FunctionExpressionInvocation.childEntities
Change-Id: I2cc5873a35ef4a7b8f36560c80c9dff7fc3820be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261942
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-09-29 20:47:41 +00:00
Konstantin Shcheglov
d8f928331a Don't import class Record from dart:core into a library where the 'records' feature is not enabled.
...while it is still an experiment.

Change-Id: Ib606a3c099b45343686b8e921c0aa1c24dec59da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261920
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-09-29 20:47:38 +00:00
Sam Rawlins
eb9554d70e Evaluate more fixes
I also noted how many ParserErrorCodes are 'needsEvaluation'

Change-Id: I487976c918038903ef49a87a3cb97d1af2327398
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2022-09-29 20:37:59 +00:00
Devon Carew
ad34feec87 [dart create] suggest using the pubspec repository field
Change-Id: I51e83853d947bc545aced1ae2ae3d048dd7c6b01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261940
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-09-29 19:13:27 +00:00
Stephen Adams
a8ab1853a9 [dart2js] Avoid eager initialization with a large set
Change-Id: Ic4027cfe09294836cc182969a7cb92be01d3c7a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261781
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-09-29 19:08:27 +00:00
DEPS Autoroller
af850a8165 Roll Dart Documentation Generator from 691fa9640aae to 62bc1503b285 (3 revisions)
https://dart.googlesource.com/dartdoc/+log/691fa9640aae..62bc1503b285

2022-09-28 srawlins@google.com Fix styles in inline search results (#3197)
2022-09-28 srawlins@google.com Simplify some code in dartdoc_options.dart (#3156)
2022-09-28 srawlins@google.com Prevent default when hitting enter (#3195)

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

To file a bug in Dart Documentation Generator: https://github.com/dart-lang/dartdoc/issues
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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

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

Tbr: dart-ecosystem-gardener@grotations.appspotmail.com
Change-Id: I51527ab30a73a73de95f53715e83488562a54c71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261445
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-09-29 18:58:38 +00:00
Aske Simon Christensen
0ef1afa10f [dart2wasm] Remove obsolete patch annotation declaration
Required to match https://dart-review.googlesource.com/c/sdk/+/224946

Change-Id: I271fca2b408583ad0a645b6bcbea3f3ac129e015
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261901
Auto-Submit: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-09-29 17:57:47 +00:00
Konstantin Shcheglov
afc8abb2e6 Replace two more assertX with textual dumps.
Change-Id: I89332f27bfdb19cbb0e64b37e5b77403ea89872e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261785
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2022-09-29 17:54:38 +00:00
Brian Wilkerson
53e3d2b5bc Fix one failure on the windows bot
Change-Id: I885b5cff40d60631602912a7b5751b4abd728cab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261446
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-09-29 17:33:27 +00:00