Commit graph

10579 commits

Author SHA1 Message Date
Ahmed Ashour be5fe7bfe8 [core] Better variable name in dartdoc
Fixes #50180

Change-Id: I47157b50b45af7b54eca1013109f90ff1bab6b35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/263621
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-10-12 09:00:33 +00:00
Kallen Tu 446ee14abf Cast sockets that set _owner and read closedReadEventSent of _NativeSocket
Change-Id: I0d3b24f503dcb167dd039e47228a665ca3d38453
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262272
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-10-11 13:12:33 +00:00
Alexander Markov cf111fdcfb [vm,corelib] Restrict Expando/WeakReference usage for records
From records specification:
```
Like numbers, records do not have a well-defined persistent identity.
That means Expandos can not be attached to them.
```

This change updates Expando and WeakReference API documentation
and adds a check to disallow attaching Expando or WeakReference
to a record.

TEST=co19/LanguageFeatures/Records/expandos_A01_t01

Issue: https://github.com/dart-lang/sdk/issues/49719
Change-Id: I6459f43a2deac697e201673589d73abedc8d413e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/263420
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2022-10-10 16:10:28 +00:00
Ömer Sinan Ağacan 651d566124 [vm] Remove old TODO
The issue in TODO was closed: #48634

Change-Id: Ie4610a04e29aac64a447514cd6be463419f5e64b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/263381
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2022-10-10 10:42:54 +00:00
Kallen Tu 7e1890d78b Revert "Cast errors to HttpExceptions and add lint to convert to tidy up dynamic calls in core libraries."
This reverts commit 5b7bd563d3.

Reason for revert: Broke VM tests, not always HttpException.

Original change's description:
> 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>

TBR=lrn@google.com,leafp@google.com,kallentu@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I1777750c07b84b267d0b62dbfe93d54a6bfee7ae
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/263180
Reviewed-by: Leaf Petersen <leafp@google.com>
2022-10-07 20:11:57 +00:00
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