Commit graph

11324 commits

Author SHA1 Message Date
Mayank Patke 7a343d0cc1 [rti] Codegen improvements in isSubtype.
Change-Id: If68a3c150b33e2029d7e6538cb3efff23bb9809f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/333701
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2023-11-02 21:37:38 +00:00
Daco Harkes e16bb210d2 [vm/ffi] Optimize @Native calls
This CL removes static fields for storing the `@Native`'s function
addresses. Instead, the function addresses are stored in the object
pool for all archs except for ia32. ia32 has no AOT and no AppJit
snapshots, so the addresses are directly embedded in the code.

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

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

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

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

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

Closes: https://github.com/dart-lang/sdk/issues/47625
Closes: https://github.com/dart-lang/sdk/issues/51618
Change-Id: Ic5d017005dedcedea40c455c4d24dbe774f91603
CoreLibraryReviewExempt: Internal FFI implementation changes
Cq-Include-Trybots: luci.dart.try:vm-aot-android-release-arm64c-try,vm-aot-android-release-arm_x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-debug-x64c-try,vm-aot-mac-release-arm64-try,vm-aot-mac-release-x64-try,vm-aot-obfuscate-linux-release-x64-try,vm-aot-win-debug-arm64-try,vm-aot-win-debug-x64c-try,vm-aot-win-release-x64-try,vm-appjit-linux-debug-x64-try,vm-asan-linux-release-x64-try,vm-checked-mac-release-arm64-try,vm-eager-optimization-linux-release-ia32-try,vm-eager-optimization-linux-release-x64-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64c-try,vm-ffi-qemu-linux-release-arm-try,vm-ffi-qemu-linux-release-riscv64-try,vm-fuchsia-release-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-linux-debug-ia32-try,vm-linux-debug-x64-try,vm-linux-debug-x64c-try,vm-mac-debug-arm64-try,vm-mac-debug-x64-try,vm-msan-linux-release-x64-try,vm-reload-linux-debug-x64-try,vm-reload-rollback-linux-debug-x64-try,vm-ubsan-linux-release-x64-try,vm-win-debug-arm64-try,vm-win-debug-x64-try,vm-win-debug-x64c-try,vm-win-release-ia32-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284300
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-11-02 16:00:53 +00:00
Ömer Sinan Ağacan d0a2656611 [dart2wasm] Use the same Dart object when to{Upper,Lower}Case returns the argument
This fixes `identical` checks when the input doesn't need case mapping.

This change was originally made in [1], but I'm trying to split it into
smaller CLs as it currently has a lot of conflicts with the main branch.

[1]: https://dart-review.googlesource.com/c/sdk/+/316628

Change-Id: I88da52a3a73c9d587acefe2b14fd39edaf01c966
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332200
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-11-02 12:21:24 +00:00
Ömer Sinan Ağacan 9ed368c2e1 [dart2wasm] Use only JS strings in JSCM
Refactor libraries so that JSCM will only use `JSStringImpl` class for
strings.

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

Changes:

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

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

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

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

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

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

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

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

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

Co-authored-by: Joshua Litt <joshualitt@google.com>
Change-Id: I366e06f44cdc369d28fe47b24015234260304399
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332680
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-10-31 12:58:26 +00:00
Daco Harkes acad65713c [vm] Mark NativeFieldWrapperClasses as base
TEST=build SDK (modified patch files)
TEST=tests/ffi/*
TEST=runtime/vm/*_test.cc
TEST=runtime/tests/vm/dart/*

Closes: https://github.com/dart-lang/sdk/issues/51896
CoreLibraryReviewExempt: VM only.
Change-Id: I349849001adf8f3a62f3d4f94d4bdd295c36ef4d
Cq-Include-Trybots: luci.dart.try:flutter-linux-try,vm-aot-linux-debug-x64c-try,vm-ffi-android-debug-arm-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291761
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-10-31 10:23:12 +00:00
Brian Quinlan 942e897bf5 [doc/io] Add a RawSocketEvent example.
Bug: https://github.com/dart-lang/sdk/issues/33721
Change-Id: I4e8f35cec8d3e689469a63826d118cfa2fe42218
CoreLibraryReviewExempt: Documentation-only change
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277701
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-10-30 16:53:17 +00:00
Ilya Yanok 8c55f3eb0b Revert "[analyzer] simplify the libraries.dart file"
This reverts commit 29979649bd.

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

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

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

Change-Id: Ieb828b654f2320b147a3c48bbb4a142da1c18380
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332421
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-10-30 10:58:45 +00:00
Brian Quinlan c31b4c0ef5 [doc/io] Minor Link.create documentation fixes.
Change-Id: I50932e9cd0c26b2070dd2930866f3fb18bc80763
CoreLibraryReviewExempt: documentation-only change
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332483
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-10-27 17:25:40 +00:00
Stephen Adams c87fec8663 Revert "[typed_data] Deprecate unmodifiable views"
This reverts commit b4bae467d4.

Reason for revert: Flutter plugin contains use of deprecated method.

Original change's description:
> [typed_data] Deprecate unmodifiable views
>
> CoreLibraryReviewExempt: Reviewed in https://dart-review.googlesource.com/c/sdk/+/321922
> Bug: #53785
> Change-Id: I23a064e76a4b359e804f41676b3b775dd02ea183
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331723
> Commit-Queue: Stephen Adams <sra@google.com>
> Reviewed-by: Lasse Nielsen <lrn@google.com>

Bug: #53785
Change-Id: I01998a3d74681ef2d8c804f59a82d51a2e4290e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332580
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-10-27 15:22:54 +00:00
Devon Carew 29979649bd [analyzer] simplify the libraries.dart file
Cleanup and re-landing of https://dart-review.googlesource.com/c/sdk/+/317803.

Change-Id: I9fd679fdb111895ce662ecbe6d0fc5844909c3bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332441
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2023-10-26 21:43:31 +00:00
Brian Quinlan 097c84f11b [io/doc/test] Modify the Windows symlink resolution behavior so that resolving a link that points to a non-existent file results in a type of notFound, which is consistent with all other platforms.
Bug:https://github.com/dart-lang/sdk/issues/53684
Change-Id: I1b594e1a85906d1f510358eec71792ea15ab801b
CoreLibraryReviewExempt: VM- and doc-only
Tested: unit tests
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331841
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-10-25 23:14:38 +00:00
Stephen Adams b4bae467d4 [typed_data] Deprecate unmodifiable views
CoreLibraryReviewExempt: Reviewed in https://dart-review.googlesource.com/c/sdk/+/321922
Bug: #53785
Change-Id: I23a064e76a4b359e804f41676b3b775dd02ea183
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331723
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2023-10-25 19:14:06 +00:00
sgrekhov 79d359ed45 [io/doc] Fix typo in File.createSync() documentation
Change-Id: Id077d3c56b6e9835821cf9d4463df34c626ffb32
CoreLibraryReviewExempt: documentation update
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331920
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-10-25 19:11:30 +00:00
Nate Bosch 7ba47c6040 Remove some now unnecessary casts
Flow analysis has improved and issue #40041 is resolved. These
`FutureOr<T>` conditionals are promoting to `Future<T>` or `T` and no
longer need an explicit cast.

R=lrn@google.com

Change-Id: I925db6d7f52aad54c88434ff02e1d0ae4e72278b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331206
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Auto-Submit: Nate Bosch <nbosch@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2023-10-24 19:09:22 +00:00
Ömer Sinan Ağacan 1b426ea6f8 [dart2wasm] Fix string array copy in UTF8 decoder
Bug introduced with [1] and broke the Flutter engine [2].

[1]: https://dart-review.googlesource.com/c/sdk/+/331187
[2]: https://github.com/flutter/flutter/issues/137120

Change-Id: I334db1bbf1440b53b7a7856f16a0e116d82efae5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331922
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-10-24 12:02:48 +00:00
Brian Quinlan 4122919684 Remove documentation that indicates that the maximum received datagram size is 64K.
Bug:https://github.com/dart-lang/sdk/issues/31733
CoreLibraryReviewExempt:documentation-only
Change-Id: Icde611deb9a0172a5caacf518e9ce01904baf8ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331422
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-10-23 19:37:40 +00:00
Sergey G. Grekhov 09fc3f9554 [io/doc] Improve Link.createSync() documentation
Change-Id: I70c593ca2b7f9ba6b7cc94886f622f4af5dd20fd
CoreLibraryReviewExempt: documentation update
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330620
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-10-23 19:15:57 +00:00
Ömer Sinan Ağacan 405a03909c [dart2wasm] Optimize UTF8 decoder when decoding a native array
Intercept all `Utf8Decoder.convert` calls to check the input type and
call the right UTF8 decoder function.

This currently only optimizes `U8List` parsing, and only the fastest
path where the input is an ASCII string. Follow-up CLs will optimize JS
typed array parsing by calling browser's UTF8 decoder and the slow paths
of non-ASCII and malformed buffers.

Results from an internal benchmark extracted from a real use case:

Before:

    Parse(RunTime):     330,500 us.

After:

    Parse(RunTime):     90,310 us.  (-72%)

dart2js -O4 results of the same benchmark:

    Parse(RunTime):     234,250 us.

Change-Id: I470697a9eb516e1e031e9b865ddb29e8f25569bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331187
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
2023-10-23 18:36:52 +00:00
Stephen Adams 0a436b7005 Reapply "[typed_data] Deprecate UnmodifiableUint8ListView and friends"
This reverts commit 4918d3ef8c.

`@Deprecated` annotations have been commented out.

CoreLibraryReviewExempt: reviewed as https://dart-review.googlesource.com/c/sdk/+/321922
TEST=ci
Bug: #53785
Change-Id: I3239251c2aba5f188aa947f0ff0208271d6be5cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331741
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
2023-10-23 18:14:33 +00:00
Ömer Sinan Ağacan fa7c42a84d [dart2wasm] Small optimizations and simplifications in string and convert patches
Change-Id: I3838f052cff13734cd5612785a5724454231be8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331183
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-10-23 18:08:22 +00:00
Derek Xu 4918d3ef8c Revert "[typed_data] Deprecate UnmodifiableUint8ListView and friends"
This reverts commit b657773d58.

Reason for revert: blocking Dart SDK -> Engine roll (https://github.com/flutter/flutter/issues/137054)

Original change's description:
> [typed_data] Deprecate UnmodifiableUint8ListView and friends
>
> This is the first of several steps to remove the unmodifiable views for typed data classes. The end goal is that dart2js has only one class implementing `Uint8List` so that `Uint8List` accesses can always be compiled down to JavaScript code that directly uses indexed property accesses (`a[i]`).
>
> This first step deprecates the unmodifiable view classes to help prevent their use in new code, and adds `asUnmodifiableView()` methods as a replacement for the small number of places that use the classes.
>
> The next steps (see #53785) are to remove uses of the unmodifiable view classes from the SDK. Once this is complete the classes themselves can be removed.
>
> TEST=ci
>
> Issue: #53218
> Issue: #53785
>
> Change-Id: I04d4feb0d9f1619e6eee65236e559f5e6adf2661
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321922
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
> Reviewed-by: Lasse Nielsen <lrn@google.com>
> Commit-Queue: Stephen Adams <sra@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Ömer Ağacan <omersa@google.com>

Issue: #53218
Issue: #53785
Change-Id: I0bb042269f9ff8e5cd69619cf97b60c79ea98cbf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331680
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-10-23 15:03:25 +00:00
Stephen Adams b657773d58 [typed_data] Deprecate UnmodifiableUint8ListView and friends
This is the first of several steps to remove the unmodifiable views for typed data classes. The end goal is that dart2js has only one class implementing `Uint8List` so that `Uint8List` accesses can always be compiled down to JavaScript code that directly uses indexed property accesses (`a[i]`).

This first step deprecates the unmodifiable view classes to help prevent their use in new code, and adds `asUnmodifiableView()` methods as a replacement for the small number of places that use the classes.

The next steps (see #53785) are to remove uses of the unmodifiable view classes from the SDK. Once this is complete the classes themselves can be removed.

TEST=ci

Issue: #53218
Issue: #53785

Change-Id: I04d4feb0d9f1619e6eee65236e559f5e6adf2661
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321922
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2023-10-20 17:14:48 +00:00
Lasse R.H. Nielsen 0234a8f17f Fix bad link in updated docs.
CoreLibraryReviewExempt: Comment only.
Change-Id: Ibaec3812e430ba0c8644315fba062bca62f3c173
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331241
Auto-Submit: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-10-20 14:47:26 +00:00
Lasse R.H. Nielsen 0ecb9ba545 Update documentation on fromEnvironment constructors.
CoreLibraryReviewExempt: Comments only.
Change-Id: If2e080764bc98ee6cb7fe31dffe12c66144c7352
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331182
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2023-10-20 07:57:18 +00:00
Nicholas Shahan 8a1e69063e [ddc] Update for extra null safety checks in RTI
- In development mode (DDC) the extra null safety errors will be thrown.
- Remove extra code paths that called unsound helpers.
- Fix expectations in weak_null_safety_errors_test.dart.

Change-Id: I107c602b0ae38b13038e501564cba9b8cfc58e70
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329568
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-10-19 21:32:15 +00:00
Mayank Patke f9c3e48406 [dart2js] Add user-definable callback to report null safety diagnostics
Change-Id: Id57efb9fb6f329f8e0b81b773ec27598a2db862a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/328761
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2023-10-19 20:29:49 +00:00
Mayank Patke 918a47c973 [dart2js, ddc] Add support for extra null safety checks in RTI.
Change-Id: I68d6b8d057e738baa9f7155ec17a8c7681f507b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325921
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2023-10-19 20:29:49 +00:00
Nate Bosch d7af8ef846 Remove indirection in Timer example
The example was originally written without a `main`, and with an example
using `Duration.operator *`. An update added a call to the example
method from a new `main`, removed the usage of `Duration.operator *`,
but did not remove the prose reference.

- Remove the sentence mentioning that the duration can be const or
  computed.
- Remove the intermediate `scheduleTimeout` method, move the `Timer`
  construction to `main`. This removes any consideration of `Duration`
  vs `int milliseconds` which had been added in an attempt make the docs
  more focused on `Timer` than `Duration`.

R=lrn@google.com

CoreLibraryReviewExempt:Documentation change.
Change-Id: I26bb4e12910eb50cf5975b8a6573701a5a862070
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330980
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2023-10-19 18:26:49 +00:00
Mopriestt ddc5894d3d Unify splay tree iterators and interables constructor argument names.
Closes https://github.com/dart-lang/sdk/pull/53706

GitOrigin-RevId: 4743ba3035efd4b458300a501e9fdefc5aaf0544
Change-Id: I4753b52e3fd73bd59b3ff56860e4135c47476fa9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329721
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2023-10-19 14:07:37 +00:00
なつき e285a57248 [dart2js] Fix compatiblity with Node.js 21
Closes https://github.com/dart-lang/sdk/pull/53796

GitOrigin-RevId: caeeb52bb832c401a22d7ba3410f42cb50d6c8c6
Change-Id: I145ecca62875a82f348ce1ea78fb935880d10688
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330987
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-10-19 03:46:18 +00:00
Mayank Patke 5a0ff4ceb1 [dart2js] Lower JS_GET_FLAG in phase 0b kernel transformer
Also adds `JS_FALSE` to replace uses of `JS_GET_FLAG(false)`. See the
doc comment for details.

Change-Id: I33f89f158c1955a19fa299f22c50d51e36ede3d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330171
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2023-10-18 22:32:43 +00:00
Ömer Sinan Ağacan feb81fc63f [dart2wasm] Optimize some string operations to array.copy
Change-Id: Ic14396cd6843666dd8ebfd6db0ed6056ea7cacc0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331043
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
2023-10-18 17:45:36 +00:00
Ömer Sinan Ağacan fa976d75be [dart2wasm] Simpify string handling in core
Now that we have our own `dart:convert` implementations in dart2wasm
targets (1) and the internal types are now internally public (2), this
simplifies some of the string implementation code by using the
implementation classes directly.

Note: stringref patch can be ignored, it's currently unused and I'm only
updating it to make it compile. It will be rewritten based on
`JSStringImpl` in [3].

To keep the CLs as small as possible, this CL does not do any of the
optimizations we can do now, such as optimizing
`OneByteString._setRange` to Wasm `array.copy` instructions. These will
be done in follow-up CLs.

[1]: https://dart-review.googlesource.com/c/sdk/+/330781
[2]: https://dart-review.googlesource.com/c/sdk/+/330783
[3]: https://dart-review.googlesource.com/c/sdk/+/316628

Change-Id: I92918d58a565ad32f5a221430e02d81562f03b00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331040
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-10-18 17:37:33 +00:00
Ömer Sinan Ağacan ce9e332bb1 [dart2wasm] Make typed data implementation classes internally public
This is a part of [1] and a continuation of [2].

- Make typed data implementation file a library, to allow importing it
  in `dart:convert` patch.

- Make SIMD implementation file a library, to allow importing it from
  the typed data library.

- Make typed data implementation classes internally public (available in
  other `dart:...` libraries).

- Relax `mayDefineRestrictedType` to allow implementing restricted types
  anywhere in the standard library implementation.

[1]: https://dart-review.googlesource.com/c/sdk/+/330121
[2]: https://dart-review.googlesource.com/c/sdk/+/330781

Change-Id: I70bc6869a20fd2479bee081cfceef27d6de19974
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330783
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
2023-10-18 06:40:49 +00:00
Ömer Sinan Ağacan 555e965bb1 [dart2wasm] Duplicate VM's convert patch for dart2wasm targets
This copies VM's convert implementation in dart2wasm's default and JSCM
targets, to be able to optimize the implementation based on these
targets' typed data and string implementation classes.

An example optimization that specializes UTF-8 decoder to `_U8List` can
be seen in [1], which improves a real-world benchmark (extracted from
internal) from 220ms to 90ms. (-59%)

Another optimization is we will be using the browser's UTF8 and JSON
decoders in JSCM convert patch.

VM's convert patch is moved from vm_shared to vm, as it's no longer used
outside of VM.

[1]: https://dart-review.googlesource.com/c/sdk/+/330121

Tested: existing tests.
Change-Id: I981070615a106e4f356ed8b292a29ec950bd4d97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330781
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-10-18 06:39:59 +00:00
Brian Quinlan b04c5a433e Adds tests and documentation for print line ending behavior
Bug:https://github.com/dart-lang/sdk/issues/53161
Change-Id: I3f13af3cb852b3656341922b9656ec91fc413eed
Tested: documentation + unit test only
CoreLibraryReviewExempt: Only adds documentation and adds a unit test to verify existing behavior
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323426
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-10-17 22:10:38 +00:00
Vyacheslav Egorov aa893870df [dart2js] Disable Timeline is performance.measure is absent
Change d8 preamble to remove performance.measure entirely.

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

Change-Id: I4588e08e9126a0d0f8010f7a7786484da876bc85
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330110
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2023-10-17 20:23:43 +00:00
Brian Quinlan becd3e396c [io] Make _HttpDetachedIncoming fields private
Change-Id: If1253a21613f2ea2baa69c68f0999b56e5181322
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330703
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-10-17 18:37:15 +00:00
Sam Rawlins 1b4ae5a7e1 Refer to unnamed constructors in doc comments with '.new'
Cleanup for https://github.com/dart-lang/dartdoc/issues/3531

This makes these comment references more idiomatic, I think
more readable, and supports dropping the leading `new ` syntax
in doc comments.

Change-Id: Id832ad14d9ea08fe03fe3125065755f49b1b93ed
CoreLibraryReviewExempt: doc comment only change
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330683
Reviewed-by: Devon Carew <devoncarew@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-10-17 14:42:38 +00:00
Tess Strickland 4d1bdaaca9 Reland "[vm/compiler] Change MemoryCopy to also take untagged addresses."
This is a reland of commit 06d7a2352e

This version fixes an issue when a phi node has multiple inputs with
different unboxed integer representations. The original CL made a
change where only the representations were considered, not the range
of values for the Phi calculated by range analysis. The reland goes
back to the old behavior for this case.

Also fixes the new tests on 32-bit architectures.

Original change's description:
> [vm/compiler] Change MemoryCopy to also take untagged addresses.
>
> This CL adds the ability to pass the payload address of the source
> and destination directly to the MemoryCopy instruction as an untagged
> value.
>
> The new translation of the _TypedListBase._memMoveN methods use the new
> MemoryCopy constructor, retrieving the untagged value of the data field
> of both the source and destination. This way, if inlining exposes the
> allocation of the object from which the data field is being retrieved,
> then allocation sinking can remove the intermediate allocation if there
> are no escaping uses of the object.
>
> Since Pointer.asTypedList allocates such ExternalTypedData objects,
> this CL makes that method inlined if at all possible, which removes
> the intermediate allocation if the only use of the TypedData object
> is to call setRange for memory copying purposes.
>
> This CL also separates unboxed native slots into two groups: those
> that contain untagged addresses and those that do not. The former
> group now have the kUntagged representation, which mimics the old
> use of LoadUntagged for the PointerBase data field and also ensures
> that any arithmetic operations on untagged addresses must first be
> explicitly converted to an unboxed integer and then explicitly converted
> back to untagged before being stored in a slot that contains untagged
> addresses.
>
> When a unboxed native slot that contains untagged addresses is defined,
> the definition also includes a boolean which represents whether
> addresses that may be moved by the GC can be stored in this slot or not.
> The redundancy eliminator uses this to decide whether it is safe to
> eliminate a duplicate load, replace a load with the value originally
> stored in the slot, or lift a load out of a loop.
>
> In particular, the PointerBase data field may contain GC-moveable
> addresses, but only for internal TypedData objects and views, not
> for external TypedData objects or Pointers. To allow load optimizations
> involving the latter, the LoadField and StoreField instructions now
> take boolean flags for whether loads or stores from the slot are
> guaranteed to not be GC-moveable, to override the information from
> the slot argument.
>
> Notable benchmark changes on x64 (similar for other archs unless noted):
>
> JIT:
> * FfiMemory.PointerPointer: 250.7%
> * FfiStructCopy.Copy1Bytes: -26.73% (only x64)
> * FfiStructCopy.Copy32Bytes: -25.18% (only x64)
> * MemoryCopy.64.setRange.Pointer.Uint8: 19.36%
> * MemoryCopy.64.setRange.Pointer.Double: 18.96%
> * MemoryCopy.8.setRange.Pointer.Double: 17.59%
> * MemoryCopy.8.setRange.Pointer.Uint8: 19.46%
>
> AOT:
> * FfiMemory.PointerPointer: 323.5%
> * FfiStruct.FieldLoadStore: 483.3%
> * FileIO_readwrite_64kb: 15.39%
> * FileIO_readwrite_512kb (Intel Xeon): 46.22%
> * MemoryCopy.512.setRange.Pointer.Uint8: 35.20%
> * MemoryCopy.64.setRange.Pointer.Uint8: 55.40%
> * MemoryCopy.512.setRange.Pointer.Double: 29.45%
> * MemoryCopy.64.setRange.Pointer.Double: 60.37%
> * MemoryCopy.8.setRange.Pointer.Double: 59.54%
> * MemoryCopy.8.setRange.Pointer.Uint8: 55.40%
> * FfiStructCopy.Copy32Bytes: 398.3%
> * FfiStructCopy.Copy1Bytes: 1233%
>
> TEST=vm/dart/address_local_pointer, vm/dart/pointer_as_typed_list
>
> Issue: https://github.com/dart-lang/sdk/issues/42072
> Fixes: https://github.com/dart-lang/sdk/issues/53124
>
> Cq-Include-Trybots: luci.dart.try:vm-ffi-qemu-linux-release-arm-try,vm-eager-optimization-linux-release-x64-try,vm-linux-release-x64-try,vm-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-aot-linux-debug-x64-try
> Change-Id: I563e0bfac5b1ac6cf1111649934067c12891b631
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324820
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Tess Strickland <sstrickl@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

TEST=vm/dart/address_local_pointer, vm/dart/pointer_as_typed_list

Issue: https://github.com/dart-lang/sdk/issues/42072
Fixes: https://github.com/dart-lang/sdk/issues/53124

Change-Id: Iabb0e910f12636d0ff51e711c8c9c98ad40e5811
Cq-Include-Trybots: luci.dart.try:vm-ffi-qemu-linux-release-arm-try,vm-eager-optimization-linux-release-x64-try,vm-linux-release-x64-try,vm-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-release-simarm_x64-try,vm-aot-linux-debug-simarm_x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330600
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-10-17 07:41:49 +00:00
Liam Appelbe 9308e6bd01 [vm/ffi] Address Lasse's post-submit comments from 328280
https://dart-review.googlesource.com/c/sdk/+/328280

1) Combine _setKeepIsolateAlive/_getKeepIsolateAlive into
abstract bool _keepIsolateAlive.

2) Refactor close to delegate to _close, rather than calling
super.close(). Makes _isClosed validation clearer.

Change-Id: I61a97f5ba35c3ff00ab4270b9f7a763968e703fc
TEST=CI (no behaviour changes)
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330580
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2023-10-17 01:54:00 +00:00
asiva 24155ef6f0 [IO/http] - Fix for https://github.com/dart-lang/sdk/issues/49930
Check for null 'bufferedData' even in the path when 'subscription' is
null. Should also fix https://github.com/dart-lang/sdk/issues/26379

TEST=ci

Change-Id: Iacc18c8a38e2c5b36c5234495d39cf20bfd8bac3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330201
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2023-10-13 22:59:28 +00:00
Alexander Markov 5362d9536b Revert "[vm/compiler] Change MemoryCopy to also take untagged addresses."
This reverts commit 06d7a2352e.

Reason for revert: everything crashes on vm-aot-linux-debug-simarm_x64

Original change's description:
> [vm/compiler] Change MemoryCopy to also take untagged addresses.
>
> This CL adds the ability to pass the payload address of the source
> and destination directly to the MemoryCopy instruction as an untagged
> value.
>
> The new translation of the _TypedListBase._memMoveN methods use the new
> MemoryCopy constructor, retrieving the untagged value of the data field
> of both the source and destination. This way, if inlining exposes the
> allocation of the object from which the data field is being retrieved,
> then allocation sinking can remove the intermediate allocation if there
> are no escaping uses of the object.
>
> Since Pointer.asTypedList allocates such ExternalTypedData objects,
> this CL makes that method inlined if at all possible, which removes
> the intermediate allocation if the only use of the TypedData object
> is to call setRange for memory copying purposes.
>
> This CL also separates unboxed native slots into two groups: those
> that contain untagged addresses and those that do not. The former
> group now have the kUntagged representation, which mimics the old
> use of LoadUntagged for the PointerBase data field and also ensures
> that any arithmetic operations on untagged addresses must first be
> explicitly converted to an unboxed integer and then explicitly converted
> back to untagged before being stored in a slot that contains untagged
> addresses.
>
> When a unboxed native slot that contains untagged addresses is defined,
> the definition also includes a boolean which represents whether
> addresses that may be moved by the GC can be stored in this slot or not.
> The redundancy eliminator uses this to decide whether it is safe to
> eliminate a duplicate load, replace a load with the value originally
> stored in the slot, or lift a load out of a loop.
>
> In particular, the PointerBase data field may contain GC-moveable
> addresses, but only for internal TypedData objects and views, not
> for external TypedData objects or Pointers. To allow load optimizations
> involving the latter, the LoadField and StoreField instructions now
> take boolean flags for whether loads or stores from the slot are
> guaranteed to not be GC-moveable, to override the information from
> the slot argument.
>
> Notable benchmark changes on x64 (similar for other archs unless noted):
>
> JIT:
> * FfiMemory.PointerPointer: 250.7%
> * FfiStructCopy.Copy1Bytes: -26.73% (only x64)
> * FfiStructCopy.Copy32Bytes: -25.18% (only x64)
> * MemoryCopy.64.setRange.Pointer.Uint8: 19.36%
> * MemoryCopy.64.setRange.Pointer.Double: 18.96%
> * MemoryCopy.8.setRange.Pointer.Double: 17.59%
> * MemoryCopy.8.setRange.Pointer.Uint8: 19.46%
>
> AOT:
> * FfiMemory.PointerPointer: 323.5%
> * FfiStruct.FieldLoadStore: 483.3%
> * FileIO_readwrite_64kb: 15.39%
> * FileIO_readwrite_512kb (Intel Xeon): 46.22%
> * MemoryCopy.512.setRange.Pointer.Uint8: 35.20%
> * MemoryCopy.64.setRange.Pointer.Uint8: 55.40%
> * MemoryCopy.512.setRange.Pointer.Double: 29.45%
> * MemoryCopy.64.setRange.Pointer.Double: 60.37%
> * MemoryCopy.8.setRange.Pointer.Double: 59.54%
> * MemoryCopy.8.setRange.Pointer.Uint8: 55.40%
> * FfiStructCopy.Copy32Bytes: 398.3%
> * FfiStructCopy.Copy1Bytes: 1233%
>
> TEST=vm/dart/address_local_pointer, vm/dart/pointer_as_typed_list
>
> Issue: https://github.com/dart-lang/sdk/issues/42072
> Fixes: https://github.com/dart-lang/sdk/issues/53124
>
> Cq-Include-Trybots: luci.dart.try:vm-ffi-qemu-linux-release-arm-try,vm-eager-optimization-linux-release-x64-try,vm-linux-release-x64-try,vm-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-aot-linux-debug-x64-try
> Change-Id: I563e0bfac5b1ac6cf1111649934067c12891b631
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324820
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Tess Strickland <sstrickl@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

Issue: https://github.com/dart-lang/sdk/issues/42072
Change-Id: I7c31434e01108487de69a32154bbefd1538c6f0f
Cq-Include-Trybots: luci.dart.try:vm-ffi-qemu-linux-release-arm-try,vm-eager-optimization-linux-release-x64-try,vm-linux-release-x64-try,vm-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-aot-linux-debug-x64-try
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330523
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-10-13 19:47:36 +00:00
Tess Strickland 06d7a2352e [vm/compiler] Change MemoryCopy to also take untagged addresses.
This CL adds the ability to pass the payload address of the source
and destination directly to the MemoryCopy instruction as an untagged
value.

The new translation of the _TypedListBase._memMoveN methods use the new
MemoryCopy constructor, retrieving the untagged value of the data field
of both the source and destination. This way, if inlining exposes the
allocation of the object from which the data field is being retrieved,
then allocation sinking can remove the intermediate allocation if there
are no escaping uses of the object.

Since Pointer.asTypedList allocates such ExternalTypedData objects,
this CL makes that method inlined if at all possible, which removes
the intermediate allocation if the only use of the TypedData object
is to call setRange for memory copying purposes.

This CL also separates unboxed native slots into two groups: those
that contain untagged addresses and those that do not. The former
group now have the kUntagged representation, which mimics the old
use of LoadUntagged for the PointerBase data field and also ensures
that any arithmetic operations on untagged addresses must first be
explicitly converted to an unboxed integer and then explicitly converted
back to untagged before being stored in a slot that contains untagged
addresses.

When a unboxed native slot that contains untagged addresses is defined,
the definition also includes a boolean which represents whether
addresses that may be moved by the GC can be stored in this slot or not.
The redundancy eliminator uses this to decide whether it is safe to
eliminate a duplicate load, replace a load with the value originally
stored in the slot, or lift a load out of a loop.

In particular, the PointerBase data field may contain GC-moveable
addresses, but only for internal TypedData objects and views, not
for external TypedData objects or Pointers. To allow load optimizations
involving the latter, the LoadField and StoreField instructions now
take boolean flags for whether loads or stores from the slot are
guaranteed to not be GC-moveable, to override the information from
the slot argument.

Notable benchmark changes on x64 (similar for other archs unless noted):

JIT:
* FfiMemory.PointerPointer: 250.7%
* FfiStructCopy.Copy1Bytes: -26.73% (only x64)
* FfiStructCopy.Copy32Bytes: -25.18% (only x64)
* MemoryCopy.64.setRange.Pointer.Uint8: 19.36%
* MemoryCopy.64.setRange.Pointer.Double: 18.96%
* MemoryCopy.8.setRange.Pointer.Double: 17.59%
* MemoryCopy.8.setRange.Pointer.Uint8: 19.46%

AOT:
* FfiMemory.PointerPointer: 323.5%
* FfiStruct.FieldLoadStore: 483.3%
* FileIO_readwrite_64kb: 15.39%
* FileIO_readwrite_512kb (Intel Xeon): 46.22%
* MemoryCopy.512.setRange.Pointer.Uint8: 35.20%
* MemoryCopy.64.setRange.Pointer.Uint8: 55.40%
* MemoryCopy.512.setRange.Pointer.Double: 29.45%
* MemoryCopy.64.setRange.Pointer.Double: 60.37%
* MemoryCopy.8.setRange.Pointer.Double: 59.54%
* MemoryCopy.8.setRange.Pointer.Uint8: 55.40%
* FfiStructCopy.Copy32Bytes: 398.3%
* FfiStructCopy.Copy1Bytes: 1233%

TEST=vm/dart/address_local_pointer, vm/dart/pointer_as_typed_list

Issue: https://github.com/dart-lang/sdk/issues/42072
Fixes: https://github.com/dart-lang/sdk/issues/53124

Cq-Include-Trybots: luci.dart.try:vm-ffi-qemu-linux-release-arm-try,vm-eager-optimization-linux-release-x64-try,vm-linux-release-x64-try,vm-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-aot-linux-debug-x64-try
Change-Id: I563e0bfac5b1ac6cf1111649934067c12891b631
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324820
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2023-10-13 19:06:30 +00:00
Brian Quinlan 0fa13d4627 [doc/io] Add documentation for HttpSession
Bug:https://github.com/dart-lang/sdk/issues/16228
Change-Id: I4e70c0b15af7325d9bfaba6dcee6b3a4c68639c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330169
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2023-10-13 17:59:08 +00:00
Stephen Adams 8ea74c0f2e [js_runtime] Use URLSearchParams to escape query parameters
Use URLSearchParams to escape query parameters.

- For large query parameters (>100KB), where escaping the parameters causes jank, this can be 2x-5x faster, reducing ~100ms pauses to nearer frame rate.

- For small query parameters (<100B) it can be slightly (10-20%) slower, but still well below 1 millisecond.


TEST=ci

Issue: #53712

Change-Id: I045bac7a067a658a58aaac4266409d526ccda774
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329822
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2023-10-13 16:36:47 +00:00
Aske Simon Christensen 4090d3b909 [dart2wasm] Normalize FutureOr<T> as nullable when T is nullable
The type normalization rules specify that `FutureOr<T>?` is normalized
to `FutureOr<T>` when `T` is nullable. However, it's more practical
for subtype testing if the declared nullability on the runtime
representation of the `FutureOr` type reflects the true nullability
(nullable if the `FutureOr` is declared nullable or its type argument
is nullable), rather than being normalized as per the spec.

This changes the static and dynamic normalization rules in dart2wasm
thus and compensates by computing the proper spec normalization when
the type is converted to a string.

The added test exposed a number of bugs in DDC and the VM:

https://github.com/dart-lang/sdk/issues/53175
https://github.com/dart-lang/sdk/issues/53737
https://github.com/dart-lang/sdk/issues/53738

Change-Id: I0ad0a09fe935ccbd3eb65e6958c958d29e0bb088
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/320821
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2023-10-12 15:29:26 +00:00
Jens Johansen 73466729f3 [vm] Pass offset and script uri for expression compilation
This CL passes the offset and uri of the file (here called a script uri
as opposed to a library uri, the two will be different if we're in a
part) when doing expression compilation.

This CL only passes the data, but doesn't actually use it.
Future CL(s) will use this data to calculate the static type of
available variables which is needed for an upcomming feature.

TEST=Existing tests.
CoreLibraryReviewExempt: Not changing SDK APIs.
Change-Id: I67ead461ab4bb9341424e693946f3e4afe35ce92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329322
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-10-12 10:22:38 +00:00
SULAPIS 5fa1830a38 Fix typo
Closes https://github.com/dart-lang/sdk/pull/53705

GitOrigin-RevId: 081385fa0e592688ffee1ecb9bd007828bf7e7c1
Change-Id: Ib4b843a5d14ef172a05adf7c2ea108e5691b6b68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/329683
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-10-12 07:54:48 +00:00