Commit graph

10715 commits

Author SHA1 Message Date
Dan Chevalier fd6fa010ec [ VM Service / DDS ] Add custom service stream support (Revised)
NOTES:
Original CL: https://dart-review.googlesource.com/c/sdk/+/274061
Revert CL: https://dart-review.googlesource.com/c/sdk/+/274802

Regression tests that failed after merging Original CL:
- https://ci.chromium.org/ui/p/dart/builders/ci.sandbox/pkg-mac-release/24046/overview
- https://ci.chromium.org/ui/p/dart/builders/ci.sandbox/pkg-mac-release-arm64/5999/overview

----------
DESCRIPTION:
Setting the `stream` parameter on `developer.postEvent` will now forward those events to a custom stream inside DDS.


The first use of this will be for widget inspection. A navigation event will be posted to a custom stream. Our IDE DAP can listen for the Event and react to it by navigating to the desired location in the code.

TEST=Made sure that regression from original PR could be reproduced, and then resolved by applying this change. Updated observatory tests. Created new developer test to check assertions. Added DDS tests for new custom stream behaviour. Manually tested the postEvent and StreamListen with multiple clients

https://github.com/flutter/devtools/issues/4533

Change-Id: I2b04a84b4daf11dd9d72f899928b5e1f62a5ae02
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275121
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-12-13 16:31:37 +00:00
Derek Xu 53d859f6b9 Revert "[VM/CLI] Remove dartdev.dill"
This reverts commit c09f790d37.

Reason for revert: CI failures

Original change's description:
> [VM/CLI] Remove dartdev.dill
>
> Incompatible VM flags will no longer break the CLI when running from an
> AppJIT snapshot, so the fallback logic is no longer required. This CL
> thus removes dartdev.dill and the fallback logic.
>
> Relevant past CLs: https://dart-review.googlesource.com/c/sdk/+/157601
> and https://dart-review.googlesource.com/c/sdk/+/178300
>
> Fixes https://github.com/dart-lang/sdk/issues/50504
>
> TEST=I tried running `out/ReleaseX64/dart --observe --sound-null-safety test.dart`
> and `out/ReleaseX64/dart --observe --no-sound-null-safety test.dart` and
> both worked.
>
> Change-Id: I5cdcfbccf71ec557964014fdb80733b4a7c76b4d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274520
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Derek Xu <derekx@google.com>

TBR=bkonyi@google.com,derekx@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I5117f990dfabf93f5a9bae56098831280845e84e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275181
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2022-12-13 15:28:19 +00:00
Joshua Litt 220bb44c55 [dart2wasm] Implement leaking Expando.
Change-Id: I14b92315c32eb9930fa852a424646fc2d0f0c0a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274820
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-12-13 00:27:59 +00:00
Nicholas Shahan 0b3533aa95 [ddc] Fix unsound await expressions
Some expressions have a static type that can lead to a possible
soundness issue when awaited. For those expressions an additional
runtime check is performed.

Issue: https://github.com/dart-lang/sdk/issues/49396
Fixes: https://github.com/dart-lang/sdk/issues/50602
Change-Id: Ief25fbe8c38330cca0c17be4d411780a20ab87a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274729
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-12-12 19:43:55 +00:00
Nate Bosch c58297b756 More consistently use parent in zone.fork doc
The doc refers to the `this` as "this", "parent", "current zone", and
"forking zone". Fix a typo "current's zone" -> "parent zone's".

Change-Id: I6d61ad5c69c2cc415ce7271831c7a364715b0652
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274280
Reviewed-by: Lasse Nielsen <lrn@google.com>
Auto-Submit: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-12-12 18:13:53 +00:00
Derek Xu c09f790d37 [VM/CLI] Remove dartdev.dill
Incompatible VM flags will no longer break the CLI when running from an
AppJIT snapshot, so the fallback logic is no longer required. This CL
thus removes dartdev.dill and the fallback logic.

Relevant past CLs: https://dart-review.googlesource.com/c/sdk/+/157601
and https://dart-review.googlesource.com/c/sdk/+/178300

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

TEST=I tried running `out/ReleaseX64/dart --observe --sound-null-safety test.dart`
and `out/ReleaseX64/dart --observe --no-sound-null-safety test.dart` and
both worked.

Change-Id: I5cdcfbccf71ec557964014fdb80733b4a7c76b4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274520
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2022-12-12 18:02:47 +00:00
Ömer Sinan Ağacan 001433992c [dart2wasm] Fix isNegative on NaN values
New passing tests:

- co19/LibTest/core/double/isNegative_A01_t01
- corelib/nan_infinity_test/01
- corelib/nan_infinity_test/none
- language/unsorted/intrinsified_methods_test

Change-Id: I379525fe0da36d6fc365d275ded9370f2b5b4812
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274541
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2022-12-12 17:09:00 +00:00
Lasse R.H. Nielsen 767049139a [3.0 alpha] Remove deprecated dart:core apis
- Remove `proxy` and `Provisional` annotations.
  - Remove `Deprecated.expires` getter.

Change-Id: I4521b48bb92e5f8420c778686f4efa9c6426cebb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258004
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2022-12-12 11:46:58 +00:00
Dan Chevalier 3ed65601b0 Revert "[ VM Service / DDS ] Add custom service stream support"
This reverts commit 4981cbffe2.

Reason for revert: Mac regression test failed.

Original change's description:
> [ VM Service / DDS ] Add custom service stream support
>
> Setting the `stream` parameter on `developer.postEvent` will now forward those events to a custom stream inside DDS.
>
>
> The first use of this will be for widget inspection. A navigation event will be posted to a custom stream. Our IDE DAP can listen for the Event and react to it by navigating to the desired location in the code.
>
> TEST=Updated observatory tests. Created new developer test to check assertions. Added DDS tests for new custom stream behaviour. Manually tested the postEvent and StreamListen with multiple clients
>
> https://github.com/flutter/devtools/issues/4533
>
> Change-Id: I870dc634c9a9a7d2ee3a6605319c2a18517ad197
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274061
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Dan Chevalier <danchevalier@google.com>

TBR=bkonyi@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com,danchevalier@google.com

Change-Id: Ia1dce25444a6329c0553c931c9a6dbbec65ee583
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274802
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Dan Chevalier <danchevalier@google.com>
2022-12-12 11:24:37 +00:00
Michael Thomsen ef286f6039 [3.0 alpha] Remove dart:developer's deprecated MAX_USER_TAGS
Change-Id: I967974b4295548278400c14fcca7540dfa95fb66
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268340
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-12-12 10:49:58 +00:00
Michael Thomsen b3304af17d [3.0 alpha] Remove deprecated onError API on int.parse, double.parse, and num.parse
Change-Id: I9ed24c380bf716cb893b99ba228e34f4671cc8fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259042
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-12-12 09:54:54 +00:00
Michael Thomsen 4028b9b0fe [3.0 alpha] Remove deprecated NoSuchMessageError API
Contributes to https://github.com/dart-lang/sdk/issues/49529

Change-Id: I2cef41b991c59869f606235929347449e17022cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271082
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-12-12 09:48:05 +00:00
Michael Thomsen d6b40b0926 [3.0 alpha] Remove deprecated dart:async APIs
Contributes to https://github.com/dart-lang/sdk/issues/49529

Change-Id: Ib70efd0f388f50686e1745ca5237d06a4538a870
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268460
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-12-12 09:35:29 +00:00
Nicholas Shahan c010e4ffbd [ddc] Add support for new native types
Use the "extension type" class as the interceptor object for the
dart:_rti library. This applies to the new type system for values
that are represented as a native JavaScript type. For example:
Number, bool, String, Array, etc.

Issue: https://github.com/dart-lang/sdk/issues/48585
Change-Id: Ie6214aa897d3ae8abb4f9619cd2be984eeb9c4ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266544
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-12-10 00:07:45 +00:00
Dan Chevalier 4981cbffe2 [ VM Service / DDS ] Add custom service stream support
Setting the `stream` parameter on `developer.postEvent` will now forward those events to a custom stream inside DDS.


The first use of this will be for widget inspection. A navigation event will be posted to a custom stream. Our IDE DAP can listen for the Event and react to it by navigating to the desired location in the code.

TEST=Updated observatory tests. Created new developer test to check assertions. Added DDS tests for new custom stream behaviour. Manually tested the postEvent and StreamListen with multiple clients

https://github.com/flutter/devtools/issues/4533

Change-Id: I870dc634c9a9a7d2ee3a6605319c2a18517ad197
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274061
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Dan Chevalier <danchevalier@google.com>
2022-12-09 20:18:30 +00:00
Sigmund Cherem c91b73eaf7 [3.0 alpha] Remove dart:html's deprecated document.registerElement & registerElement2 APIs
Change-Id: I07fc124c55d1aeb678f39a4d72d3b4f581025a10
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273541
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2022-12-09 16:02:02 +00:00
Daco Harkes 56e581aa34 [3.0 alpha] Move AbstractClassInstantiationError to dart:mirrors
Split off https://dart-review.googlesource.com/c/sdk/+/259041 so that
the VM changes can be landed separately.

TEST=tests/lib/mirrors/instantiate_abstract_class_test.dart

Bug: https://github.com/dart-lang/sdk/issues/49529
Change-Id: Ic06dee0dfeaea64d9d9ffd9511ec66d9d0837e7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274383
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-12-09 12:53:28 +00:00
Ivan Inozemtsev d83b1af147 Revert "[ddc] Wrapping loadLibrary checks in a future to obey eval order rules"
This reverts commit d9ea7207e8.

Reason for revert: b/261854137

Original change's description:
> [ddc] Wrapping loadLibrary checks in a future to obey eval order rules
>
> These checks are cosmetic right now in DDC, but the load check was happening synchronously rather than after the future returned by loadLibrary completed.
>
> Change-Id: I867779605ddfe4f63b83b47418994e0c5e68572a
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274087
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
> Commit-Queue: Mark Zhou <markzipan@google.com>
> Reviewed-by: Anna Gringauze <annagrin@google.com>

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

Change-Id: If7e19644498835d0f77569ce11a2438f4d012f6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274362
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Auto-Submit: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2022-12-09 11:33:33 +00:00
Daco Harkes 1d567c888f [vm] Remove use of CastError
`CastError` is replaced by `TypeError`.

Also makes the fields of TypeError nullable. See:
https://github.com/dart-lang/sdk/issues/49279

TEST=build SDK and run default suites.

Bug: https://github.com/dart-lang/sdk/issues/49529
Change-Id: I7e880ff2d8b18c4bffdd7a942efd743244a12734
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274381
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2022-12-08 17:07:33 +00:00
Aske Simon Christensen a22e0ac5ea [dart2wasm] Compute correct type for generic function instantiation
Change-Id: I3811e37002ed6ae458600513bff3ac29482a6af3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271104
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-12-08 13:54:57 +00:00
Aske Simon Christensen ad06d73ace [dart2wasm] Use a flat index space for function type parameters
The current two-level indexing scheme for function type parameters
(depth and index) breaks down in the case of type substitution when
the substituted type is a generic function type, since its internal
type parameter types have been encoded assuming that the function type
had nesting depth zero, but after substitution its nesting depth can
be higher.

Relative indexing schemes such as De Bruijn indices will also not
work, since function type parameter types are constant types, and the
constant infrastructure assumes that the same constant always has the
same representation.

This change introduces a flat indexing scheme where function type
parameters are indexed using a single index which is independent of
the context in which the type parameter type appears. To avoid
collisions in the case of nested generic function types, every function
type has a type parameter offset, which conceptually shifts the
indexing range of its type parameters so it doesn't necessarily start
at zero.

Looking up a function type parameter in its environment thus involves
searching outwards until a function type is found whose type parameter
index range contains the index encoded in the function type parameter
type.

Change-Id: I544056d52711ff829b170f78a7274a93871825a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272361
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-12-08 13:54:57 +00:00
Ömer Sinan Ağacan 636232628b [dart2wasm] Implement missing features in dynamic invocations
This reimplements dynamic call code generation to add support for type
checking, named parameters (optional and required), and fixes a few
related bugs on the way.

Currently we do not try to be as efficient as possible. The goal with
this patch is to implement it correctly.

Summary of the changes:

- For every dynamic access kind and member name, we generate a new
  "forwarder" function. Dynamic gets, sets, and invocations are compiled
  to calls to the forwarders with the right access kind (invocation,
  get, set) and member name.

  For example, if the program has dynamic invocation of a member "f", we
  create an "invocation forwarder for f". If it has a dynamic get of a
  member "x", we generate "getter forwarder for x".

- Forwarder functions take 4 arguments:

  - Receiver of the invocation, get, or set.

  - A Dart list for type arguments in the invocation. For gets and sets
    the list is empty.

  - A Dart list for positional arguments in the invocation. For gets the
    list is empty. For sets, the list only has one element.

  - A Dart list for named arguments. For gets and sets the list is
    empty. The list has alternating elements of type `Symbol` and
    `Object?`, for the name and value of the named parameters.

- A forwarder function compares receiver class ID with the potential
  targets of the call. When it finds a match, it compares the callee
  "shape" with the parameters passed in the call site.

  As it compares the shapes it adjusts argument lists:

  - Creates default values for missing optional positional and named
    arguments

  - Reorders the named argument list to match order expected by the
    callee

  If it can't find a matching class ID and a member with the right name
  and shape, it calls `noSuchMethod` on the receiver.

  If it finds a matching class ID and a member, it calls the "type
  checker" for the member, passing the original receiver and adjusted
  argument lists.

- A "type checker" implements argument type checking for a member, and
  it's a member of the same class as the member it's checking types
  for. This is to allow accessing class-bound type parameters when
  generating type checking code.

- Type checking is implemented using `_isSubtype` on arguments in the
  lists.

- When type checking is successful a type checker calls the original
  member, passing the arguments as expected by the member.

  If type checking is unsuccessful it throws a type error.

Most of the changes are for generating Wasm functions that compare
shapes, adjusts argument lists, and checks types.

Changes to members:

- `Translator.dynamics` fields is renamed to
  `Translator.dynamicForwarders`

- New field `Translator.dynamicForwarderFunctionType` added for the Wasm
  function type of forwarder and type checker functions.

- Two new code gen utilities added:

  - `Translator.indexList`: generates code that indexes a Dart list

  - `Translator.getListLength`: generates code that gets length of a
    Dart list

- New `Reference` extensions added to get type checker function
  references of members

- New runtime library `named_parameters` implements two helper functions
  for dealing with named argument lists

- The library `dynamic_dispatch` is replaced by `dynamic_forwarders`,
  which consists of two classes:

  - `DynamicForwarders`: maintains mapping from call kind (get, set,
    invocation) and member name to forwarder functions.

  - `Forwarder`: a single forwarder, implements code generation for
    forwarder functions.

- `CodeGenerator` gets 3 new members:

  - `_callForwader` generates call to a forwarder

  - `_generateFieldSetterTypeCheckerMethod` generates code for a type
    checker of a setter function.

  - `_generateProcedureTypeCheckerMethod` generates code for a type
    checker of a method.

Fixes #50367

Change-Id: I2b9d84237c8517bd217166d8acb67e025f0498fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272261
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-12-08 10:45:12 +00:00
Stephen Adams 2dbd64bb29 [dart2js, js_runtime] Make JSNull.== an external method
Change-Id: I5a69b4f085a1d418fe60af7a8726bc713b54a0bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273462
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-12-08 02:14:00 +00:00
Nicholas Shahan 1edc2ecd3f [ddc] Support warnings/errors in weak mode
In the new runtime type system when running with weak null safety,
perform type tests multiple times to produce optional warnings or
errors when a test passes but would fail in sound null safety.
This is the same technique DDC uses with the current type system.

Issue: https://github.com/dart-lang/sdk/issues/48585
Change-Id: Ic1514987a6f4ffeb127a0d2be5ec15b606016212
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266543
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-12-08 00:52:18 +00:00
Alexander Markov 66f1dee48c [vm] Runtime type check in await
'await e' should check that e is a Future<flatten(S)>, where S is a
static type of e before awaiting e. If e is not a Future<flatten(S)>,
then 'await e' should await Future.value(e) instead of e. So futures
of incompatible type are not awaited and soundness is not violated.

TEST=tests/language/async/await_type_check_test.dart
(Based on https://dart-review.git.corp.google.com/c/sdk/+/267422.)

Fixes https://github.com/dart-lang/sdk/issues/50529
Part of https://github.com/dart-lang/sdk/issues/49396

Change-Id: Ia418db1be6736710abc9be87d95584c50cbc677e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273002
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-12-07 22:46:22 +00:00
Alexander Aprelev efaad34a46 [vm/simd] Recognize TypedData Float64x2 getter/setters
```
import 'dart:typed_data';

@pragma("vm:never-inline")
fetch(l, i) => l[i];

main() {
  const n = 16*1024*1024;
  final l = ByteData(16 * n).buffer.asFloat64x2List();
  for (int i = 0; i < n; i++) {
    fetch(l, i);
  }
  final sw = Stopwatch()..start();
  for (int i = 0; i < n; i++) {
    fetch(l, i);
  }
  print(sw.elapsedMilliseconds);
}
```

on x64
before 1137ms
after 101ms

BUG=https://github.com/dart-lang/sdk/issues/50636
TEST=ci

Change-Id: I90ef8ccfa1161d4d8bb076a3c1a0e3c7d6521289
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274263
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2022-12-07 22:25:25 +00:00
Mark Zhou d9ea7207e8 [ddc] Wrapping loadLibrary checks in a future to obey eval order rules
These checks are cosmetic right now in DDC, but the load check was happening synchronously rather than after the future returned by loadLibrary completed.

Change-Id: I867779605ddfe4f63b83b47418994e0c5e68572a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274087
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
2022-12-07 20:47:17 +00:00
Nate Bosch 2f864c0a5d Use async/await for readAsString
The comment mentions that this was a planned refactoring after
--sync-async became the default. Avoid eagerly reading
`StackTrace.current` and switch to an `async` method.

Change-Id: I6a8e9399fa4c282ddbd42eb93f6e19669e75ebc9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274260
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Auto-Submit: Nate Bosch <nbosch@google.com>
2022-12-07 20:39:15 +00:00
asiva 606a64a743 [3.0 alpha][VM/Runtime] - Flip flag to make strong null safety the default.
- Flip flag to make strong null safety the default
- Remove code that auto detects null safety mode from source files,
  it is necessary to specify --no-strong-null-safety to opt out.
- Retains sniffing of AOT/JIT snapshots and kernel files to determine
  null safety mode, the opt out has to be done when generating these
  file.

TEST=ci

Change-Id: If2c9608eedb7c46d9c3cd85e261ee9640e0d28eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261140
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-12-06 04:04:23 +00:00
Kallen Tu 7e4d4bfef6 [corelib] _RawSecureSocket implements _RawSocketBase to avoid dynamic call in _Socket
Change-Id: Iaca38bcc5df51636016b2833c10f1bb7200ce708
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273021
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-12-05 23:05:54 +00:00
Nicholas Shahan a464fc354b [ddc] Support more complicated subtype checks
Generate type hierarchy rules for all interface types used in a
module. These rules are utilized by the `isSubtype()` to determine
interface subtypes.

Issue: https://github.com/dart-lang/sdk/issues/48585
Change-Id: I63f64075d4947f234eca5e730ad15588e60b9e1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266542
Reviewed-by: Anna Gringauze <annagrin@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-12-03 00:37:41 +00:00
Nicholas Shahan bf548e788a [ddc] Clarify class vs type references for records
Preparation for separating type representation from classes.

Use `JS_CLASS_REF(_RecordImpl)` to inline a reference to the class
in JavaScript (not the type representation).

Use a standard Dart `is _RecordImpl` type test and let the compiler
produce the correct type test code.

Change-Id: I160312d61137ad0c6b2aa30b8aeba4acbe848df9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273523
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-12-03 00:26:58 +00:00
Nate Bosch b64f84d695 Mention late errors in Future.timeout doc
Add an example where the source future results in an error that is ignored, with
only the `TimeoutException` surfacing in a catch block.

Move some comments to the same line as the `print` call to match other
lines in the example code. Use doc comment syntax on functions in the
example code.

Change-Id: I5d3146ebe8f7edce303d76ff36822ced9b831c95
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272960
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
2022-12-02 20:05:26 +00:00
Joshua Litt b493cdfc1b [dart2wasm] Add runner script to streamline running wasm in d8.
Change-Id: I0f891d28419d0df55f94e0229ff33e87b791e7d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273280
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-12-02 19:55:16 +00:00
Nate Biggs e48df2f7f3 [dart2js] Carry library load priorty through to script tag creation.
Change-Id: Ie05b5ffe0f2e1638faf8b784a2e8c5535ec0d76a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272760
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2022-12-02 05:19:53 +00:00
Ömer Sinan Ağacan ddbc111067 [dart2wasm] Fix range checks in codeUnitAt methods
New passing tests:

- co19/LibTest/core/String/codeUnitAt_A02_t01
- co19/LibTest/core/String/operator_subscript_A02_t01
- corelib/string_codeunits_test
- language/optimize/string_charat_test
- language/string/charcode_test

Change-Id: I27fe1bc080be8d70d4a33763cbfb737e6c837a50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273143
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2022-12-01 16:19:10 +00:00
Brian Quinlan 8df8bbf0de Add PathExistsException and PathAccessException FileSystemException subclasses.
Bug:https://github.com/dart-lang/sdk/issues/50436
Change-Id: Ie2954f162c01189cd0d817f58606529acdc13416
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269240
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2022-11-30 04:54:52 +00:00
Marya f8a0d65c70 runZoned to runZonedGuarded in docs
Closes https://github.com/dart-lang/sdk/pull/50577

GitOrigin-RevId: 5dd34da55ba6ecab73966d753ef275ddd4b4b2d8
Change-Id: Ie60ce8e57fa5cad532b776f35b82ab5470fe6d4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272488
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2022-11-29 20:28:59 +00:00
Mark Zhou 8b48d7839b [ddc] Adding checks to expando setters, and extending checks to records
Change-Id: I7cd1244806fa63b880d5f6c842d1995207330db9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272462
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2022-11-29 19:51:37 +00:00
Ben Konyi af1536d463 [ dart:developer ] Deprecate Metrics related functionality
See https://github.com/dart-lang/sdk/issues/50231

Change-Id: I8f5196f90dd7a03c08d413d381bf093cc1f309eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272381
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-11-28 23:03:18 +00:00
Coaspe 091a292d82 Fix typo in wasm_types.dart
Closes https://github.com/dart-lang/sdk/pull/50555

GitOrigin-RevId: 5bdce7c315236c33be893c525f1fa063c71b95ea
Change-Id: I0267dc19610746323abab067b1957e9ca32ad61c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272340
Reviewed-by: Michael Thomsen <mit@google.com>
2022-11-28 09:29:36 +00:00
Aske Simon Christensen ca131dbf6f [dart2wasm] Fix some errors in FutureOr normalization
This fixes two issues for the cases where `FutureOr` normalizes to
`Future`:

- Normalize to `Future` instead of `_Future`.
- Normalize `FutureOr<Never>?` to `Future<Never>?` instead of
  `Future<Never>`.

Change-Id: I3bcf96c71a7424cecd3872255660fa1513abdfc3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271882
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2022-11-25 09:31:37 +00:00
Lasse R.H. Nielsen b7b45eb421 Deprecate NullThrownError and CyclicInitializetionError.
Both exceptions are used only in pre-null-safe code.
They can safely be removed when all code has been
migrated to null safety, and non-null-safe code is
no longer supported.

Change-Id: I13624d0da369c2241b8f6d66da01ea91bc0b45f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271920
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Auto-Submit: Lasse Nielsen <lrn@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2022-11-24 15:05:13 +00:00
Anna Gringauze 72493a75c6 Make records inherit from core.Object
Towards: https://github.com/dart-lang/sdk/issues/49717
Change-Id: Ie32704a21db51dd713a2f03ce78532ed67fe1792
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270821
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2022-11-23 21:03:58 +00:00
Ömer Sinan Ağacan a76a43f451 [dart2wasm] Make WasmTable a _WasmBase subclass
This fixes `isWasmType` checks for `WasmTable`. Currently this doesn't
cause any test failures, but dynamic invocations incorrectly consider
`WasmTable` as a potential receiver, which causes these warnings:

    Unimplemented external member WasmTable.[] at file:///...

Change-Id: Icc2b30e21e9d5c1de3229f6d55e3a6dc962b648b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271522
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2022-11-23 11:18:17 +00:00
Martin Kustermann 7be0af20f0 [gardening] Make dart:vmservice_ios _serveObservatory only entrypoint in non-product mode
After [0] landed the `vm/dart_2/product_aot_kernel_test` test started
failing due to addition of an additional `_saveObservatory` field which
was marked as entrypoint.

Though this field isn't needed in product mode, so we make the
entrypoint conditional on !is_product.

[0] https://dart-review.googlesource.com/c/sdk/+/267720

TEST=Fixes vm/dart_2/product_aot_kernel_test

Change-Id: I95a7c15fcbee7844be28d82ed2e7803fb6c52138
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271362
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-11-22 12:41:07 +00:00
Anna Gringauze 112c93863b Add record types
Towards: https://github.com/dart-lang/sdk/issues/49717
Change-Id: Ib2df16184d1db7d191a22305dacaeb1efe595e5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270581
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2022-11-21 20:49:10 +00:00
Ahmed Ashour 9bea89246a Fix grammar
Fixes #50509

TEST=ci

Change-Id: I7ca115bbe6f436e9df126afddcc08eaba79af2f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270740
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-11-21 20:07:29 +00:00
Ben Konyi 3602351df0 [ VM Service ] Add support for '--[no-]serve-observatory'
To prepare for the eventual removal of Observatory, we plan on disabling
Observatory by default while providing an escape hatch to manually serve
the tool for some period of time before completely removing Observatory
from the SDK. This change adds flags that can be used to configure
whether or not Observatory is served.

Currently, '--serve-observatory' is the default behavior, but will be
changed to '--no-serve-observatory' once tooling is ready to support the
escape hatch behavior.

Part of https://github.com/dart-lang/sdk/issues/50233

TEST=run_test.dart

Change-Id: Ib6d1e1587d9fbd3c61d4a4c75d90635052835844
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267720
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-11-21 17:47:31 +00:00
Aske Simon Christensen 2518307779 [dart2wasm] Generic function types
Extend the runtime representation of function types with a list of
type parameter bounds and take these into account when doing subtype
comparisons on function types.

The implementation has a number of limitations for now:

- When converting a function type to a string, the type does not know
  its nesting depth. Function types on all nesting levels thus follow
  the same naming scheme for their type parameters (`X0`, `X1`, ...),
  which can lead to name clashes between type parameters in the case
  of nested generic function types.

- When a generic function is instantiated, the type arguments are not
  substituted for the function type parameters in the type of the
  resulting function object, which therefore has an incorrect type.

- The default types of function type parameters are not explicitly
  represented in function types. When we implement automatic
  instantiation of missing type arguments in dynamic function calls,
  we need to either add the default types to the representation
  somehow or compute them from the bounds.

Change-Id: Ib756d9f8f2b6959efd7ef2e6bc79c7e4793ca3e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269761
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-11-21 10:40:20 +00:00