Commit graph

9969 commits

Author SHA1 Message Date
Devon Carew ee1774ca6c several minor edits to various dart-lang/sdk files
Change-Id: I62e5b46811ef5d4d4f280a9e334ba87a355bc1cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205302
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2021-06-29 17:47:48 +00:00
Janice Collins 6876eb83b6 Correct a link error that snuck in after the last pass.
Change-Id: I71fa21ef33e7726f8b663809c605c9a2a8dfe6da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205300
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2021-06-29 17:12:30 +00:00
Janice Collins f899fd1310 Update SDK documentation for new lookup code.
This fixes existing problems in the SDK documentation, and corrects
expressions that were invalid but ignored in the previous version of
dartdoc.

Change-Id: Ic06b6bce7a886f8e5ce797594d37e382fe37bd40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205068
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2021-06-28 17:33:30 +00:00
Hoylen Sue 4b82a5f5c2 Added documentation about out-of-range components to DateTime.parse.
The [DateTime.parse](https://api.dart.dev/stable/2.10.4/dart-core/DateTime/parse.html) method accepts out-of-range components. For example, parsing the string "2020-01-42" produces "2020-02-11".

This was raised as a bug in https://github.com/dart-lang/sdk/issues/11189, but after more than 7 years that issue was closed with the solution being "use parseStrict from the intl package" instead.

This pull request simply **updates the documentation of DateTime's _parse_ method** so that users know:

1. This is how the method behaves. Otherwise they might be surprised when it unexpectedly happens in their code.
2. This behaviour is a feature and not a bug. Otherwise they might raise another issue for it.
3. The _parseStrict_ method in the intl package exists. Otherwise they might reinvent the wheel.

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

GitOrigin-RevId: a88ada479d6664cac69a6dc44de3fe2a41f8e9be
Change-Id: Ic45e4db118bd3fad3a612659a35ca7a5d80937b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176680
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-06-28 06:45:51 +00:00
Mayank Patke 58ad941a5a [dart2js] Fix interface subtyping bug.
Previously, when checking S <: T, we only checked if S and T had the
same interface name once. However, it's possible that redirections
eventually cause them to become equal. For example, if S is an interop
type and T is JavaScriptObject, after following the redirection from S
to JavaScriptObject, we end up checking JavaScriptObject <:
JavaScriptObject. Therefore, we need to recheck after following each
redirection.

Change-Id: Ie3eb9530627a0e48a5ea704fd4078ae238a65c78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204744
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-06-25 22:34:06 +00:00
Stephen Adams 3d081f907a [dart2js] Clean up tear-off code
- Simplify tear-off signatures
- Make BoundClosure have consistent Dart receiver
- Use receiver/interceptor terminology rather than self / self+receiver

Change-Id: Ifb6c52cc7a9475b79e468efb19eb76f70ec5cd09
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204680
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-06-25 21:51:20 +00:00
Nicholas Shahan e2cb0b8553 [ddc] Fix function apply arguments list
- Fix default value assignment when passing a list of positional
  arguments that isn't a dart:core `List` at runtime.
- Fix modification of the original list passed as positional arguments
  when also passing named arguments.

Change-Id: I3aef6b1584f159c92251b963ffb927e1f75d3472
Fixes: https://github.com/dart-lang/sdk/issues/46457
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204900
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-06-25 15:44:15 +00:00
Lasse R.H. Nielsen 43cff26365 Add supertype to enum classes.
TEST= language/enum/enum_test

Change-Id: I83b7fd1c29103c3aa4dc7ad3e41141fb8c62339e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203564
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-06-25 14:08:16 +00:00
Lasse R.H. Nielsen 83376bf1ee Add Object.hash and Object.hashAll static helper methods.
Fixes #11617.

Bug: http://dartbug.com/11617
Change-Id: Id06fb5b3914bee24713427edbd3b9b7e86f86449
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/73360
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-06-25 11:40:35 +00:00
Stephen Adams 8fda1d6cf3 [js_runtime] Don't modify inputs to Function.apply
In some cases adding default arguments modified the 'positional'
arguments input List.  Since there are 'accelerated' paths for small
numbers of arguments, this bug did not show in any other tests.

Change-Id: I5075c96ecfdc9645b85b9beeeb38305415153d20
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204747
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2021-06-24 03:29:38 +00:00
Mayank Patke 3405b94338 [dart2js] Remove Symbol.validated.
Bug: https://github.com/dart-lang/sdk/issues/46397
Fixes: https://github.com/dart-lang/sdk/issues/46397
Change-Id: I307f486deb7afe72c347bfeb6779cb9389d1ff13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204601
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2021-06-23 20:58:18 +00:00
Mayank Patke c015e02180 [dart2js] Fix spurious ! in ConstantMap.
Change-Id: I45ab75005c4f3d658c476886ede3ba37dbb067e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204625
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-06-23 18:30:11 +00:00
Stephen Adams 11991056b6 Specialize closures for 0 and 2 arguments
Change-Id: Ia21249cb9671960eb3e0d96afef5e5efb8ba7ee2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105200
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2021-06-23 16:54:41 +00:00
Lasse R.H. Nielsen f89ed9bfc3 More elaborate error when a future error handler returns something of the wrong type.
Bug: https://github.com/dart-lang/sdk/issues/44386, https://github.com/dart-lang/sdk/issues/41313
Change-Id: I87b10c3cd03475f4cd80b7a7c5cba6a558167748
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175062
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-06-23 11:25:25 +00:00
Ben Konyi 3a4b3514bc [ VM / Service ] Add UserTag support to C-API and send UserTagChanged
events on Developer stream.

Also removes intrinsic implementations for UserTag_makeCurrent to allow
for service events to be sent on UserTag change.

TEST=DartAPI_UserTags,pkg/vm_service/test/user_tag_changed_test.dart

Change-Id: I5dc9ee77c0048590d3c6e33a652eee5bc3bf522a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204440
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-06-23 00:58:47 +00:00
Nate Bosch 1948bd6109 Add fixes for HttpStatus constants
Add rename migrations for all the screaming snake case constants that
were renamed to lower camel case during the Dart 2 migraiton.

Rename the test from `file.dart` to `io.dart` so that we can test all
deprecations for the same import together. Add a test for the same
deprecations when imported through `dart:html`.

Change-Id: Iee91d88b1b11648e8c65cfcc8d2fcfabac3954ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203820
Auto-Submit: Nate Bosch <nbosch@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2021-06-22 23:39:57 +00:00
Lasse R.H. Nielsen 902f149e2c Add unawaited function and ignore extensions member.
The `unawaited` function in `dart:async` is intended for use with the `unawaited_futures` lint which is hopefully going to be part of the Dart recommended set of lints.

The `ignore` extension method is there to provide an alternative if you even want to ignore errors from a future. By having both, it makes the distinction clearer and makes it easier to not think one can be used for everything.

Change-Id: Ib96ed5ff64ead4b228721e5210efa82f76119c9f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200428
Reviewed-by: Jacob Richman <jacobr@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-06-22 20:03:13 +00:00
Lasse R.H. Nielsen 19252d5786 Fix behavior for -infinity width/height of rectangles.
Fixes #30186
BUG= dartbug.com/30186

Change-Id: I2994d180a4dc4d4e4bba7edec67bc2bcc2e8fc0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201568
Auto-Submit: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2021-06-21 13:29:39 +00:00
Jason Simmons 2f9f746d83 Fix a typo in the Object docs (exception -> except)
Change-Id: Ie160e4b7daa2f989e23edf9f5248b612681d285e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204262
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-06-19 11:19:13 +00:00
Martin Kustermann 2ed0bb3596 [vm/concurrency] Allow rehashing of linked hashmaps that contain deleted entries
When rehashing linked hash maps we'll allow rehashing of hashmaps that
have deleted entries in them. This avoids making assumptions about the
state of a linked hashmap object at the time when it's transitively
copied.

It was split out of a follow-up CL that adds transitive object copies,
which will copy linked hashmaps as they are.

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

TEST=Existing test coverage.

Change-Id: Ia844a14a3893e2416a11fa99d9de38025d6fac7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203773
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-06-18 05:58:11 +00:00
Tomasz Kontusz b14e5ed355 [doc] setTrustedCertificates doesn't replace certs
With the previous wording, "Sets the set of ... certificates", I've assumed it always replaces everything in the store (at least on non-iOS).
This change should make it clear that the certificates are added.

(See also bc2cf88bac/runtime/bin/security_context.cc (L181) for the actual implementation).

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

GitOrigin-RevId: 04d6cdece5f707af3e4d74aca983e4025fcc6cde
Change-Id: Ib3d3dcf41b78cb3925947d58e5c980b7bb82f331
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203720
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2021-06-16 08:35:05 +00:00
Nicholas Shahan c83eeac5b8 [ddc] Avoid sending messages to console.debug
Calling `postEvent()` or `registerExtension()` from the
dart:developer library now sends messages via global functions
that can be set by the development infrastructure. For example,
these hooks are set by package:dwds.

When there is no debugger attached to the app, calling `postEvent()`
or `registerExtension()` will produce a warning once each to avoid
spamming the debug log with messages that do nothing.

For backwards compatibility, when a debugger is attached but the
hooks have not defined continue to write the events to the
console.debug log. This support will be removed when package:dwds
no longer reads from the log.
https://github.com/dart-lang/webdev/issues/1342

Change-Id: I126446666b5a85c68424546b8b1198d1582bba74
Issue: https://github.com/flutter/flutter/issues/75225
Fixes: https://github.com/dart-lang/sdk/issues/36143
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202540
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Gary Roumanis <grouma@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-06-15 23:28:03 +00:00
Stephen Adams 8a60ce9e6d [dart2js] Pass tear-off parameters in an object
- Pass tear-off parameters in an object rather than a large number
  of variables.

- Reduce number of fields for BoundClosure. This speeds up tear-off
  creation 7-20%

-

Change-Id: Idf5313d5709a098cd5c877871417304f4e4c5b56
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203445
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-06-15 22:19:13 +00:00
Clement Skau a7210551ca [VM] Nit: rename var with keyword name "native"
Change-Id: Id612c11d21f67734a95aaafd6ff19a017e44dd32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203681
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2021-06-15 11:07:50 +00:00
Clement Skau 2f916ad807 [vm/ffi] Adds @FfiNative() support
Adds support for marking external functions as @FfiNative's,
which will be called using fast FFI calls.

Resolution happens by calling out to a new embedder provided
Dart_FfiNativeResolver which the embedder can specify via
Dart_SetFfiNativeResolver.

TEST=vm/cc/DartAPI_FfiNativeResolver

Bug: https://github.com/dart-lang/sdk/issues/43889
Change-Id: I3cfff360b05314499a81444b90f4ea0a1b937b0b
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170092
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-06-15 05:58:39 +00:00
Gabriel Castro 820ba59dda [html] Fix nested JS Map to Dart assignment
Added check to convertNativeToDart_Dictionary to recursively convert native objects within a map to their Dart equivalent.

Fixes: https://github.com/dart-lang/sdk/issues/44319
Change-Id: I80a2bc0541454900b1c7d9635debaf72d7c120f2
Bug: 44319
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201200
Commit-Queue: Gabriel Castro <gabrielmcastro@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2021-06-14 21:18:08 +00:00
Lasse Reichstein Holst Nielsen fdcc930bd0 Update String.split documentation.
Fixes #46280
BUG= http://dartbug.com/46280

Change-Id: I8425cb71fb3cdf97bd59ad48232f0ebb07878e3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202771
Auto-Submit: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-06-14 19:15:07 +00:00
Martin Kustermann 65bca53b6e [vm] Avoid going to runtime for String.split()
This makes the small benchmark on the github issue more than 2.5x
faster.

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

TEST=Existing test suite.

Change-Id: I82c53b3553e04f2afe23606b09b3199cb9b6a926
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203502
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2021-06-14 14:41:33 +00:00
Lasse Reichstein Holst Nielsen 2951e33b24 Add extra documentation on asBroadcastStream.
Fixes #30395
BUG= https://github.com/dart-lang/sdk/issues/30395

Change-Id: I887b4b5882b9f4801f29690c2d039941eb99efd1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201567
Auto-Submit: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-06-14 09:44:42 +00:00
Alexander Aprelev 52aa8508f1 [io/stacktraces] Ensure websocket connect reports callers stacktrace.
Introduce dwarf-friendly socket connect stacktrace test.

TEST=socket_connect_dwarf_stacktrace_test

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

Change-Id: I428ac4b334d9d80ea06c64283ece3ff411abfa19
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203160
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-06-10 16:16:50 +00:00
Stephen Adams 8ee467361b [dart2js] Fix for #46175
Pass compile-time shadowing information through tearoff code, rather
than trying to feature-test for potential overrides of the method
accessed via a super-getter.

Bug: 46175

Change-Id: Idca8e440cf12bb6cbae020f305763575e6a37b08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202803
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-06-10 03:30:09 +00:00
Ryan Macnak 84e6d4a4e8 [vm] Make use of the new TypedDataBase to avoid redundant code in the runtime.
Reduces VM code size by about 18k.

TEST=ci
Change-Id: Ic0dbdb6a7807a0f0d37333c6f32bed5cb3e7b905
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202543
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-06-08 19:15:38 +00:00
Alexander Aprelev 80749188ca [io/socket] When socket connection fails report stacktrace of the callsite.
Currently stack trace reported on thrown exceptions is null.

TEST=socket_connect_stacktrace_test.dart

Bug: https://github.com/dart-lang/sdk/issues/44994
Change-Id: I188aff197ab519272f63f41387b94458c2f1cec7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202802
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-06-08 16:17:47 +00:00
Lasse Reichstein Holst Nielsen 1154efb073 Fix null-safety migration bug in VM version of fuse JSON-UTF-8 decoder.
A JSON value can be `null`, so the return type must be `Object?`, not `Object`.

Fixes #46205.

Bug: http://dartbug.com/462051
Change-Id: I9a5522e09765457dcf8cd2639abbe385d97a3186
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202623
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-06-07 11:43:02 +00:00
Alexander Aprelev 3cd209692c [io/android] Enable file watching on Android.
Fixes https://github.com/dart-lang/sdk/issues/46261
File watching was partially disabled on android despite working as expected with
minor detail that [read] from inotify returns -1 at the end of the stream.

TEST=file_system_watcher_large_set

Change-Id: I4ce7a89ab1e531d91b62d0363ebc36f919d5b8a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202500
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-06-05 01:33:27 +00:00
Sigmund Cherem 80160d3efb [dart:html] add syntax highlighting to code blocks
Change-Id: I7dc008c01e776be8010da4845b3dc95643e34194
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202401
Auto-Submit: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2021-06-04 01:07:35 +00:00
Alexander Aprelev 6c254fab89 [io/http] Don't add zero-valued content-length header on GET, HEAD, DELETE, CONNECT requests.
Per https://tools.ietf.org/html/rfc7230#section-3.3.2:
"... A user agent SHOULD NOT send a
Content-Length header field when the request message does not contain
a payload body and the method semantics do not anticipate such a
body."

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

Change-Id: I96b735c06038eb3d12a303ee5329228a9b594726
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194881
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2021-06-03 16:14:24 +00:00
Robert Nystrom 4333b3db98 Add deprecation warning to dartfmt.
Change-Id: I7c67041fc84cddbc44b54e629eee79548fd6566b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202144
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
2021-06-03 10:11:24 +00:00
Mayank Patke 93c96d5857 [dart2js] Implement basic lowering for late instance variables.
This feature is gated behind the --experiment-late-instance-variables
flag.

Change-Id: I1ecb2d4d960b58204207ea055361463efa3a0bcb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200922
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-06-02 23:21:24 +00:00
Stephen Adams d3d6c86fe1 [dart2js] Migrate shared libraries to 2.12
Change-Id: I5600fe01e90963b56a6ffa36ec9edf0096088b2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202000
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-06-02 21:41:34 +00:00
Simon Binder be893fdf27 [vm/ffi] Add providesSymbol to DynamicLibrary
This adds the providesSymbol method to DynamicLibrary. It returns
whether the library contains a function with the given name.

As per dlsym(3), it is valid for dlsym to return nullptr in a success
case if the symbol actually has a NULL value. So I've changed the logic
to check for dlerror() after we invoke dlsym(), both in the existing
lookup and in the new method.

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

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

Change-Id: Ibcb1c051cc0cdd95a104fe86ef2fc76da5bafb5d
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm64-try,vm-ffi-android-debug-arm-try,vm-kernel-linux-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-mac-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201900
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-06-02 16:01:43 +00:00
Jason Simmons b67de429e0 Move the frontend server snapshot into the platform SDK
Change-Id: I15bfa8690fe792a4f0c4ac66a337fdc9c2647626
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201920
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2021-06-01 21:05:35 +00:00
Ryan Macnak ab91ef643c [vm] Remove code dead since the type 'int' stopped supporting integers.
Change-Id: I72e1760a8172d8486b634abddbfc1ca8759a375c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197441
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-06-01 17:18:33 +00:00
Riley Porter f08edad8ce Optimize js_util setProperty calls for non-function values to
_setPropertyUnchecked version that can be inlined.

No change in the generated JavaScript for dart2js.

Change-Id: Ie4a8e5a34826b6c9083d34656aaa27050635cb21
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200933
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>
2021-05-25 19:28:01 +00:00
Stephen Adams 7572e5ba4a [js_runtime] Speed up 'is List' test on negative path
Change-Id: Ie8849837a394724fb3e8419eacc283d8cd370d69
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201229
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-05-25 18:03:01 +00:00
Michael Thomsen cac00e9d95 Add deprecations notices to dart2native
Related to: https://github.com/dart-lang/sdk/issues/46100

Change-Id: I2bcd4aadfbc96fa6ba265aec04cd60e3e81eef41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199429
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2021-05-25 13:20:30 +00:00
Clement Skau 4d5055805f [VM/FFI] Adds FFI leaf calls.
This CL adds FFI leaf calls by adding `lookupFunction(.., isLeaf)`
and `_asFunctionInternal(.., isLeaf)`, which generate FFI leaf calls.
These calls skip a lot of the usual frame building and generated <->
native transition overhead.

`benchmark/FfiCall/` shows a 1.1x - 4.3x speed-up between the regular
FFI calls and their leaf call counterparts (JIT, x64, release).

TEST=Adds `tests/ffi{,_2}/vmspecific_leaf_call_test.dart`. Tested FFI tests.

Closes: https://github.com/dart-lang/sdk/issues/36707
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-release-arm64-try,vm-ffi-android-release-arm-try,vm-ffi-android-product-arm64-try,vm-ffi-android-product-arm-try,vm-ffi-android-debug-arm64-try,vm-ffi-android-debug-arm-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-release-x64-try,vm-kernel-mac-debug-x64-try,vm-kernel-precomp-nnbd-mac-release-simarm64-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-precomp-asan-linux-release-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,vm-kernel-precomp-ubsan-linux-release-x64-try,vm-kernel-precomp-tsan-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try
Bug: https://github.com/dart-lang/sdk/issues/36707
Change-Id: Id8824f36b0006bf09951207bd004356fe6e9f46e
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179768
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-05-21 11:12:02 +00:00
Alexander Aprelev 8d54a30825 [io/http] Introduce callback that embedder can override to provide custom HTTPClient connection validation.
For example, this can be used to ban insecure http connections, force use of https ones - see https://github.com/flutter/engine/pull/26226.

Issue https://github.com/flutter/flutter/issues/69685
Issue https://github.com/flutter/flutter/issues/54448

Change-Id: Id81aeae9aff0d469ac6f911e4e502b39ce9558bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200524
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2021-05-20 15:17:52 +00:00
Daco Harkes 413abf0d82 [sdk] Recover folder structure in include folder 2
Such that runtime/include/internal/dart_api_dl_impl.h ends up in
include/internal/dart_api_dl_impl.h in the sdk release.

Long explanation:

https://dart-review.googlesource.com/c/sdk/+/164320 tried to recover the
folder structure but failed to do so correctly. It put
runtime/include/internal/dart_api_dl_impl.h in
include/runtime/dart_api_dl_impl.h rather than
include/internal/dart_api_dl_impl.h.

The gn copy action only supports a single `outputs` string.
https://gn.googlesource.com/gn/+/HEAD/docs/reference.md#var_outputs

This string can have 'placeholders'.
https://gn.googlesource.com/gn/+/HEAD/docs/reference.md#placeholders

The only placeholder that preserves the original folder structure,
without also nesting deeply inside folders is `source_target_relative`.

If `source_target_relative` inside sdk/BUILD.gn it starts including
`runtime/include/` in its path. So the only way to achieve the correct
copy is by doing it in runtime/include/BUILD.gn.

TEST=Manual testing, we don't have tests verifying the SDK structure.

Change-Id: I9d503626266edcdd8417f5cafb0f8ff9746f89f7
Cq-Include-Trybots: luci.dart.try:dart-sdk-linux-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200866
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-05-20 13:54:42 +00:00
Lasse R.H. Nielsen cf627eb01c Change signature of HttpClient.authenticate{,Proxy}.
Allow the `realm` argument to callbacks to be `null`.
This is a breaking change, but it only affects null-safe code.

Also fix a bug in http_impl.dart where an error function with
an *optional* stack trace parameter would be called without a stack trace.

Bug: https://github.com/dart-lang/sdk/issues/44039
Change-Id: I4b38382328e26478661bf45f46cd3017631f4ebd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170094
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-05-20 13:13:42 +00:00
asiva 6f2eeae1a4 [sdk] - Fix for issue 46050 (Allow spaces in environment constants)
TEST=Manual command line test

Change-Id: I0e6e70093df32b4878b32b91ab101af5ffb8d1a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200661
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2021-05-19 19:09:02 +00:00
Stephen Adams cb23be0b5f [rti] Specialized is List<dynamic> test
Change-Id: I7ded143b8316a5b3f78f8fe358cf7341f42d8ddd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200288
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-05-19 01:12:43 +00:00
Lasse R.H. Nielsen 59526f4311 Address missed comments from CL https://dart-review.googlesource.com/c/sdk/+/200189
Change-Id: I54baa2ca802c6524ddf5baf9c205d5c6bb2e9779
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200223
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-05-18 11:00:14 +00:00
Jacob MacDonald 4da697ce56 fix todos linked to issue #38725
Change-Id: I06fd71b4027673105be8a3219af61fbc9b93e216
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200282
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2021-05-17 20:51:52 +00:00
Alexander Aprelev 0aeb8731e5 [vm] Use recognized method for has63BitSmis, drop static final field.
This should improve performance of lightweight isolates configuration

TEST=ci, perf benchmarks

Change-Id: I98ac9a7e02318d58db3431a6d33f08ab95e607fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199700
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-05-17 17:22:13 +00:00
Lasse R.H. Nielsen c88d8163c0 Update documentation for num.operator< and other members.
Fixes #46015.

Bug: http://dartbug.com/46015
Change-Id: I6a8b245e10c644df84f767df4f24404b332af9b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200189
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-05-17 16:56:22 +00:00
asiva fb90f11f4b [dart:io] - Fix incorrect setting of socket options for UNIX-DOMAIN sockets
- setting of UNIX-DOMAIN socket options was not throwing the correct error
- listen in HTTPServer was trying to set TCP_NODELAY for UNIX-DOMAIN sockets

Fixes :
 https://github.com/dart-lang/sdk/issues/45977
 https://github.com/dart-lang/sdk/pull/45978
 https://github.com/dart-lang/sdk/issues/45975

TEST=new test cases added

Change-Id: Ie0341f26b1ba0f9423c08a8de968053a2af1c730
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199640
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2021-05-14 01:53:48 +00:00
Joshua Litt b8a1cd4850 [dart2js] Cleanup obsolete 'getGlobalFromName' builtin.
Change-Id: Ie2b0f586fedbd183ea98b08fc766d5acf52d9e7b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198881
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2021-05-13 20:47:38 +00:00
Kenzie Schmoll a0de473efd Update UserTag class documentation to point to DevTools instead of Observatory
Change-Id: I3814bc4cf1485d78409bd358fb62df9794c824ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199740
Reviewed-by: Kenzie Schmoll <kenzieschmoll@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Kenzie Schmoll <kenzieschmoll@google.com>
2021-05-13 19:19:55 +00:00
Jonas Finnemann Jensen 47f88b5ff3 Removed 7zip from Windows distribution of the Dart SDK
Bug: https://github.com/dart-lang/pub/issues/2939
Change-Id: I30148017e33a4d7af99102bd98b99e70d5641478
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199250
Commit-Queue: Jonas Jensen <jonasfj@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2021-05-12 14:50:50 +00:00
Mayank Patke 2d62f325a2 [dart2js] Add a flag to omit names for late cells.
Change-Id: I67125e35b5339697b97738dd0c5540fe7a773510
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199300
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-05-12 14:02:10 +00:00
Lasse R.H. Nielsen a5e18113f3 Remove references to triple-shift and generic-metadata experiments.
TEST= removed flags from test. No behavior should change.

Change-Id: I401bfb68c082d1bd405a118d5eca6a47a807945f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199241
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2021-05-12 13:35:00 +00:00
Sigmund Cherem 460887d814 [web] Replace DDC's expando implementation
DDC now uses WeakMaps, just like dart2js. This ensures that expandos
will also continue to work properly after a hot restart.

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

Change-Id: I89799b4da9cb7827500a14dcdc2aff7c5e6afa03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199222
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2021-05-11 22:14:28 +00:00
Sigmund Cherem 7a18ef405e [web] Cleanup dart2js implementation of expandos.
This removes the feature detection of WeakMaps and no longer uses a raw
field to implement an expando. This is because WeakMaps are supported in
all browsers we currently support, and are also supported in IE11.

Change-Id: Ia0bc8261a3eb3dd4fad8cba5d0a2abecd1d3ecc0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199220
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-05-11 22:14:28 +00:00
Ben Konyi b99466d472 Reland "[ VM / DDS / CLI ] Add DevTools support to the standalone VM"
This reverts commit 5cbf10febe.

TEST=pkg/dds/devtools_observatory_connection_test.dart

Change-Id: I682d009f784b930094dae9b7d4e9a66efffb6ee8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198561
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-05-11 17:55:26 +00:00
Lasse R.H. Nielsen f5a1dd57a1 Change parameters named f to something longer on Iterable.
Remove some unnecessary `new`s while here.

Bug: http://dartbug.com/30399
Change-Id: Ie5665fc680bcd25a74dd765ef68dc88e2c54b671
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192385
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-05-10 15:03:20 +00:00
Lasse R.H. Nielsen 5b64d1233b Fix null-safety migration error in CastMap.
Make expect use `Never` to signal non-completion instead of depending on `meta`.

Change-Id: Ibb4230e6b0cfbf995ad91a31c6620525cf6a8918
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194244
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-05-10 14:15:07 +00:00
Stephen Adams b7d2dbe9b5 [js_runtime] Cleanup some dynamic calls
Change-Id: I7fe4dab27f1d6fb2e52a171bd8f373c3decc0b7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197562
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-05-07 22:47:47 +00:00
Ben Konyi 5cbf10febe Revert "[ VM / DDS / CLI ] Add DevTools support to the standalone VM"
This reverts commit ef0e4ea107.

Reason for revert: Flutter HHH and golem builds are red. Rolls to Flutter are failing.

TEST=N/A

Original change's description:
> [ VM / DDS / CLI ] Add DevTools support to the standalone VM
>
> Example output on stdout when DevTools is enabled:
>
> Observatory listening on http://127.0.0.1:8181/CzkZzZaONW4=/
> The Dart DevTools debugger and profiler is available at: http://127.0.0.1:8181/devtools/#/?uri=ws%3A%2F%2F127.0.0.1%3A8181%2FCzkZzZaONW4%3D%2Fws
> hello world!
>
> vm-service: isolate(1674461414267555)  'main' has no debugger attached and is paused at exit.  Connect to Observatory at http://127.0.0.1:8181/CzkZzZaONW4=/ to debug.
>
> TEST=pkg/dartdev/test/commands/run_test.dart
>
> Change-Id: Icd1afda87ad4a46f228125d53094d10adf8056ec
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188361
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>

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

Change-Id: I50e8dc4e592e13b44c2fb980b2029d5c5cc3ad2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198381
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-05-05 20:31:07 +00:00
Nicholas Shahan 0c53b5999c [ddc] Remove unnecessary call to addTypeCaches
The `makeGenericType` closure is not actually used as a type so the
caches are not needed.

The caches are already added to the type in body of `typeConstructor`
that gets called on line 236.

This change showed no notable differences in performance:
Weak:
https://golem.corp.goog/Comparison?repository=dart&team=dartdevc#targetA%3Ddartdevc%3BmachineTypeA%3Dlinux-x64%3BrevisionA%3D92073%3BpatchA%3Dnshahan-generic-perf%3BtargetB%3Ddartdevc%3BmachineTypeB%3Dlinux-x64%3BrevisionB%3D92073%3BpatchB%3DNone
Sound:
https://golem.corp.goog/Comparison?repository=dart&team=dartdevc#targetA%3Ddartdevc-null%3BmachineTypeA%3Dlinux-x64%3BrevisionA%3D92073%3BpatchA%3Dnshahan-generic-perf%3BtargetB%3Ddartdevc-null%3BmachineTypeB%3Dlinux-x64%3BrevisionB%3D92073%3BpatchB%3DNone

Change-Id: Ife8b5353b30205d16e56cb52f0db4909fc965846
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197821
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-05-04 19:48:11 +00:00
Nicholas Shahan 7ae257ebdf [ddc] remove extra call of addTypeCaches
The caches on FutureOr types were accidentally being cleared every time
one was created with the same type argument. These caches are already
added on every FutureOr class that is created in the wrapping for
generic types.

This bug surfaced when a class with a circular type hierarchy that must
be deferred included a FutureOr. The result was infinite recursion when
creating the type because the caches were always empty.

This change showed no notable differences in performance:
Weak:
https://golem.corp.goog/Comparison?repository=dart&team=dartdevc#targetA%3Ddartdevc%3BmachineTypeA%3Dlinux-x64%3BrevisionA%3D92060%3BpatchA%3Dnshahan-FutureOr-perf%3BtargetB%3Ddartdevc%3BmachineTypeB%3Dlinux-x64%3BrevisionB%3D92059%3BpatchB%3DNone
Sound:
https://golem.corp.goog/Comparison?repository=dart&team=dartdevc#targetA%3Ddartdevc-null%3BmachineTypeA%3Dlinux-x64%3BrevisionA%3D92060%3BpatchA%3Dnshahan-FutureOr-perf%3BtargetB%3Ddartdevc-null%3BmachineTypeB%3Dlinux-x64%3BrevisionB%3D92058%3BpatchB%3DNone

Change-Id: I985e0ab2898a8a68ac6cdf4d0a738120bc42c623
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197900
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-05-04 19:46:51 +00:00
Ben Konyi ef0e4ea107 [ VM / DDS / CLI ] Add DevTools support to the standalone VM
Example output on stdout when DevTools is enabled:

Observatory listening on http://127.0.0.1:8181/CzkZzZaONW4=/
The Dart DevTools debugger and profiler is available at: http://127.0.0.1:8181/devtools/#/?uri=ws%3A%2F%2F127.0.0.1%3A8181%2FCzkZzZaONW4%3D%2Fws
hello world!

vm-service: isolate(1674461414267555)  'main' has no debugger attached and is paused at exit.  Connect to Observatory at http://127.0.0.1:8181/CzkZzZaONW4=/ to debug.

TEST=pkg/dartdev/test/commands/run_test.dart

Change-Id: Icd1afda87ad4a46f228125d53094d10adf8056ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188361
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-05-03 18:24:09 +00:00
Vyacheslav Egorov a11d9f17fb [vm] Fix race when setting identity hash codes.
We might interrupt Object._objectHashCode(obj) helper to serve a
vm-service request between checking for unset hash code and setting
a new hash code. While serving this request we might set the hash
code of [obj] (e.g. when generating heap snapshot or in
Instance::PrintJSONImpl). Later Object._objectHashCode will call
Object_setHash, which (on 64-bit platforms) assumes that
hash field in the object header is set to 0 and uses bitwise-or
to initialize it. This leads to a mismatch between hash code that
the first invocation of _objectHashCode will return and the
value stored in the header (because we OR non-zero value set
by vm-service with a value which _objectHashCode intended to
use as a hash).

This CL changes Object_setHash to avoid overwriting or mangling
the hash value if it was already set.

We also fix hash code generation in vm-service to ensure that we
only generate values which are valid Smis because the rest of the
code expects that.

TEST=pkg/front_end/test/incremental_compiler_leak_test.dart

Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm64-try
Change-Id: Ica913af8bc1cfef0ad60a9e7504531ee4de53015
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/197400
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2021-05-03 11:47:08 +00:00
Srujan Gaddam 7abaa95492 [dart:html] Fix Geoposition bindings and callbacks
Closes https://github.com/dart-lang/sdk/issues/45562
Closes https://github.com/dart-lang/sdk/issues/44324

Geoposition should be bound to GeolocationPosition as well since
Position is deprecated since Chrome 79.

Similarly, success callbacks used in the Geolocation API can accept
a Firefox-specific implementation, so the callback should accept a
dynamic instead. Doing this requires adding annotations to the APIs
so liveness of Geolocation types is maintained.

Change-Id: Id38f68d10c9cdcb7d711ef83a70df87b30be405d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194325
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2021-04-29 21:32:15 +00:00
Nate Bosch 427e17dfce Allow null to flow through _throwFormatException
In the case of `tryParse` the intention was for the `onError` callback
to return `null`, however in strong mode this can't be returned through
the `int` return type so there is an exception.

Add types to the `onError` callback to make it explicit that below the
boundary of the public `parse` method the callback may return null. A
`null` return from the `onError` callback is now caught in strong mode
within `parse` with an `as int` cast.

Remove the catch-all error handler that masked this issue.

TEST=ci

Change-Id: Ib8b266e0d7e425c1811145e80b6f5bd4a81d4c6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193960
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Auto-Submit: Nate Bosch <nbosch@google.com>
2021-04-29 10:22:45 +00:00
Chandru S 871374447f Expose loadId during deferred loading that will allow for advanced bundling optimizations.
Change-Id: Ic4e5edd8dc4761e49b4eb97892c75b869adfc2a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196980
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2021-04-27 01:40:48 +00:00
Sigmund Cherem d52475c166 [web] deprecate dart:web_sql
The WebSql was dropped 5+ years ago and this library is unsupported.

This change adds the `@deprecated` annotation on the library and APIs in
dart:html that expose it (`window.openDatabase`). It also indicates to dartdoc
to skip it for the api.dart.dev site.

I run a `pub_crawl` process to verify that this is not in use. I checked 15K
packages, and only found 2 occurrances of an import to this library:
  * One in a package marked as discontinued (used for migrating constants back
  in Dart 2)
  * Another in an example mock test (generated by mockito for mocking dart:html)
Also no library uses `window.openDatabase` either.

We will send a breaking change announcement soon and plan to delete this in a
future Dart release (possibly 2.15).

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

Change-Id: I8cd2bfa0ce64892c3f108bd6e24b8a0a3ec7c6ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196461
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2021-04-23 19:04:42 +00:00
Dan Field 5776d576a0 Reland "Make throwing Zone.uncaughtError handlers propagate the error to their parent zone."
This reverts commit f0a8b63402.

Reason for revert: The Flutter SDK issues have been resolved - see https://github.com/flutter/flutter/issues/80969 and https://github.com/flutter/flutter/pull/81014

Original change's description:
> Revert "Make throwing Zone.uncaughtError handlers propagate the error to their parent zone."
>
> This reverts commit 88a351f3d2.
>
> This broke the Dart SDK -> Flutter Engine roller. Flutter issue at https://github.com/flutter/flutter/issues/80969
>
> Change-Id: Idaf255a730c7b6054e6cd929b6770dbe66860151
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196561
> Reviewed-by: Zach Anderson <zra@google.com>
> Commit-Queue: Zach Anderson <zra@google.com>

# Not skipping CQ checks because this is a reland.

Change-Id: Icd98c550c63160f35cc5da40af7ca6bf2cbf180e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196621
Reviewed-by: Dan Field <dnfield@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Dan Field <dnfield@google.com>
2021-04-23 05:24:41 +00:00
George Wright f0a8b63402 Revert "Make throwing Zone.uncaughtError handlers propagate the error to their parent zone."
This reverts commit 88a351f3d2.

This broke the Dart SDK -> Flutter Engine roller. Flutter issue at https://github.com/flutter/flutter/issues/80969

Change-Id: Idaf255a730c7b6054e6cd929b6770dbe66860151
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196561
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2021-04-22 22:20:16 +00:00
Emmanuel Pellereau 335f55a601 Revert "Optimize js_util setProperty calls for non-function value types."
This reverts commit 853597a978.

Reason for revert: Breaks google3 (b/186088197)

Original change's description:
> Optimize js_util setProperty calls for non-function value types.
>
> No change in the generated JavaScript for dart2js base on a sample
> foo.dart file and tests/lib/js/js_util/properties_test.dart
>
> Bug: #44533
> Change-Id: Ib6866fa7fca1f13b03c75dd4f1eac904b18811e3
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193838
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Commit-Queue: Riley Porter <rileyporter@google.com>

TBR=sigmund@google.com,srujzs@google.com,rileyporter@google.com

Change-Id: I3f08d29e2d6a1a7846b8d67fadc314ad947f54cf
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: #44533
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196484
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
2021-04-22 09:27:29 +00:00
Stephen Adams b529afd10a [dart2js] rename setRuntimeTypeInfo to _setArrayType
For a long time now this is used only to put types on JSArray.

Change-Id: I31f15d313d7e131eecac76697a8938c197f83e7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195940
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-04-22 02:06:31 +00:00
Riley Porter 853597a978 Optimize js_util setProperty calls for non-function value types.
No change in the generated JavaScript for dart2js base on a sample
foo.dart file and tests/lib/js/js_util/properties_test.dart

Bug: #44533
Change-Id: Ib6866fa7fca1f13b03c75dd4f1eac904b18811e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193838
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>
2021-04-21 19:01:11 +00:00
Lasse Reichstein Holst Nielsen 88a351f3d2 Make throwing Zone.uncaughtError handlers propagate the error to their parent zone.
Avoids infinite recursion when the uncaught error is handled by the same,
potentially still failing, uncaught error handler.

Bug: https://github.com/dart-lang/sdk/issues/45616, https://github.com/dart-lang/sdk/issues/45617
Change-Id: I60ee0f1220b7345f4a41e1f1b323b8da47ed326e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194402
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Auto-Submit: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-04-21 07:52:58 +00:00
Stephen Adams fc3ce31d39 [dart2js] Remove vestiges of reflection
Change-Id: I8d6beadc6e1d6b4525d810308957ca5527f19eb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195463
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-04-20 21:40:08 +00:00
Xiao Yu d968304570 Reland "Revert commits part of #40548 which still has some design debates and breaks valid local network http traffic"
This is a reland of d84f359786

Original change's description:
> Revert commits part of #40548 which still has some design debates and breaks valid local network http traffic
>
> Bug: https://github.com/flutter/flutter/issues/72723
> Change-Id: Ib5f809fccf1fad69add441fd40c463da8dc8be36
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192953
> Auto-Submit: Xiao Yu <xster@google.com>
> Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>

Bug: https://github.com/flutter/flutter/issues/72723
Change-Id: I466d888b3f324a996f0bef0463e7ab3df3179c56
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195485
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Xiao Yu <xster@google.com>
2021-04-16 20:25:36 +00:00
Stephen Adams 7754a868dd [dart2js] Remove static state accessors
Change-Id: I58391845d3e28b041b7bb1746e696610d113ea7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195511
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-04-16 03:43:17 +00:00
Xiao Yu f560d90059 Revert "Revert commits part of #40548 which still has some design debates and breaks valid local network http traffic"
This reverts commit d84f359786.

Reason for revert: removed some private looking but actually vm-entrypoints used by Flutter engine https://buganizer.corp.google.com/issues/185462669

Original change's description:
> Revert commits part of #40548 which still has some design debates and breaks valid local network http traffic
>
> Bug: https://github.com/flutter/flutter/issues/72723
> Change-Id: Ib5f809fccf1fad69add441fd40c463da8dc8be36
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192953
> Auto-Submit: Xiao Yu <xster@google.com>
> Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>

TBR=lrn@google.com,vegorov@google.com,xster@google.com

Change-Id: Ie746805ab7ef214bc4ba6f3582eb1d32672360ee
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/flutter/flutter/issues/72723
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195484
Reviewed-by: Xiao Yu <xster@google.com>
Commit-Queue: Xiao Yu <xster@google.com>
2021-04-15 15:29:28 +00:00
Daco Harkes 8a2b7bb5d5 [vm/ffi] Support Unions
Closes: https://github.com/dart-lang/sdk/issues/38491

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

Change-Id: I6d29f7e3c3046cda4a15c9b42063c66b064787be
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,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-linux-debug-x64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194420
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-04-15 10:16:27 +00:00
Alexander Thomas b5c63ce757 [infra] Migrate scripts to python3
* Migrate to python3; drop python support.
* Update Windows toolchain support.
* Remove some unused methods.
* Python 2.7 is still needed on Windows.
* Update gsutil to a version that supports python3.

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

TEST=Manually tested common user journeys.

Change-Id: I663a22b237a548bb82dc2e601e399e3bc3649211
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192182
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2021-04-15 10:10:20 +00:00
Xiao Yu d84f359786 Revert commits part of #40548 which still has some design debates and breaks valid local network http traffic
Bug: https://github.com/flutter/flutter/issues/72723
Change-Id: Ib5f809fccf1fad69add441fd40c463da8dc8be36
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192953
Auto-Submit: Xiao Yu <xster@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2021-04-15 09:25:17 +00:00
Stephen Adams 813019a9c5 [dart2js] Remove old-rti substitution property from namer
Change-Id: I696220cba191b5df4ffd14abd62a718708366f7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195308
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2021-04-15 04:46:56 +00:00
Daco Harkes 4558112105 Rereland "[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.

Reland 1: Allow importing `dart:ffi` from `dart:core` with
          `--enable-ffi=false`.
Reland 2: Allow the new `_Compound` class to extend `NativeType`. (This
          got triggered in this CL on the build because of the import
          from `dart:core`.)

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: I133278e16bd75cd2bb6234e7ddf042ffa0a54fd6
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,vm-kernel-precomp-linux-debug-x64c-try,vm-kernel-linux-debug-x64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195079
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-04-14 12:07:18 +00:00
Srujan Gaddam 3d52fcd250 [dart:html] Type FontFaceSet.add result as nullable
Closes https://github.com/dart-lang/sdk/issues/45676

`FontFaceSet.add` can return null on Firefox, which leads to a crash
due to native null assertions. The scripts are modified to treat
the `add` return type as nullable.

Change-Id: I8fcff8ef716e8620f04c44f5fb8b3a5884b3d1db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195167
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2021-04-14 00:00:08 +00:00
Srujan Gaddam ce5a1c2392 [dart:html] Fix sanitization for HTML templates
Bug: b/143778164

Resolves an issue where sanitization wasn't properly handled
when templates were involved.

Change-Id: Ic8f6f28036e18981eb934c2b39c2c0cd4e6f1a96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195056
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-04-13 23:29:08 +00:00
Ryan Macnak 55645786bc Revert "[vm, compiler] Support unboxed parameters for integer intrinsics."
This reverts commit 1d369b5000.

Reason for revert: Failures on Golem

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

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

Change-Id: I09e54cd894c0f73bf3af215729567503c156ec3e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195165
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-04-13 17:05:47 +00:00
Daco Harkes c33dad37e5 Revert "Reland "[vm/ffi] Disallow Pointers and structs in finalizers and expandos""
This reverts commit 3f0ad61daa.

Reason for revert: Conflicts with https://dart-review.googlesource.com/c/sdk/+/194765

Original change's description:
> Reland "[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: I9af6d0173db60614091068c218391f73756c135f
> Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195061
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Daco Harkes <dacoharkes@google.com>

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

Change-Id: I90064b6b73155a43f37388f987c6b29f72ce9770
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195076
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-04-13 15:05:07 +00:00
Daco Harkes 3f0ad61daa Reland "[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: I9af6d0173db60614091068c218391f73756c135f
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195061
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-04-13 13:52:36 +00:00
Alexander Aprelev 8800decca4 [io] Move OSError::isInprogressCode to implementation patch class.
This addresses comments on https://dart-review.googlesource.com/c/sdk/+/193221.

TEST=ci

Change-Id: I0eaac9f640b172e37da6199f7353de8b066f854e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195059
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2021-04-13 13:52:06 +00:00
Daco Harkes bde9578a39 [vm/ffi] Introduce _Compound NativeType
Introduces the class `_Compound extends NativeType`, for sharing between
`Struct` and `Union`.

Does minimal changes to CFE and IL construction. Follow up refactor CLs
rename everything.

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

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

Change-Id: I276ceb9249c20bd331c2f8b6ef64e35acb525e9c
Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194765
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-04-13 12:50:17 +00:00
Mayank Patke 05a0508e7c [dart2js] Implement Cell lowering for initialized local variables.
Change-Id: I99c1274e1a74693be329ad9f582baf2a9817934a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194961
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-04-13 02:25:46 +00:00
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