While we can't modify the kernel ASTs due to modular compilations, we
can change the type we emit instead of using a runtime @staticInterop
type. This CL refactors the erasure so that DDC can use it to emit
JavaScriptObject instead of StaticInteropType.
Change-Id: I9cbeaa2127e50702d2bdf6aeedb2744b7ece33c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295392
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Adds the ability to call functions/methods/tearoffs with
generic type arguments when running with the new type system.
Issue: https://github.com/dart-lang/sdk/issues/48585
Change-Id: I28b8cdad56d614a6b9904995634c0cef67d88ebc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296960
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
This package contains the logic for building native assets.
This package is the backend that invokes toplevel `build.dart` scripts.
For more info on these scripts see https://github.com/dart-lang/native.
This is a separate package so that dartdev and flutter_tools can reuse
the same logic without flutter_tools having to import dartdev.
Some design decisions:
* We don't yet have `build_dependencies`, so we use the ordinary
dependency graph for ordering of native assets builds. (If there is
a cycle we refuse to run.)
Bug: https://github.com/dart-lang/pub/issues/3794
* Builds are cached based on all the configuration provided by the
caller. Environment variables are ignored in caching. This CL also
contains a unit test that invokes the build by not passing through
environment variables. However, for Windows we need to pass through
at least `SYSTEMROOT` for MSVC to run correctly. So we might need
to further explore if we can/want to lock env variables down.
Bug: https://github.com/dart-lang/native/issues/32
Bug: https://github.com/dart-lang/native/issues/33
Run tests:
```
dart tools/generate_package_config.dart && \
tools/test.py -n unittest-asserts-release-linux pkg/native_assets_builder
```
Bug: https://github.com/dart-lang/sdk/issues/50565
Change-Id: I133052d7195373e87d20924d61e1e96e3d34ce8f
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/300203
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Hossein Yousefi <yousefi@google.com>
The helper methods make it easier to call the JS version of
`Object.getPrototypeOf()` and `Object.getPrototypeOf()` from the
SDK libraries. The body gets inlined directly to avoid extra method
calls in potentially hot code paths.
Start using the setter when setting base and extension classes.
Issue:https://github.com/dart-lang/sdk/issues/52372
Change-Id: I6ca70cbf1936f76f24c8843e51c1c47e9bfe659c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303009
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Update the format of the shape keys to better match the format used in
the dart:_rti library. This change applies to the current runtime type
system as well.
Change-Id: I87d2af2aaf2b9dbe012fae60a64718d264a3a18c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295721
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Closes#19095
The current doc implies that the future will complete before listeners
have received the events, but a paused listener will instead block
completion.
Change-Id: Ic24ff9e46d269664f89c670eb60084821a824278
CoreLibraryReviewExempt: Doc change without behavior changes.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302101
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Required for upcoming deferred loading changes.
Our previous only stored this resolution logic for all componets except the
current component, which resulted in some empty deferred loads when referencing
modules in the main component.
Also adds a small type signature update missed in a previous commit.
Change-Id: I8511a39b26e1864919cc4882a6c008d2010354a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/299381
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
Closes https://github.com/dart-lang/api.dart.dev/issues/91
dart:js_interop_unsafe is documented, but dart:js_interop is not.
Also updates library documentation for both libraries.
CoreLibraryReviewExempt: Documentation of backend-specific library.
Change-Id: I0faff9f7d7fed134e203558de53ad3313eb43b31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301260
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
This reverts commit 4919729f00.
This CL also adds back in logic to handle older package:js versions to avoid
failures in our static checking. It also supports dart:js_interop's @JS
annotation since it can now be used for @staticInterop classes.
CoreLibraryReviewExempt: Reland of backend-specific library changes.
Change-Id: I104653a9a6b2593f6bab658808287e2074c18550
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294130
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
This implementation is for creating record values, and isn't related to
the type system. Moving to a new file so it can persist after switching
to a new runtime type information library and deleting types.dart.
Change-Id: Ib2d0c621a194d139fb20d12c30b606e8012dfb48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295106
Reviewed-by: Anna Gringauze <annagrin@google.com>
Using `new Error()` in the direct throw-helper results in fewer
frames.
Bug: b/279093088
Change-Id: I066b06adb5f872b71809e821e18e77d69ff0cd4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/300060
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Splits out some implementation from the
[orignal CL](https://dart-review.googlesource.com/c/sdk/+/266545)
to simplify the review.
Does not include support for dynamic calls of methods with
type parameters. That support will be added separately.
Addresses some feedback by removing the changes that expose more
internals of the Rti class and creates a static method to
retrieve the information needed to perform the dynamic checks at
runtime.
Change-Id: I4999cd172e7a327025eadc9346d3082093160bfb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285883
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Purposefully adds the indentation without any implementation to create a
baseline for future changes. The reviews are easier when you can see
there are no diffs in the code for the current runtime type system.
Change-Id: I42438b3fa19263ad3fb8e4e9d5cca6da088fdcdf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296062
Reviewed-by: Stephen Adams <sra@google.com>
Currently, dart:_js_types types are all typedefs in the web backends.
This leads to inconsistent semantics, since you can statically pass
Strings to JSString, for example. You cannot do this in dart2wasm.
In order to ensure consistent semantics, we reify these types using
a custom @staticInterop lowering. They all get erased to their
respective Dart type. When we have inline classes, these types
should be implemented using inline classes.
Note that Interceptor will not work for this use case. The reified
type of JS primitives are Dart types e.g. String, bool, and therefore
can not be casted to Interceptor.
In order to do this, the eraser is refactored and the JS backends use
shared erasure code to either erase/emit types.
Tests are added to make sure you need to go through a conversion or
cast to pass Dart objects to JS types.
CoreLibraryReviewExempt: Backend-specific internal library changes.
Change-Id: I5942be628102919ec167f094cfe10fced606363c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/295105
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Class used to be abstract, but lost it when made `final`.
There is no reason to allow instantiation, it's all static members.
Restablishing the `abstract` before we release 3.0, so we don't have to go through any extra steps.
The class is public, exported by `dart:io`. (Should probably also be documented.)
Change-Id: Ic1a3e1a777ecbdcf535b92dbcdd88f55a65e9cbe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297463
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
This CL replaces https://dart-review.googlesource.com/c/sdk/+/296900
The `List` constructor is removed in Dart 3.0.
Some of the `@patch` implementations were not removed.
This is *high priority*. It seems the left-over `@patch factory List` constructor did not cause any errors, instead it *added* a constructor to `List` that can be used in web compiled code. Even if `List` doesn't have such a constructor in the SDK code proper.
The VM and analyzer will say the invocation is an error, but dart2js happily compiles it and runs.
(It used to be that patches couldn't add public members, that security seems to have been removed.)
Also removes code which tries to detect "the unnamed List constructor",
which is no longer a thing, and a number of invocations of the constructor, where it's not clear that the test is aware that the constructor no longer exists, and is not marked as `@dart=2.x` with x < 12.
TEST=ci
Change-Id: I4ffaf3ae2c4e75ca06e7ba0bf19187b6376f3888
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297100
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This supports flow events reported through dart:developer, but does not
support ones reported with Dart_TimelineEvent in dart_tools_api.h. That
will have to be supported in a future CL.
TEST=CI, manually verifying that flow arrows appeared on flow events in
the trace viewer for traces recorded with our Perfetto recorder
Change-Id: Ic75a8ce277b436a609c027c2c0d4e94b51031aa7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280740
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
The `instanceof` operator needs a reference to the JavaScript class
instead of the Dart Type. This avoids an issue when changing the
type representation in the new runtime type system where the two
are no longer interchangeable.
Update the parameter name for `_jsInstanceof()` which which was
probably the remnants of a copy paste.
Change-Id: I1d3fcf1915fb3e189ad7f3e130e101009ee50381
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296341
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
It's not *needed* for safety or soundness, and it forces
subclasses to be `base` whether they want to or not.
Bug: https://github.com/dart-lang/async/issues/238
CoreLibraryReviewExempt: Removes a modifier, no implementation effect.
Change-Id: I72ec1ddb3b05b746c08437b0b8173c9e71673fc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/296280
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Change the calling convention of the sync* body to fix bugs and avoid allocations.
- Body takes the controlling _SyncStarIterator as a parameter.
- `yield` assigns directly to the `_current` field and returns.
- `yield*` calls a method on the controlling iterator (rather than returning the iterable). This avoids an allocation to wrap the iterable, a type test to distinguish `yield` from `yield*`, and allows the `get:iterator` call to happen in the dynamic scope of try-catch surrounding the `yield*` to that it will catch any exceptions.
- Avoid using IIFE to bind constants just to call the body.
- Use a dummy body to avoid the need to testing termination of the body.
Tests now passing:
co19_2/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_sync_t05
language_2/sync_star/move_past_end_test
language_2/sync_star/sync_star_exception_current_test
language_2/sync_star/sync_star_exception_iterator_test
language_2/sync_star/sync_star_exception_nested_test
language_2/sync_star/sync_star_exception_test
Bug: #51992
Change-Id: I397b470e121b8d71242ac28b3130637b78a1d0dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294685
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
The main reason is to do this change is to avoid inconsistencies in what is considered to be a `JSArray`. Using `Array.isArray` allows js-interop where the JavaScript code subclasses `Array`.
dart2js-production results:
ArrayLoop.pseudopoly.hoisted1-indexing -50.20%
ArrayLoop.pseudopoly.indexing -35.18%
Iteration.concat.manual 11.69%
ListCopy.List.int.unmodifiable.2 12.03%
ListCopy.for.int.2 12.58%
ListCopy.spread.int.2 13.57%
ListCopy.toList.fixed.100 16.06%
ListCopy.List.of.fixed.100 16.96%
ListCopy.toList.100 17.28%
ListCopy.spread.int.cast.2 18.45%
ObjectHash.hash.5 19.62%
TypedDataPoly.A_UVx5.view.2 21.12%
ObjectHash.manual.5 21.70%
ListCopy.spread.int.map.2 21.96%
ListCopy.spread.int.cast.100 22.12%
TypedDataPoly.A_UVx5.view.100 23.04%
ListCopy.spread.int.map.100 25.26%
ListCopy.List.of.100 27.88%
ImagingGaussianBlurOnce 29.67%
MegaEquality 37.90%
An investigation of the two regressions shows that they benefit from a micro-benchmarking effect. The previous code was monomorphic at the property access in `receiver.constructor == Array`. If this is forced to be polymorphic, the baseline is quite a bit worse, leading to an improvement in line with some of the other benchmarks.
Change-Id: I5c265b1d7408fbd41da9c6fa17472bf648000c8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287140
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This saves the space for the `_identityHashCode` method in the
dispatch table and allows customizing `identityHashCode` for classes
not in `dart:core`.
Change-Id: I829fb0f53dea1f3baf92e12079b9772ce2ff8c2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292820
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Auto-Submit: Aske Simon Christensen <askesc@google.com>