No functional changes, just flattening capabilities into using set...() methods instead of providing them inline to the `initialize` method.
Change-Id: I0182a7dfa6ad2a3b3d83519b7a90f296722d05b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324523
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
The lint was being reported on the entire expression, making it potentially hard to identify the source of the lint. This change moves the range to the type itself, now matching the existing behavior of the lint in for each loops.
Change-Id: Id4a7c487aadb6282515c7ef5bb0fd8ebf923d8eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325161
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
The linter is moved from third_party to pkg, and the old copy has
been removed from DEPS for weeks now. Remove the workaround that
ignores an old copy of linter in third_party/pkg/linter.
Users who have updated without running gclient sync -D will
now get an error that they have two copies of the
linter package, and they will get a message that they should
run gclient sync -D when they run gclient sync.
This completes the migration of the linter package into the SDK
source repository.
This reverts most of https://dart-review.googlesource.com/c/sdk/+/321722
leaving a small refactoring cleanup in place.
Bug: https://github.com/dart-lang/linter/issues/4411
Change-Id: Id5cdb3485e42e78743303d64370bc9f7899ad00e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325301
Reviewed-by: Jonas Termansen <sortie@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: William Hesse <whesse@google.com>
This simplifies handle the constructor/member and its corresponding
tearoff as a pair. Also it prepare for supporting tearoff of
extension type constructors and methods with the same name.
TEST=existing
Change-Id: Iea6cbc0250c8df6bd0f825068c1f3e865d938427
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324202
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
- Add dart2wasm_options syntax to test_matrix.json.
- Add a new builder for the JavaScript compatbility mode
(`--js-compatbility`).
Change-Id: I32642e932f1d4a8a74b5b75f7783117520d51f02
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322281
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
Currently the heap snapshot tool uses a regular Set<int> for storing
ints between 0 and the number of objects (n).
This CL instead introduces a specialized int set backed by a Uint8List
where each bit represents a number between 0 and n.
This specialized set is then created to fit the number of objects, so
even an empty set takes the same amount of space as a full set: about
125 kb per million possible values (or ~6 mb per 50 million).
For small sets thats a lot worse than before, but for big sets it's a
lot better. Runtime is also a lot better.
"Benchmarks" on a snapshot that's ~1.5GB:
Runtimes:
Before:
closure roots (or all after the first one): ~30s, ~19s, ~20s
eval and: ~5.5s, ~6.3, ~5.6
eval or: ~7.3s, ~6.5s, ~6.4s
eval minus: ~4.5s, ~6.4s, ~6.5s
With CL:
closure roots (or all after the first one): ~7.7s, ~4.3s, ~4.1s
eval and: ~0.2s, ~0.3s, ~0.2s
eval or: ~0.6s, ~0.6s, ~0.6s
eval minus: ~0.3s, ~0.2s, ~0.3s
Memory usage:
Before:
after loaded:
$ grep -E "VmPeak|VmSize|VmRSS" /proc/588700/status
VmPeak: 10293036 kB
VmSize: 9896880 kB
VmRSS: 9260604 kB
after all = closure roots
VmPeak: 12354840 kB
VmSize: 9529612 kB
VmRSS: 8898088 kB
after 2 x closure all
VmPeak: 13068580 kB
VmSize: 12478236 kB
VmRSS: 11891620 kB
after 3 x eval and
VmPeak: 18377540 kB
VmSize: 18376520 kB
VmRSS: 17803032 kB
after 3 x eval or
VmPeak: 19621712 kB
VmSize: 18114376 kB
VmRSS: 17491808 kB
after 3 x eval minus
VmPeak: 21522780 kB
VmSize: 21522272 kB
VmRSS: 20907724 kB
With CL:
after loaded:
$ grep -E "VmPeak|VmSize|VmRSS" /proc/594718/status
VmPeak: 10293560 kB
VmSize: 9967036 kB
VmRSS: 9323404 kB
after all = closure roots
VmPeak: 10293560 kB
VmSize: 9805272 kB
VmRSS: 9137364 kB
after 2 x closure all
VmPeak: 10868740 kB
VmSize: 10867208 kB
VmRSS: 10199784 kB
after 3 x eval and
VmPeak: 10906236 kB
VmSize: 10905728 kB
VmRSS: 10238424 kB
after 3 x eval or
VmPeak: 10925496 kB
VmSize: 10924988 kB
VmRSS: 10257388 kB
after 3 x eval minus
VmPeak: 10944756 kB
VmSize: 10944248 kB
VmRSS: 10276672 kB
Change-Id: I8d0b65fa51ac2bd4696c4d2782c4423966a7fbae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324682
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Consider for example the following two functions
f0(int value) => value == 0 ? ... : ...;
f1(List<int> list) => list[0] == 1 ? ... : ...;
before this change we would produce a `BoxInt64(value)` followed by
`StrictCompare` in `f0` and `UnboxInt64` followed by `EqualityCompare`
in `f1`. However the decisions should be reversed: when comparing
unboxed values we should lean on `EqualityCompare` and when
comparing boxed values when smis are involved we should lean
on `StrictCompare`.
This change adjusts specialization and canonicalization rules to achieve
that: we prefer to emit `EqualityCompare` when specializing and then
add rule to collapse it back into `StrictCompare` if we discover that
is going to be more optimal (e.g. allows to avoid boxing).
TEST=vm/dart/aot_prefer_equality_comparison_il_test
Cq-Include-Trybots: luci.dart.try:vm-aot-linux-release-x64-try,vm-aot-linux-debug-simarm_x64-try,vm-aot-linux-debug-x64-try,vm-aot-android-release-arm64c-try
Change-Id: I953a346f22702debc61b84b745d2a9fab58a9ca5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324981
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
When serializing JS, we can sometimes end up changing the order we visit ModularExpressions. This can mean their indices are not stable against serialization and so the emitted code (and as a result hashes for that code) can change if the compiler did any serializing during the compilation.
We can make the order stable by sorting the holders before we process them.
This removes diff in hashes when running this (`--test-mode` forces serialization):
```
out/ReleaseX64/dart-sdk/bin/dart compile js benchmarks/OmnibusDeferred/dart/OmnibusDeferred.dart --out=om1a/m.js
out/ReleaseX64/dart-sdk/bin/dart compile js benchmarks/OmnibusDeferred/dart/OmnibusDeferred.dart --test-mode --out=om1b/m.js
```
Bug: https://github.com/dart-lang/sdk/issues/53466
Change-Id: Ibec88ff6acb71f1e96cbdb1d5ef4200d370cc3c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325100
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
The analyzer team has decided to adopt the convention of using `TODO`
comments to document long term issues that should persist in the
codebase, and `FIXME` comments to document short term issues that need
immediate attention. They may even consider adding a presubmit hook
to ensure that `FIXME` comments are only used during local
development.
Accordingly, it makes sense to suppress `TODO` comments from being
surfaced to the IDE "problems" view (since there are hundreds of them,
and they're not immediately actionable). This makes VSCode's
"problems" view much more usable in "tree" mode.
(See also https://dart-review.googlesource.com/c/sdk/+/295662, which
made the corresponding change to the `analysis_server` and `analyzer`
packages).
Change-Id: I68734fdfc051ffe434c1ffc709e8b686f571d2c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325121
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
We are experiencing diffs in Dart2JS source maps in `--test-mode` which does a serialization round trip. JS that should map to default parameters is instead mapping to the surrounding `Constructor` member since the FieldInitializer's offset is getting dropped.
This is affecting any Dart2JS split action build since those all end of serialiaing and deserializing the kernel. Any other tools using this serialization would also be affected.
TEST=Existing/will add in follow up.
Bug: https://github.com/dart-lang/sdk/issues/53466
Change-Id: Ibeccf9153c78e6c358806c7ded4dbc2dea49d8e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325020
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Optimize repetitive calls to isSubtype with a caches to store pairwise
results.
There are currently two caches for sound and unsound results but in the
future that can be combined into a single cache once the library is
aware of error reporting. That single cache could stores "pass", "fail",
or "fails when sound mode but passes in unsound null safety".
Issue: https://github.com/dart-lang/sdk/issues/48585
Change-Id: I49e5794703fd58f1b2bba50e426e25146800fbb8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323707
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Adds a new TargetKind for extension types and adds it to `@optionalTypeArgs`.
Change-Id: I7254c1299c296451b9adc5d1f8eceb50af66f039
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324769
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
(We should do the same for `package:flutter` but that will likely require some updates to the version stored in server.)
Change-Id: I262886a3522e19f86a7ba4ae46a50c48090c8d95
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
When the CFE compiles code for DDC or dart2wasm, it lowers late final
fields to synthetic getters. In order to ensure that accesses to these
fields can still be type promoted, a flag is added to the kernel
`Procedure` class, to indicate that a getter was produced by lowering
a late final field. When deciding whether a property access is
promotable, the CFE checks this flag; if it's set, it treats the
getter like a field.
Includes a language test validating the fix.
Fixes https://github.com/dart-lang/sdk/issues/53462.
TEST=tests/language/inference_update_2/late_field_test.dart
Change-Id: I98b81f04a3342d851060e5b2a7265323b93bb4e3
Bug: https://github.com/dart-lang/sdk/issues/53462
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324767
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This splits DartTypeVisitor(1) into a pure interface and a
DartTypeVisitor(1)DefaultMixin with the base implementation. This is
a step towards avoid having an accidental default implementation where
a static error would have been preferable.
TEST=existing
Change-Id: Ieea9a773a9b70897a2db10cff8d721831a702a8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324780
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This adds a typed `TypeParameter.declaration` property to be used
instead of the `parent` property. The `declaration` property holds the
declaration (Class, Method, Extension, etc.) that introduced the
type parameter. `GenericFunction` is the subset of `GenericDeclaration`
that is defined through a `FunctionNode`.
TEST=existing
Change-Id: Ie89e7f5fa12a7966507a250cacc098eb0ce6b30b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323160
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
- consider prefix when sorting
- remove duplicates
- ignore comment if there is a line break
fixes b/299271413, b/299270948, b/299272871
Change-Id: I0e5e72ae0d326042ee1bec777189c645a52e9ed7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324840
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Adds a conversion function on List<JSAny?> so that users can
modify the original list and have those changes carry forward
to the array. Creates a proxy object for dart2wasm when the
list is not a JSArrayImpl. This proxy uses handler methods and
the fact that Array methods are generic to provide an Array
interface. Also fixes a small issue in the exporting so that
toJS'd function types have a valid return type.
CoreLibraryReviewExempt: Backend-specific library.
Change-Id: I00f453aa82dd19f2913820579eb2675b799288d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323446
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
When a callback is toJS'd with an int parameter, we should attempt
a conversion to int if possible, similar to return values on
external functions. Similarly, parameters where the expected type is
a JS type should check to make the value isn't nullish before boxing,
as JS null and undefined are converted to Dart null.
Tests are added for conversion semantics of JSFunctions.
Change-Id: I95566c2954d915b8cf31cdc55fed359c695404f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323445
Reviewed-by: Aske Simon Christensen <askesc@google.com>
This is a reland of commit 8193e6a385
The CL is changed to handle the inconsistent patching we have for
extension methods. This CL either checks if the member is non-external
or has the @patch annotation. This accounts for all the members in
dart:js_interop.
Original change's description:
> [dart:js_interop] Remove unnecessary custom static interop check
>
> This was added to prevent accidentally lowering patched members,
> but these members are patched before we see them, so they aren't
> marked external.
>
> Change-Id: Ib8f7c52c38a3f1e28905798a40319f7aa2994328
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322502
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Commit-Queue: Srujan Gaddam <srujzs@google.com>
Change-Id: I129e5a030df1fd55e7292b4b4bd0276cab7bee15
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322564
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Change-Id: Ia32b15ec9ac572332da7904e94ec9c9615bf3de1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324842
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
Auto-Submit: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This is cleanup work required to start enforcing this with static analysis, as
per https://github.com/dart-lang/sdk/issues/53253.
Real quick this issue is that this code is unsafe:
```dart
void f(Completer<int> c, int? i) {
Future<int>.value(i); // Ouch!
c.complete(i); // Ouch!
}
```
Change-Id: Ia4d83719c425601b24e8ae6e305c88c95cba8b20
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324640
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
The generated constant evaluator is not being used and is removed by
this CL. All imports of the deleted evaluator will import the more
direct dependency and tests are moved to `evaluation_test.dart`.
Change-Id: Ie435d289bd85256419f67407b36af0375661f335
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324342
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
After this move, there are 10 remaining HintCodes: 3 are deprecated
(only reported in pre Dart 3.0 code), 5 are to be moved; 2 are to be
re-implemented as LintCodes.
Work towards https://github.com/dart-lang/sdk/issues/50796
Change-Id: I230c1c6a4defcdf1a00c0a755eac71baa1d4c9bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324420
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
No functional changes, just moving from the old `markers()` functions to `TestCode`, using the flat setXxxCapabilities() style and some other minor cleanup to be consistent with other tests.
Change-Id: I8ad04cd6b50df59004d07510f4fa2f57a8cd4463
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324721
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This is cleanup work required to start enforcing this with static
analysis, as per dart-lang/sdk#53253.
Real quick this issue is that this code is unsafe:
```dart
void f(Completer<int> c, int? i) {
Future<int>.value(i); // Ouch!
c.complete(i); // Ouch!
}
```
Change-Id: I12c4f0a92a2071fb47759d9626689e00cfa42f8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324763
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This CL also cleans up any required mixin declarations/uses.
Change-Id: Ib51847f01aa6c10ebf1284600455a07091a109b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324484
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>