Commit graph

10724 commits

Author SHA1 Message Date
Kallen Tu 5b7bd563d3 Cast errors to HttpExceptions and add lint to convert to tidy up dynamic calls in core libraries.
Change-Id: I7ea73b232d13baf84e834d742ebc16f2a081e727
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262626
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2022-10-07 18:12:28 +00:00
Johnni Winther 51cf541243 [vm,wasm] Share more patch libraries
This shares patch libraries between vm and wasm.

The shared libraries are those previously shared as parts which
need private access to other patch libraries.

TEST=existing

Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Change-Id: I750a20de5a78362e84b87b2bfe1e5395ca4d3769
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262341
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-10-07 13:19:19 +00:00
Jackson Gardner 47dd60fed0 Refactor run_wasm.js into an ESM module that is reusable in the browser.
Change-Id: I1566febad2b4e1399f50bb923ad0596f04aa1a40
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262268
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Jackson Gardner <jacksongardner@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2022-10-07 03:09:39 +00:00
Kallen Tu b3e57bd2f7 Remove dynamic call in _JsonMap.
Change-Id: I73297a65a59aeefee9f170aa640b9d5d20e7bf9e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262271
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2022-10-06 18:12:02 +00:00
Ömer Sinan Ağacan 113f249e06 [dart2wasm] Implement null instance tear-offs
Fixes https://github.com/dart-lang/sdk/issues/50111

These tests now pass:

corelib/null_closurized_method_tostring_test
corelib/null_test
language/nnbd/static_errors/unchecked_use_of_nullable_cascaded_test/10
language/nnbd/static_errors/unchecked_use_of_nullable_test/14
language/nnbd/static_errors/unchecked_use_of_nullable_test/15
language/null/to_string2_test
language/null/to_string_test

Change-Id: Iba5152aa986df24cc96ee81854d9a538aa839e74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262601
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2022-10-06 12:54:53 +00:00
Stephen Adams aaed0ce048 [dart2js] Add subtyping of record types against Record interface
- Fix bug with nullable record type, e.g. `(int,int)?`.

Change-Id: Ie8006e8ec3a9ffd675519df2ab7b4d101d8d5dcd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262843
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-10-05 21:56:07 +00:00
Stephen Adams edf0da2df4 [dart2js,js_runtime] Record type recipes and runtime subtype test
Change-Id: I54adb8b6184a19667a296a670fecb37d7ce9dce7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262126
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-10-05 16:48:01 +00:00
Joshua Litt 16d06dac06 [dart2wasm] Restore caller's zone when returning from await.
Change-Id: Ifd0013eb130ff98bf2127991b685258ced115824
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262480
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-10-05 16:37:59 +00:00
Joshua Litt fd39eab463 [dart2wasm] Build snapshot as part of the SDK.
Change-Id: Iea75c14b6709f2347fe82af2ef226a1ed068d8a6
Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try,dart-sdk-mac-arm64-try,dart-sdk-mac-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261502
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-10-05 11:55:22 +00:00
Johnni Winther 99f60a5e66 [cfe,vm] Support 'records' experiment in the sdk
This adds support for the experimental 'records' feature in the sdk
by settings its experimental release version to 2.19 and opting the sdk
into the feature the allowed_experiments.

Change-Id: I7a30212e5724e5d8ae3208f177103764b9aed737
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262760
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2022-10-05 09:00:30 +00:00
Kallen Tu ce7c036db2 Make _detachRaw an external method of Socket to avoid dynamic calls.
Change-Id: Iba40ba3b0f0defea7efa750688386c7fe21bbae7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261260
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2022-10-05 01:44:22 +00:00
Johnni Winther 5b2e23eab0 [cfe,vm,wasm] Handle private injected members like augmentations
This changes the way the CFE handled private injected members. Previously
these were "hidden" within the patch library in which they were declared.
Now they are, like with members injected in augmentation libraries, fully
integrated and accessible within the origin library and all its patches.

This change revealed that the vm and wasm platforms had some
inconsistently declared classes in which injected private members that
were not implemented by all implementing classes. For these, throwing
stubs have been added.

Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Change-Id: I330eade944964ef43b83aa416baef75e3649d023
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262340
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-10-04 14:43:43 +00:00
Chloe Stefantsova 1d768f3c75 Reland "Reland "[cfe,corelib] Add class 'Record' to the core library""
This is a reland of commit 4b6a8f35b9

Original change's description:
> Reland "[cfe,corelib] Add class 'Record' to the core library"
>
> Part of https://github.com/dart-lang/sdk/issues/49713
>
> Change-Id: I56bfca49492d14bb561b32993fd9adfe775b7400
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259583
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>

Change-Id: Idaab98c028312ca36bd07f569374ca8b76151a02
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260101
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-10-04 12:29:47 +00:00
Nicholas Shahan da79baa962 [ddc] Fix bug in FutureOr type normalization
The correct normalization should only normalize FutureOr<Never>
when Never is non-nullable.

Change-Id: I592f3a4856c219b33a8f1ac8377567a956e1148c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261000
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2022-10-03 20:09:38 +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
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
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
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
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
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
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
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
Alexander Markov 824028f96f [vm] Move _Record class to record_patch.dart
TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: Ibf818df1f57afa93051123d0c9493913e7f9ab76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260641
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-09-29 14:12:57 +00:00
Johnni Winther 3cfca8e38c Make internal/patch.part a part of dart:_internal
`internal/patch.dart` is changed to be an actual part of
`dart:_internal` and backends are changed to all use the `patch`
constant from `dart:_internal` in `@patch` annotations.

This is done in preparation for changing the import uri of a
patch library builder to be its file uri, with which the
`internal/patch.dart` part can no longer declare itself as
`part of 'dart:_internal';` through a patch library.

Change-Id: I884e939d4a56782e64fb527cdf900769c2b2fcfd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224946
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-09-29 11:52:37 +00:00
Sigmund Cherem efb509c114 [dart2js] stop using the deprecated NoSuchMethod consturctor
This change is a small incremental step, but should allow us to delete
the public NoSuchMethod constructor in dart:core. The change simply creates
a private constructor in the dart2js patch file and uses that instead.

https://github.com/dart-lang/sdk/issues/49529

Change-Id: I51cb2ec3b7f169a6cb831e753a3e5e9bf0752dbd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260940
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2022-09-29 01:58:56 +00:00
Lasse R.H. Nielsen 72f574507e Update the documentation of Function to mention function types.
And all the other things it didn't mention.
And update the `==` documentation too.

Change-Id: Iccd4b046b0632db788e44b02799d1f8d5541d766
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260881
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-09-28 17:36:56 +00:00
Aske Simon Christensen 985c0ccc46 [dart2wasm] Throw UnimplementedError instead of constructor tear-offs
Change-Id: Icff981119ba0d0f3c5a7c498a16d7a22074105d3
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261680
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Auto-Submit: Aske Simon Christensen <askesc@google.com>
2022-09-28 17:17:12 +00:00
Joshua Litt 203344cf5d [dart2wasm] Add support for runtime types for function types.
Change-Id: I3c446b8ef7dd9b1edc612b9e27893870a25c54d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261160
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-09-27 20:44:35 +00:00
Kallen Tu 80c6f0e824 Clean up dynamic invocations in dart2js core library files.
Change-Id: I3967a13585b2e3c8e0859bef9d08f181f88bf1f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260450
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-09-26 22:26:37 +00:00
Alexander Aprelev c5b0a2de72 [docs] Further update Isolate.spawn documentation
Addresses missed review comments from https://dart-review.googlesource.com/c/sdk/+/260403

TEST=ci

Change-Id: Ic2f5cc5278126f393877970375d50560ee8e2677
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260620
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-09-26 16:23:18 +00:00
Lasse R.H. Nielsen 2fcf9d8803 Update Future.timeout documentation.
Makes it clear that the original future can still complete,
it's just the new future which doesn't wait for it any longer.

Fixes #42318

Bug: http://dartbug.com/42318
Change-Id: I16c25e4e4588d444bd99796d25bdb92bea1467f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260582
Commit-Queue: Nate Bosch <nbosch@google.com>
Auto-Submit: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2022-09-23 19:22:40 +00:00
Alexander Markov 15af1d2c55 [core library] Extract vm_common set of core libraries in libraries.yaml
"vm_common" set of core libraries is shared between various Dart VM
embedders: standalone VM, Flutter, Fuchsia Dart runner and Fuchsia
Flutter runner.

This change would simplify future changes of core library patch
files and will remove the need for additional changes in Flutter
engine when patch file is added or removed.

TEST=ci

Change-Id: Id9fb9dc369504fd4d7dab44de3799dbef594b12d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260900
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-09-23 19:06:14 +00:00
Siva Annamalai 29cf22fa10 Revert "[VM/Library] - Adjust next probe to be a quadratic probe in _HashBase"
This reverts commit 959854769c.

Reason for revert: This CL appears to cause some performance regressions in Flutter hot reload, please see https://github.com/flutter/flutter/issues/112177
In addition the recently added benchmark IntegerSetLookup.DefaultHashSet also shows regressions.

Original change's description:
> [VM/Library] - Adjust next probe to be a quadratic probe in _HashBase
>
> Adjust next probe to a quadratic probe so that it matches up with the internal VM hash map implementation.This avoids some issues with hash code clustering and uses the probing strategy in the VM's HashTable.
>
> Change-Id: I6af560b971c2e6fa745e3b3414e2d8a9075e7ff5
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239004
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Siva Annamalai <asiva@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I27955a4eb239cf9afcbd40989d570467b9eea063
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260747
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2022-09-23 19:01:39 +00:00
Ömer Sinan Ağacan affc3392a0 [dart2wasm] Implement Wasm FfiNative support
This CL introduces a new kernel-to-kernel pass in Wasm backend to
compile `FfiNative`-annotated external functions to external functions
with `wasm:import` pragmas.

The new pass `WasmFfiNativeTransformer` extends `FfiNativeTransformer`.
Some `FfiNativeTransformer` methods made public to allow reuse in the
pass.

The conversion works like this: when we see a member like:

    @FfiNative<Int8 Function(Int8, Int8)>("ffi.addInt8")
    external int addInt8(int a, int b);

We generate a Wasm import using Wasm ABI types according to emscripten
calling conventions:

    @pragma('wasm:import', 'ffi.addInt8')
    external static WasmI32 addInt8_$import(WasmI32 a, WasmI32 b);

and convert the original member (`addInt8()`) to a wrapper function that
calls the Wasm import, converting the arguments and return values to
Dart types:

    static int addInt8(int a, int b) {
      return WasmI32.toIntSigned(
        addInt8_$import(
            WasmI32::int8FromInt(a),
            WasmI32::int8FromInt(b),
        ));
    }

Build, test, and CI changes:

- Test runner now uses `// SharedObjects=...` lines in dart2wasm tests
  to pass extra Wasm modules to d8 command used to run the tests.

  Support for `// SharedObjects=...` lines were already used in
  native/AOT FFI tests, not added in this CL. We just start to use those
  lines in dart2wasm tests.

- dart2wasm gn file updated with a target "test_wasm_modules" that
  builds FFI test Wasm modules to Wasm using emcc (emscripten C
  compiler).

- CI dart2wasm_hostasserts configuration updated to copy the Wasm files
  generated by the "test_wasm_modules" target to the shards.

TEST=tests/web/wasm/ffi_native_test

Change-Id: I6527fe4e2ca2b582e16d84fee244e9cbe6dee307
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252822
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-09-23 09:41:22 +00:00
Nicholas Shahan 76a4d351b8 [ddc] Add non-null assertions when setting fields
!!! NOTE to Google3 rollers:
If this change causes test failures in google3 you can temporarily
set `null_safety_asserts = False` on the failing
`dart_browser_binary` targets until we can fix the mistyped code.
That should allow the test to pass with this change.

Of course feel free to revert this change again if the number of
failures is too high.

Re-land previously reverted change:
https://dart-review.googlesource.com/c/sdk/+/258780

Adds additional tests and more checks to ensure assertions are only
added in libraries that have been migrated to null safety.

Issue: https://github.com/dart-lang/sdk/issues/49918
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259120
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Change-Id: Idcab0fe49a8dd98cdd73192eabae4439aebe2013
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260070
2022-09-23 01:22:11 +00:00
Alexander Markov 1139ed3373 [vm] Record toString()
TEST=language/records/simple/to_string_test

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: I7e55a2486b1d964b24a287ffcf87c40c20f9cfe9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260480
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-09-22 21:49:08 +00:00
Alexander Markov ed593585cc [vm] Record operator== and hashCode
TEST=language/records/simple/equals_and_hashcode_test
TEST=co19/LanguageFeatures/Records/equality_*

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: I63842f980389d63650d00638f1cb1501db88b025
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260442
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-09-22 21:24:58 +00:00
Joshua Litt eb17780ef1 [dart2wasm] Fix dartify check for WasmGC struct.
Change-Id: I86a31a542ddd5b8a85249b80d9ad9235561b3ae2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260000
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-09-22 17:40:38 +00:00
Alexander Aprelev 92638bf5d3 [docs] Update Isolate.spawn doc to remove top-level function/static method restriction.
The restriction was lifted in 5f9ec9f52a.

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

TESt=ci

Change-Id: I5a6c063fe558d4dd305ec4c78bf998f4f3750c89
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260403
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-09-22 07:45:41 +00:00
asiva 959854769c [VM/Library] - Adjust next probe to be a quadratic probe in _HashBase
Adjust next probe to a quadratic probe so that it matches up with the internal VM hash map implementation.This avoids some issues with hash code clustering and uses the probing strategy in the VM's HashTable.

Change-Id: I6af560b971c2e6fa745e3b3414e2d8a9075e7ff5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239004
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2022-09-20 23:35:25 +00:00
Oleh Prypin c0b40136e5 Revert "[ddc] Add non-null assertions when setting fields"
This reverts commit c590001ef0.

Reason for revert: Breaks google3 (b/247639927)

Original change's description:
> [ddc] Add non-null assertions when setting fields
>
> Re-land previously reverted change:
> https://dart-review.googlesource.com/c/sdk/+/258780
>
> Adds additional tests and more checks to ensure assertions are only
> added in libraries that have been migrated to null safety.
>
> Issue: https://github.com/dart-lang/sdk/issues/49918
> Change-Id: If0b9bca9fe0d7db5e15023fe03ccac891af568e8
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259120
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Commit-Queue: Nicholas Shahan <nshahan@google.com>

TBR=sigmund@google.com,nshahan@google.com,annagrin@google.com

Change-Id: Iee2d33005cbabfacab7fc5c45046c6eeb8e31b01
Issue: https://github.com/dart-lang/sdk/issues/49918
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260106
Reviewed-by: Oleh Prypin <oprypin@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2022-09-20 17:19:38 +00:00
Kallen Tu 7578614639 Remove dynamic invocations from custom elements in html_dart2js.
Registering custom elements are already broken -- see: https://github.com/dart-lang/sdk/issues/49536. There are plans on deleting this code at some point. This current change cleans up dynamic invocations in the deprecated code.

Removes cruft on already-deprecated code and doing it now because I assume dynamic clean up will finish before the issue resolves.

Change-Id: Ic6250c139c5d9b08d88650110f55442a7bf5dd42
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259247
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2022-09-20 16:16:06 +00:00
Nicholas Shahan c590001ef0 [ddc] Add non-null assertions when setting fields
Re-land previously reverted change:
https://dart-review.googlesource.com/c/sdk/+/258780

Adds additional tests and more checks to ensure assertions are only
added in libraries that have been migrated to null safety.

Issue: https://github.com/dart-lang/sdk/issues/49918
Change-Id: If0b9bca9fe0d7db5e15023fe03ccac891af568e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259120
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-09-19 23:39:03 +00:00
Brian Quinlan 78bd225ac9 Add a note that sendMessage and readMessage are only available on macOS and Linux.
Change-Id: I74d6a373f914e7c9e9924425df9c87b952ee9c8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257420
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2022-09-19 22:53:21 +00:00
Alexander Markov ae2cebcee9 [vm] runtimeType for record instances and record type equality
TEST=language/records/simple/runtime_type_test

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: I031dff68241dfc62ebc3b6350b10ba7d352bab37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259621
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-09-19 22:05:04 +00:00
Kallen Tu a3764263d8 Use AssertionError rather than Exceptions for unexpected behaviour in io.
Follow up to https://dart-review.googlesource.com/c/sdk/+/257140/comments/38b33a34_5c1914ff.

Unreachable code in error handling.

Change-Id: I9e8a5b19372d63a604efcdf9856a618e5f7b520f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258513
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-09-19 16:42:30 +00:00
Chloe Stefantsova f8ef60a868 Revert "Reland "[cfe,corelib] Add class 'Record' to the core library""
This reverts commit 4b6a8f35b9.

Reason for revert: Breakages in google3.

Original change's description:
> Reland "[cfe,corelib] Add class 'Record' to the core library"
>
> Part of https://github.com/dart-lang/sdk/issues/49713
>
> Change-Id: I56bfca49492d14bb561b32993fd9adfe775b7400
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259583
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I61c4db244329615d7d218484cd86601b1c737ba6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259800
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Auto-Submit: Chloe Stefantsova <cstefantsova@google.com>
2022-09-19 13:52:01 +00:00
Kallen Tu c903b8a3f5 Expose the members of _ProcessImpl to avoid dynamic invocations.
Change-Id: I676f3d5742bffb79bc0815ff55d09d09a5afe305
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258640
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2022-09-16 21:28:30 +00:00
Srujan Gaddam ed38cc874d [pkg:js] Add proto argument to createStaticInteropMock
Adds optional argument proto to allow users to pass instanceof/is
checks with the generated forwarding mock.

Change-Id: If2dba386fb0e66cbe738105e58d9e5ec1f02d02a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257162
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
2022-09-16 20:13:30 +00:00
Srujan Gaddam 8a081b95c6 [pkg:js] Add type/conformance checking for createStaticInteropMock
Bug: https://github.com/dart-lang/sdk/issues/49351

Adds checks for the following cases:
- Type arguments to createStaticInteropMock are correct
- No missing members in implementing class
- Inherited and non-overridden @staticInterop members are implemented
- Dart class can implement through inheritance and mixins
- Implemented members are correct subtypes of @staticInterop members
- Potential extension member conflicts that are attempted to be
resolved through subtyping rules

Change-Id: Iacbe5846040ba7fab41459aa19be77351cf1efca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255761
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
2022-09-16 20:13:30 +00:00
Ahmed Ashour 5fe480b788 Fix typos
Fix #49864

TEST=ci

Change-Id: I9a7e06d604cd0b4f56f2ac229ab3fc9f01cb9d76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256824
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2022-09-16 19:35:00 +00:00
Chloe Stefantsova 4b6a8f35b9 Reland "[cfe,corelib] Add class 'Record' to the core library"
Part of https://github.com/dart-lang/sdk/issues/49713

Change-Id: I56bfca49492d14bb561b32993fd9adfe775b7400
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259583
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-09-16 11:46:40 +00:00
Emmanuel Pellereau 2189897c1b Docs fix: add missing parentheses in whenComplete method docs (by mohanl@).
Change-Id: Ic67992d268366f313a2ffbf789125cbf39d0b707
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259585
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Emmanuel Pellereau <emmanuelp@google.com>
2022-09-16 11:17:24 +00:00
Kallen Tu af20d93e56 Type RandomAccessFile in io_resource_info to avoid dynamic invocation of path
There's one only one path for creating a _FileResourceInfo which comes from RandomAccessFile. Type the `file` field to avoid a dynamic call to `.path`.

Change-Id: Ia1041d5b221d0496af3dd177562263b31cdf4157
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259106
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-09-15 20:55:39 +00:00
Alexander Aprelev d31c741fbb Revert "[cfe,corelib] Add class 'Record' to the core library"
This reverts commit f553f0aad9

Reason for revert: breaks g3 bot

Original change's description:
> [cfe,corelib] Add class 'Record' to the core library
>
> Part of https://github.com/dart-lang/sdk/issues/49713
>
> Change-Id: Ibb0309f97565c0a623f60e588eefcad6759d5ace
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257066
> Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>

TBR=lrn@google.com,scheglov@google.com,cstefantsova@google.com,johnniwinther@google.com

Change-Id: If386819fc7419a660c692e4187ead4ebf142c68c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259462
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-09-15 17:45:50 +00:00
Chloe Stefantsova f553f0aad9 [cfe,corelib] Add class 'Record' to the core library
Part of https://github.com/dart-lang/sdk/issues/49713

Change-Id: Ibb0309f97565c0a623f60e588eefcad6759d5ace
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257066
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-09-15 11:50:33 +00:00
Aske Simon Christensen b6e227e6fa [dart2wasm] Implement typeAcceptsNull
This function is used internally to abstract over null safety modes.
Since dart2wasm is always fully null safe, the function is trivial.

Change-Id: I8d636d4ce146a2a848dde736d8563dcb0028f92a
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258928
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2022-09-15 10:01:43 +00:00
Joshua Litt 8429f01593 [dart2wasm] Implement optional parameters for JS interop callbacks.
Also added tests of optional parameters for static interop functions.

Change-Id: Id23237b96d0de5a4a4b948b3f23fd1bfe40b218e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259101
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-09-14 22:33:02 +00:00
Ian Hickson 9e9768c89d Simplify the license situation
There's no LICENSE file that mentions the Go authors in this repository, but since this code is covered by the CLA we can just move the name to the AUTHORS file and rely on the existing statement that references the Dart LICENSE file.

Change-Id: I3e8e04ef39e7ed6de0134cc33bf8a22e3d33389b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250792
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
2022-09-14 21:06:22 +00:00
Kallen Tu 586efdfe59 Add ignores for dynamic calls in html_dart2js sanitizing code.
Avoid removing dynamic invocations in sanitizing code as we don't know what type the element and its attributes may be.

Change-Id: I057d908027befe7fd284bf4ec6c68bd1d0e977f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259108
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-09-14 20:35:04 +00:00
Brian Quinlan fa53fb66d0 Throw an error if an attempt is made to create more than one resource from a ResourceHandle
Change-Id: I629d2b9cfddd8e5f7fe8ae65a03362c7bcce5e2c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257000
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2022-09-14 18:17:33 +00:00
Aske Simon Christensen 8ae4802e05 [dart2wasm] Dummy isolate patch
Change-Id: Id748ef2f69c09592513ba6a3cffafc37a8450d00
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258921
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-09-14 13:43:52 +00:00
Kallen Tu aad35b490f Remove dynamic invocations in error handling in directory_impl.
Change-Id: Idb1ac4490efd74a2ff98a3d9f0c57a74299ce413
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258512
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-09-14 07:24:53 +00:00
Brian Quinlan 2ead86ab9d Implement anonymous pipes and the ability to transmit them between processes using Unix Domain Sockets.
Change-Id: I9c9f4ec0e99075a29c6f4d97c503e759134eb094
TESTED=Unit tests
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257804
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-09-13 21:16:28 +00:00
Lasse R.H. Nielsen e4ae0cf2ce Make Uri treat \ as / in path and authority.
When using `Uri.parse` or `Uri(path:..)`, a `\` is treated as, and converted to, a `/`.
This avoids a particular problematic difference in behavior between Dart and the browser's `URL` functionality. There are still examples where the two differ in interpretation of the same code, but in those cases, the Dart `Uri` will most likely end up without a host name, which should be easily detected.


Change-Id: I798df6c3c27c6d64fb9fc8dc30d90b06ba5a9004
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258120
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-09-13 11:48:19 +00:00
Alexander Markov c94103ae05 [vm] Initial implementation of record instances
TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: I82ba571d1935d616fe3d4d6d579e59eb57d65a43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256804
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-09-12 22:41:57 +00:00
Alexander Markov 9a023aeae9 [vm] Initial implementation of record types
TEST=language/record_type_test

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: Ib2100c23513395c9fa9c541320eacbb33a2a119e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256802
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-09-12 22:40:57 +00:00
Emmanuel Pellereau 727e792e77 Revert "[ddc] Add non-null assertions when setting fields"
This reverts commit 27099c121c.

Reason for revert: Breaks google3 (b/246251728)
Original change's description:
> [ddc] Add non-null assertions when setting fields
>
> Fixes: https://github.com/dart-lang/sdk/issues/49918
> Change-Id: I6dddda878afa504bebebb00a80855bac636f8efd
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258220
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Commit-Queue: Nicholas Shahan <nshahan@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I5e3fb1c151a85e11025135b8fc95c65192b33791
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258780
Commit-Queue: Emmanuel Pellereau <emmanuelp@google.com>
Reviewed-by: Emmanuel Pellereau <emmanuelp@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2022-09-12 11:21:06 +00:00
Nicholas Shahan 27099c121c [ddc] Add non-null assertions when setting fields
Fixes: https://github.com/dart-lang/sdk/issues/49918
Change-Id: I6dddda878afa504bebebb00a80855bac636f8efd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258220
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-09-09 21:05:25 +00:00
Joshua Litt 014818bf8e [dart2wasm] Implement js_util.instanceof.
Also fixes performanceNow for Chrome.

Change-Id: I1b70610a8a1a44c0f0e3ce7b166f32f9915324c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258504
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-09-09 20:40:34 +00:00
Aske Simon Christensen 9af959c167 [dart2wasm] Coerce types on imports/exports to externref or funcref
Change-Id: Id7fe0775e14b7ed16c925819ffc9c41dea863e4d
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258001
Auto-Submit: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-09-09 18:10:34 +00:00
Kallen Tu 7055da30a7 Remove dynamic invocations from io file classes.
Change-Id: Iaf556ca462b9d962557b627c59220101f384ae51
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258380
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2022-09-09 17:45:45 +00:00
Aske Simon Christensen cded056cf1 Move cast and toSet on immutable sets to implementation classes
These methods create new sets, whose implementation must match the
target platform. Thus, they should be specialized for the VM and
dart2wasm instead of being implemented in the shared mixin.

Change-Id: I102a45686e3eb373463f2fcdf84ee861e202ecc0
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258362
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-09-09 14:04:34 +00:00
Aske Simon Christensen f2bc59738c Rename the VM's internal hash set classes
Rename `_CompactLinkedHashSet` to `_InternalLinkedHashSet` and
`_CompactImmutableLinkedHashSet` to `_InternalImmutableLinkedHashSet`
to make the names consistent with the corresponding `Map` class names
and to distinguish them from the non-VM-specific hash maps and sets,
which are generally named starting with `_Compact`.

Tested: ci
Change-Id: Ic1ebc44ba8beba34ceab382a4edddc6624fe3fb3
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258002
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2022-09-09 14:04:34 +00:00
Aske Simon Christensen bab5cfbe74 Add more types to the VM's internal compact hash structures.
This gets rid of some occurrences of `dynamic` and makes the
associated implicit conversions explicit.

Based on https://dart-review.googlesource.com/c/sdk/+/237582

Tested: ci
Change-Id: I7faeffab395c916800b29ea7e56bd3f7d15aac54
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258242
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-09-09 08:38:36 +00:00
Ryan Macnak e5fc6d652b [vm] Don't pass and copy unused category string when recording timeline events.
TEST=ci
Change-Id: I53b60a977c2b33d29a0ca685120044ba208d3ae4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258321
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-09-08 22:02:46 +00:00
Kallen Tu 7e13c388fe Clean up - unused typedef and lint ignore for html.
Change-Id: I50f89a2d59478c8e2a63a81d106e0943b496ad46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257427
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2022-09-08 20:59:24 +00:00
Kallen Tu 10a1ac18ab Eliminate dynamic [] calls from common, directory_impl and link.
Change-Id: I91be3303d957d5c746e33099b6238b51243ba60f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257140
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-09-08 17:17:03 +00:00
Daco Harkes 2cd6fdd100 [doc] Update Uri.queryParameters type
Because the value type is dynamic, I noticed use sites passing in
`Map<String, String?>`. After inspecting the implementation, it looks
like this is by design: `writeParameter` in `_makeQuery` takes a
nullable value.

This CL updates the documented type to reflect this.

Change-Id: I7b6f1c4a59ec44282e5e8b4ada86becafb308d30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258240
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-09-08 14:32:03 +00:00
Joshua Litt 708264289d [dart2wasm] Use WasmExternRef for JS interop.
Change-Id: I01138d48ba9cc67954ef086968af90dae173fda9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257880
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-09-07 20:55:27 +00:00
Joshua Litt eb540194ad [dart2wasm] Implement promiseToFuture.
Change-Id: I265441c5c78933f8bdace53f956d22677442d7fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257803
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-09-07 17:56:17 +00:00
Joshua Litt 2b85e02c5d [dart2wasm] Implement == for JSValue.
Change-Id: I45af5bdabfb0dfa12b6b39094843b9394f4fe510
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257923
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-09-07 16:37:17 +00:00
Kallen Tu 8264bd94d1 Revert "Eliminate dynamic call() in html_dart2js in _EventStreamSubscription."
This reverts commit f630a7c07d.

Reason for revert: Remove the `is` check since it's more costly than removing a dynamic call for web.

Original change's description:
> Eliminate dynamic call() in html_dart2js in _EventStreamSubscription.
>
> Change-Id: Ia4a300c210bc505f71cc3bfb1a1b911c96c1aa53
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256703
> Commit-Queue: Kallen Tu <kallentu@google.com>
> Reviewed-by: Leaf Petersen <leafp@google.com>
> Reviewed-by: Lasse Nielsen <lrn@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I36b2f8cedc5f8b5235832ea29ea5eb40e2e8dc92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257421
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-09-02 18:44:53 +00:00
Kallen Tu f630a7c07d Eliminate dynamic call() in html_dart2js in _EventStreamSubscription.
Change-Id: Ia4a300c210bc505f71cc3bfb1a1b911c96c1aa53
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256703
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-09-01 00:27:29 +00:00
Ivan Inozemtsev 12d1e58cbc Revert "Make addStream events be delivered synchronously."
This reverts commit 9292afa710.

Reason for revert: b/244407576

Original change's description:
> Make `addStream` events be delivered synchronously.
>
> The asynchronous stream controllers were forwarding stream events
> from an `addStream` stream through the same path as user-added event,
> which added an extra asynchronous delay that is unnecessary for forwarding existing events.
>
> Change-Id: I8edd1936d0d155d051d3cb8f7f82c577334d5f8e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256560
> Reviewed-by: Nate Bosch <nbosch@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I0e4791f4d32616fee9772a2ab7015bac4e117312
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257080
Auto-Submit: Ivan Inozemtsev <iinozemtsev@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
2022-08-31 15:59:18 +00:00
Ivan Inozemtsev 212d5e3a31 Revert "Fix bug in Completer.complete."
This reverts commit 3688a4723c.

Reason for revert: b/244409289

Original change's description:
> Fix bug in Completer.complete.
>
> When given a completed `_Future`, it would complete its own future synchronously.
>
> Fixes #48493.
>
> Bug: https://github.com/dart-lang/sdk/issues/48493
> Change-Id: Ic4a68389b5a009ef52b3875bf03a3bafb493f79a
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234981
> Reviewed-by: Nate Bosch <nbosch@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: https://github.com/dart-lang/sdk/issues/48493
Change-Id: I5ed360bebe160868f6152c72c82070c93188858e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257100
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-08-31 15:04:08 +00:00
Kallen Tu e0884c91f1 Eliminate dynamic call of .createElement in html_dart2js.
Change-Id: I76ab0063eee4213f20483172c16f86e651536945
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256740
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2022-08-30 15:48:40 +00:00
Lasse R.H. Nielsen 3688a4723c Fix bug in Completer.complete.
When given a completed `_Future`, it would complete its own future synchronously.

Fixes #48493.

Bug: https://github.com/dart-lang/sdk/issues/48493
Change-Id: Ic4a68389b5a009ef52b3875bf03a3bafb493f79a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234981
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-08-30 10:52:27 +00:00
Lasse R.H. Nielsen 9292afa710 Make addStream events be delivered synchronously.
The asynchronous stream controllers were forwarding stream events
from an `addStream` stream through the same path as user-added event,
which added an extra asynchronous delay that is unnecessary for forwarding existing events.

Change-Id: I8edd1936d0d155d051d3cb8f7f82c577334d5f8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256560
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-08-30 08:22:27 +00:00
Alexander Aprelev 6abb6e5110 [io/http] Validate method name passed to HttpClient.open/openUrl.
There should be no control characters or delimiters in method name
provided to open/openUrl methods.

Fixes https://github.com/dart-lang/sdk/issues/45744
TEST=http_open_method_validate_test

Change-Id: I0db98f2376c980a054420fb447d4f7ef9321f1a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256429
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-08-29 21:12:27 +00:00
Kallen Tu 2bb03e4344 Eliminate .style and ._initKeyboardEvent from html_dart2js.
Change-Id: I16ea832e8eff2b2aea02fb73e1cf7ee9702923af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256581
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-08-29 20:06:45 +00:00
Kallen Tu bcb9fd28fb Eliminate [] dynamic call in io_resource_info.
Change-Id: I80a30d8c31ecc41f2ebf6f7fc8ac6dd41225ea4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256600
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-08-29 18:53:15 +00:00
Kallen Tu 78a9f52544 Eliminate dynamic calls with file and subscription in stdio.
Change-Id: I3dbdb2c14729fd1c74e733a59234df5035386cfd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256249
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-08-26 20:21:21 +00:00
Alexander Aprelev 33846f3678 [io/file] Add exclusive optional parameter to File.create, createSync.
TEST=standalone/io/file_create_test

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

Change-Id: I0b1bdc889caf5801570d7ac9e7b6694264cd6565
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255482
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2022-08-24 17:09:49 +00:00
Kallen Tu fa7ffc9ac1 Eliminate dynamic calls in SVGElement.
Change-Id: I60c48145fb8ffe5cc5d1c20f86cfa9f067c2705c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256026
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2022-08-23 18:21:40 +00:00
Lasse R.H. Nielsen be70a6dc13 Change : to = for default values in sdk/
Change-Id: I1939b0998343c36eab162a015fcf9eeb7e1dd7bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256123
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2022-08-23 13:53:30 +00:00
Joshua Litt 8009c39d61 [dart2wasm] Implement dynamic naively.
Change-Id: I905a81faead20b4339309521018291d0b4d90dda
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250786
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-08-22 21:33:29 +00:00
Joshua Litt 1d6407fc3f [dart2wasm] Align semantics of jsify / dartify.
Change-Id: If4a5fc90093c35476a58e5f4755ef58ed9d9d889
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255766
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-08-22 19:54:29 +00:00
Ryan Macnak ae57447189 [vm] Simplify creating ByteData from the embedding API.
TEST=ci
Change-Id: I0d5093c0eee6ab477e73a368179aba9a23d9600f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255817
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-08-22 17:50:45 +00:00
Kallen Tu 64c3ea27da Eliminate dynamic calls to remove and tagName.
Additionally, fixed the template for html_dart2js so the generator would generate the correct code.

Change-Id: I2172bb10db413169b86690faa027365ff72e3d68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255763
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-08-22 17:27:39 +00:00
Aske Simon Christensen a85157e233 [dart2wasm] Convert to/from externref via Wasm instructions
This adds support for the newly added `extern.externalize` and
`extern.internalize` instructions and uses these for converting to/from
`externref` instead of a JS round-trip.

Change-Id: If18d8f44ddf013d4c26bf1597be91bcd0db41c5a
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255462
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-08-19 07:11:18 +00:00
Aske Simon Christensen 02d1255d75 Update d8 to 10.6.166
The API for the JS Promise integration API has changed to be part of
the `new WebAssembly.Function` constructor. This requires parameter
types to be specified explicitly. Apparently, these types currently
must be all `externref`.

Change-Id: Ifae634f65cfa377441be4b2dc0643c34b702fbe7
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255061
Reviewed-by: Stephen Adams <sra@google.com>
2022-08-19 07:11:18 +00:00
Aske Simon Christensen b1c0992199 [dart2wasm] Implement the three-pronged WasmGC type hierarchy.
This splits the type hierarchy into three separate hierarchies with
the top types `any`, `func` and `extern`.

Update d8 to 10.6.91, which switches to the new type hierarchy.

Also, all ref shorthands for abstract heap types are now nullable, so
the type emitter in the `wasm_builder` is updated to follow that scheme.

To reduce confusion about the nullability of abstract reference types,
these now all require the nullability to be specified explicitly.

Change-Id: I4774d08cbed18307e481c466b2e3402a8d8fb6bd
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255060
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-08-19 07:11:18 +00:00
Aske Simon Christensen bde8430b97 [dart2wasm] Initial async/await support based on Promise integration
This implementation has a number of limitations:

- Returning a Future from an async function is not supported.
- Every async call switches to a new stack. A later optimization will
  stay on the same stack if the call is directly awaited.
- Exceptions that cross async boundaries do not receive full stack
  traces including the async suspension points. The stack trace of the
  final exception just reflects the stack trace for the outermost
  async call.

Change-Id: I2a5d5e30d6e955999ba55842c8b2ca3427cbf954
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241010
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-08-19 07:11:18 +00:00
Kallen Tu add88f24c2 Eliminate dynamic calls to firstChild, remove and _innerHtml.
Change-Id: If984af54620727929ea8deb182226ce8d6514bb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255581
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-08-18 21:50:14 +00:00
Joshua Litt 4810c8930b [dart2wasm] Initial regexp support.
Change-Id: Ia461c77979785bbc0510052a31f94bdd83babc01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250582
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-08-18 19:49:34 +00:00
Lasse R.H. Nielsen a5f25ee3ba Add Isolate.run.
Adds static method on `Isolate` to run an asynchronous function
in a separate isolate.

Change-Id: I673373fa02524f1d0b88099027cfaf1b796eb344
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254960
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-08-18 10:42:55 +00:00
Kallen Tu d0e27df1e3 Eliminate dynamic calls when getting the environment.
Statically type String variables to avoid dynamic calls for substring or concatenation.

Change-Id: If485243dc0580fd1f4e53ec4cf69cb3819a57b5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255301
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-08-17 21:00:23 +00:00
Bishwajeet Parhi 0a4c6a5cf4 Docs: Update broken link for Random.secure
Closes https://github.com/dart-lang/sdk/pull/49682

GitOrigin-RevId: 0a049389dd422e646036232282bbb23ea3bc805e
Change-Id: I39da72e4adb8365a608d53117c146d85ab459bcb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255381
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-08-17 13:24:43 +00:00
Lasse R.H. Nielsen 59cd692fb9 Remove documentation for runZoned's onError parameter.
Fixes #49679

Bug: https://dartbug.com/49679
Change-Id: I14d0822f80099ac754db84580a52400a6c249fca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255252
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
2022-08-17 09:32:53 +00:00
Joshua Litt 2c4ee2895f [dart2wasm] Implement toString methods on double using JS interop.
Change-Id: I5843e9cae59b8f152b922a01796eaf05494808a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250681
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-08-17 00:23:52 +00:00
Joshua Litt 591ef06a29 [dart2wasm] Implement unimplemented Uri methods.
Change-Id: I54b8633d39df64d1760a7face5dda38c3aa95d5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251592
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-08-16 22:38:02 +00:00
Joshua Litt 3923013b81 [dart2wasm] Implement some missing members on String.
Change-Id: I37db0a4fa2ebdd0101832e0e4025cb5a38434dc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251720
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-08-16 20:34:54 +00:00
Ilya Yanok d3f30dc3c6 Revert "Reapply "Avoid computing the URI scanner tables at runtime.""
This reverts commit 4c7110332e.

Reason for revert: Still breaks the same tests, see b/242715525

Original change's description:
> Reapply "Avoid computing the URI scanner tables at runtime."
>
> This reverts commit 855e1cd975.
>
> The blocking issue in internal test code is assumed fixed.
>
> Change-Id: I74e0be130d149a45f77dc90c354916308b76b741
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255248
> Commit-Queue: Lasse Nielsen <lrn@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Auto-Submit: Lasse Nielsen <lrn@google.com>

TBR=lrn@google.com,kustermann@google.com

Change-Id: I391d2eb6dd9ae7367f656eaaaa7f9aeb1c31e0f7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255254
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ilya Yanok <yanok@google.com>
Reviewed-by: Ilya Yanok <yanok@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-08-16 16:46:28 +00:00
Lasse R.H. Nielsen 4c7110332e Reapply "Avoid computing the URI scanner tables at runtime."
This reverts commit 855e1cd975.

The blocking issue in internal test code is assumed fixed.

Change-Id: I74e0be130d149a45f77dc90c354916308b76b741
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255248
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Auto-Submit: Lasse Nielsen <lrn@google.com>
2022-08-16 14:53:07 +00:00
Alexander Aprelev 0914835773 [vm/inliner] Tweak inlining heuristic, improve List.of inlining.
Builds on top of https://dart-review.googlesource.com/c/sdk/+/228660, introduces vm:vm:always-consider-inlining that tell inliner not to give up inlining of a function.

HashMap constructor got prefer-inline pragma to accommodate shift in inlining away from where it used to be inlined due to large size of inlined HashMap, greater than FLAG_inline_getters_setters_smaller_than heuristic.

Notable performance changes:

JIT (x64)
===
ListCopy.List.of.fixed.100 27.37%
ListCopy.List.of.fixed.2 16.31%

AOT (x64)
===
Empty  -9.978%
InstantiateTypeArgs.Instantiate1  -8.262%
...
ListCopy.List.of.fixed.2 13.73%
ListCopy.spread.num.2 15.51%
ListCopy.List.of.2 15.08%
MapCopy.Map.String.of.Map.100 55.62%
MapCopy.Map.Thing.of.Map.100 56.06%

flutter release
===
flutter_gallery_apk_size (Pixel 2)
-0.0074% (1.0 noise)41809568.00 41812676.00


Addresses https://github.com/dart-lang/sdk/issues/49408

TEST=Inliner_always_consider_inlining, Inliner_List_of_inlined
Change-Id: I7f8fc7cb0ac4a69310c108cf519518c384dc0164
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253740
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-08-15 21:14:36 +00:00
Ryan Macnak c1e67ac84f [vm] Recognize unmodifiable typed data views.
These types now work with Dart_TypedDataAcquireData.

The presence of these types no longer degrades the performance of typed data indexed loads.

The presence of these types degrades the performance of typed data indexed stores much less. The performance of indexed stores is somewhat regressed if these types were not used.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/32028
Bug: https://github.com/dart-lang/sdk/issues/40924
Bug: https://github.com/dart-lang/sdk/issues/42785
Change-Id: Iffad865708501acf96db418985cd5a69bd9afa55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254501
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-08-11 18:10:48 +00:00
Daco Harkes f592a11e51 [vm/ffi] NativeFieldWrapper FfiNative check receivers for nullptr
Changes `FfiNative` instance methods on `NativeFieldWrapperClass`es
that have `Pointer<Void>` conversion to check for `nullptr`.

If the native field has `0`/`nullptr` a `StateError` is thrown:
"Bad state: Native field is nullptr."

This only makes sense if the first native field is used to point to
the C++ object corresponding to the Dart object. As far as we know
all current use cases do so.

TEST=pkg/vm/testcases/transformations/ffi/ffinative.dart.expect
TEST=tests/ffi/vmspecific_ffi_native_test.dart

Closes: https://github.com/dart-lang/sdk/issues/49620
Change-Id: I92f760c33d391476010722358f9713fa4491ab61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254200
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-08-11 17:39:57 +00:00
Johnni Winther 50ac2500a1 [dart2js] Handle private names correctly in K/J-model
The library wasn't taken into account when handling computing class
members in the K/J-model and not handled correctly when computing
applicable selectors. This made dart2js unable to handle members with
a name private to a different library than the enclosing library.

Fixes #33732
Fixes #49226

Change-Id: I5ba143d87662bbd42e0ff02355054e4a937be8f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252665
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2022-08-11 06:56:32 +00:00
Joshua Litt 90478c34c4 [dart2wasm] Support typed data conversions across JS interop boundary.
Change-Id: Ie8aca2027ac47dafd79636d8ac06f3466817b8d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253841
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2022-08-10 20:23:41 +00:00
Ryan Macnak 10bf1cfe58 Revert "[vm] Recognize unmodifiabled typed data views."
This reverts commit d1112d37bd.

Reason for revert: b/242043014

Original change's description:
> [vm] Recognize unmodifiabled typed data views.
>
> These types now work with Dart_TypedDataAcquireData.
>
> The presence of these types no longer degrades the performance of typed data indexed loads.
>
> The presence of these types degrades the performance of typed data indexed stores much less. The performance of indexed stores is somewhat regressed if these types were not used.
>
> TEST=ci
> Bug: https://github.com/dart-lang/sdk/issues/32028
> Bug: https://github.com/dart-lang/sdk/issues/40924
> Bug: https://github.com/dart-lang/sdk/issues/42785
> Change-Id: I05ac5c9543f6f61ac37533b9efe511254778caed
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253700
> Reviewed-by: Aske Simon Christensen <askesc@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

TBR=kustermann@google.com,rmacnak@google.com,askesc@google.com

TEST=ci
Change-Id: I32c1c460fc30c51bc0d42e7cfaafe72bf5630069
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/32028
Bug: https://github.com/dart-lang/sdk/issues/40924
Bug: https://github.com/dart-lang/sdk/issues/42785
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254560
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-08-10 20:08:22 +00:00
Ryan Macnak d1112d37bd [vm] Recognize unmodifiabled typed data views.
These types now work with Dart_TypedDataAcquireData.

The presence of these types no longer degrades the performance of typed data indexed loads.

The presence of these types degrades the performance of typed data indexed stores much less. The performance of indexed stores is somewhat regressed if these types were not used.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/32028
Bug: https://github.com/dart-lang/sdk/issues/40924
Bug: https://github.com/dart-lang/sdk/issues/42785
Change-Id: I05ac5c9543f6f61ac37533b9efe511254778caed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253700
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-08-09 20:57:05 +00:00
Nicholas Shahan fa47a0547c [web] Make environment nullable in more places
It appears that the environment was intended to be nullable in
some type constructions.

DDC running in weak mode can fail when null is passed as an argument
that is typed to be non-nullable.

Change-Id: I2c67efacc1166e6053ef8d8d7820de2c022c5e1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253706
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-08-09 18:22:55 +00:00
Michael Thomsen c34b72482e Remove deprecated APIs from dart:convert
Contributes to bug: https://github.com/dart-lang/sdk/issues/34233

Change-Id: I443fa14342680b61bf7357d40347427200fea29b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247741
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2022-08-09 10:21:22 +00:00
Joshua Litt b99140115b [dart2wasm] Fix some js interop related issues.
Change-Id: Id189c53c7a4c536c703b0b9e83265a81d0c14094
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253609
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-08-08 17:29:40 +00:00
Martin Kustermann 4539bf6584 [vm] Make heap snapshot writer also visit isolate stacks as roots
Heap snapshots currently produced don't visit isolate stacks. As such
analyzing such snapshots may lead one to conclude there is a lot of
garbage while objects are actually reachable.

=> This CL makes us visit isolate stacks when building heap snapshots.

Furthermore we add a new `VMInternals.writeHeapSnapshotToFile` helper
that can be used to programmatically write snapshots and can be handy
for internal use at times. (We also use this helper in a test)

TEST=vm/dart{,_2}/heap_snapshot_test

Change-Id: I976544b7f6d20863764af9a40bf1ffb3c319bbce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253785
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-08-06 11:24:28 +00:00
Mark Zhou ad8d2ccb06 [dart2js] Updating runtime allocations to store a JSON-decoded map instead of a JSON string
This was requested by internal teams for easier querying/processing.

Change-Id: I59fea565f79bf92d4cf808cc0466b4e9cfa37fe8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253707
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-08-06 00:02:37 +00:00
Slava Egorov d94a1cd419 Revert "[vm, compiler] Implement unboxed SIMD for RISC-V via lowering."
This reverts commit 460bd7a03a.

Reason for revert: build and layout benchmarks seem to be failing on Golem

Original change's description:
> [vm, compiler] Implement unboxed SIMD for RISC-V via lowering.
>
> TEST=ci
> Change-Id: Ice2ec0847ee43ff9b8c5859ba15dbbeee48ba36e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250943
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>

TBR=vegorov@google.com,rmacnak@google.com,alexmarkov@google.com

Change-Id: I062bc13d0d941fcabf4c67a696fc2be324f0e1c3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253580
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-08-03 10:32:46 +00:00
Srujan Gaddam 409b426cfc [dart:html] Add SharedArrayBuffer constructor and slice
Fixes https://github.com/dart-lang/sdk/issues/35344

Change-Id: I5742adddf1fe01bfe40860a734a4c930091d8472
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253563
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
2022-08-03 01:04:25 +00:00
Ryan Macnak 460bd7a03a [vm, compiler] Implement unboxed SIMD for RISC-V via lowering.
TEST=ci
Change-Id: Ice2ec0847ee43ff9b8c5859ba15dbbeee48ba36e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250943
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-08-02 20:24:54 +00:00
Brian Quinlan 0a591de164 Document that Directory.list* returns results in arbitrary order
Bug: https://github.com/dart-lang/sdk/issues/48621
Change-Id: I0f200abf4a5a218cccf79b4b5b71fe85959b16db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253360
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2022-08-01 23:58:44 +00:00
Sigmund Cherem b62e612dc8 [dart:html] Deprecate custom element registration APIs.
The `registerElement` APIs in `dart:html` are legacy APIs based on a
deprecated Web Components v0.5 specification. These methods don't work
on modern browsers and can only be used with a polyfill.

The latest Web Components specification is supported indirectly via
JSInterop and doesn't have an explicit API in the `dart:html` library.

This change marks these APIs as deprecated. We intend to remove them in
the future (see https://github.com/dart-lang/sdk/issues/49536)

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

Change-Id: I2e96d36e95c9971b59cde80bc4da49b63d12b17c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252840
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2022-07-28 16:07:30 +00:00
Kabo a11c253152 Fix documentation for Object.hashAllUnordered
Closes https://github.com/dart-lang/sdk/pull/49496

GitOrigin-RevId: 60d2f2a8548f51aab9f8d8a782e46240e0255ae5
Change-Id: I6fb3f5c31f73691ac577a4a58898bf49237a2ff7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252400
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-07-28 10:54:00 +00:00
Joshua Litt e1933cd4a0 [dart2wasm] Implement NoSuchMethodError.
Change-Id: I1a799255f93449fef011cb0bc9b92cd63f3437c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250791
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-07-28 01:20:40 +00:00
Aske Simon Christensen e75be087e5 [dart2wasm] Fix handling of null values in some non-nullable contexts
Change-Id: Id25f4899d0898686ee30bf05f7e57a9ef84fb818
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252740
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-07-27 22:47:30 +00:00
Joshua Litt 9683862a4e [dart2wasm] Minor fixes to unblock building Flutter.
Change-Id: I58b9554b94f8a35432a04a27a7bf1b39701f45d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251781
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-07-27 17:31:28 +00:00
Joshua Litt 63a9057f12 [dart2wasm] Implement unimplemented methods in DateTime.
Change-Id: Ia84d2e65ab6207fc70f6f8380c18ba3b89f7400f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251590
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-07-27 00:50:47 +00:00
Joshua Litt fe78a23e9a [js_util] Generalize dartify, and make it more robust.
Change-Id: I3608bcbdf320f6d4da2a52119d48fb02df2ad0e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252565
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-07-26 21:49:27 +00:00
Joshua Litt eeb2212287 [dart2wasm] Implement Stopwatch on top of JS.
Change-Id: Ia9bde1b86fe80c33db4219e08a3ce0180227e104
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251591
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-07-26 20:41:27 +00:00
Joshua Litt 9e83c53c61 [dart2wasm] Implement constant symbols.
Change-Id: I758576a7a35c6ffe127fd02eb394e97719750476
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250776
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-07-26 17:40:07 +00:00
Joshua Litt e45f73dd6d [dart2wasm] Use VM's bigint implementation.
Change-Id: Ie0cfa40ec4497ee9d6eacff07bc479fe7d74537c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250485
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-07-25 17:16:29 +00:00
Ben Konyi 5ef61ff1e5 [ dart:developer ] Update documentation for Metrics
Fixes https://github.com/dart-lang/sdk/issues/49511

Change-Id: I0dae4709ef34d1dd9cf3c8ccebd295df4565fbc3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252620
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2022-07-25 15:32:59 +00:00
Anis Alibegić 40e18905f2 Fixed various typos in a lot of files
Closes https://github.com/dart-lang/sdk/pull/49478

TEST=Manual

GitOrigin-RevId: f4c9c6869dfe73639295e86574a021523b3d374d
Change-Id: I134a97caed4eec59d70e9cbca16b7e9a472cf2c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251902
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Kevin Chisholm <kevinjchisholm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2022-07-25 12:21:59 +00:00
Joshua Litt f6f29df4b5 [dart2wasm] Enable RTI tests for oddball and interface types.
Change-Id: I4b92d4cf30779b78f3eab1acd18193fdd58ab452
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249641
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-07-23 00:56:38 +00:00
Ryan Macnak 2d13b205d7 Reland "[vm] Generate event ids for synchronous begin and end events."
Fix transposed id and timestamp.

TEST=Instruments, ci
Bug: https://github.com/dart-lang/sdk/issues/49178
Change-Id: I2c2650f28050b179d26e1269729727f58201a8a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251581
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-07-22 19:13:47 +00:00
Nicholas Shahan 8d1ad7d13c [ddc] Refactor _checkAndCall
Move the method body out of one giant JS foreign function and into
Dart code with small JS foreign function calls inside.

The generous use of small JS foreign function calls ensures almost
identical compiled output with the exception of indentation, curly
braces on if statements, and single vs double quote differences.

Issue: https://github.com/dart-lang/sdk/issues/46002
Change-Id: Ice039fd096893e4f8869696ca46651b3d2e88add
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252410
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-07-22 16:57:22 +00:00
Tess Strickland 27f6c6d660 Reland "[pkg/native_stack_traces] Support Mach-O dSYM debugging information."
This is a reland of commit 08c13f173c

Fixes test failures on non-x64 architectures, both in the test
harness and due to DWARF5 line number program headers having a
non-backwards compatible format. (We generate DWARF2 in the
ELF snapshot writer, but the assembler used for assembly snapshots
may generate DWARF5.)

TEST=vm/dart{,_2}/use_dwarf_stack_traces_flag

Original change's description:
> [pkg/native_stack_traces] Support Mach-O dSYM debugging information.
>
> TEST=vm/dart{,_2}/use_dwarf_stack_traces_flag
>
> Bug: https://github.com/dart-lang/sdk/issues/43612
> Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-mac-product-x64-try,pkg-mac-release-arm64-try,vm-kernel-mac-release-arm64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try
> Change-Id: Icda21bb14dcc0cf4784cea118e6ba7dd4edd35aa
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250381
> Commit-Queue: Tess Strickland <sstrickl@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>

Bug: https://github.com/dart-lang/sdk/issues/43612
Change-Id: I8a9cb70e78bc8594bcae004809c5a1be778d691d
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-mac-product-x64-try,pkg-mac-release-arm64-try,vm-kernel-mac-release-arm64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-nnbd-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-nnbd-mac-release-simarm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251464
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2022-07-22 07:05:26 +00:00
Joshua Litt 047ca385c4 [dart2wasm] Fix infinite loop in createFromCharCodes.
Change-Id: I6d9c92f2b509424c829af4b057c7cebf5a746e00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250446
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-07-21 23:04:36 +00:00
Joshua Litt cf51477ad3 [dart2wasm] Add _DuplicatedFieldInitializerError to core for CFE.
Change-Id: I8b3c594d6fb56437c76e819b45c53d3465f0fdc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250483
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-07-21 23:01:16 +00:00
Aske Simon Christensen bfd2ec2c26 [dart2wasm] Fix return type of _typeArguments
This fixes the breakage of barista3 introduced in
https://dart-review.googlesource.com/c/sdk/+/250480

Change-Id: I5ebca17ab35464e0c452d2fbe1b0f6574e05b6cd
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252381
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Auto-Submit: Aske Simon Christensen <askesc@google.com>
2022-07-21 18:12:25 +00:00
Michael Thomsen e84412af45 Remove unsupported APIs in dart:mirrors
Contributes to bug: https://github.com/dart-lang/sdk/issues/34233
Fixes https://github.com/dart-lang/sdk/issues/32507

Change-Id: Iee72e9f91fc1fc49761e6f5e6e9dba412493c8ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248003
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-07-20 18:28:35 +00:00
Ryan Macnak b25d63043b Document which classes in dart:typed_data cannot be extended or implemented.
Cf. pkg/front_end/lib/src/fasta/denylisted_classes.dart.

Change-Id: Ib2692e763506164a34eca89ab98adc087642dce8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252003
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-07-20 17:37:19 +00:00
Joshua Litt 1dd12d45c7 [dart2wasm] Add support for stub dart:io.
Change-Id: Ic6c7e7dc230023d5aee35529ff8ab600f1d0ec3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250444
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-07-20 16:51:25 +00:00
Ian Hickson e2b2f56829 Be more explicit about when Futures are used
Closes https://github.com/dart-lang/sdk/pull/48561

GitOrigin-RevId: e8d67d3d54393aa9ddbb996458139b3e76e97450
Change-Id: Ic3fe09ff060f7ace55e08c416fbab925525b44d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237241
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-07-20 13:40:05 +00:00
Nicholas Shahan a9bcff7388 [ddc] Refactor typeName
Move the method body out of one giant JS foreign function and into
Dart code with small JS foreign function calls inside.

Issue: https://github.com/dart-lang/sdk/issues/46002
Change-Id: I978f752c8bb6f09ed3c2ca7d149561f488034509
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251851
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-07-19 19:19:24 +00:00
Ryan Macnak 9b6bda05ec [vm] Remove dead _localTimeZoneAdjustmentInSeconds.
Dead since 6af4987dc6.

TEST=ci
Change-Id: Ib92d2334dcc4c98e203628b4a8d244e6277b6b97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251841
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2022-07-19 17:29:04 +00:00
Aske Simon Christensen d8d9e06804 [dart2wasm] Support defining, exporting and accessing Wasm tables
Tested: Added tests/web/wasm/table_test.dart
Change-Id: I3971f4432a7a59bd6bc9874fc96202a7a9f2283d
Cq-Include-Trybots: luci.dart.try:dart2wasm-linux-x64-d8-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248586
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-07-19 13:06:54 +00:00
Michael Thomsen e15d639827 Remove deprecated APIs from dart:developer
Contributes to bug: https://github.com/dart-lang/sdk/issues/34233

Change-Id: I18f12b8c8da2ec444911128b96111e93df6c0496
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251767
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-07-19 07:10:03 +00:00
Brian Quinlan 981bcf61c9 Disallow invalid content-length.
Change-Id: I502c80f6d5914683622272cca37b5ba324f9262f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248840
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2022-07-19 00:44:33 +00:00
Alexander Markov 025bfc858e [vm] Fix yield in async* to check if the stream was canceled while generator was suspended
Previously there was a window between the decision to resume generator
and actually running the micro-task. The stream could be canceled
during that window, making running the generator incorrect.

The solution is to check if the stream was canceled right before
resuming the generator in yield/yield*.

This change also unifies yield and yield* to check if the stream
was canceled even before suspending the generator.

TEST=language/async_star/cancel_while_paused_test,
language/async_star/cancel_while_paused_at_yield_test

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

Change-Id: Ib8ff3a2da9a6a7da8766a7dbf28e2c9d618728f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251562
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-07-15 14:09:20 +00:00
Michael Debertol 357d4a556b Fix documentation of num.remainder
Closes https://github.com/dart-lang/sdk/pull/49378

GitOrigin-RevId: f668688317d9eac62b5e629c5a450be98c830959
Change-Id: I9381e3ec6ea10efdc1f7da4f59cf4b64a0908f73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250400
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-07-15 12:57:19 +00:00
Gary Qian 03e5f9f941 Revert "Reland "[vm] Generate event ids for synchronous begin and end events.""
This reverts commit 05e5664ad6.

Reason for revert: Blocking Flutter engine -> framework roll, https://github.com/flutter/flutter/pull/107653/checks?check_run_id=7341814911

Invalid argument(s): durations is empty!
package:flutter_driver/src/driver/timeline_summary.dart 414:7   TimelineSummary._averageInMillis
package:flutter_driver/src/driver/timeline_summary.dart 72:12   TimelineSummary.computeAverageFrameRasterizerTimeMillis
package:flutter_driver/src/driver/timeline_summary.dart 232:47  TimelineSummary.summaryJson


Original change's description:
> Reland "[vm] Generate event ids for synchronous begin and end events."
>
> TEST=Instruments
> Bug: https://github.com/dart-lang/sdk/issues/49178
> Change-Id: I5ecb76e468d32e120de338e802ec313a7f50a49c
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251144
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>

TBR=rmacnak@google.com,asiva@google.com

Change-Id: I52fffe00ec141a486241fa8719d4cf12df168384
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/49178
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251561
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2022-07-14 17:21:25 +00:00
Alexander Markov 2ad557a892 [vm] Cleanup more async-related code
This change continues cleanup of async implementation in the VM.

TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: Icdaeab18bcdc0d6974bc45841b630822cd1ac114
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251441
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-07-14 16:04:54 +00:00
Ryan Macnak 05e5664ad6 Reland "[vm] Generate event ids for synchronous begin and end events."
TEST=Instruments
Bug: https://github.com/dart-lang/sdk/issues/49178
Change-Id: I5ecb76e468d32e120de338e802ec313a7f50a49c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251144
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-07-13 21:59:33 +00:00
Ben Konyi a75e9cd3ee Revert "[pkg/native_stack_traces] Support Mach-O dSYM debugging information."
This reverts commit 08c13f173c.

Reason for revert: Causing failures on simarm, simarm64, etc

Original change's description:
> [pkg/native_stack_traces] Support Mach-O dSYM debugging information.
>
> TEST=vm/dart{,_2}/use_dwarf_stack_traces_flag
>
> Bug: https://github.com/dart-lang/sdk/issues/43612
> Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-mac-product-x64-try,pkg-mac-release-arm64-try,vm-kernel-mac-release-arm64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try
> Change-Id: Icda21bb14dcc0cf4784cea118e6ba7dd4edd35aa
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250381
> Commit-Queue: Tess Strickland <sstrickl@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: https://github.com/dart-lang/sdk/issues/43612
Change-Id: I020c29f7329e9b53a8fe0f4f4a4de4070fca0ec3
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-mac-product-x64-try,pkg-mac-release-arm64-try,vm-kernel-mac-release-arm64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251242
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-07-13 16:15:45 +00:00
Ahmed Ashour 99f0fb5b70 Fix typos
Fixes #49364

TEST=ci

Change-Id: Ic643819c9cdd7b56690981b96b854b1e8d622fff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250160
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-07-12 19:35:22 +00:00
Alexander Markov fb7b291886 [vm] Reduce number of callbacks used in sync* functions
This change introduces separate stubs for suspending sync* functions
at start and at yield/yield*. Suspend stub for yield/yield*
no longer calls Dart callback (in order to make it faster).

Also, ReturnSyncStar stub is removed - sync* functions now directly
return false instead of going through the stub.

TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: Iee9a1f48cab2812cf0f9f0e4e6d8e847547e49f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250420
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-07-12 19:30:12 +00:00
Alexander Markov 61caeca47a Reland "[vm] Cleanup old async/async*/sync* implementation from the VM"
This is a reland of commit bc8afad855

On top of the original commit, this change fixes incorrect
propagation of async/async*/sync* modifiers from a function to
its dynamic invocation forwarder.

TEST=ci, runtime/tests/vm/dart/regress_b_238653741_test.dart
Fixes b/238653741
Issue: https://github.com/dart-lang/sdk/issues/48378

Original change's description:
> [vm] Cleanup old async/async*/sync* implementation from the VM
>
> TEST=ci
>
> Issue: https://github.com/dart-lang/sdk/issues/48378
> Change-Id: I089ba4ed5613f30eec29f0db4ac6d5d8fbffd185
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249980
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

Change-Id: Iaad033d974a23fc6c5880a3d7f41818eb117f839
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251300
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-07-12 19:25:32 +00:00
Ben Konyi 4c263d3754 [ dart:developer ] Add deprecation message to MAX_USER_TAGS
Follow up to https://dart-review.googlesource.com/c/sdk/+/251120/

Change-Id: Ib7fa8d1ece6d3301489f70d58793b65e0c1cfe0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251240
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
2022-07-12 15:40:12 +00:00
Tess Strickland 08c13f173c [pkg/native_stack_traces] Support Mach-O dSYM debugging information.
TEST=vm/dart{,_2}/use_dwarf_stack_traces_flag

Bug: https://github.com/dart-lang/sdk/issues/43612
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-mac-product-x64-try,pkg-mac-release-arm64-try,vm-kernel-mac-release-arm64-try,vm-kernel-precomp-nnbd-mac-release-arm64-try
Change-Id: Icda21bb14dcc0cf4784cea118e6ba7dd4edd35aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250381
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-07-12 11:10:02 +00:00
Alexander Markov 2f17c118b5 Revert "[vm] Cleanup old async/async*/sync* implementation from the VM"
This reverts commit bc8afad855.

Reason for revert: b/238653741

Original change's description:
> [vm] Cleanup old async/async*/sync* implementation from the VM
>
> TEST=ci
>
> Issue: https://github.com/dart-lang/sdk/issues/48378
> Change-Id: I089ba4ed5613f30eec29f0db4ac6d5d8fbffd185
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249980
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

TBR=vegorov@google.com,kustermann@google.com,alexmarkov@google.com

Change-Id: I6437d2d7d3914eb7fb9fe397472e2a5f7ae0cd9e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Issue: https://github.com/dart-lang/sdk/issues/48378
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251147
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2022-07-11 21:09:52 +00:00
Ben Konyi 4e75f872a8 [ dart:developer ] Minor cleanup, deprecate MAX_USER_TAGS
Change-Id: I11d087bea7be9c7ceedc8a0aec8bc061a99b63e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251120
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-07-11 19:47:01 +00:00
Alexander Markov bc8afad855 [vm] Cleanup old async/async*/sync* implementation from the VM
TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: I089ba4ed5613f30eec29f0db4ac6d5d8fbffd185
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249980
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-07-11 18:46:41 +00:00
Ben Konyi bf19cfc8fe [ dart:developer ] Expose the set of currently registered Metrics
Fixes https://github.com/dart-lang/sdk/issues/49062

Change-Id: I2e12dd51c7e43c3cd33d7ad6716849a010ec57d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251121
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-07-11 15:52:18 +00:00
asiva 08d2a29233 [io] Remove call to FATAL on a socket error event with no error
Remove call to FATAL on a socket error event when we get back a null
error from the call to getsockopt with SO_ERROR, instead we just close
the socket.
(Should address the increased crash reports that apps are seeing after the FATAL call was added to see if we could get a stack trace when this condition happens).

TEST=ci
Change-Id: I39a399a7f60b218c665d30d6c43e7c18173c0e80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250346
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2022-07-07 00:03:44 +00:00
Daco Harkes 1c7a7d0c41 [vm/ffi] Fix reference in comment
The comment was referencing a non-existent function.

TEST=just a comment update

Change-Id: I516debc58addb42d80775223625b0b2088c230d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250740
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-07-06 12:22:50 +00:00
Janice Collins 822cd1cbd5 Remove dartanalyzer from built SDK.
Bug: https://github.com/dart-lang/sdk/issues/48457
Change-Id: Ic0d038299712989b8445859590ff870ce3bdc13a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249662
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-07-01 17:43:20 +00:00
Zach Anderson d7df61e042 Revert "[vm] Generate event ids for synchronous begin and end events."
This reverts commit 7fe44864d6.

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

Original change's description:
> [vm] Generate event ids for synchronous begin and end events.
>
> os_signposts needs explicit ids to match begin and end events, whereas all other trace systems do this implicitly.
>
> TEST=Instruments
> Bug: https://github.com/dart-lang/sdk/issues/49178
> Change-Id: Ifeeaa1dfe823a0d5668f48b8c584f8bdeef23212
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249951
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

TBR=rmacnak@google.com,asiva@google.com

Change-Id: Id86959d08b5352b5446b6f294a8302b88b4fa0c8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/49178
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250403
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2022-07-01 16:08:40 +00:00
Alexander Markov abedfaf62a [vm] Fix soundness issue when awaiting a user-defined Future
TEST=language/async/await_user_defined_future_soundness_test

Issue: https://github.com/dart-lang/sdk/issues/49345
Change-Id: Ieaaa9baace13dad242c770a710d4d459e135af81
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250222
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-06-30 22:53:24 +00:00
Ryan Macnak 7fe44864d6 [vm] Generate event ids for synchronous begin and end events.
os_signposts needs explicit ids to match begin and end events, whereas all other trace systems do this implicitly.

TEST=Instruments
Bug: https://github.com/dart-lang/sdk/issues/49178
Change-Id: Ifeeaa1dfe823a0d5668f48b8c584f8bdeef23212
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249951
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-06-30 16:48:36 +00:00
Alexander Aprelev f51149eba3 [embedder] Clean up deprecated secure connection enforcement mechanism.
Addresses https://github.com/flutter/flutter/issues/54448
TEST=ci, flutter

Change-Id: If1ea8044cdfa8d593e0cd5b5201c2fbe71dd08ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248220
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
2022-06-29 16:59:25 +00:00
Daco Harkes a37502c1b8 [misc] Cleanup stale todos
TEST=tests/ffi

Change-Id: Iae97f62b1adb8dbe99ad075dfe750604db0de62c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249301
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2022-06-28 16:02:53 +00:00
Srujan Gaddam fe93b161e0 [dart:html] Add MathMLElement
Fixes b/236721367

Per https://developer.mozilla.org/en-US/docs/Web/API/MathMLElement,
MathMLElement is in the Element type hierarchy. This adds an empty
class so that type-checking against Element can pass.

Change-Id: Ie0c2e33c2236bedd5627ed8624437d24d9fbac2d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249945
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-06-27 23:10:12 +00:00
Alexander Markov 77ea9820aa [vm] New implementation of sync* based on suspend/resume stubs
Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: I7f4b6b56d914a617dfd7ac724cd4414532073b4c
TEST=ci
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249141
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-06-27 18:19:12 +00:00
Joshua Litt 51e38cb554 [dart2wasm] Correctly generate type arguments for InterfaceType.
Change-Id: I8b6429827e691f09875df90ea32ba91021ab2418
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245286
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-06-24 20:07:20 +00:00
Lasse R.H. Nielsen a08a5c5d6c Deprecate BidirectionalIterator.
There is only one use of it in the SDK, `RuneIterator`,
one use of it outside, `TreeSet` from `package:quiver`,
and one known use in Google internal code.

There are other bi-directional iteration interfaces,
like `CharacterRange` from `package:characters`,
which can move a cursor in two directions,
but which didn't loke the `movePrevious` name and therefore
are not `BidirectionalIterator`s.
(There is also a Google internal class which mentions explicitly
why they're not `BidirectionalIterator`.)

There is no real need for this "shared" interface.
It doesn't carry its own weight.
We have no abstractions which work on the *interface*,
only code that works on one specific concrete implementation.

I'd recommend:
* `quiver` introduce a `TreeSetIterator` for their use-case
  (the actual class has more public members than `BidirectionalIterator`,
  which cannot be accessed through the declared type.)
* the Google internal code introduces its own interface
  (which is just `Iterable` + `movePrevious`.
* The SDK will just make `RuneIterator` not implement
  `BidirectionalIterator` at some (breaking) point.
  Maybe just when we remove the type.


FLUTTER: Needs to land https://github.com/flutter/flutter/pull/106471 before merging this CL into Flutter.

Change-Id: Iaaa6b0c428d30eb3b68898c077d265ac0a622805
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249486
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-06-24 14:21:29 +00:00
Emmanuel Pellereau fd590c54c2 Revert "Make nullFuture be per-zone."
This reverts commit c97f7b7fad.

Reason for revert: Still breaking google3 (b/236665701)

Original change's description:
> Make `nullFuture` be per-zone.
>
> We introduced a `nullFuture` during the null-safety migration where
> we changed some methods to no longer allow returning `null`,
> and they therefore had to return a `Future`.
> That affected timing, because returning `null` was processed
> synchronously, and that change in timing made some tests fail.
> Rather that fix the fragile tests, we made the function return
> a recognizable future, a canonical `Future<Null>.value(null)`,
> and then recognized it and took a synchronous path for it.
>
> That caused other issues, because the future was created in the
> root zone. (Well, originally, it was created in the first zone
> which needed one, that was worse. Now it's created in the root zone.)
> Some code tries to contain asynchrony inside a custom zone, and
> then the get a `nullFuture` and calls `then` on it, and that
> schedules a microtask in the root zone.
> (It should probably have used the listener's zone, and not store
> a zone in the future at all, but that's how it was first done,
> and now people rely on that behavior too.)
>
> This change creates a `null` future *per zone* (lazily initialized
> when asked for). That should be sufficient because the code recognizing
> a returned `null` future is generally running in the same zone,
> but if any other code gets the `nullFuture`, it will be in the
> expected zone for where it was requested.
>
> This is a reland of commit a247b158d6
>
> Change-Id: Ieec74d6f93c57175c357ec18889144635f5bdca6
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249490
> Commit-Queue: Lasse Nielsen <lrn@google.com>
> Reviewed-by: Erik Ernst <eernst@google.com>

TBR=lrn@google.com,eernst@google.com,nbosch@google.com

Change-Id: I870285b03ec05803c5aaa6b66f9a6e6ea360d732
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249609
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Emmanuel Pellereau <emmanuelp@google.com>
Reviewed-by: Emmanuel Pellereau <emmanuelp@google.com>
2022-06-24 14:13:39 +00:00
Lasse R.H. Nielsen c97f7b7fad Make nullFuture be per-zone.
We introduced a `nullFuture` during the null-safety migration where
we changed some methods to no longer allow returning `null`,
and they therefore had to return a `Future`.
That affected timing, because returning `null` was processed
synchronously, and that change in timing made some tests fail.
Rather that fix the fragile tests, we made the function return
a recognizable future, a canonical `Future<Null>.value(null)`,
and then recognized it and took a synchronous path for it.

That caused other issues, because the future was created in the
root zone. (Well, originally, it was created in the first zone
which needed one, that was worse. Now it's created in the root zone.)
Some code tries to contain asynchrony inside a custom zone, and
then the get a `nullFuture` and calls `then` on it, and that
schedules a microtask in the root zone.
(It should probably have used the listener's zone, and not store
a zone in the future at all, but that's how it was first done,
and now people rely on that behavior too.)

This change creates a `null` future *per zone* (lazily initialized
when asked for). That should be sufficient because the code recognizing
a returned `null` future is generally running in the same zone,
but if any other code gets the `nullFuture`, it will be in the
expected zone for where it was requested.

This is a reland of commit a247b158d6

Change-Id: Ieec74d6f93c57175c357ec18889144635f5bdca6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249490
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2022-06-24 11:32:30 +00:00
Emmanuel Pellereau d9d7d30820 Revert "Make nullFuture be per-zone."
This reverts commit 4d750a862d.

Reason for revert: breaks google3 (b/236665701)

Original change's description:
> Make `nullFuture` be per-zone.
>
> We introduced a `nullFuture` during the null-safety migration where
> we changed some methods to no longer allow returning `null`,
> and they therefore had to return a `Future`.
> That affected timing, because returning `null` was processed
> synchronously, and that change in timing made some tests fail.
> Rather that fix the fragile tests, we made the function return
> a recognizable future, a canonical `Future<Null>.value(null)`,
> and then recognized it and took a synchronous path for it.
>
> That caused other issues, because the future was created in the
> root zone. (Well, originally, it was created in the first zone
> which needed one, that was worse. Now it's created in the root zone.)
> Some code tries to contain asynchrony inside a custom zone, and
> then the get a `nullFuture` and calls `then` on it, and that
> schedules a microtask in the root zone.
> (It should probably have used the listener's zone, and not store
> a zone in the future at all, but that's how it was first done,
> and now people rely on that behavior too.)
>
> This change creates a `null` future *per zone* (lazily initialized
> when asked for). That should be sufficient because the code recognizing
> a returned `null` future is generally running in the same zone,
> but if any other code gets the `nullFuture`, it will be in the
> expected zone for where it was requested.
>
> This is a reland of commit a247b158d6
>
> Change-Id: Ia113756de1f6d50af4b1abfec219d6b4dcd5d59b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249488
> Reviewed-by: Nate Bosch <nbosch@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>

TBR=lrn@google.com,nbosch@google.com

Change-Id: I02d62d58bae33d6a606a80eb3eee2e8e721a8e20
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249620
Commit-Queue: Emmanuel Pellereau <emmanuelp@google.com>
Reviewed-by: Emmanuel Pellereau <emmanuelp@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2022-06-24 06:48:49 +00:00
Devon Carew 93951169ba [pkg/js_shared] address a few analysis issues
Change-Id: I9ce9c66fa24bf58172b0fb2545c8bd745bc2fe68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249549
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-06-23 23:34:18 +00:00
Lasse R.H. Nielsen 4d750a862d Make nullFuture be per-zone.
We introduced a `nullFuture` during the null-safety migration where
we changed some methods to no longer allow returning `null`,
and they therefore had to return a `Future`.
That affected timing, because returning `null` was processed
synchronously, and that change in timing made some tests fail.
Rather that fix the fragile tests, we made the function return
a recognizable future, a canonical `Future<Null>.value(null)`,
and then recognized it and took a synchronous path for it.

That caused other issues, because the future was created in the
root zone. (Well, originally, it was created in the first zone
which needed one, that was worse. Now it's created in the root zone.)
Some code tries to contain asynchrony inside a custom zone, and
then the get a `nullFuture` and calls `then` on it, and that
schedules a microtask in the root zone.
(It should probably have used the listener's zone, and not store
a zone in the future at all, but that's how it was first done,
and now people rely on that behavior too.)

This change creates a `null` future *per zone* (lazily initialized
when asked for). That should be sufficient because the code recognizing
a returned `null` future is generally running in the same zone,
but if any other code gets the `nullFuture`, it will be in the
expected zone for where it was requested.

This is a reland of commit a247b158d6

Change-Id: Ia113756de1f6d50af4b1abfec219d6b4dcd5d59b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249488
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-06-23 09:19:45 +00:00
Emmanuel Pellereau 707ade91c9 Revert "Make nullFuture be per-zone."
This reverts commit a247b158d6.

Reason for revert: breaks google3. See b/236665701.

Original change's description:
> Make `nullFuture` be per-zone.
>
> We introduced a `nullFuture` during the null-safety migration where
> we changed some methods to no longer allow returning `null`,
> and they therefore had to return a `Future`.
> That affected timing, because returning `null` was processed
> synchronously, and that change in timing made some tests fail.
> Rather that fix the fragile tests, we made the function return
> a recognizable future, a canonical `Future<Null>.value(null)`,
> and then recognized it and took a synchronous path for it.
>
> That caused other issues, because the future was created in the
> root zone. (Well, originally, it was created in the first zone
> which needed one, that was worse. Now it's created in the root zone.)
> Some code tries to contain asynchrony inside a custom zone, and
> then the get a `nullFuture` and calls `then` on it, and that
> schedules a microtask in the root zone.
> (It should probably have used the listener's zone, and not store
> a zone in the future at all, but that's how it was first done,
> and now people rely on that behavior too.)
>
> This change creates a `null` future *per zone* (lazily initialized
> when asked for). That should be sufficient because the code recognizing
> a returned `null` future is generally running in the same zone,
> but if any other code gets the `nullFuture`, it will be in the
> expected zone for where it was requested.
>
> Change-Id: Ibe204eaabe175cbcbcb7822ca1f2bcdda72a478c
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248660
> Reviewed-by: Nate Bosch <nbosch@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>

TBR=lrn@google.com,nbosch@google.com

Change-Id: Ic765eb1401dbff4dea6c08c007c0bf9aff186684
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249188
Reviewed-by: Oleh Prypin <oprypin@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Emmanuel Pellereau <emmanuelp@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Emmanuel Pellereau <emmanuelp@google.com>
2022-06-21 07:33:23 +00:00
Lasse R.H. Nielsen a247b158d6 Make nullFuture be per-zone.
We introduced a `nullFuture` during the null-safety migration where
we changed some methods to no longer allow returning `null`,
and they therefore had to return a `Future`.
That affected timing, because returning `null` was processed
synchronously, and that change in timing made some tests fail.
Rather that fix the fragile tests, we made the function return
a recognizable future, a canonical `Future<Null>.value(null)`,
and then recognized it and took a synchronous path for it.

That caused other issues, because the future was created in the
root zone. (Well, originally, it was created in the first zone
which needed one, that was worse. Now it's created in the root zone.)
Some code tries to contain asynchrony inside a custom zone, and
then the get a `nullFuture` and calls `then` on it, and that
schedules a microtask in the root zone.
(It should probably have used the listener's zone, and not store
a zone in the future at all, but that's how it was first done,
and now people rely on that behavior too.)

This change creates a `null` future *per zone* (lazily initialized
when asked for). That should be sufficient because the code recognizing
a returned `null` future is generally running in the same zone,
but if any other code gets the `nullFuture`, it will be in the
expected zone for where it was requested.

Change-Id: Ibe204eaabe175cbcbcb7822ca1f2bcdda72a478c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248660
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-06-20 08:00:01 +00:00
Stephen Adams 6dd17d6ec4 [runtime] Avoid SIGSEGV on String.*
Correctness changes:

Fix SEGV by checking for overflow in computing the length of the
repeated string.

Performance changes:

Use unnested loops to fill the string instead of nested loops.

Implement `operator *` for _TwoByteString in the same way.

(The default implementation using StringBuffer causes a lot of
allocations. For example, `"α" * 10000` repeatedly adds the small
string to the StringBuffer, which repeatedly compresses a sequence of
small strings to make a bigger string to stop the list of parts
becoming too large. This compression creates a lot of small strings
with the same contents.)

Bug: 49289
Change-Id: I06c3d91b531d7e4fffc8de9f3bada3eb62ad185f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249122
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-06-19 17:02:41 +00:00
Martin Kustermann 4703d2c54e [vm] Make _CastError.{_url,_line,_column} nullable fields
The ! operator causes _CastErrors to be thrown without the
_CastError.{_url,_line,_column} fields to be set (see
runtime/vm/runtime_entry.cc:NullErrorHelper).

This CL makes the fields nullable. An alternative would be to remove the
fields entirely since the fields are not used and the position of the
failed null check is visible from top frame in the stack frame as well.

Though the fields are visible in the debugger and there are other
situations where they are correctly set (e.g. in type errors that cause
_CastError to be thrown). To avoid changing this behavior, we make them
nullable.

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

TEST=vm/dart{,_2}/regress_49279_test

Change-Id: Ieff9e84819d5afa83c8950ad1f99d684d184340a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248980
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2022-06-17 10:39:28 +00:00
Daco Harkes 2b700003d9 Reland "[vm] Only call .hashCode once when adding to Map and Set"
Relanding after https://dart-review.googlesource.com/c/sdk/+/244200.

Original change's description:
> [vm] Only call `.hashCode` once when adding to `Map` and `Set`
>
> The methods to add to hash maps and hash sets are recursive: if the
> index needs to be rehashed then the same method is called again
> after rehashing.
>
> This CL nests the actual implementation in a private method that takes
> the full hashCode as an extra argument.
>
> No significant code size or run time changes are reported on our
> benchmarks. (Our benchmarks do not contain purposefully slow hashCodes.)
>
> Note that hashCode can be called again later if rehashing of the index
> is required on adding subsequent elements.
>
> Bug: https://github.com/dart-lang/sdk/issues/48948
> Change-Id: Ia3ccff9e592d675b4922ac78c4aa7ee0287ecb50
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243623
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Daco Harkes <dacoharkes@google.com>


Change-Id: I033bd7cc29fc812dccb6dccf0c3dca6e22cae2ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248802
Commit-Queue: Tess Strickland <sstrickl@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2022-06-17 10:05:18 +00:00
Ahmed Ashour b91256e78a [dart:math] fix documentation about Random()
Fixes #49263

Change-Id: I6c81d3ae65993d9ba3bcb2cd7b66a62ddffd2952
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248900
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-06-16 23:00:09 +00:00
Joshua Litt 05dfe9047d [dart2wasm] Build type rules for interface type arguments.
Change-Id: I4017d14ff9b32b2a556592f5074cdd3401c7d961
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243960
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-06-16 18:50:59 +00:00
Alexander Aprelev 6d923dfd99 Revert "Deprecate outdated errors, drop CastError and NullThrownError."
This reverts commit 0f3dea33f9.

Reason for revert: breaks dart->engine roller as flutter still uses NullThrownError, fails analysis step

Original change's description:
> Deprecate outdated errors, drop `CastError` and `NullThrownError`.
>
> Both `CastError` and `NullThrownError` becomes just (deprecated) aliases for `TypeError`.
>
> `FallThroughError` becomes deprecated. Fall-through was made a compile-time error in Dart 2.0, the error should no longer be used.
>
> `CyclicInitializationError` is deprecated. Null safe Dart doesn't specify which error a late initialization error throws. We use internal errors now.
>
> These errors should not be needed in sound null-safe mode (if they are even needed now), and so should be removed in Dart 3.0.
>
> TEST= No new tests, should not change behavior in a significant way.
>
> Bug: https://github.com/dart-lang/sdk/issues/49141
> Change-Id: I636e9a0d0c32021d40bb819a88a1f57db6efc5a9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247384
> Reviewed-by: Nate Bosch <nbosch@google.com>
> Reviewed-by: Brian Quinlan <bquinlan@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: https://github.com/dart-lang/sdk/issues/49141
Change-Id: I1b2802ec69fe654525e683527ff3554ff972f0c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248741
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-06-16 17:12:19 +00:00
Lasse R.H. Nielsen 330759efc0 Refactor to implement Stream.fromIterator more directly.
The current implementation uses a specialized version of the
pending-event queue used by stream subscriptions to remember
pending events.
That makes the queue polymorphic, and slightly more complicated than
necessary, and that again makes further refactorings of the
Stream implementation harder.

This change moves the logic from the specialized pending-queue
into a simple function instead, so you only pay for it if you
actually use `Stream.fromIterable`.

Also allows `Stream.fromIterable` to be listened to more than once.
(It uses `Stream.multi` for the general async+sync controller API,
and it would cost extra code to make it only work once.)

Change-Id: I44b2010225cd3d32c2bcdb8a315c94881331bdae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248146
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-06-16 11:39:30 +00:00