Commit graph

9969 commits

Author SHA1 Message Date
Daco Harkes ac2412ca01 Revert "[vm/ffi] Disallow Pointers and structs in finalizers and expandos"
This reverts commit 2376ab5186.

Reason for revert: Importing dart:ffi from dart:core breaks the VM when using --enable-ffi=false

Original change's description:
> [vm/ffi] Disallow `Pointer`s and structs in finalizers and expandos
>
> `Dart_NewWeakPersistentHandle` and `Dart_NewFinalizableHandle` in
> `dart_api.h` do no longer accept `Pointer`s and subtypes of `Struct`s
> as values passed in to the `object` parameter.
>
> Expandos no longer accept `Pointer`s and subtypes of `Struct`s
> as values passed in to the `object` parameter.
>
> Cleans up unused object_store->ffi_struct_class.
>
> Closes: https://github.com/dart-lang/sdk/issues/45071
> Breaking change: https://github.com/dart-lang/sdk/issues/45072
>
> TEST=vm/cc/DartAPI_FinalizableHandleErrors
> TEST=vm/cc/DartAPI_WeakPersistentHandleErrors
> TEST=tests/ffi(_2)/expando_test.dart
>
> Change-Id: I1f11adfa073c7d2c979f3c2bb15c7444c7c767a0
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186280
> Commit-Queue: Daco Harkes <dacoharkes@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>

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

Change-Id: Ib76d27e59391dc6107d3f8e8fba3d67640ea9a5c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195060
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-04-12 16:30:57 +00:00
Daco Harkes 2376ab5186 [vm/ffi] Disallow Pointers and structs in finalizers and expandos
`Dart_NewWeakPersistentHandle` and `Dart_NewFinalizableHandle` in
`dart_api.h` do no longer accept `Pointer`s and subtypes of `Struct`s
as values passed in to the `object` parameter.

Expandos no longer accept `Pointer`s and subtypes of `Struct`s
as values passed in to the `object` parameter.

Cleans up unused object_store->ffi_struct_class.

Closes: https://github.com/dart-lang/sdk/issues/45071
Breaking change: https://github.com/dart-lang/sdk/issues/45072

TEST=vm/cc/DartAPI_FinalizableHandleErrors
TEST=vm/cc/DartAPI_WeakPersistentHandleErrors
TEST=tests/ffi(_2)/expando_test.dart

Change-Id: I1f11adfa073c7d2c979f3c2bb15c7444c7c767a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186280
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-04-12 14:04:16 +00:00
Nicholas Shahan 4e25e499c8 [ddc] Add library URIs to cast failure messages
When the two types have the same name but are from different libraries
showing the library URI will help users understand the failure better.

Change-Id: I5ab4412e676272111d41f688ef2d1cc83afbe627
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194116
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-04-09 22:24:43 +00:00
Srujan Gaddam bd58cea90b [dart:html] Fix getContext3d nullability
Closes https://github.com/dart-lang/sdk/issues/45572

getContext3d should return a nullable value since getContext can
return a nullable.

Change-Id: Iaefff781976656db3765d526ec95305f2acfeecf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194503
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2021-04-09 19:03:43 +00:00
Daco Harkes 189c36b82a [vm] Native effects
Adds a way to express native effects in Dart expressions in kernel.

This CL adds a `void _nativeEffect(Object)` to `dart:internal`.
The semantics of `_nativeEffect` are to not execute its arguments and
return `null`.

This CL uses this `_nativeEffect` to make sure that we never execute
the struct constructor invocations used to simulate the native behavior
of FFI trampolines.

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

TEST=tests/ffi(_2)/native_effect_test.dart

Change-Id: Ie06de145e49f8b1cae9e148c2d5d97d5cd8e6878
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm64-try,vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,dart-sdk-linux-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194421
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-04-09 16:45:13 +00:00
Ryan Macnak 1d369b5000 [vm, compiler] Support unboxed parameters for integer intrinsics.
TEST=ci
Change-Id: I7f29471043c049ef1acf7cd4bcb0890db6d33aa4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192728
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-04-09 00:30:10 +00:00
Lasse R.H. Nielsen 6af4987dc6 Change VM DateTime to-local-time computation to not fail for <1h changes.
The DateTime conversion to local time amounts to solving an
equation, finding an offset where the current local time is that offset.

The current approach doesn't actually do that, it just tries to simulate
the JS approach, with a tweak to avoid DST change issues, but that tweak
assumes that all time zone adjustments are one hour changes.

This CL should work correctly for time zone changes of up to one hour,
but might still fail for changes of more than one hour.
It works by trying more offsets, which obviously has a performance cost,
which depends on how efficient the operation system is at providing
the local time zone for a specific milliseconds-since-epoch.

Change-Id: I80dc6e62e0639d9966d3c5a06430787d8acc4ff1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182041
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-04-08 16:51:00 +00:00
Ben Konyi d18d3d837f [ dart:developer ] Add serverWebSocketUri to ServiceProtocolInfo
Adds a convenience getter to ServiceProtocolInfo which transforms the VM
Service HTTP URI into a valid web socket URI that can be used to connect
to the VM service.

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

TEST=runtime/observatory/tests/service/developer_server_control_test.dart

Change-Id: Ib15de1f1a9b26ac5cf45f55a53014761a6fa7900
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194209
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2021-04-07 20:02:17 +00:00
Mayank Patke c089922d2a Reland "[dart2js] Implement Cell abstraction for late lowering."
This is a reland of b647020318

Original change's description:
> [dart2js] Implement Cell abstraction for late lowering.
>
> Change-Id: Ib5fe8ed8e43513283a4e05f216e068241e8d63da
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193587
> Commit-Queue: Mayank Patke <fishythefish@google.com>
> Reviewed-by: Stephen Adams <sra@google.com>

Change-Id: I75501a556819463dab09842be11790b5f4ef1c7b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193890
Reviewed-by: Mayank Patke <fishythefish@google.com>
2021-04-07 19:43:07 +00:00
Lasse Reichstein Holst Nielsen 4b59bf54b2 Fix bug introduced in refactoring.
A constant was renamed to conform to the style guide, and that made it
have the same name as a local variable, and it was shadowed inside that function.

Rename another constant while we're here.

Fixes #45432.

Bug: http://dartbug.com/45432
Change-Id: Ie7e83bb77fea25a93a006bde78431ec35007a82a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192920
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-04-07 11:33:07 +00:00
Daco Harkes d27f166b75 [vm/ffi] Tree shaking of Struct sub classes
This CL enables tree shaking of `Struct` sub classes by simulating the
native behavior in Dart code.

We call the struct constructors in let expressions where FFI trampolines
are created which allocate these struct objects in native code. This way
TFA is instructed about the native behavior. The VM recognizes these
constructor calls as dead code and removes them.

For more info see go/dart-ffi-struct-treeshaking.

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

This CL fixes the types on the generated #fromTypedDataBase constructors.

Also, this CL also cleans up the struct naming:
* _addressOf   -> _typedDataBase
* _fromPointer -> _fromTypedDataBase
* #pointer     -> #typedDataBase

These cleanups are not split into a separate CL to prevent updating
the .expect files multiple times.

Finally, this CL enables running a single transformer test through:
`dart pkg/vm/test/transformations/type_flow/transformer_test.dart name`

TEST=pkg/vm/testcases/transformations/type_flow/transformer/ffi_struct_constructors.dart
TEST=tests/ffi(_2)/function_callbacks_structs_by_value_generated_test.dart
TEST=tests/ffi(_2)/function_structs_by_value_generated_test.dart

Change-Id: I418d0d73bc86b234dfe5b7b04ae726c33d2b8aeb
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm64-try,vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-precomp-dwarf-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,dart-sdk-linux-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193661
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-04-07 11:02:27 +00:00
Jonas Finnemann Jensen 9558ac12bb Migrate InternetAddressType.ANY -> InternetAddressType.any
In documentation comment for `InternetAddress.lookup`.
This should make API docs a little bit prettier.

Change-Id: Ie969756a54e13b2efbef17a1a78fa0ffb8670dec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194063
Auto-Submit: Jonas Jensen <jonasfj@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
2021-04-06 16:12:17 +00:00
Stephen Adams 0087b0538b Revert "[dart2js] Implement Cell abstraction for late lowering."
This reverts commit b647020318.

Reason: test failures.
Change-Id: I1c4987ede89bebfcc5f14273f0bfbaf809507a43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193883
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-04-02 16:59:31 +00:00
Mayank Patke b647020318 [dart2js] Implement Cell abstraction for late lowering.
Change-Id: Ib5fe8ed8e43513283a4e05f216e068241e8d63da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193587
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-04-01 23:57:27 +00:00
Liam Appelbe 6b42491dcf [wasm] Remove deprecated dart_enable_wasm flag.
Change-Id: I37f326a30de20a895159f5b57a772cd808aa53d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193826
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2021-04-01 22:45:07 +00:00
Alexander Aprelev e190a85f49 [io/socket] Handle OSError returned by Socket_GetPort.
Dart code did not expect OSError as a return value from Socket_GetPort.
This CL ensures that Dart code handles OSError in addition to int gracefully as a result of Socket_GetPort call.

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

TEST=run dart ci socket tests on mac with transparent proxy running

Change-Id: I198d99107729ccefecd9a16b71474ccdbfc0039b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193221
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-04-01 18:04:12 +00:00
Alexander Aprelev bddded13aa [io/lookup] Ensure public type InternetAddress is used in lookup methods.
Use of private _InternetAddress class in method declarations results
in errors when user attempts to for example provide timeout handler.

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

Change-Id: Ied83479d7ce6319d0a82985c667ad29ef58cf6de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193720
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-03-31 19:43:42 +00:00
Devon Carew 1ba371139e Address a todo: related to the fix_data.yaml format docs.
Change-Id: I2ce20c975ceaa4f0dc94bf288387426fbb99c611
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193580
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-03-31 00:47:57 +00:00
Daco Harkes 9dd716a9ea [vm/ffi] Update DynamicLibrary documentation
Improves documentation on `DynamicLibrary`.

Doesn't change `DynamicLibrary.open` from a factory to a static method
yet. Because it's a breaking change, see issue.

Bug: https://github.com/dart-lang/sdk/issues/44849
Closes: https://github.com/dart-lang/sdk/issues/45294

TEST=tests/ffi/vmspecific_dynamic_library_test.dart

Change-Id: Id989e6d4397cb1378ef842bde0f64fc19f3275ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182626
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2021-03-30 08:34:48 +00:00
Daco Harkes 4ba4fd3f1d [analyzer/ffi] Inline array annotation const dimensions
Moves the Array forwarding constructors and _ArraySize class out of
the patch files so that the analyzer can reason about them.
(The analyzer does not include patch files, because it does not know
whether it's analyzing for VM or JS backend.)

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

Change-Id: Ia0eb4bbca40b906a1e636714f53c5c73dcfc3cad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193403
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-03-30 00:28:57 +00:00
Daco Harkes 38d5c5e444 [vm/ffi] Array range error message
Closes: https://github.com/dart-lang/sdk/issues/45189

Change-Id: I225a092fd05efe8a6eed7749375ea4c842547fb7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193404
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2021-03-30 00:12:49 +00:00
Ryan Macnak 6a6e08b784 Reapply "[vm, compiler] Convert binary Smi ops to graph intrinsics."
Explicitly disable unboxed parameters for these functions, previously implicitly disabled by virtue of being ASM intrinsics.

TEST=ci
Change-Id: Ic810bb8400e081c5f99a49b5035031bc9edc4bf5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192044
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-03-25 21:54:44 +00:00
Stephen Adams a1db3de44a [dart2js] Accept >>> as a symbol name
Makes language/operator/operator_triple_shift_test pass and
corelib_2/symbol_operator_test/03 fail like all the other configurations.

Change-Id: I06c0fba62dc5407a9787e6216d50acfe8da053c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193080
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-03-25 21:52:14 +00:00
Srujan Gaddam 6929718456 [pkg:js] Handle null value in promise rejection
Closes https://github.com/dart-lang/sdk/issues/44602

Creates an exception to signal a `null`/`undefined` value when a
converted promise is rejected with `null`/`undefined`.

Change-Id: Ic7f14e23c6c1d51d6dbcc5831ffa8491418a4267
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192046
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-03-25 01:30:23 +00:00
Ben Konyi c4bfca9b6a [ dart:io / package:vm_service ] Add HTTP request profiling service
extensions

This change adds HTTP request profiling support to the dart:io service
extensions and removes HTTP request/response body logging to the
timeline due to memory constraints.

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

TEST=pkg/vm_service/test/get_http_profile_test.dart

Change-Id: I85642296c3d6595197f3365022477c7685c452bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189881
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Kenzie Schmoll <kenzieschmoll@google.com>
2021-03-24 23:01:03 +00:00
Nate Bosch 0c258ed081 Fix typo memthod -> method
Fixes https://github.com/dart-lang/language/issues/1545

Change-Id: I8970f29c7e0557143714920d354f2d0d39fad3bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192942
Auto-Submit: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2021-03-24 22:54:53 +00:00
Ryan Macnak 5bfb36daa3 [vm, compiler] Use leaf calls for exp and log.
We already do this for the other functions in dart:math.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/45414
Change-Id: Ic1fb1c7cdbbf39eaa4af645219874408988b740b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192522
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-03-22 23:14:25 +00:00
Lasse Reichstein Holst Nielsen 7f2b875b4a Add efficient entries and keys.contains to SplayTreeMap.
Update some other methods to be more performant than the default
inherited from `MapMixin`.
Change argument validation to `map.[]=`, `map.putIfAbsent` and `set.add`
checks that the key/element is allowed by the `compare` function.
Previously the map methods just checked `key != null` (which was wrong),
and compare did nothing special, both just relied on the `splay` call
doing a `compare` call. That was not true for an empty map, which means
that you could add a key/element which wasn't a valid comparable,
as long as you did it as the *first* key/element.
That is now caught.


Bug: https://github.com/dart-lang/sdk/issues/45296
Change-Id: I8ba49a7892ed27daa4434f5fb7be3e777ef32bc9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190883
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-03-22 13:20:13 +00:00
Alexander Aprelev f5432d7164 [io/http] Relax http parsing constraints around CRLF.
https://tools.ietf.org/html/rfc2616\#section-19.3 advises to
allow CR*LF wherever CRLF line terminator is expected.

Issue https://github.com/dart-lang/sdk/issues/43916

TEST=http_client_parser_crlf_tolerant_test, http_100_continue_test

Change-Id: I8c6d263bdb950b2f3992b69921eff0ee75704c10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192120
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-03-20 03:11:28 +00:00
Daco Harkes 77dc74bcd5 [vm/ffi] Support packed Structs
Closes: https://github.com/dart-lang/sdk/issues/38158

This CL implements unaligned access for float/double on arm32, but does
not expose it in an API. Rather it only uses these loads/stores inside
the getters and setters of packed structs.
Bug: https://github.com/dart-lang/sdk/issues/45009

Besides unaligned access for float/double, this CL is mostly a CFE
change. The only VM change is reading the packing in the
`_FfiStructLayout` annotation.

The implementation of using the packing in the VM, and analyzer changes
have landed separately in earlier CLs.

tools/test.py ffi ffi_2
TEST=tests/ffi(_2)/(.*)by_value_(*.)_test.dart

Change-Id: Ic3106ecc626d2e30674a49bf03f65ae12d2b3502
Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try,dart-sdk-mac-try,dart-sdk-win-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-mac-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-mac-release-x64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-precomp-android-release-arm_x64-try,analyzer-analysis-server-linux-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186143
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-03-19 15:34:42 +00:00
Alexander Thomas f38081d1ff [sdk] Add analysis_server.dart.snapshot to ARM SDKs.
Fixes https://github.com/dart-lang/sdk/issues/41845.

Change-Id: Ib1558472dfef0d4c815e5ba870d087fdf18f6862
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191922
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2021-03-19 12:03:48 +00:00
Ryan Macnak c5eaf317b6 Revert "[vm, compiler] Convert binary Smi ops to graph intrinsics."
This reverts commit 051ec30ff0.

Reason for revert: Failures on ARM32 AOT

Original change's description:
> [vm, compiler] Convert binary Smi ops to graph intrinsics.
>
> Keep left shift as an ASM intrinsic because it includes fallbacks to Mint operations on 32-bit architectures that graph intrinsics aren't good at expressing.
>
> This should be close to neutral on performance, but removes a fair amount of redundant code.
>
> TEST=ci
> Change-Id: Ic9c7d3b2d015ebf31972163a58c6bc9a27bad4ca
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187164
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

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

Change-Id: I2a08df5b4aa0269a6237a3d967729c155c88a1c7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192061
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-03-18 22:11:56 +00:00
Ryan Macnak 051ec30ff0 [vm, compiler] Convert binary Smi ops to graph intrinsics.
Keep left shift as an ASM intrinsic because it includes fallbacks to Mint operations on 32-bit architectures that graph intrinsics aren't good at expressing.

This should be close to neutral on performance, but removes a fair amount of redundant code.

TEST=ci
Change-Id: Ic9c7d3b2d015ebf31972163a58c6bc9a27bad4ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187164
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-03-18 20:33:34 +00:00
Kevin Moore 4616f47c4d dart: library spelling fixes
Change-Id: I3974094d611df8401941eba35ff0071b48d9e44f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191981
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Kathy Walrath <kathyw@google.com>
Auto-Submit: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kathy Walrath <kathyw@google.com>
2021-03-18 19:11:33 +00:00
Daco Harkes 55082199e7 [vm/ffi] Fix Array<Pointer> loads and stores
Closes: https://github.com/dart-lang/sdk/issues/45198

TEST=tests/ffi(_2)/regress_45198_test.dart

Change-Id: I15cf5a4d48b1bfb33de039cc8b17be8e01fba752
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191881
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-03-18 12:26:38 +00:00
Kevin Moore d59e280a62 Fix spelling mistakes in core classes
Uri, StringBuffer, int, RangeError

Change-Id: I6d22d4707aed3a871af78c584ae3a06894d8b632
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191804
Auto-Submit: Kevin Moore <kevmoo@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-03-18 10:19:48 +00:00
Martin Kustermann 1055db533c [vm/compiler] Add infer range to Utf8ScanInstr
This tells the compiler that boxing the result of Utf8ScanInstr will
always fit in a Smi and the boxing instruction can therefore never go to
runtime (and e.g. cause a lazy-deopt).

Noticed as part of https://github.com/dart-lang/sdk/issues/45213

TEST=Existing test suite.

Change-Id: I30712ec50378c7e0f70e1a5d95a2390b4f5d8ebc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190481
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-03-17 11:17:41 +00:00
Lasse R.H. Nielsen b250a58d8e Implement int.>>> for DDC.
BUG= https://github.com/dart-lang/sdk/issues/44915

Change-Id: Ia63d1653729ff458f9ebb2a2e33883a00a66378f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191220
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-03-16 09:37:15 +00:00
Alexander Markov 16beb34813 [vm/aot] Remove special cases of dynamic function lookups from precompiler
Flutter gallery AOT snapshot size
release: no change;
release-sizeopt: arm -0.24%, arm64 -0.25%.

TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/44852
Change-Id: I847bfc311552bb4e80222e0040b50b4766a18dbe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190783
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-03-15 17:53:23 +00:00
Parker Lougheed 39550008d6 Tag all code blocks which were missing language tags.
A warning to catch these situations was added in https://github.com/dart-lang/dartdoc/pull/2559 so this adds tags to the code blocks in the SDK which were missing them as caught by the new warning.

Change-Id: Iaadbb6e1b811ecac3b95a6c6f64cb689d2eb2d26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190200
Reviewed-by: Janice Collins <jcollins@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Janice Collins <jcollins@google.com>
2021-03-10 18:09:53 +00:00
Ryan Knell 48c23c50d4 Update process.dart
Example was broken, silly typo.

Closes https://github.com/dart-lang/sdk/pull/45253
https://github.com/dart-lang/sdk/pull/45253

GitOrigin-RevId: cd1abd5a307e38093467371db8f59dbb60b71fb7
Change-Id: Ie18e9665c8df4611637ee3632fcc25861971d7b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189940
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2021-03-09 12:13:10 +00:00
Daco Harkes ffa5d16ae7 [vm/ffi] Support multi-dimensional inline arrays
This CL only changes dart:ffi API, CFE, and analyzer. No VM changes
were needed because the dimensions of inline arrays can be flattened
before passing them to the VM. The multi-dimensionality does not
impact the ABI.

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

TEST=pkg/analyzer/test/src/diagnostics/size_annotation_dimensions_test.dart
TEST=pkg/front_end/testcases/nnbd/ffi_struct_inline_array_multi_dimensional.dart
TEST=tests/ffi/function_structs_by_value_generated_test.dart
TEST=tests/ffi/inline_array_multi_dimensional_test.dart

Change-Id: Ica2c01fccbea7e513879365b34086d8968b54c5b
Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try,dart-sdk-mac-try,dart-sdk-win-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-mac-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-mac-release-x64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-precomp-android-release-arm_x64-try,analyzer-analysis-server-linux-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188286
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-03-09 10:50:17 +00:00
Stephen Adams 39aa454e7b [dart2js] Implement int.>>> optimizations
Change-Id: I7d54bc523bb81c5ae8d6fed4ec2e6df473206788
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187340
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2021-03-09 02:20:06 +00:00
Lasse R.H. Nielsen b6001547ff Make NoSuchMethodError.withInvocation a factory constructor.
This will allow implementations to use a different implementation class
when the deprecated unnamed constructor is removed.

Change-Id: I553a733e3947c8cbc316b0a427919892f281445d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/55464
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2021-03-05 09:46:37 +00:00
Ryan Macnak 9451963493 [vm, compiler] Remove intrinsics from internal double-dispatching int methods.
If the intrinsic on int.op fails, then the intrinsic on _opFromInteger will also fail, since both handle the same range of values.

Add intrinsic on int.% as previously only _moduloFromInteger was intrinsified. All the other ops already intrinsified the public method.

Remove _bitAndFromSmi; this was once useful for handling BigInt & Smi, but this case no longer exists.

TEST=ci
Change-Id: Ie33b75126e56110db3caabb9bcb6e9198a3158bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187160
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-03-01 19:29:00 +00:00
Daco Harkes b21430a384 Reland "[vm/ffi] Remove deprecated Struct.addressOf getter"
This got deprecated in Dart 2.12 stable. Removing for the next release.

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

This reverts commit 1d1f68fd6d.

Change-Id: I1df84f2225ea68c2d8ccb7d3e6359050e8802f62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188291
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-03-01 19:20:30 +00:00
Lasse R.H. Nielsen eb6b474d7a Fix null-safety issue in VM's typed-data + operators.
Fixes #45140.

Bug: http://dartbug.com/45140
Change-Id: I95f45c64d86428ddb67d176cdd2d50cfdbadfe8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188283
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-03-01 13:56:19 +00:00
Daco Harkes 0295dfc74e [vm] Support redirecting external const factories
This CL introduces the first combination of `external const factory`
with `@patch const factory (.*) = (.*)`. This specific combination was
never used in the core libraries, and did not work.

Half of the fix is a missing flag from the CFE:
https://dart-review.googlesource.com/c/sdk/+/187440

The other half of the fix is matching on the
kRedirectingFactoryConstructor tag, and allowing constructor names
in procedure targets (even though we never compile those expressions
because they are invalid).

Bug: https://github.com/dart-lang/sdk/issues/45101

TEST=Using redirecting const factory in patch file in core lib.
TEST=tests/ffi(_2)/*

Change-Id: I5524bde928290bf32aaea9170eda1f2d03127fa6
Cq-Include-Trybots: luci.dart.try:benchmark-linux-try,front-end-linux-release-x64-try,vm-kernel-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187003
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2021-02-26 11:15:26 +00:00
Daco Harkes d45fd0f9d5 [vm/ffi] Support inline arrays in Structs
Adds support for single dimension inline arrays in structs. Multi-
dimensional arrays will be supported in a future CL.

This CL adds:
- CFE static error checks for inline arrays.
- CFE transformations for inline arrays.
- VM consumption of inline array fields for NativeType.
- Test generator support for inline arrays + generated tests.

Previous CLs added support for inline arrays in:
- analyzer https://dart-review.googlesource.com/c/sdk/+/183684
  - updated in this CL to new API.
- ABI calculation https://dart-review.googlesource.com/c/sdk/+/183682

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

Open issue: https://github.com/dart-lang/sdk/issues/45101

CFE transformations are tested with expectation files:
TEST=pkg/front_end/testcases/(.*)/ffi_struct_inline_array.dart

Trampolines and CArray API are tested with end-to-end Dart tests:
TEST=tests/ffi(_2)/(.*)by_value(.*)test.dart
TEST=tests/ffi(_2)/inline_array_test.dart

Compile-time errors (both CFE and analyzer) are tested in:
TEST=tests/ffi(_2)/vmspecific_static_checks_test.dart

Change-Id: I014c0e4153f1b885638adce80de6ab3cac8e6bb2
Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try,dart-sdk-mac-try,dart-sdk-win-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-mac-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-mac-release-x64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-precomp-android-release-arm_x64-try,analyzer-analysis-server-linux-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183640
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2021-02-24 13:02:45 +00:00
Alexander Aprelev ea3dfc9ac4 [vm/io] Fix an exception when attempting to immediately cancel socket connection.
Fixes dartbug.com/45047

Change-Id: Ie4630684722e8c17cbc3766f91111b2a76bce7c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186641
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-02-24 00:32:07 +00:00
Alexander Markov 7f8001218b [vm] Support unsigned shift operator int.>>>
TEST=runtime/tests/vm/dart/unsigned_shift_right_test.dart and other
tests for >>>.

Issue https://github.com/dart-lang/sdk/issues/30892
Issue https://github.com/dart-lang/sdk/issues/44914

Change-Id: I7f0a9e1e486be06576c5d9bff3659b0aa6d68c23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184921
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2021-02-24 00:14:57 +00:00
Alexander Markov 9d4ad8a14b [core lib] Add unimplemented int.operator >>>
This change adds a placeholder for int.operator >>>.
No implementation is added yet.

This change unblocks implementation of this operator in
the backends (VM, dart2js, DDC).

Issue: https://github.com/dart-lang/sdk/issues/44912
Issue: https://github.com/dart-lang/sdk/issues/30892
Change-Id: I9912ca9f44d594e9c5fa91f5fc65e807fe48cc7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185480
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2021-02-22 00:02:47 +00:00
jonahwilliams 91ae755c35 add network_policy to io gni
This source file is missing from the gni that flutter engine uses to
construct the analyzer summary. Assuming it wasn't left out intentionally.

Bug: https://github.com/flutter/flutter/issues/76228
Change-Id: I9758ed5839d5b3898064d0372798ecfaa70f9042
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185489
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2021-02-18 22:26:49 +00:00
Zach Anderson 1d1f68fd6d Revert "[vm/ffi] Remove deprecated Struct.addressOf getter"
This reverts commit 65fab2397b.

Reason for revert: These can't be remove until the next dev roll of Flutter. See https://github.com/flutter/flutter/issues/76129.

Original change's description:
> [vm/ffi] Remove deprecated `Struct.addressOf` getter
>
> This got deprecated in Dart 2.12 stable. Removing for the next release.
>
> Closes: https://github.com/dart-lang/sdk/issues/40667
>
> Change-Id: Ifdbcf76178be6fca8603d478d629b6b6655b7123
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184463
> Reviewed-by: Clement Skau <cskau@google.com>
> Commit-Queue: Daco Harkes <dacoharkes@google.com>

Change-Id: I94c22a206f3668ddb72d284afdc3b048d8b11aaa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185500
Commit-Queue: Zach Anderson <zra@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-02-17 21:47:42 +00:00
Lasse Reichstein Holst Nielsen 5bcb19125c Add documentation saying that String.fromEnvironment etc. must behave consistently.
AAll calls to those constructors must behave as if there is a single consistent
environment backing them.
This will force compilers to reject programs where that wouldn't be the case,
which is possible if doing modular compilation with different settings.

If a library doesn't check the environment, it doesn't matter whether the
environment was declared differently, the requirement is only that when actually checking,
the values must be consistent.

Bug: https://github.com/dart-lang/language/issues/304
Change-Id: Ie52ecc3ea49ed87297fab92e5e7bb6d9f96a495d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184467
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2021-02-17 12:52:03 +00:00
Daco Harkes 3593de9179 [vm/ffi] Change Pointer.elementAt and sizeOf to use static type
This CL changes the semantics of
`Pointer<T extends NativeType>.elementAt` and
`sizeOf<T extends NativeType>` to use the compile-time `T` rather than
the runtime `T`.

Issue: https://github.com/dart-lang/sdk/issues/38721

TEST=tests/ffi/data_test.dart
TEST=tests/ffi/sizeof_test.dart
TEST=tests/ffi/structs_test.dart
TEST=tests/ffi/vmspecific_static_checks_test.dart

Change-Id: Ifb25a4bd66d50a385d3db6dec9213b96dff21722
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-arm-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,analyzer-nnbd-linux-release-try,front-end-linux-release-x64-try,front-end-nnbd-linux-release-x64-try,benchmark-linux-try,dart-sdk-linux-try,pkg-linux-release-try,vm-ffi-android-release-arm-try,vm-ffi-android-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178200
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-02-17 11:39:42 +00:00
ffabss c0d688e139 [docs] Fixed a typo in bigint.dart operator | documentation
Closes https://github.com/dart-lang/sdk/pull/45010
https://github.com/dart-lang/sdk/pull/45010

GitOrigin-RevId: b27d0bd0bf25a08909502e37fc86abd00bef82b9
Change-Id: Icf84e3b1ba13002d6dff992f42be55f1a808a536
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185040
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-02-17 09:15:19 +00:00
Lasse R.H. Nielsen d352bc28b8 Remove (most) uses of the "non-nullable" experiment flag.
Since the flag is now enabled by default, there should be no mention of it.
There are still some uses in front_end/testcases that are not just removable
(it also uses `no-non-nullable`). There migth be more uses that are not
as easily found as grepping for `--enable-experiment

Removes two VM tests where fixing them meant they were just duplicating
the corresponding non *_2/ tests.
Fixes #44941

TEST= Large number of tests chaged.=(no-)?non-nullable`.

Change-Id: Ief755981ccde9a5482fcdf408c2929c74433a710
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183688
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-02-12 17:16:54 +00:00
Lasse R.H. Nielsen 0b70cec33d Update dart:async library documentation.
It's a little too pompous about being essential.
(Also, never call `listen` if you don't want the subscription).

Change-Id: I15b3193abaafa31223f889d864d32a225b3b43ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183681
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-12 13:48:13 +00:00
Daco Harkes 65fab2397b [vm/ffi] Remove deprecated Struct.addressOf getter
This got deprecated in Dart 2.12 stable. Removing for the next release.

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

Change-Id: Ifdbcf76178be6fca8603d478d629b6b6655b7123
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184463
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-02-12 09:16:02 +00:00
Daco Harkes fca959e5f6 [vm/ffi] Add class to vm:ffi:struct-fields pragma
This CL changes `@pragma('vm:ffi:struct-fields', [...])` to
`@pragma('vm:ffi:struct-fields', _FfiStructLayout([...]))` which makes
it easier to add more data in subsequent CLs.

Extends `FindPragma` to allow returning multiple matched pragma's, so
that we can filter them. (In this case to avoid matching user-defined
pragma's that do not have an instance of the private class.)

Separated out from https://dart-review.googlesource.com/c/sdk/+/183640
because of the extra constant in existing expectation files.

Bug: https://github.com/dart-lang/sdk/issues/35763
Bug: https://github.com/dart-lang/sdk/issues/38158

TEST=tests/ffi(_2)/*_by_value_*_test.dart

Change-Id: Idef9f82e9b53c2a32dffabcec19669eae550fe2f
Cq-Include-Trybots: luci.dart.try:front-end-nnbd-mac-release-x64-try,front-end-linux-release-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-nnbd-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184181
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2021-02-11 18:09:05 +00:00
Lasse R.H. Nielsen 9cbed61204 Fix type bug in dart:io HTTP client code.
This would have been caught if the static type had not
been made `Future<dynamic>`.

Fixes #44895

BUG= http://dartbug.com/44895
TEST= standalone/io/regress_44895

Change-Id: I237c552fdb42943b395352a7232b34ab5488ac6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184261
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-02-10 18:00:11 +00:00
Clement Skau 622d54c209 [VM] Adds fast case for custom zone callback.
This expands the fast case in `_asyncThenWrapperHelper` and
`_asyncErrorWrapperHelper` to any zone that uses the root zone
`registerUnaryCallback` (which does nothing).

Informal micro-benchmarking shows a runtime decrease of about
3-5% for custom zones that fall back on the root zone
`register{,Unary,Binary}Callback`.

TEST=Tested all cases.

Bug: https://github.com/dart-lang/sdk/issues/40752
Change-Id: I76c944189cc355eb404163a50914ed0e7711446c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182623
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2021-02-10 06:44:18 +00:00
Sergey G. Grekhov 46b46c2931 [vm/ffi] Fixed typo in Struct documentation
Change-Id: I9823b09b614145b8d1a0691e45ffd1ec15c19e57
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183696
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-02-09 18:49:42 +00:00
Stephen Adams cb06d6c86a [dart2js] Rename JSDouble to JSNumNotInt
JSDouble was really "double *excluding integral values*".
This was confusing, with JSDouble sometimes used assuming it was all doubles.
Rename JSDouble to JSNumNotInt to avoid future errors like #44818

Change-Id: I96bf33d5531b94aaf33b582e584702f47ed50395
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183201
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-02-09 17:51:07 +00:00
Daco Harkes aa2a6f8581 [vm/ffi] Change type of typedDataBase parameter for load and store
So that it can be invoked from `CArray` which has a backing store
that is either TypedData or Pointer.

Bug: https://github.com/dart-lang/sdk/issues/35763

TEST=tests/ffi(_2)/*

Change-Id: I30bb0c1e848f2ac4f47919009106d5428ed66453
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183683
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-02-09 13:01:49 +00:00
Lasse R.H. Nielsen 222b894d62 Change resolve for package:URIs to not remove package name.
A "package URI" is defined as one with a `package` scheme,
no authority, a first path segment terminated by `/` which
contains no escapes and is not all `.` characters.
This is the definition of package names accepted by .packages
as well: Valid path characters and not all dots.

Change-Id: I9a161d47732e8bf873d278774315c72a4a928823
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117542
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-02-05 18:31:48 +00:00
Sigmund Cherem 912005267d [web] rename suite dart2js -> web.
Change-Id: I46be49b2effec3e38a3dc44cd45cfe736f77fa78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182680
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-02-04 23:11:32 +00:00
Daco Harkes d052156ea4 [vm/ffi] Remove .ref VM runtime entry
After https://dart-review.googlesource.com/c/sdk/+/180190 the runtime
entry has become dead code.

This CL keeps the runtime entry itself but makes it unreachable as was
the suggestion on previous a CL removing runtime entries:
https://dart-review.googlesource.com/c/sdk/+/169406

Bug: https://github.com/dart-lang/sdk/issues/38648
Bug: https://github.com/dart-lang/sdk/issues/38721

TEST=tests/ffi/vmspecific_static_checks_test.dart
TEST=tests/ffi/*struct*test_.dart

Change-Id: I84c5c925215b9dbd999826fb390df91d8050e1dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182627
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-02-04 21:31:29 +00:00
Lasse R.H. Nielsen 98d5ecb553 Add back accidentally removed pragma on scheduleMicrotask.
Was removed in a failed merge.

Change-Id: Ie8bd18f434786dbb7a3bc619d0b49565198c8c9c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182782
Auto-Submit: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2021-02-04 19:28:37 +00:00
Alexander Thomas c88171c8af [sdk] Bump version to 2.13
TEST=Presubmit tests and local builds
Change-Id: I1b15d60eced0cf3f422548eda75706609f6640cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182624
Commit-Queue: Alexander Thomas <athom@google.com>
Auto-Submit: Alexander Thomas <athom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-04 12:10:17 +00:00
Devon Carew b7e9413d14 Several doc fixes for dart:io.
Change-Id: I0b7577faf49bc2e80e82ef77b2677478503fe6c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182180
Reviewed-by: Janice Collins <jcollins@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2021-02-03 18:43:22 +00:00
Alexander Aprelev 0f3e6553c4 [vm/service] Keep track and close RawReceivePorts opened for isolate's response if isolate exits.
It could happen that recipient isolate exits before having a chance to respond to a posted request/message. If that happens RawReceivePort remains open preventing an application from exiting.

Fixes b/168809314.

Change-Id: I760f83d4d3a65da75a32cc88684dca74b43c942b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182480
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2021-02-03 18:07:42 +00:00
Daco Harkes fb624c4209 Reland "[vm/ffi] Change Pointer<T extends Struct>.ref to use static type"
This CL changes the semantics of `Pointer<T extends Struct>.ref` to use
the compile-time `T` rather than the runtime `T`.

This enables tree shaking of subtypes of Struct and optimizing `.ref`.

Bug: https://github.com/dart-lang/sdk/issues/38721

TEST=tests/ffi/vmspecific_static_checks_test.dart
TEST=tests/ffi/*struct*test_.dart

Change-Id: Ie19bc3259d1cb721d0ce56d68e82d09dc3a4ad0e
Cq-Include-Trybots: luci.dart.try:analyzer-linux-release-try,analyzer-nnbd-linux-release-try,app-kernel-linux-debug-x64-try,dart-sdk-linux-try,front-end-nnbd-linux-release-x64-try,pkg-linux-debug-try,vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180190
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-02-03 10:55:49 +00:00
Daco Harkes 7cb49e2fb0 [vm/ffi] Rewrite Allocator.call calls in CFE
This rewrites `Allocator.call` calls in the CFE to skip the runtime
entry for `sizeOf` when the type argument is constant.

The runtime entry is still used when the type argument is generic.
Forcing the type argument to be constant and removing the runtime entry
will be done in follow up CLs.

Bug: https://github.com/dart-lang/sdk/issues/44621
Bug: https://github.com/dart-lang/sdk/issues/38721

TEST=test/ffi (almost all of them)

Change-Id: I5e855fa2b63a5c1b7fa70dbaa1b89c122a82da6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182264
Reviewed-by: Clement Skau <cskau@google.com>
2021-02-02 16:33:54 +00:00
Clement Skau dfd5413952 [VM] Adds Debugger break for Future.catchError
TEST=Added new Future.catchError pause-on-unhandled-exceptions test.

Bug: https://github.com/dart-lang/sdk/issues/37953
Change-Id: Ieb3cf834eacad4f9b98ab2db0e5813e9bfa09747
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180840
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-02-02 06:59:54 +00:00
Devon Carew f93a844060 [sdk docs] validate the sdk docs per commit
Change-Id: I0521297a1da229b190eb7ec6c7615da445ed5685
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181000
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Janice Collins <jcollins@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2021-02-01 19:39:49 +00:00
pq 2ecc9b76c8 initial sdk API fix data
Some simple SDK API changes codified in fix data w/ accompanying tests.

Tests are in `tests/lib/fix_data` and run on the pkg bots.

Sample run:

https://ci.chromium.org/ui/p/dart/builders/try/pkg-linux-release-try/46526/steps?succeeded=true&debug=false
https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket.appspot.com/8856735093298466576/+/steps/validate_SDK_API_data-driven_fixes/0/stdout


Change-Id: Id0959d6cde4003f114056c21b9969f2792f21a6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180940
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2021-02-01 18:47:59 +00:00
Alexander Thomas 48b9d645c0 [sdk] Mark List.empty as @Since("2.9")
2.9.0 is the first release that included List.empty:
https://api.dart.dev/stable/2.8.4/dart-core/List/List.empty.html (404)
https://api.dart.dev/stable/2.9.0/dart-core/List/List.empty.html (200)

Change-Id: Iddccfd9a38032da6353667fb032fcfcca26c2664
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181803
Auto-Submit: Alexander Thomas <athom@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-01-29 16:30:16 +00:00
Lasse R.H. Nielsen bb5b0ff0ce Fix typed data views throwing.
Fixes #43204

BUG= http://dartbug.com/43204

Change-Id: I93ee6931900b79ac6755431c90d2b203ccf94ff1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181401
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-01-29 09:24:45 +00:00
Lasse R.H. Nielsen 4a484c88e1 Make ListMixin.take check that the argument is not null.
Fixes #41743, #30155
BUG= http://dartbug.com/41743

Change-Id: I223905a92b7353cdc50498d265a6dfe2f2f614d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160640
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-01-28 17:19:35 +00:00
Ryan Macnak a2a9bbbb0c [vm] Rename dart:_internal's is64Bit to has63BitSmis.
Uses of this property care about the range of Smis rather than the range of machine words.

TEST=ci
Change-Id: Ia2c4324590d3aab27d97da4ee40b0e701731e7e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181080
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-01-26 20:14:14 +00:00
Clement Skau c3ec3e53a1 [VM] Adds Future.then stack unwind. (3)
TEST=ASAN; Various 'causal' tests updated below.

Issues addressed in this revision:
- https://github.com/dart-lang/sdk/issues/44708 ASAN
- https://github.com/dart-lang/sdk/issues/44700 SegFault

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-asan-linux-release-x64-try,analyzer-linux-release-try,analyzer-analysis-server-linux-try,analyzer-nnbd-linux-release-try
Bug: https://github.com/dart-lang/sdk/issues/40815, https://github.com/dart-lang/sdk/issues/37953
Change-Id: I8b8f6ee2e5d4ca2e6bea988ec1cd9f912ddf8240
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180186
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-01-26 14:02:39 +00:00
Parker Lougheed 3223072f09 Remove mention of dart2js from mirrors library documentation
Change-Id: I6abb182c19f903cdc8121f2a23eecae4330aea18
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180320
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-01-25 10:08:23 +00:00
Alexander Aprelev ee37fff58c [io/http] Have http parser reply with error if Content-Length and Transfer-Encoding are both specified on http request.
Issue b/150476984

Change-Id: Iafc7154c84682678e4d7e3d614b74942b0d259b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180485
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2021-01-22 18:32:43 +00:00
Daco Harkes 90f3de0421 [vm/ffi] Mark dart:ffi as stable
Closes: https://github.com/dart-lang/sdk/issues/34452

We will still actively adding new features to `dart:ffi`. Please refer
to https://github.com/dart-lang/sdk/labels/library-ffi for open issues
and feature requests.

Related documentation PRs:
- https://github.com/dart-lang/site-www/pull/2873
- https://github.com/flutter/website/pull/5195

Change-Id: I59a23e462c859da5dcd2e5548fb6fe295c5d8532
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179765
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
2021-01-22 13:58:09 +00:00
Daco Harkes d74b2f4672 [vm/ffi] Deprecate Pointer.elementAt and sizeOf generic calls
The analyzer and CFE now report a warning on calls to
`Pointer<T extends NativeType>.elementAt()` and
`sizeOf<T extends NativeType>()` where `T` is a generic.

Adapted from https://dart-review.googlesource.com/c/sdk/+/178200 to
only deprecate but not error out on generic calls.

Does not roll forward `package:ffi` to a version with the `Allocator`
but keeps the generic `sizeOf` invocation. This causes extra warnings
in the pkg/front_end testcases.

Issue: https://github.com/dart-lang/sdk/issues/38721

TEST=tests/ffi/data_test.dart
TEST=tests/ffi/sizeof_test.dart
TEST=tests/ffi/structs_test.dart
TEST=tests/ffi/vmspecific_static_checks_test.dart

Change-Id: I8f41c4dc04fc44e7e6c540ba87a3f41604130fe9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180560
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-01-22 13:58:09 +00:00
Daco Harkes f74c9d43d3 [vm/ffi] Deprecate Pointer<T extends Struct>.ref generic calls
The analyzer and CFE now report a warning on calls to
`Pointer<T extends Struct>.ref` and `Pointer<T extends Struct>.[]`
where `T` is a generic.

Adapted from https://dart-review.googlesource.com/c/sdk/+/180190 to
only deprecate but not error out on generic calls to `.ref` and `[]`.

Issue: https://github.com/dart-lang/sdk/issues/38721

TEST=tests/ffi/vmspecific_static_checks_test.dart

Change-Id: I81353089d59f093730d63792e9dbcd0b2ff0c432
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180365
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-01-22 13:58:09 +00:00
Lasse R.H. Nielsen a7f2da3898 Update documentation of dart:io.
Change-Id: Ibbc692545af636e33cfa7f5946480d3640d95b5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178985
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-01-22 13:37:39 +00:00
Nicholas Shahan c3e56519fc [ddc] Add getGenericClassStatic runtime helper
Used in the SDK runtime library like the getGenericClass helper but this
is intended to be used when we statically know the type of the class to
be retrieved. Helps avoid breaks caused by an upcoming CFE change that
turns type literals into constants.

Change-Id: I262dd2dae347170050d2fe5cd2722ab132951036
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180265
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-01-22 02:24:17 +00:00
Lasse R.H. Nielsen 726904ac17 Add onError extension method to Future.
Provides better typing than `catchError`.

Change-Id: If0d4487b7c3a499160fb719740a1d65c0545024d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151512
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-01-21 23:13:56 +00:00
Daco Harkes 49ec189fb3 Revert "[vm/ffi] Change Pointer<T extends Struct>.ref to use s..."
Revert submission 177862

Reason for revert: breaks g3 without https://github.com/flutter/engine/pull/23808
Reverted Changes:
I50b3b4c31:[vm/ffi] Roll `package:ffi` to `Allocator` and `Op...
I3f5b08c08:[vm/ffi] Change `Pointer<T extends Struct>.ref` to...
I6141c193b:[vm/ffi] Disallow empty structs

Change-Id: I1bfe4d70a5f7f35039b8a01d599d33542872574c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180183
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-01-20 21:37:11 +00:00
Daco Harkes 2e8f9b85a6 [vm/ffi] Change Pointer<T extends Struct>.ref to use static type
This CL changes the semantics of `Pointer<T extends Struct>.ref` to use
the compile-time `T` rather than the runtime `T`.

This enables tree shaking of subtypes of Struct and optimizing `.ref`.

Issue: https://github.com/dart-lang/sdk/issues/38721

TEST=tests/ffi/vmspecific_static_checks_test.dart
TEST=tests/ffi/*struct*test_.dart

Change-Id: I3f5b08c08ec0799ef8aab3c4177e2ac70d25501c
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-arm-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,analyzer-nnbd-linux-release-try,front-end-linux-release-x64-try,front-end-nnbd-linux-release-x64-try,benchmark-linux-try,dart-sdk-linux-try,pkg-linux-release-try,vm-ffi-android-release-arm-try,vm-ffi-android-release-arm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177862
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-01-20 18:08:25 +00:00
Sigmund Cherem 54837aa59c [infra] refactor list of snapshots in sdk/BUILD.gn
This is to make it clearer that the full_sdk_snapshots are a superset of the
platform_sdk_snapshots.

Change-Id: Ib853c098d84bdc357a717d8338176faa4a35398d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179860
Reviewed-by: Ben Konyi <bkonyi@google.com>
2021-01-20 17:06:25 +00:00
Lasse R.H. Nielsen 186049d2b0 Avoid recursion in secure socket _tryFilter method.
Change-Id: If91859b008c76ed1dd4b86c06a563418757bc109
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180180
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-01-20 15:20:15 +00:00
David Morgan 88c1be7e3b Revert "Reland "[VM] Adds Future.then and Future.catchError stack unwinding.""
This reverts commit 9978a246c1.

Reason for revert: VM crashes in google3, b/177506826

Original change's description:
> Reland "[VM] Adds Future.then and Future.catchError stack unwinding."
>
> This reverts commit 978b838461.
>
> Reason for revert: Fix: https://dart-review.googlesource.com/c/sdk/+/179762
>
> TEST=Various 'causal' tests updated below.
>
> Original change's description:
> > Revert "[VM] Adds Future.then and Future.catchError stack unwinding."
> >
> > This reverts commit 8f2c47f24b.
> >
> > Reason for revert: We suspect this is causing VM crashes: http://b/177506826
> >
> > Original change's description:
> > > [VM] Adds Future.then and Future.catchError stack unwinding.
> > >
> > > TEST=Various 'causal' tests updated below.
> > >
> > > Bug: https://github.com/dart-lang/sdk/issues/40815, https://github.com/dart-lang/sdk/issues/37953
> > > Change-Id: I1420d6163ac2e3b22e0971f7b0ad516895dded70
> > > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176662
> > > Commit-Queue: Clement Skau <cskau@google.com>
> > > Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> >
> > TBR=vegorov@google.com,cskau@google.com
> >
> > # Not skipping CQ checks because original CL landed > 1 day ago.
> >
> > Bug: https://github.com/dart-lang/sdk/issues/40815
> > Bug: https://github.com/dart-lang/sdk/issues/37953
> > Change-Id: I870f0202f43588f71a5d2b0f82338978b5a5dda9
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178998
> > Reviewed-by: Michal Terepeta <michalt@google.com>
> > Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> > Commit-Queue: Michal Terepeta <michalt@google.com>
>
> TBR=vegorov@google.com,cskau@google.com,michalt@google.com
>
> # Not skipping CQ checks because original CL landed > 1 day ago.
>
> Bug: https://github.com/dart-lang/sdk/issues/40815
> Bug: https://github.com/dart-lang/sdk/issues/37953
> Change-Id: I8a1eb6679b01571b850499cac2dadc5bf9ef2dcd
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179763
> Reviewed-by: Clement Skau <cskau@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> Commit-Queue: Clement Skau <cskau@google.com>

TBR=vegorov@google.com,cskau@google.com,michalt@google.com

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

Bug: https://github.com/dart-lang/sdk/issues/40815
Bug: https://github.com/dart-lang/sdk/issues/37953
Change-Id: I1274bcb375bf6f9cb0609d372b0b451d51eb99c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180147
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
2021-01-20 12:44:55 +00:00
Johnni Winther 07a6f9511d Revert "Makes _propagateToListeners not recurse unboundedly."
This reverts commit 073f792b59.

Reason for revert: Some g3 test failures, needs more investigation to figure out how to land. b/177972603

TEST=revert

Original change's description:
> Makes `_propagateToListeners` not recurse unboundedly.
>
> Change-Id: I85818282276e8a5ab4a639e98c238c2a822cab9e
> TEST=Added regression test.
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179770
> Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>

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

Change-Id: If3b6a2ee5511a13fa2de19e70a3c52321007b1ff
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180142
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: David Morgan <davidmorgan@google.com>
2021-01-20 09:27:47 +00:00
Lasse R.H. Nielsen 073f792b59 Makes _propagateToListeners not recurse unboundedly.
Change-Id: I85818282276e8a5ab4a639e98c238c2a822cab9e
TEST=Added regression test.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179770
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-01-19 16:47:32 +00:00
Clement Skau 9978a246c1 Reland "[VM] Adds Future.then and Future.catchError stack unwinding."
This reverts commit 978b838461.

Reason for revert: Fix: https://dart-review.googlesource.com/c/sdk/+/179762

TEST=Various 'causal' tests updated below.

Original change's description:
> Revert "[VM] Adds Future.then and Future.catchError stack unwinding."
>
> This reverts commit 8f2c47f24b.
>
> Reason for revert: We suspect this is causing VM crashes: http://b/177506826
>
> Original change's description:
> > [VM] Adds Future.then and Future.catchError stack unwinding.
> >
> > TEST=Various 'causal' tests updated below.
> >
> > Bug: https://github.com/dart-lang/sdk/issues/40815, https://github.com/dart-lang/sdk/issues/37953
> > Change-Id: I1420d6163ac2e3b22e0971f7b0ad516895dded70
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176662
> > Commit-Queue: Clement Skau <cskau@google.com>
> > Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
>
> TBR=vegorov@google.com,cskau@google.com
>
> # Not skipping CQ checks because original CL landed > 1 day ago.
>
> Bug: https://github.com/dart-lang/sdk/issues/40815
> Bug: https://github.com/dart-lang/sdk/issues/37953
> Change-Id: I870f0202f43588f71a5d2b0f82338978b5a5dda9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178998
> Reviewed-by: Michal Terepeta <michalt@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> Commit-Queue: Michal Terepeta <michalt@google.com>

TBR=vegorov@google.com,cskau@google.com,michalt@google.com

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

Bug: https://github.com/dart-lang/sdk/issues/40815
Bug: https://github.com/dart-lang/sdk/issues/37953
Change-Id: I8a1eb6679b01571b850499cac2dadc5bf9ef2dcd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179763
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2021-01-18 12:15:49 +00:00
Lasse Reichstein Holst Nielsen 4563164eec Remove mentions of NullThrownError from documentation.
You can no longer pass `null` to, e.g., `StreamController.addError`,
so we shouldn't document what happens if you do.
In general, in sound null safe code, you cannot even attempt to throw `null`,
so the `NullThrownError` should go away when non-null-safe code stops being
supported.

Change-Id: I3dc7f5ac934b2af48095770767359e8720c3909a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179501
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-01-18 11:46:59 +00:00
jonahwilliams d4d3e3698c [dart:io] ensure Process.start throws with a stack trace
Change-Id: I8b5d585b10752a873632b3a7b9447214e2d38954
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179640
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Jonah Williams <jonahwilliams@google.com>
2021-01-16 01:36:02 +00:00
Sigmund Cherem 9837afa509 [web] partial migration of native tests to support dartdevc
Most files are changed in two ways:

* add `self.` so that the code can run with "use strict" (which ddc
does by default when generating code)

* call the js-helper that installs the interceptor/type-extensions in
DDC on each test.

This was mostly done mechanically and gets about 50% of the tests under
dart2js/native running and passing in dartdevc.  There are, however,
many tests here that are dart2js-specific or for features we don't want
to prioritize at this time (like custom elements), so after this the
next step should probably be to reoarganize the tests and split them in
general native support vs dart2js-specific.

Change-Id: I37759d854f9f51c185789471454d37b6bc78af90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177821
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2021-01-15 02:16:42 +00:00
Sigmund Cherem 90e6fd4734 [web] Support for running native tests in dartdevc.
This consists of a few combined changes:
* support `@Native` on tests: This entails calling registerExtensions
  on user code, but only when running on native tests (which are explicitly
  added to an allow list).

* support for invoking external top-level methods also on native tests.

* support for running `applyExtension` later in tests. This is because
  tests introduce the JavaScript definitions after the calls to
  registerExtensions happen. Note: this wouldn't be necessary if we one
  day change how tests are loaded (e.g. if we can load the JavaScript
  portion of the test before the module compiled by dartdevc is loaded).
  That would entail more infrastructure work and given that this is only
  used for ~200 tests, it doesn't seem worthwhile at this time.

* ensure extension symbols are also stored in `dartx.*` from a native
  test. This is to ensure dynamic calls are fully supported.

* changes to the dart2js runtime to ensure the test code can run in both
  dartdevc and dart2js with the same API.

* one updated test: all native tests need to be updated and I'll follow
  up with those, but the changes on this test are included in this CL to
  illustrate how this all fits together.

After this change (and parent changes), you can now run:

  ./tools/test.py -m release -c dartdevk -r d8 dart2js/native/native_checked_arguments1_frog_test

Change-Id: I4c2615a80b0e7611aa6f57abaa55b4e03b42bfe4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177180
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2021-01-15 02:16:42 +00:00
Lasse R.H. Nielsen b837038cf9 Update dart:async documentation and fix null-safety mistakes in the documentation.
Large update to `Zone` which sorely needed it.

Change-Id: I5d398e4c401ea8b17c7706e7e01ae2e22137ce77
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178620
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-01-14 16:40:53 +00:00
Michal Terepeta 978b838461 Revert "[VM] Adds Future.then and Future.catchError stack unwinding."
This reverts commit 8f2c47f24b.

Reason for revert: We suspect this is causing VM crashes: http://b/177506826

Original change's description:
> [VM] Adds Future.then and Future.catchError stack unwinding.
>
> TEST=Various 'causal' tests updated below.
>
> Bug: https://github.com/dart-lang/sdk/issues/40815, https://github.com/dart-lang/sdk/issues/37953
> Change-Id: I1420d6163ac2e3b22e0971f7b0ad516895dded70
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176662
> Commit-Queue: Clement Skau <cskau@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>

TBR=vegorov@google.com,cskau@google.com

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

Bug: https://github.com/dart-lang/sdk/issues/40815
Bug: https://github.com/dart-lang/sdk/issues/37953
Change-Id: I870f0202f43588f71a5d2b0f82338978b5a5dda9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178998
Reviewed-by: Michal Terepeta <michalt@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Michal Terepeta <michalt@google.com>
2021-01-14 13:56:53 +00:00
Lasse Reichstein Holst Nielsen f93cf84590 Update documentation of dart:isolate.
Change-Id: If026cebc668603f80168dfe943646c0c0dc451e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178983
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-01-14 12:59:53 +00:00
Lasse Reichstein Holst Nielsen 434a97a3c1 Update documentation of dart:math.
Change-Id: Ice4a00c0dee37e88e4ee52ce76d7e7955e75cdb1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178820
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-01-14 11:24:06 +00:00
Lasse Reichstein Holst Nielsen 1ebeb87a82 Update dart:typed_data documentation.
Update to using `///` and some minor tweaks.

Change-Id: Iaae63111952b56fa7631c969d5f43bff774216ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178801
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-01-14 11:10:17 +00:00
Daco Harkes 5d40d52fca [vm/ffi] Add Opaque type
Issue: https://github.com/dart-lang/sdk/issues/44622
Issue: https://github.com/dart-lang/sdk/issues/43974

TEST=samples/ffi/sqlite/lib/src/bindings/types.dart
TEST=tests/ffi/vmspecific_static_checks_test.dart

Change-Id: Ib9e72df6a07b1bc2b72a7db66f945652814baf51
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-arm-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,analyzer-nnbd-linux-release-try,front-end-linux-release-x64-try,front-end-nnbd-linux-release-x64-try,benchmark-linux-try,dart-sdk-linux-try,pkg-linux-release-try,vm-ffi-android-release-arm-try,vm-ffi-android-release-arm64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-win-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178984
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2021-01-13 17:04:08 +00:00
Daco Harkes 4e2343c290 [vm/ffi] Introduce Allocator API
Introduces the Allocator API in `dart:ffi`.

This CL does not yet roll `package:ffi` to use `Allocator`, because that
breaks the checked in Dart in Fluter in g3. Instead, this coppies
`_MallocAllocator` from `package:ffi` into the ffi tests for testing.

This CL does not yet migrate off `allocate` and `free` in the SDK. That
is done in a dependent CL.

Issue: https://github.com/dart-lang/sdk/issues/44621
Issue: https://github.com/dart-lang/sdk/issues/38721

TEST=tests/ffi/allocator_test.dart
TEST=tests/ffi/calloc_test.dart
TEST=tests/ffi/vmspecific_static_checks_test.dart

Change-Id: I173e213a750b8b3f594bb8d4fc72575f2b6b91f7
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-arm-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,analyzer-nnbd-linux-release-try,front-end-linux-release-x64-try,front-end-nnbd-linux-release-x64-try,benchmark-linux-try,dart-sdk-linux-try,pkg-linux-release-try,vm-ffi-android-release-arm-try,vm-ffi-android-release-arm64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-win-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177705
Reviewed-by: Clement Skau <cskau@google.com>
2021-01-13 17:04:08 +00:00
Lasse Reichstein Holst Nielsen 8a81fe235d Update dart:collection documentation for null safety.
Minor cleanups.

Change-Id: I8bd2efbec3aa0c7cf9651c1a2cfa7e436e09ab0f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178204
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-01-13 12:05:14 +00:00
Clement Skau 8f2c47f24b [VM] Adds Future.then and Future.catchError stack unwinding.
TEST=Various 'causal' tests updated below.

Bug: https://github.com/dart-lang/sdk/issues/40815, https://github.com/dart-lang/sdk/issues/37953
Change-Id: I1420d6163ac2e3b22e0971f7b0ad516895dded70
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176662
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-01-13 08:00:14 +00:00
Lasse R.H. Nielsen ef8cc2c1cf Remove LateInitializationError.
As per planned breaking change to let platforms decide how they and what throw for late initiaization errors,
we no longer need a public `LateInitializationError` class. It's confusing to have one if some platforms throw
something else instead.

Removes the public abstract class. The dart:_internal implementation class `LateError` no longer implements it.
This is the only implementation of the public interface, and the class which platforms either throw directly,
or through front-end lowering of the feature.

Remove mentions in tests. All tests now just expect `Error`, some platform specific tests might test the message.

TEST=rewrote tests referring to LateInitializationError.

Change-Id: I54344a67f89ce101ed770412db134e12354cdcc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174928
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-01-12 20:21:33 +00:00
Stephen Adams 87ad206da2 [dart2js] Make JS string literals more uniform
More runtime and boilerplate strings use double-quotes.
This is more consistent with strings from codegen.

Change-Id: I53b6852fc3e8b644a530046aa1a135faf9ae3782
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178380
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-01-12 18:24:21 +00:00
Lasse Reichstein Holst Nielsen 2499451126 Update documentation of dart:convert.
Change-Id: I8c739b720a749b11035fa2841ebb024bf1d5b351
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178205
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-01-12 14:31:01 +00:00
Lasse R.H. Nielsen fe7efd5606 Update documentation in dart:core.
Fix null safety issues and tweak documentation where it can be improved.

Change-Id: Ia8cc20274ae151c454662bf5f137913787365a64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177960
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-01-12 13:06:41 +00:00
Ben Konyi d9ca0514bc [ Service ] Disconnect existing clients when DDS calls
_yieldControlToDDS

Instead of DDS failing to connect when there are existing clients
connected to the VM service, the VM service will now disconnect these
clients when _yieldControlToDDS is invoked.

If an existing DDS instance is already connected, existing clients will *not*
be disconnected and instead an error will be returned containing the URI of
the existing DDS instance.

TEST= runtime/observatory/tests/service/dds_disconnects_existing_clients_test.dart

Change-Id: I08e126d99f51ff14205f359a60ca802c27fd206d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178725
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2021-01-12 02:05:00 +00:00
Regis Crelier daef1f0dbf [VM/runtime] Turn error for missing entry point pragma into a warning.
Print a warning and continue execution after the signature of a function cannot
be verified, because it was not marked as entry point and therefore tree-shaken.
Keep reporting the error only if the flag --verify-entry-points was specified.

Add missing entry point pragma to `scheduleMicrotask` in `dart::async`.
See issue https://buganizer.corp.google.com/issues/177110012

TEST=CL to be patched in test roll of Flutter to Google3 for verification

Change-Id: I1e5f42d02a312363f3003480b053d881a9a58048
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178722
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2021-01-12 00:41:30 +00:00
Ben Konyi c42c76f590 [ VM / CLI ] Run DartDev isolate from snapshot when possible
This change tries to run from dartdev.dart.snapshot and falls back to
running from dartdev.dill if incompatible VM flags are provided.

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

Performance results:

dart test.dart (no CLI isolate): 0.167s
dart run test (from snapshot):   0.208s
dart run test (from kernel):     0.326s

TEST=pkg/dartdev/test/load_from_dill_test.dart

Change-Id: I3195886b86676580ef2a0221f0284328964ef061
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178300
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-01-11 19:41:50 +00:00
Alexander Markov 9d1a307954 [vm] Add specialized factory constructors for small list literals
Flutter gallery in release mode:
AOT snapshot size arm64 -0.22%, arm -0.21%
instructions size arm64 -0.46%, arm -0.4%

TEST=existing tests

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

Change-Id: I4733e91ecf4601c0bcde725cf9e97f5db0b8bc13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175821
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2021-01-11 19:32:30 +00:00
Alexander Aprelev a173599f4c [io/lookup] On iOS run both ipv6- and ipv4-lookup concurrently.
On iOS name resolution can take unexpectedly long because it waits for both ipv4 and ipv6 results and in some cases ipv6 lookup can take long. This CL runs explicit ipv4 and ipv6 concurrently and picks up first successfully resolved name it can connect to.

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

TEST=standalone/io/http_force_concurrent_ipv6_lookup_test

Change-Id: Ie9b7ca0493d945e2eeb8de1dec7bbacdeb902785
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177560
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2021-01-11 17:07:26 +00:00
Lasse R.H. Nielsen eaf5be7b80 Uri.https and Uri.http constructors queryParams type
Currently `Uri.http` and `Uri.https` factory constructors do not allow for `queryParameters` to be `Map<String, dynamic>`, but only `Map<String, String>`, when in fact the main `Uri` constructor does work with `queryParameters` as `Map<String, dynamic>`.

Closes https://github.com/dart-lang/sdk/pull/42564
https://github.com/dart-lang/sdk/pull/42564

GitOrigin-RevId: 6fa130cc4325ae99d96260e8dc0a222398e7522f
Change-Id: Ia1ee0911ec4d80df75792a365af9ca143a729fa2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163620
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2021-01-11 15:22:06 +00:00
Regis Crelier b3bca1821c [VM/runtime] Decouple representation of function signatures from Function objects.
This fixes issue https://github.com/dart-lang/sdk/issues/43088

This CL improves on https://dart-review.googlesource.com/c/sdk/+/166920 by keeping the names of type parameters.

See go/dart-vm-signatures for motivation for this change.

TEST=existing suites

Change-Id: Ia82f1d322f72d07b2fb253cf914f9b868025c71e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176981
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-01-07 23:45:37 +00:00
Mark Zhou 5ee1ee3c04 [dartdevc] Adding support for deferred library checks in DDC.
Fixes #42491

Change-Id: I6afc084bb7b1ccf6c667cb241ab2ac20aa881af1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177620
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-01-07 21:43:08 +00:00
Ryan Macnak 0a63d23c11 [vm] Don't allocate a backing store for maps until the first insert.
Empty maps are fairly common; delaying allocation of the backing store saves time and memory for empty maps. Non-empty maps probe an extra time for the first insert.

Most maps also have few associations, so reducing the initial backing store size also saves memory on balance. The best value for dart2js would be 2 associations, but this CL changes it to 4 as a compromise with other benchmarks on Golem.

Runtime as Score geomean              2.620%
MemoryUse geomean                    -5.233%
dart2js CompileSwarmLatest            0%
dart2js CompileSwarmLastedMemoryUse -10.51%

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/26081
Change-Id: I80a925f698f3df44fae5e97e1804c8dff2ce0c60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176583
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-01-06 17:49:31 +00:00
suragch 76114063f3 Fix InternetAddress.fromRawAddress unix socket documentation.
`InternetAddressType.unix` is the one that should be encoded as a valid
UTF-8 encoded file path, not `InternetAddressType.IPv4`.

Closes https://github.com/dart-lang/sdk/pull/44517
https://github.com/dart-lang/sdk/pull/44517

GitOrigin-RevId: e89eb88ef1732fcc9011ecaf8e18da409d692eaa
Change-Id: Id4ff25921c9c9e0999f44ea90332a7d7cce5d628
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176620
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
2021-01-05 13:53:28 +00:00
suragch cfe73b7fce Fix "set customize" typo in socket options documentation.
"set" or "customize" is fine, but not "set customize"

Closes https://github.com/dart-lang/sdk/pull/44518
https://github.com/dart-lang/sdk/pull/44518

GitOrigin-RevId: 05068faace7f1ab59a4c2920f42cbb6a02305a74
Change-Id: I41618e72cc6cf4ae3267fa66dd1e1da7634c2aba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176640
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
2021-01-05 13:50:59 +00:00
Daco Harkes 7e1d23bb29 [vm/ffi] Deprecate Struct.addressOf
Now that we have nested structs, objects a subtype of `Struct` can be
backed by either a `Pointer` or a `TypedData`. Having this accessor is
misleading.

Instead of passing a struct around (which could be backed by either),
the `Pointer<T extends Struct>` should be passed around and `.ref`
should be used everywhere when access to the backing pointer is
required.

Issue: https://github.com/dart-lang/sdk/issues/40667

Related issues:
* Optimize .ref #38648
* Support tree shaking of structs #38721

Change-Id: I3c73423480b91c00639df886bf1d6ac2e444beab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177581
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-01-05 11:47:48 +00:00
Srujan Gaddam d683f33f5b [dart:js_util] Add checks for functions in js_util
Closes https://github.com/dart-lang/sdk/issues/44145

Introduces assertions in js_util for `setProperty`,
`callMethod`, and `callConstructor` for when the provided
values are Functions but not wrapped with `allowInterop`.
Adds a test to check for assertions in each of those methods.

Change-Id: I7681cf81170d7975abc7e7dd4172f2c5673f203b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176740
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2020-12-29 22:29:05 +00:00
Daco Harkes b6b82dd3ac [vm/ffi] Support nested structs
This CL adds support for nested structs in FFI calls, callbacks, and
memory loads and stores through the Struct classes itself.

Nesting empty structs and nesting a structs in themselves (directly or
indirectly) is reported as error.

This feature is almost fully implemented in the CFE transformation.

Because structs depend on the sizes of their nested structs, the structs
now need to be processed in topological order.

Field access to nested structs branches at runtime on making a derived
Pointer if the backing memory of the outer struct was a Pointer or
making a TypedDataView if the backing memory of the outer struct was
a TypedData.

Assigning to a nested struct is a byte for byte copy from the source.

The only changes in the VM are contained in the native calling
convention calculation which now recursively needs to reason about
fundamental types instead of just 1 struct deep.

Because of the amount of corner cases in the calling conventions that
need to be covered, the tests are generated, rather than hand-written.

ABIs tested on CQ: x64 (Linux, MacOS, Windows), ia32 (Linux, Windows),
arm (Android softFP, Linux hardFP), arm64 Android.
ABIs tested locally through Flutter: arm64 iOS.
ABIs not tested: ia32 Android (emulator), x64 iOS (simulator), arm iOS.
TEST=runtime/bin/ffi_test/ffi_test_functions_generated.cc
TEST=runtime/bin/ffi_test/ffi_test_functions.cc
TEST=tests/{ffi,ffi_2}/function_structs_by_value_generated_test.dart
TEST=tests/{ffi,ffi_2}/function_callbacks_structs_by_value_generated_tes
TEST=tests/{ffi,ffi_2}/function_callbacks_structs_by_value_test.dart
TEST=tests/{ffi,ffi_2}/vmspecific_static_checks_test.dart

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

Contains a temporary workaround for
https://github.com/dart-lang/sdk/issues/44454.

Change-Id: I5e5d10e09e5c3fc209f5f7e997efe17bd362214d
Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try,dart-sdk-mac-try,dart-sdk-win-try,vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-mac-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-ia32-try,vm-kernel-nnbd-mac-release-x64-try,vm-kernel-nnbd-win-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-debug-simarm_x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-precomp-android-release-arm_x64-try,analyzer-analysis-server-linux-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169221
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-12-18 09:34:35 +00:00
Kamil Rykowski dd47afa136 Fix typo in error message
Closes https://github.com/dart-lang/sdk/pull/44470
https://github.com/dart-lang/sdk/pull/44470

GitOrigin-RevId: f692093e550b1ac60683089db7911687559b6970
Change-Id: I21d25062cfa4b2575d2c1bc308da15d6c7c260ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176100
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2020-12-17 12:37:08 +00:00
Sigmund Cherem 368d9f375f web: fix js-number patches to avoid assignment errors
Change-Id: Ie4ae4b1aa1a67a0153168d30d27d16d005c564a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176483
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2020-12-17 04:35:53 +00:00
Devon Carew c7bd33106b [dart: api docs] fix two resolution issues in the dart core library docs
Change-Id: Ic36ff59dc0784d7fdf8a560272016b81880eebd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176067
Reviewed-by: Janice Collins <jcollins@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2020-12-16 23:31:13 +00:00
Lasse R.H. Nielsen e40ae3ba25 Add missing @Since markers on unmodifiable set additions.
Change-Id: I84e94736a425d45b6b1334e90f7991fa31070713
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176240
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Auto-Submit: Lasse R.H. Nielsen <lrn@google.com>
2020-12-15 18:48:41 +00:00
Lasse R.H. Nielsen 478602ad79 Fix errors in Future implementation around Future<Future<X>>.
Previously, when completing a future with another future,
we always chained to the other future. This effectively awaits
the latter future and then completes the former with its result.
This is incorrect behavior if the former future is, say,
a `Future<Future<int>>` and the latter is a `Future<int>`.
In that case we *must not* await the latter future
because we can't complete the former future with an `int`.
We should just complete the future directly with the latter future
as a value.

We now check first whether to chain a `Future<T>` to another
future, and only does so if the latter future is a `Future<T>`
(or it's not a `T`, which shouldn't happen,
but currently does in some places).

Add test for behavior.

Change-Id: I57e27111c2fc7b7792dcf4ae9b7c1d5d504d0c0f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/53602
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2020-12-14 16:34:28 +00:00
Stephen Adams 12548b3be1 [js_dev_runtime] 2.5.gcd(5) is an error
Change-Id: I1419f6a8b7b65e7b37502a1d7b96440ef5683e44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175942
Auto-Submit: Stephen Adams <sra@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-12-13 18:34:46 +00:00
Stephen Adams cc3c70159d [dart2js] Convert first argument to main
- When `main` has arguments, use a callMain shim to convert first
  argument passed to `main` to a `List<String>`.

- Make js_runtime/preambles/{d8,jsshell}.js pass command line arguments to
  Dart `main`.

Change-Id: I8c04bbe49366e756cfe84d1c705767e0366ee74c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158373
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-12-11 01:29:28 +00:00
Oleksii Khomchenko 64226729c1 [corelib] Add Set.unmodifiable backed by an UnmodifiableSetView
UnmodifiableSetView does not have backend specific implementations
(simillar to UnmodifiableMapView, unlike UnmodifiableListView).

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

Change-Id: I041bb6dc95d6a67a395ca75581ffe8e5933acdc6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164103
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-12-10 11:00:27 +00:00
Srujan Gaddam 8e663541c9 [ddc] Change is checks for JS types
Changes 'is' checks for JS types such that it no longer does an
instance of check and instead only checks to see if the object
in question is a JS object or appropriate subtype. This means that
any two @JS objects will pass an is check and therefore can be
casted as one another. This makes it consistent with expected
behavior and dart2js.

Also amends the README to reflect the unified behavior.

Change-Id: I11aa105d6cafbbafde482b27dcc1182c0960cce9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173140
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2020-12-10 01:38:26 +00:00
Nicholas Shahan d0ee5dbe40 [ddc] Verify null safety modes of modules agree
Checks that the null safety mode of every module loaded matches the mode
of the SDK.

This relands https://dart-review.googlesource.com/c/sdk/+/173120 with
additional fix to correctly set the mode of a new component created
in the frontend_server.

Change-Id: I855b226f724ce0b6c83dbdc11ff6113853892dbb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174881
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-12-09 21:12:20 +00:00
Lasse R.H. Nielsen b62ad8247f Switch order of socket tests to avoid timing issue.
Also fix one more place where ??= was appropriate.

Bug: https://github.com/dart-lang/sdk/issues/44414
Change-Id: I323bd0b82a1070a7e1341bee3a917564af45cafa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175360
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2020-12-09 16:19:00 +00:00
Stephen Adams 35c7ebba1f [js_runtime] Specialize JSArray.addAll for JSArray input
Change-Id: I80b648a1a7c1cafb871618ccf57901047a374c19
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175344
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-12-09 05:23:08 +00:00
Nicholas Shahan 4c2edfd5b9 [html] Make cancel() always return synchronously
Before Null Safety, `_EventStreamSubscription.cancel()` used a trick
to run with synchronous timing even though it was typed to return a
`Future`. During the migration of the SDK to support Null Safety it
kept the synchronous timing in weak mode, but was changed to
asynchronous in sound mode so that the behavior matched the method
signature. In hindsight, changing the timing when opting into Null
Safety is problematic:

* A shared package has no control over what mode it runs in. Libraries
  may be opted in and run their tests with sound null safety but the
  apps they are used in could still be running in weak mode. This
  results in library unit tests that behave differently than the
  production app that deploys the code.

* This codepath can be triggered by EventTarget.dispatchEvent() from
  dart:html which should have synchronous timings for the event
  listeners before returning to the calling code. The asynchronous
  timing when running with sound null safety is inconsistent with the
  browser API.

This change reverses that migration decision and keeps the synchronous
timing in both modes. To support this in sound mode it returns a
special future value that is internal to the SDK and known to be used
for synchronous timing.

This change also removes the workaround introduced in DDC to avoid
warning/failing when `_EventStreamSubscription.cancel()` returned
null and the extra warnings/errors features were enabled in weak
null safety mode.

Change-Id: I6b08a2ada5b10120bea787ad59d1d58e6e181de5
Fixes: https://github.com/dart-lang/sdk/issues/44157
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175323
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-12-09 01:44:38 +00:00
Ryan Macnak 1b160f79fe [vm] Gracefully handle loads not solicited by prefix.loadLibrary().
TEST=flutter
Bug: https://github.com/dart-lang/sdk/issues/41974
Change-Id: Ia0e99c5e84cdff8736c44e4e82ce40b045ed0207
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174563
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-12-08 22:14:25 +00:00
Alexander Markov bae438c033 [vm/corelib] Remove unnecessary isEmpty call from List._fromLiteral
VM doesn't call List._fromLiteral for empty list literals, so there is
no need in testing if elements are empty in List._fromLiteral.

Also, List._fromLiteral is always called on _List elements, so we can
use a more specific type for its parameter.

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

Change-Id: I2e58534c6d183c30673a68bc6705f5c64edc9f09
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175280
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-12-08 00:00:28 +00:00
Lasse R.H. Nielsen 6e29700e16 Update List constructor documentation, deprecate constructor.
Emphasize that the operation is going away,
and mark constructor as deprecated.

TEST= Refactoring+deprecation only, covered by existing tests.

Change-Id: I82aa044cd2cf7bf347b624371399f44bda8f4a07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173261
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2020-12-07 16:20:28 +00:00
Lasse Reichstein Holst Nielsen 81c3e8cbb4 Address comments from https://dart-review.googlesource.com/c/sdk/+/174471
* Rename `completer` to `result` (its role, rather than repeating its type).
* Change &times; in non-dartdoc comment to the actual character.
* Throw on an unexpected source address argument type.

Also handle failing unix socket connections better.
The current code did not account for all possible return values
from the native connect functions. Likely, those other values never
occurred, but unless it's proven that they can't, not even in unsound
mode, the code should be prepared for them.
(And added missing `return` to the native code).

TEST= Refactoring, no change to tests.

Change-Id: Ie27670f62ae6ecc64dc045c28869e3d5ab218fda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175042
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2020-12-07 15:42:57 +00:00
Kabirou Agouda bf539b4aed Update list.dart
Line 745 .
Added the value of words.asMap() as a comment
it allows to have an idea of the result of the use of the asMap function.

Closes https://github.com/dart-lang/sdk/pull/44378
https://github.com/dart-lang/sdk/pull/44378

GitOrigin-RevId: c197eb72523706216e92057c7c3b0dbe17e5c86b
Change-Id: I97693ffa4a9840245d340cc81e68d0d31eb926f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174940
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2020-12-07 11:46:57 +00:00
Alexander Markov f04757f6ea [vm] Specialize List.empty calls for growable and fixed-length lists
TEST=existing tests for List

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

Change-Id: I89eecb15b535cc5a3e1aeea350a306883b463b9f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175003
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-12-06 23:31:55 +00:00
Ryan Macnak 28fe36c637 [vm, compiler] Recognize WeakProperty's accessors.
The layout of WeakProperty is defined in C++ instead of Dart. Add missing recognition of its accessors so the compiler can use direct field access instead of always going through natives. Compare LinkedHashMap.

Change the sentinel for WeakProperty lists to object null so that no special constructor is needed.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/44333
Change-Id: I8686383053c2c345c972b6615b514a1381e79fda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175001
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-12-04 22:25:12 +00:00
Alexander Markov 4457de2278 [vm/corelib] Shrink code size of inlined _GrowableList.add
Previously, _GrowableList.add used 2 calls to grow the list which
results in extra code generated for each inlined List.add call.

This change replaces

  _grow(_nextCapacity(len));

with

  _growToNextCapacity();

which reduces code size.

Flutter gallery in release mode
instructions size -0.32% (arm), -0.1% (arm64)
total snapshot size -0.19% (arm) -0.06% (arm64)

Change-Id: I8422757d147ecec5bdec60910c65c558c39fde1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175006
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-12-04 20:05:32 +00:00
Daco Harkes 224351bb92 [vm/ffi] Clarify struct documentation
Closes: https://github.com/dart-lang/sdk/issues/44355

Change-Id: I1a9676a16fcf61b776216626665a2802dcf64305
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175043
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Jonas Jensen <jonasfj@google.com>
2020-12-04 18:04:05 +00:00
Stephen Adams 6b6eccecb3 [vm] Fine-grained dispatch of List.of
Dispatch List.of to one of ten implementations so that the inner loop
is monomorphic for {_List,_GrowableList,_ImmutableList} x
{_List,_GrowableList} cases.

ListCopy.List.of related benchmarks show a nice gain, especially for
the longer lists where the monomorphic loop pays off (arm7):

ListCopy.List.num.unmodifiable.2    12.10%
ListCopy.List.num.from.2            18.24%
ListCopy.List.of.2                  19.19%
ListCopy.List.num.from.fixed.2      26.42%
ListCopy.List.of.fixed.2            34.63%
ListCopy.List.num.unmodifiable.100  68.80%
ListCopy.List.num.from.100          62.83%
ListCopy.List.of.100                66.39%
ListCopy.List.of.fixed.100          80.20%
ListCopy.List.num.from.fixed.100    75.12%

Bug: 32937
Change-Id: I5c7006969240a60e0c5797546db72b6b5caec748
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174880
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-12-03 22:33:11 +00:00
Alexander Markov 3a75dffd8a [vm/nnbd] Add check for repeated initialization of late final local variables
TEST=tests/language/nnbd/syntax/late_modifier_runtime_error_test.dart

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

Change-Id: I93776094914358600b3bd6ae6df649500fcff7b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174980
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-12-03 21:48:11 +00:00
Johnni Winther 87ef15787a [cfe] Handle write during late local initialization
In response to issue #44372

Change-Id: I6ad0730e662f7fcd8987a745cbab72dbb91c2045
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174923
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-12-03 16:41:53 +00:00
Lasse Reichstein Holst Nielsen 96dc4116e5 Update _NativeSocket.startConnection to avoid state errors.
The existing code is undocumented and has caused state errors
where a future is attempted completed more than once.

This rewrites the code, formalizes and documents the expected behavior,
which is slightly different from the previous behavior wrt. scheduling
new connections when existing connections fail.

Change-Id: I369fc5b70920954af4a066a179d751b72da35800
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174471
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2020-12-03 14:37:43 +00:00
Brian Armstrong cccf8ec256 Update some dartdoc comments in list.dart
Fixing a typo and adding a reference to a function argument

Closes https://github.com/dart-lang/sdk/pull/42868
https://github.com/dart-lang/sdk/pull/42868

GitOrigin-RevId: a7fea5ff706fe1ae0a077587f287e49b2f72a3b6
Change-Id: I47c9cc77d361e7ad9af9398ab71ca28fff62c9d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174844
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2020-12-03 04:51:07 +00:00
Alexander Markov 36015bde54 [vm/nnbd] More detailed error messages for late field/variable errors
TEST=tests/language/nnbd/syntax/late_modifier_runtime_error_test.dart

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

Change-Id: I84727583a0b743c5c868921a6148b18f12eb68e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174842
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2020-12-03 02:29:38 +00:00
Yong Joseph Bakos 60b7cc5a22 Uri: complete hashCode property description.
The documentation for the Uri `hashCode` property is incomplete.

Complete the description of the property.

Closes https://github.com/dart-lang/sdk/pull/44371
https://github.com/dart-lang/sdk/pull/44371

GitOrigin-RevId: 058f54ca035ec09b884b1cffeef15ca1c9b4643f
Change-Id: Ifeec2a26b9c4fed4db3b8b6a3fda64d238257425
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174765
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2020-12-02 22:41:27 +00:00
Stephen Adams bbce39d27c [vm] Better List.of
List.from now calls List.of instead of the other way around.

Separate loops for system Lists, EfficientLengthIterables
and other Iterables should keep the performance of these
cases independent.

Change-Id: I26a23b10d2fb8fd2683a4f9c26257860cfdfa758
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173860
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-12-02 18:16:58 +00:00
Lasse Reichstein Holst Nielsen 8129c40c5e Update LinkedList.contains to take advantage of internal structure.
Made it explicit in the documentation that elements of the `LinkedList`
are compared using identity, not `operator==`, even if they choose to
override that.
The linked list entries are directly linked to their containing list,
which is what defined their containing list. Merely being equal to an entry
of a list does not make another entry belong to that list.

The `contains` method now simply checks that the `list` property of the
the provided entry is the list itself, which matches the existing behavior
of `remove`.

Fixes #44189.

Bug: https://github.com/dart-lang/sdk/issues/44189
Change-Id: Ia6a7fd461ddf18f99121662f87e83415746e1ca4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172161
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2020-12-02 14:08:08 +00:00
Stephen Adams f0be731480 [js_runtime] Faster List.of copying a JSArray
Improved inferrer to handle some cases of JS-fragments.
The JS-fragment to copy the array caused the inferrer to be too
pessimistic about list-tracing into List.of.


Change-Id: I0cb4f7610d971d7927d973bd2b0b532d4cef9a7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173883
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2020-12-02 07:53:47 +00:00
Clement Skau 2d36c85ff8 [vm] Removes support for --causal-async-stacks
All existing embedders have been opted into --lazy-async-stacks, the
VM also uses it as it's default in all configurations.

After this CL, any user of --causal-async-stacks will get an error
message when trying to use it.
=> In any such case, please simply remove the flag.

TEST=Exhaustive CQ.

Bug: https://github.com/dart-lang/sdk/issues/37668
Change-Id: Ia440afcf2dba464aa8b8cf381b93bbac8eb9f8dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172564
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-12-01 07:27:14 +00:00
Devon Carew a0ed69b03a [dartdev] move the location of the dartdev dill snapshot
TEST=covered by existing build/test systems

Change-Id: Ic4ca16c3abc956e1947a2a7fa035ef7f889255fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173442
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-11-30 18:46:42 +00:00
Tess Strickland 367761987b [vm/corelib] Fix ConcurrentModificationError for empty addAll.
Since we only add elements if the iterator is non-empty, we
shouldn't get a ConcurrentModificationError if both the iterator
and receiver are the same empty EfficientLengthIterator.

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

TEST=New regression test added that fails without the sdk change.

Fixed: 42011
Change-Id: Ib5259c8f043cc8277d2fea407d1f64a24430c4d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173901
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2020-11-25 12:01:44 +00:00
Lasse Reichstein Holst Nielsen b64550eaff Add a nullFuture in dart:internal.
This is the future returned by `dart:async` in some cases which used to return `null` pre null-safety.
Code inside the SDK which *needs* to not change its timing of events can recognize the future and skip waiting for it, giving the same "synchronous" behavior as before the null safety change.

Longer term, we need to wean people off depending on the specific interleaving of events.
Maybe we should randomly shuffle our microtask queue.

Change-Id: I8d52e74f0549a3068f5dfaffb28c7894b324c49d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172641
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2020-11-25 11:58:53 +00:00
Simon Binder 9818a0cc93 [vm/mirrors] Fix ClassMirror.isSubclassOf in strong mode
It currently throws a type error as it attempts to cast the superclass
of Object to a non-nullable ClassMirror.

TEST=Covered by existing tests

Fixed: 44310
Change-Id: If222344d3135d7903ddc76bb18f7f72266dc0c64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173900
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2020-11-25 10:07:13 +00:00
Liam Appelbe 1b94364da7 [wasm] Clean up native objects using finalizers
The finalizers associate each native object with a Dart object that owns
them. The finalizers need to be in native code, so I had to go back to
the old approach of linking Wasmer and my native code into a single .so.

TEST=I tried running the wasm tests using asan, but it didn't detect any
leaks even before the finalizers. So I put printfs in all the
set_finalizer and finalizer functions and manually verified that all the
finalizers were being run.

Bug: https://github.com/dart-lang/sdk/issues/37882
Change-Id: I38303ae0c6c446a23562c1b157c92ccc9af2dc34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172680
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2020-11-24 21:12:09 +00:00
Lasse Reichstein Holst Nielsen 40535c3159 Fix typo in unmodifiable map mixin return type.
Fixes #44264.

Bug: http://dartbug.com/44264
Change-Id: I958403af0e217cea6b45b4a74cb00fb800914f86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173724
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2020-11-24 18:59:08 +00:00
Clement Skau 013c19ecb6 [VM] Adds Future.whenComplete stack unwind.
TEST=tools/test.py -n dartk-linux-release-x64 vm/dart_2/causal_stacks

Bug: https://github.com/dart-lang/sdk/issues/44169
Change-Id: Ia5810ca3585f8e90b6fb91827a892a038e82f13b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173264
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-11-23 07:51:05 +00:00
Nicholas Shahan a9f3c66bd8 Revert "[ddc] Verify null safety modes of modules agree"
This reverts commit fda897a423.

Reason for revert: Breaks all the flutter web tests here:
https://ci.chromium.org/ui/p/dart/builders/ci.sandbox/flutter-engine-linux-web_tests/1089/overview

This indicates we still have a misconfiguration in flutter web dev 
builds where artifacts with different null safety modes are being 
mixed.

Original change's description:
> [ddc] Verify null safety modes of modules agree
>
> Checks that the null safety mode of every module loaded matches the mode
> of the SDK.
>
> Change-Id: I50543d10fbea22a61bd7f12d51d6e9c8f8286890
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173120
> Commit-Queue: Nicholas Shahan <nshahan@google.com>
> Reviewed-by: Mark Zhou <markzipan@google.com>

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

Change-Id: I0d09efde53f268b353cb842286b11bb3f375e754
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173440
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-11-21 17:42:25 +00:00
Nicholas Shahan fda897a423 [ddc] Verify null safety modes of modules agree
Checks that the null safety mode of every module loaded matches the mode
of the SDK.

Change-Id: I50543d10fbea22a61bd7f12d51d6e9c8f8286890
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173120
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2020-11-21 00:51:14 +00:00
Alexander Markov 520165383e [corelib] Remove manual cast specialization in Iterator.current implementations
This change removes the workaround introduced in
https://dart-review.googlesource.com/c/sdk/+/138327.

The workaround can be removed as VM now optimizes such casts in compiler
(https://dart-review.googlesource.com/c/sdk/+/139314).

Issue: https://github.com/dart-lang/sdk/issues/40892
Issue: https://github.com/dart-lang/sdk/issues/40893
Change-Id: I2dd8c15a7b64b19c0a2606ab0e43b926a6d2cfd8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172260
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-11-17 20:01:48 +00:00
Robert Nystrom c4a1eaf4c7 Require an SDK constraint in the package config generator.
Also, fix the one package that didn't have one, and regenerate the
config.

Change-Id: Id7f210e9a3f73b2070e52df6ae9d4b1c4d4aeae3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172081
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
2020-11-17 00:11:00 +00:00
Nicholas Shahan bfe8aa8d5b [ddc] Add option to throw null safety violations
Allows sound-like null safety when running mixed applications in weak
mode.

This is not a specified option and is only intended to assist large
scale migration efforts.

Change-Id: Icd0abb0e876d16e719a01e8381eef55a2b511051
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171821
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2020-11-16 22:58:50 +00:00
Srujan Gaddam 1a86143557 [dart:html] Make dictionary conversion recursive
Bug: https://github.com/dart-lang/sdk/issues/43802

convertDartToNative_Dictionary relied on the input being flat, which
failed since it was being used for some APIs which allowed for nested
dictionaries. Modifies it so that it converts any map or list values
in the provided map.

Change-Id: I9a404f4cd1f582cd88d43a57fbee0e07b0ee7e76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171805
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2020-11-16 19:20:16 +00:00
Aske Simon Christensen b11d057572 [vm] Look for the recognized pragma in the unboxer and signature shaker.
This removes the conservative exclusion of everything below num in the
unboxer, and it allows some methods marked as entry points to not be
entry points, as they are not actually referred explicitly in VM code.

TEST=Existing test suite.
Change-Id: If465b9081ac278a105ba99c23a49f5516b7bfbc0
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169401
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-11-16 13:49:50 +00:00
Aske Simon Christensen 1ab705f60c [vm] Require all recognized methods to be marked with pragma.
Adds a @pragma("vm:recognized", <kind>) to all recognized methods, where
<kind> is one of "intrinsic", "graph" or "other", corresponding to the
kind of recognized method.

When running in debug mode, it is checked that all recognized methods
are marked with the correct kind of pragma, and that all methods marked
with the pragma are in fact recognized.

This enables kernel-level analyses and optimizations to query whether
a method is recognized by the VM.

TEST=Asserts that check the correspondence both ways, covered by test
suite, in particular the various CompileAll tests that compile all code.
Change-Id: I12f3305c72a93ecb1aefae2d66e3d9a7dae23b44
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168951
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-11-16 13:49:50 +00:00
Devon Carew f5e26456bf Remove the --completion-model flag from the analysis server.
Change-Id: I6bedbb0b5c4b8bedba18d2e3b788db0a9686f6df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172026
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-11-16 03:31:18 +00:00
Martin Kustermann d9561e5a1d [vm/concurrency] Move Isolate.spawn()-related logic out of runtime/vm/ into runtime/lib
The Isolate.spawn() is part of our dart:isolate library implementation,
it should therefore preferrably live under runtime/lib folder.

This CL does that as well as removing some special message handling
logic by using the new `Dart_RunLoopAsync()` C API, which results in
net removal of code.

As a nice side-effect it also makes isolate spawning slightly faster due
to avoiding extra safepoint/vm<->native transitions.

Issue https://github.com/dart-lang/sdk/issues/44088

TEST=Changes existing implementation, have existing test coverage for it.

Change-Id: I00607a1436946552bbe12e8e23062e8f743d4f11
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171731
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-11-15 13:31:47 +00:00
Stephen Adams 887b094bb5 [js_runtime] typed array constructors don't have effects
Change-Id: I31238331cd878b953c623de077b05d47b2d1be5b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171809
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2020-11-13 21:40:04 +00:00
Liam Appelbe 504e9a32f9 Reland "[wasm] Remove dart:wasm"
This is a reland of ade333dd54

Original change's description:
> [wasm] Remove dart:wasm
>
> I'm not entirely sure why I had to modify a random set of fingerprints
> in runtime/vm/compiler/recognized_methods_list.h, but when I did a debug
> build it had some fingerprint errors.
>
> Change-Id: Ib0a0cccb37f2efba509e2b37b6eabe790fa933c4
> TEST= Deleting stuff, so not really necessary
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170620
> Commit-Queue: Liam Appelbe <liama@google.com>
> Reviewed-by: Liam Appelbe <liama@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

Change-Id: I0d1388f6312358cc62bb32f5ac7b88a3187223c9
TEST= Deleting stuff, so not really necessary
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171940
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2020-11-13 20:40:24 +00:00
Sigurd Meldgaard 00b7040dc8 Remove obsolete dartfix build target and scripts
The package was deleted in 224a997a23

Bug: https://github.com/dart-lang/sdk/issues/43863
Change-Id: I599ea7b594365ef244550c90f50bab15d116c937
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170696
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2020-11-13 09:18:36 +00:00
Siva Annamalai 54a91f26c4 Revert "[wasm] Remove dart:wasm"
This reverts commit ade333dd54.

Reason for revert: This broke both the Flutter HHH and Google3 bots. It looks like some co-ordination is required between the Google3 and Flutter engine build changes for this CL to land.

Original change's description:
> [wasm] Remove dart:wasm
>
> I'm not entirely sure why I had to modify a random set of fingerprints
> in runtime/vm/compiler/recognized_methods_list.h, but when I did a debug
> build it had some fingerprint errors.
>
> Change-Id: Ib0a0cccb37f2efba509e2b37b6eabe790fa933c4
> TEST= Deleting stuff, so not really necessary
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170620
> Commit-Queue: Liam Appelbe <liama@google.com>
> Reviewed-by: Liam Appelbe <liama@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

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

Change-Id: I244d7b3549845dd71719176a62b6ec3a4c4b5f86
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171860
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-11-13 01:54:10 +00:00
Ben Konyi 87e70c7816 [ VM / Service ] Added debug names to all instances of
ReceivePort/RawReceivePort created in the core Dart libraries

These names should make it more clear of the reason a given port is
open.

Change-Id: Idb19c3e47ddcce0ee301452f179fd4a1c5979e9f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170745
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-11-12 21:02:56 +00:00
Liam Appelbe ade333dd54 [wasm] Remove dart:wasm
I'm not entirely sure why I had to modify a random set of fingerprints
in runtime/vm/compiler/recognized_methods_list.h, but when I did a debug
build it had some fingerprint errors.

Change-Id: Ib0a0cccb37f2efba509e2b37b6eabe790fa933c4
TEST= Deleting stuff, so not really necessary
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170620
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-11-12 19:22:29 +00:00
Srujan Gaddam 546fdf55bc [dart:html] Add file for JS interop workarounds
Creates a markdown file that documents issues to help users work
around limitations in dart:html and similar libraries.

Change-Id: I0f83661919f3d09bb2743a84cdcd141a9aa9a87e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171629
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2020-11-12 00:14:52 +00:00
Ben Konyi b729693cb9 [ VM ] Allow for Timer to set its ReceivePort as active / inactive to
prevent repeated port allocations

Flutter makes heavy use of short-lived Timers which currently causes
repeated opening/closing of the Timer port. This change allows for
RawReceivePorts to be set active / inactive, allowing for a port to be
kept open but not considered alive.

Flutter benchmark changes:

Before dart-lang/sdk@d5118d5: "notifyListener2_iteration": 545.0
After dart-lang/sdk@d5118d5: "notifyListener2_iteration": 1639.0
With fix: "notifyListener2_iteration": 629.0

Fixes https://github.com/flutter/flutter/issues/69583

TEST=Updated port state tests and verified change against Flutter's microbenchmarks

Change-Id: I50ff1a1b0f1f29bcdac958e41c66429e9586fba2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171628
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-11-11 23:42:12 +00:00
Lasse Reichstein Holst Nielsen 1003e91a35 Remove uses of, and need for, Expect.throwsNullCheckedError.
All code which was tested now throws a TypeError in both
sound and unsound null safe mode.

Change-Id: I304dfa6b8683223562f8613f3d14823fccab35bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170439
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2020-11-11 13:30:30 +00:00
Robert Nystrom adbc3cdad7 Update StreamIterator docs for null safety.
Bug: https://github.com/dart-lang/sdk/issues/43380
Change-Id: I12984d15961c1950a5b6bb1d087b43cba8960e43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170142
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
2020-11-11 12:06:09 +00:00
Stephen Adams 8c13fa841e [dart2js] Kernel transformer expansion for List.generate
Simple calls to `List.generate` are expanded into a list allocation
and a loop. This generates better code for several reasons:

 - There is no overhead for the function argument (closure allocation,
   closure type, closure class)

 - Global type inference is more precise since each List.generate list
   is tracked separately, and the assignments in the loop give better
   inference to the collection's element type.

To get precise element type inference, there are two new JSArray
constructors. Global type inference starts with the element type being
bottom for these elements, avoiding spurious nulls in the inferred
type.

Change-Id: I5efb90651ae3f9eb2e81af556704960cdf0b75c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168770
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-11-11 04:27:22 +00:00
benarso 8c495e075d Typo correction in documentation
"concatentation" should be "concatenation"

Closes https://github.com/dart-lang/sdk/pull/44142
https://github.com/dart-lang/sdk/pull/44142

GitOrigin-RevId: 80b0c3a3bac67fea76c278c64c1305b213128c9f
Change-Id: I02461e92df45764792c2553b64981e0f1fe48d06
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171382
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2020-11-11 02:01:12 +00:00
Stephen Adams 3c12e4a659 [js_runtime] Improve tree-shaking with RegExp named groups.
The spec string `Object` matches all native classes. The combination
of RegExp named groups and importing 'dart:html' in a small program
could result in a larger `.js` file than expected. Using `=Object`
fixes the excessive number of native classes matched.

Change-Id: I40ab8195d0edc24d05a748bc35c5f74f66272937
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171044
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-11-10 21:59:16 +00:00
Clement Skau 27ca552ddb [SDK] Replaces async's _AsyncAwaitCompleter with _Future.
Run time (less is better) impact:
dart:
- Calls.AwaitAsyncCall  -43.95% ~ -55.50%
- Calls.AwaitAsyncCallClosureTargetPolymorphic  -40.33% ~ -53.58%
- Calls.AwaitAsyncCallInstanceTargetPolymorphic  -42.69% ~ -55.65%
- Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits  -42.05% ~ -56.14%
- Calls.Await...  0% ~ -13%
dart-aot:
- Calls.AwaitAsyncCall  -9.748% ~ -11.13%
- Calls.AwaitAsyncCallClosureTargetPolymorphic  -8.673% ~ -13.19%
- Calls.AwaitAsyncCallInstanceTargetPolymorphic  -9.799% ~ -11.74%
- Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits  -5.412% ~ -13.43%

Code size impact:
- flutter_gallery_app_so_brotli_size  -0.1237% ~ -0.2410%
- flutter_gallery_readonlydata_size  0.1693% ~ 0.2041%
- flutter_gallery_instructions_size  0.1157% ~ 0.1779%
- flutter_gallery_total_size  0.1021% ~ 0.1413%

Bug: https://github.com/dart-lang/sdk/issues/39119
Change-Id: I64d28a8bea078277946d7be43737e265920c8f16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126322
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-11-05 09:51:13 +00:00
Stephen Adams f387d24f68 [js_runtime] List.of improvements
`List.of` avoids per-element checks and no longer forwards to
the more expensive `List.from`.

Global type inference infers `List.of` and `List.from` as new
list allocations.

Bug: 40211
Bug: 32937

Change-Id: I54746610a1b0089ec54e43459301720105f872ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170127
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2020-11-05 01:47:17 +00:00
Johnni Winther 0609c6dacc [cfe] Add predefined constructors for late error messages
This CL adds predefined constructors to LateInitializationErrorImpl that
only take the name of the late field/variable as argument. This can reduce
the size of the generated code for ddc/dart2js size because the long
message isn't repeated at all call sites.

In response to #43995

Change-Id: Ie276dd1455feab1655da3a503856da425b20f04f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169883
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-11-03 12:47:06 +00:00
Vijay Menon f346cb7f77 Fix ddc debugger_test
This CL:
- Fixes https://github.com/dart-lang/sdk/issues/43987 (an exception in custom formatting code)
- Restores (most of) debugger_test.dart to passing (which tests above)
- Fixes a type caching error also exposed by the above test

Note, this skips the golden file comparison.  That appears to be very broken
(see comment).

Change-Id: I283b66a710f17765faed47aa099b0b8570e6cac1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170022
Reviewed-by: Gary Roumanis <grouma@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
2020-11-02 23:31:30 +00:00
Nicholas Shahan ab7dc265d7 [ddc] Avoid weak mode warning in FutureOr casts
This is not intended to change the result of the cast in any mode.

An optimization for casting null in weak mode accidentally added
warnings when casting to a FutureOr (non-nullable) of a legacy
type.

Also moves the `is` and `as` methods for FutureOr types from being
hard-coded in the compiler to the runtime method that builds the
type.

Tested on golem and found no attributable performance regressions:
https://golem.corp.goog/Comparison?team=dartdevc#targetA%3Ddartdevc-null%3BmachineTypeA%3Dlinux-x64%3BrevisionA%3D88970%3BpatchA%3Dnshahan-FutureOr-Fix%3BtargetB%3Ddartdevc-null%3BmachineTypeB%3Dlinux-x64%3BrevisionB%3D88964%3BpatchB%3DNone

Change-Id: I44a23c7e2e1d15bc6c383fc95b19f99b584a3f7a
Fixes: https://github.com/dart-lang/sdk/issues/43990
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170001
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-11-02 21:45:09 +00:00
Gihwan Oh afa41aa3f1 Correct a typo in the documentation
`Symbol("[]=")` is identical with `#[]=` not `#[]=]`

Closes https://github.com/dart-lang/sdk/pull/43409
https://github.com/dart-lang/sdk/pull/43409

GitOrigin-RevId: 48e3c5da1c1e9e2374fbb29247244a765aef4258
Change-Id: I3da5e74b9f075094a5d3e4667a5b9b1a386d7b3f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162760
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2020-11-02 11:03:52 +00:00
Matthew Lloyd 30ba97bb1b Fix remaining instance where DateTime accesses the private member _value
This does not work if the DateTime accessed is an implementation of
the DateTime interface, rather than an instance of the same class.

Related issues:

* https://github.com/dart-lang/sdk/issues/34962
* https://github.com/srawlins/timezone/issues/57

Related changes:

* https://dart-review.googlesource.com/c/sdk/+/81828

Closes https://github.com/dart-lang/sdk/pull/42351
https://github.com/dart-lang/sdk/pull/42351

GitOrigin-RevId: 877ae83867a37c402ae5057471fa283eebd8891c
Change-Id: I91205292bb91d7958c4b3687135a8152d6ebbe6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151322
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2020-11-02 10:35:42 +00:00
Alexander Aprelev da133e5047 [io/file_watch] Don't attempt to close already closed DirectoryWatchHandle.
Fixes https://github.com/dart-lang/sdk/issues/43941

TEST=Running four dart scripts in parallel that delete/watch thousands of file reproduces the failure after several minutes. After the fix it no longer reproduces.

Change-Id: I6a0a928838c676f44e747a822611b56f0ffc4841
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169601
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-10-31 01:39:33 +00:00
Karl Klose 5cc2ca1ccf Fix typo in list.length= method comment
Change-Id: I35457f926446c9b77c34d7b2a967b6d9076ba055
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169841
Auto-Submit: Karl Klose <karlklose@google.com>
Commit-Queue: Karl Klose <karlklose@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-10-30 09:47:01 +00:00
Ben Konyi d5118d5fc8 Reland "[ Service / dart:isolate ] Added getPorts RPC and 'debugName' optional"
This reverts commit f78c40e32a.

Change-Id: Id838b39afcb371d3b50f0009322ecf0fb2080894
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169461
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-10-29 02:52:03 +00:00
Emmanuel Garcia 2672eb34f6 Add Flutter plugins to the list of allowed null safety experiments
This will allow to bump the dependencies in the Flutter repo.
https://github.com/flutter/flutter/pull/69238

Change-Id: Iacf681e88790f9805d874ec8dbfeb125779b62ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169462
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-10-29 01:19:33 +00:00
Alexander Aprelev 91be377fda [io/ssl] Avoid redundant handshake call that can break ongoing handshake try-retry sequence.
This is follow-up to a6dafabb88 which introduced async handshake retry mechanism for async certificate evaluation on mac.
Introduced asynchrony could though collide with other asynchronous parts of ssl filter life cycle that also run during handshake:
reads/writes/handshake-retries.
In this cl both asynchronous parts are synchronized via future awaits.

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

Change-Id: I0b48262a8fb2c01417ea42d41d09f5ffbe78edf8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169300
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-10-28 22:28:10 +00:00
Alexander Markov 061848e97e Cleanup misc remaining references to bytecode
Change-Id: I37c2dfb29a5bc4faf1478fb31623749cb8f67d67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169502
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2020-10-28 21:51:20 +00:00
Srujan Gaddam 2fd4b4f562 [dart2js, ddc] Emit native null checks in sound mode only
Bug: https://github.com/dart-lang/sdk/issues/42536
Bug: https://github.com/dart-lang/sdk/issues/42535

Since ddc would require a potentially breaking change to emit these
checks in unsound mode without opt-in and it's currently not possible
to emit these checks only in opt-in with dart2js, both are changed
to only emit checks in sound mode. In ddc, calling convention is
changed conditionally on sound mode as well to avoid emitting
unnecessary code in unsound mode.

Change-Id: I42f7bb5a53550f4ee5412fbbbfb6ca533c393e96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169247
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2020-10-28 21:35:45 +00:00
Srujan Gaddam d4c03fbc1b [ddc] Add more descriptive error for native null assertions
Adds a .md file discussing how to disable native null assertions
in various build systems and modifies the assertion to point to it.
Adds a section for build_web_compilers.

Change-Id: I05b89dc806c480a5a16b7dc8318ec4b2224fc29e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168997
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2020-10-28 21:35:45 +00:00
Tess Strickland f78c40e32a Revert "Reland "[ Service / dart:isolate ] Added getPorts RPC and 'debugName' optional""
This reverts commit a5d4511847.

Reason for revert: Failure in test standalone_2/io/unix_socket_test on reload bots, see https://github.com/dart-lang/sdk/issues/43952.

Original change's description:
> Reland "[ Service / dart:isolate ] Added getPorts RPC and 'debugName' optional"
>
> This reverts commit b71477a2a6.
>
> Change-Id: Iba11c41e43ec8c08b48147bbd07b71a151c3d1e6
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169243
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Ben Konyi <bkonyi@google.com>

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

Change-Id: I2ac1f18fef03d29bf74df4f49a91406a26f1ce26
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169323
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2020-10-28 10:51:40 +00:00
Ben Konyi a5d4511847 Reland "[ Service / dart:isolate ] Added getPorts RPC and 'debugName' optional"
This reverts commit b71477a2a6.

Change-Id: Iba11c41e43ec8c08b48147bbd07b71a151c3d1e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169243
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-10-28 00:49:11 +00:00
Nicholas Shahan 4f630a9a16 [typed_data] Remove specific Errors from docs
Documentation should not reference specific errors thrown and
tests/user code should not depend on them, only that some Error
is thrown. See discussion in issue.

Issue: https://github.com/dart-lang/sdk/issues/43196

Change-Id: I240302b37fade629c5942aa0e8a13e6f373dfd8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163404
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-10-27 18:25:52 +00:00
Clement Skau c486a07b02 [VM] Fixes yield* exception handling in sync*.
This adds a mechanism similar to that used in async functions where
exceptions are caught in the synthetic code and passed into the
generated body to be rethrow'n.
This ensures the exception is throw'n from the same place as the
original yield*, as per the spec.

Bug: https://github.com/dart-lang/sdk/issues/42466
Change-Id: I054b9db568a49b046b6bb49f3e775bf093f83950
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160221
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-10-27 06:46:27 +00:00
Ben Konyi b71477a2a6 Revert "[ Service / dart:isolate ] Added getPorts RPC and 'debugName' optional"
This reverts commit 5bf9163e1b.

Reason for revert: Tests failing on bots.

Original change's description:
> [ Service / dart:isolate ] Added getPorts RPC and 'debugName' optional
> parameter for ReceivePort and RawReceivePort
>
> This change collects additional information related to ReceivePort
> allocation locations and an optional debug name that will be displayed
> by tooling. ReceivePort is now a special InstanceKind and a ReceivePort
> @Instance will include the port ID, allocation stack trace, and debug
> name.
>
> Change-Id: I003cfff2b7649218e37d9b653c0e953df5d992e7
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167902
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

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

Change-Id: I39c3abb07c8c40c158eb4549749b076399bccce9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169160
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-10-27 03:14:30 +00:00
Ben Konyi b9f83d1988 [ dart:io / Service ] Added socketProfilingEnable RPC to dart:io service
extensions

This is a replacement for startSocketProfiling and pauseSocketProfiling
which are now deprecated in favor of this single setter/getter RPC.

Also added a SocketProfilingStateChange event that is sent on the
Extension stream when socket profiling is enabled or disabled.

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

Change-Id: Ie3d7bb8cddaa935de3725ee95a39a17d0588e66f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169140
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Kenzie Schmoll <kenzieschmoll@google.com>
2020-10-26 23:15:57 +00:00
Ryan Macnak b10f25ed26 [vm] Remove _Closure._clone.
Dead since 2359f4dc68.

Change-Id: Ifacf0e3273af61c774be4d461bc24a63ba081c3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169142
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-10-26 23:14:07 +00:00
Ben Konyi 5bf9163e1b [ Service / dart:isolate ] Added getPorts RPC and 'debugName' optional
parameter for ReceivePort and RawReceivePort

This change collects additional information related to ReceivePort
allocation locations and an optional debug name that will be displayed
by tooling. ReceivePort is now a special InstanceKind and a ReceivePort
@Instance will include the port ID, allocation stack trace, and debug
name.

Change-Id: I003cfff2b7649218e37d9b653c0e953df5d992e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167902
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-10-26 23:09:47 +00:00
Kevin Moore 063c3ede72 Update pkg dependencies on pkg:analyzer
Now `pub get` actually succeeds on `pkg:front_end`

Change-Id: Ifdab9d6741efba034ecd56f27fd83e288267e46c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168662
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Kevin Moore <kevmoo@google.com>
2020-10-26 19:30:06 +00:00
Lasse Reichstein Holst Nielsen 51f8304b71 Add documentation to the Type class.
Change-Id: I32986b440d1c45d3d2a6314c03ff8864e0dcac85
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108804
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2020-10-23 12:41:52 +00:00
Lasse Reichstein Holst Nielsen f264f6a451 Fix bad DartDoc in Set.toSet documentation.
Change-Id: I1801d4d8f3f25c76885f3482ae1553d32e6ee15b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168828
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2020-10-23 11:18:12 +00:00
Clement Skau 7f0bd5e811 [VM] Removes _Future's and _StreamImpl's _awaiter.
Changes debugger.cc to use the 'lazy async stack' mechanism for
unwinding async stacks, which means we no longer have to manually
keep track of the caller.

This also allows us to get rid of _asyncStarListenHelper.

Bug: https://github.com/dart-lang/sdk/issues/42457
Change-Id: I536e9da4af275998140ae5f05e3a43e07c77cfc7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167561
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-10-21 12:38:23 +00:00
Lasse Reichstein Holst Nielsen 48c73d82bf Clean up annotations and update @override documentation.
Fixes #43622

Bug: http://dartbug.com/43622
Change-Id: I4adea2995146ecd317d5c90a514cb564afa4f846
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165800
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-10-20 15:56:13 +00:00
Nicholas Shahan 6959e8f5be [ddc] Optimize constructor access in getType()
Change-Id: I08c667d07ffb25d15b7e3861fa60fd36fe6e4f08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166924
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2020-10-16 21:21:42 +00:00
Nicholas Shahan d20eac8f44 [ddc] Update signatures in runtime lib
Change-Id: Ic298f48c7c341ff5f3e582b3fbd0031a5aa386d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166941
Reviewed-by: Mark Zhou <markzipan@google.com>
2020-10-16 21:21:42 +00:00
Nicholas Shahan 6b84ac8d0f [ddc] Optimize creating native typed data lists
Connect the type hierarchy with the missing (compared to the
dart2js versions) of the JSMutableIndexable class.

Avoids an extra copying of all data to a temporary list during
the construction just to get access to the index operator.

Change-Id: I8a9f8ba4d956ac49d6fb635709d11a6e7c018270
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166782
Reviewed-by: Mark Zhou <markzipan@google.com>
2020-10-16 21:21:42 +00:00
Nicholas Shahan 0376746d84 [ddc] Optimize list operations
Avoid redundant element casts and checks if the list is growable.

Change-Id: Ib915ccf2ec65fbe7d32ecaabe23899f2530617c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166781
Reviewed-by: Mark Zhou <markzipan@google.com>
2020-10-16 21:21:42 +00:00
Lasse R.H. Nielsen a15025fc85 Harden StreamIterator against out-of-order events.
Users have seen event being sent *during* the `listen` call
to the underlying stream. This caught the `StreamIterator`
in an unanticipated state (subscription wasn't available yet).

Sending events during a `listen` call can currently happen
using a synchronous broadcast stream controller adding
events in the `onListen` callback.
That should be fixed so that broadcast stream subscriptions
are treated as paused during the `onListen` call like
single-subscription streams already are.

This change hardens the class against that particular malpratice,
but it's still possible to get into inconsistent states if the
`listen` call somehow manages to call back into the same
stream-iterator again. So, don't do that.

(The class also assumes that no stream will send events/call callbacks
* while paused.
* after cancelling
* after a done event
* while delivering another event.

If a stream does so, things will still crash.
It is believed that no platform stream will do any of these.)

Fixes #43779.
BUG= http://dartbug.com/43779

Change-Id: If47065cfa9a1115425fdf51b147f2ed7154fef99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167800
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2020-10-16 20:20:02 +00:00
Daco Harkes b13c37726c [cfe/ffi] Transformation changes for structs-by-value
Changes the kernel representation of structs in two ways.
1. `_addressOf` field of `Struct` gets type `Object` because it will be
   either `TypedData` or `Pointer` in structs by value CL.
2. Subtypes of `Struct` get a pragma `vm:ffi:struct-fields` which
   contains a const list of the native types of the fields of the struct
   which will be read in the VM to do compute the locations of structs
   in the target ABI.

Split off from https://dart-review.googlesource.com/c/sdk/+/140290/23
to make that CL smaller. That CL will no longer have changes to the
kernel representation of FFI code after this CL lands separately.

These changes are not consumed in the VM in this CL, but they are tested
by the expect files.

Issue: https://github.com/dart-lang/sdk/issues/36730.

Change-Id: I5d3babd5be07f78c6d2bd80bbc1fd492c51bc01f
Cq-Include-Trybots: luci.dart.try:front-end-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167280
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-10-16 11:16:02 +00:00
Johnni Winther 16f7ce8e57 [cfe] Warn on null aware access on this and static members
Closes #43703
Closes #43461

Change-Id: I861462b5fcf31d5459c17cbe1604ce285c359dec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167563
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-15 08:48:33 +00:00
Lasse Reichstein Holst Nielsen 4b531dc515 Move the Jenkins hash combination code into a shared library.
Other uses in the platform libraries can now use it from there
instead of creating their own.

Includes helper functions `hash2` through `hash10` for directly combining 2-10 hash codes.


Change-Id: I218b1c30144e39015594d6be50d3d01543702d37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167564
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2020-10-14 19:02:48 +00:00
Ryan Macnak 37ed87b038 [vm, service, observatory] Bang Bang (My Type System Shot Me Down).
Port the service tests and Observatory to Dart 3.

Change-Id: I8a8b20d8f90acd3b5f741c93f10ba99971aa0c52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154825
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-10-14 18:16:27 +00:00
Liam Appelbe cff78bed87 Reland "Switch wasmer FFI boilerplate to new API"
This reverts commit 0c3d3da6ce.

Un-deleting the LICENSE file, to fix the dart->flutter roller.

Change-Id: Iee44c24e7cdb5c03f4ae131d08451fae2e996f49
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167201
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2020-10-13 19:30:58 +00:00
Mark Zhou 34b485c0c4 [dartdevc] Warning and shorting when trying to improperly modify JS Object's prototype chain.
See bugs:
* https://github.com/dart-lang/webdev/issues/1133
* https://github.com/dart-lang/sdk/issues/43750

Change-Id: I0daa13ab56be5a2967241a5fcea63a32c0a5cde4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167220
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2020-10-13 01:23:53 +00:00
Alexander Aprelev 0c3d3da6ce Revert "Switch wasmer FFI boilerplate to new API"
This reverts commit 9d0ae7d017 as it broke dart->flutter roller's flutter license script.

Change-Id: If523b9b88631e1eca0fef3612387005921481222
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166981
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-10-10 05:56:29 +00:00
Liam Appelbe 9d0ae7d017 Switch wasmer FFI boilerplate to new API
Broadly speaking, the new API is very similar to the old one. The only
public facing change is that you can't make a memory by itself anymore.
You need to construct if from a store, which is owned by a module.

The new API no longer passes structs by value, so I was able to delete
the wasmer_wrapper.cc, and the files I had copied from the wasmer repo.

The new API is also a lot more verbose, so it made more sense to write
a script to generate the FFI boilerplate, rather that write it all
manually.

All the migrated tests that were passing before this refactor are still
passing.

Bug: https://github.com/dart-lang/sdk/issues/37882
Change-Id: I52ca54b982a27f1d851c630d3e09833b8810060c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164081
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2020-10-09 19:43:57 +00:00
Jacob MacDonald 1e450cadde Remove reference to nullable StackTrace from Stream.listen docs.
The StackTrace argument will never be null, but may be a default.

Also rewrite the type descriptions to use function type syntax instead
of the legacy argument syntax, and remove a redundant parameter name.

Bug: #43655
Change-Id: Ie91024b2a70d66c24ce29e413c811a61beae3bfc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166460
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2020-10-07 15:58:15 +00:00
David Morgan 7d00f6239a Add http, http_parser and logging to null safety allowlist.
Change-Id: Ic019c13540cfd6b6f489cef17e3d7cd18df43f81
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166020
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
2020-10-06 08:03:03 +00:00
Ben Konyi f69dc37d5c [ Service ] Redirect direct connections to VM service when DDS is connected
'flutter attach' attempts to connect to the first VM service URI it
finds in device logs so it needs to be redirected to the DDS instance.

Also added a fix that prevents a second DDS instance from connecting via
the first DDS instance.

Change-Id: Ibde4c8d4b825a180639c3406b427f977286f5724
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166121
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-10-05 20:25:52 +00:00
Oleksii Khomchenko 238b7f4e3f [corelib] _SetBase mixes SetMixin in to avoid duplicate methods
Since https://github.com/dart-lang/sdk/issues/35548 was resolved there is
no longer need to duplicate methods in _SetBase.

Change-Id: Ia4e1b0273996c5f04f2afae06e7a9633ad3f8932
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161080
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-10-05 12:05:39 +00:00
Nate Bosch 3efed86147 Allow null safety for pub_semver
Change-Id: I73e2e718feb82a11131dc8479a792bb3dbe49b6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165920
Auto-Submit: Nate Bosch <nbosch@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2020-10-02 23:58:21 +00:00
Jacob MacDonald d63d5d93a5 add flutter_driver to the allow list
Change-Id: I747999ae50a9f87a1e55bfc2f289ca2ff868f529
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165871
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2020-10-02 22:47:41 +00:00
Nate Bosch 0c544cd523 Remove reference to nullable StackTrace
Closes #43655

The StackTrace argument will never be null, but may be a default.

Also rewrite the type descriptions to use function type syntax instead
of the legacy argument syntax, and remove a redundant parameter name.

Change-Id: Icfd29ef2073cd01bc0ef6e4190fea0d5a736be5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165861
Auto-Submit: Nate Bosch <nbosch@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-10-02 18:44:40 +00:00
Alexander Aprelev a6dafabb88 [vm/io/mac] On macos/ios run trust evaluation part of ssl certification validation on separate worker thread.
Running trust evaluation system api call on worker thread effectively unblocks main isolate when it attempts to establish https connection.

Execution of the worker thread is implemented via dart native port infrastructure which allows to run C++ code as a dart message handler.
TrustEvaluateHandlerFunc (if provided by platform-dependent SSLCertContext) is that handler, only mac(ios) implementation provides it.

Asynchrony of CertificateVerificationCallback (for mac/ios) is implemented via [ssl_verify_retry] return code which allows to suspend ssl handshake until certificate trust is confirmed.
When dart's _RawSecureSocket.secureHandshake() method that initiated ssl's handshake received this return code it knows it has to wait for a future that is completed by another callback([rpEvaluteResponse]) that waits for trust evaluation handler response.
rpEvaluateResponse purpose is to listen for response from TrustEvaluateHandler and also invoke user-provided [badCertficateCallback] that can override trust decision for a given connection request, for a given certificate.
Once that future is completed and CertificateVerificationCallback knows whether to trust a certificate or not, _secureHandshake retries ssl handshake.


Bug: https://github.com/dart-lang/sdk/issues/41519
Change-Id: Ifee18639c78099ec77cad50000444bc6c7b9369b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165520
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-10-01 23:40:16 +00:00
Ben Konyi fafc1bdb85 [ VM Service / DDS ] Forward 'evaluate' and 'evaluateInFrame' requests to VM Service
Changes DDS from invoking the VM's private compilation RPCs directly
when an external compilation service is not present. This resulted in
expression evaluation failing when the VM Service implementation was
DWDS.

Change-Id: I889774f0f2e133307f490b586a68ebe609096b49
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165680
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-10-01 19:00:20 +00:00
Nicholas Shahan 94cd793f88 [ddc] Fix types of regex match results from js
The value returned from a calling `exec()` is an array-like object
where the values at valid indices can be a string or undefined
(maybe null on some browsers). Changing the element type of the
list to `String?` better reflects that.

As far as I can tell this isn't a problem now because we still treat
local variables initialized with a method call as nullable so the
value is always null checked.

I'm working on a change to start trusting the return type when running
with --sound-null-saftey that exposed the errors in the explicit types.

Change-Id: Ia98fd64549f572a51f0060da3508f4f69557e56c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165440
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-10-01 18:02:10 +00:00
Ben Konyi 9c1adbd8c5 [ dart:io / package:vm_service ] Change parameter name for httpEnableTimelineLogging enable -> enabled
This is a backward compatible change that will continue to accept the
old parameter name.

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

Change-Id: I4e7a9d8d14921784e9d1c8693ae2252cf5f023e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165623
Reviewed-by: Kenzie Schmoll <kenzieschmoll@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-10-01 17:17:58 +00:00
Wenny Yustalim a833dc81e1 Fix moveNext() documentation typo
Closes https://github.com/dart-lang/sdk/pull/43406
https://github.com/dart-lang/sdk/pull/43406

GitOrigin-RevId: 2a2b506d94caa1102dc610d749722f91b9eef417
Change-Id: I1bdd57ec626caeab411caba7367567e2b967a848
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162631
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2020-10-01 15:51:30 +00:00
Filip Hracek 7e7c01e804 Follow HTTP 308 redirects
Fixes https://github.com/dart-lang/sdk/issues/43548.

Bug: 43548
Change-Id: Ifd07941f4ae3ef9c9874c1be4254a2fe3c15ae2c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165404
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-10-01 14:02:40 +00:00
Mark Zhou 33044ddd9a [dartdevc] Resetting lazy js types on hot restart
Fixes https://github.com/flutter/flutter/issues/66361

Change-Id: I4e68963a36c71bb4dac964d8b0fdcd8ee9187e97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164101
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2020-09-30 00:08:23 +00:00
Mayank Patke 712b9254be [dart2js] Add missing debugName parameter to Isolate.spawn.
Fixes: https://github.com/dart-lang/sdk/issues/43581
Change-Id: I8d9517f04694e81c04d2eda7e743d85347cc423c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164940
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2020-09-30 00:00:19 +00:00
Nate Bosch 6a89415451 Allow nullsafety for package:intl
Change-Id: Iad9a67de93f1850105442441b47001e53748fd22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164802
Auto-Submit: Nate Bosch <nbosch@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
2020-09-29 20:47:39 +00:00