Under some configurations, we can't obtain an observatoryURI to compute
the RAM utilization of dart2js. It appears this happens when building
in product mode: "./tools/build.py -m product create_sdk".
This changes the logic to return "N/A" when that happens.
Change-Id: Ic8c9e89a09603558db3ac07ea696aed77f2eaca1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245781
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
- Reconciles some logic for closure/LocalFunction name resolution between dump info and the element model
- Handles closure disambiguation (j world <-> k world) by assuming fixed visit order
Change-Id: Ic9a61208ed93372633e118541b71f20543e250a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245600
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Creates a new 'dart:_js_shared_embedded_names' library for the names
accessed from the shared 'dart:_rti' library. Migrate all of the shared
symbols and uses to the new location.
Change-Id: Iaa72c4522888ad630782b921b0b70d7a2626d1b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241507
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This adds a small text on the output of dart2js to indicate how much memory
it consumed during compilation.
It's implemented via a service protocol API that collects the total heap
capacity at the time dart2js is practically done with compilation.
Once this is in place, we could change our benchmarks to start using this metric.
Change-Id: Iaf4425ef713ce0195474ef4e818149d46ab55e9b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244802
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
We were always emitting an initialization of the $async$next stack for
unwinding finally blocks, even if there was no finally. The extra code
only appeared in generators that had try-catch-(no-finally), and seems
to be harmless, if slightly inefficient.
Change-Id: Ic1fa80e451fe00015a53b0319e3b56d2aaf04a30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245088
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
These libraries will be shared between the dart2js and DDC runtimes.
Also renames the `shared` directory to `synced` to avoid confusion.
Synced directories are copied to be in sync with the compilers and
runtimes.
Change-Id: Ic36076938741d7102792f09413666de0033da3a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238300
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
This CL moves the bounds checking into the TypeBuilder instead of
performing it from the outside on the computed DartType node.
This solves several problems:
1) Errors are now reported on the type in the code instead of the
declaration which holds the type.
2) Checking of type aliases (both function and nonfunction type
aliases) is now handled correctly in all cases. This achieved by
computed the aliased type (containing TypedefType nodes)
internally and performing the checking on this type, and only
convert the type into the unaliased version (without TypedefType
nodes) after checks have been performed. Previously this handled
through the FunctionType.typedefType property for function type
aliases and through and incomplete work-around for nonfunction
type aliases.
3) With 2) FunctionType.typedefType is no longer needed and is
removed.
TEST=general/bounds_*
Change-Id: I7653bca5ccb0ebf4b3553828a298d1ad918ef235
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243722
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
It should not be necessary to ever run `pub get` for a package which is
not published. All packages used in the SDK are controlled by a single
package config, so it's not necessary to declare versions or paths for
any packages.
Remove all dependency overrides.
R=devoncarew@google.com
Change-Id: Icb328813b471f35ee4c99995f4e90aac4d8ed438
Tested: Covered by existing static analysis.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244767
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
This is a reland of commit 072603d40a
Original change's description:
> Sync packages from shelf mono repo
>
> Drop the DEPS entries for the repositories which will be archived. Each
> of the packages has been merged into the `shelf` repository.
>
> Add the `shelf` repository to the specially handled directories with
> nested packages in `generate_package_config`.
>
> Update path dependencies in pubspecs to the new location.
>
> R=devoncarew@google.com
>
> Change-Id: Iefca4fdb2abb6bafa273b9b6b1b4f25d6c91b005
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243929
> Reviewed-by: Alexander Thomas <athom@google.com>
> Reviewed-by: Devon Carew <devoncarew@google.com>
> Commit-Queue: Nate Bosch <nbosch@google.com>
> Auto-Submit: Nate Bosch <nbosch@google.com>
Change-Id: I064d9bc87263e02357021c1def2b656afe45cf22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244725
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Auto-Submit: Nate Bosch <nbosch@google.com>
This reverts commit 243ac04dbf.
Reason for revert: Breaks roll to flutter engine still.
Original change's description:
> Sync packages from shelf mono repo
>
> Keep the DEPS entries and directories for the old locations for these
> packages, but ignore them in `generate_package_config`. Removing the
> hashes and directories would invalidate the DEPS file in the flutter
> engine repository.
>
> Add the `shelf` repository to the specially handled directories with
> nested packages in `generate_package_config`.
>
> Update path dependencies in pubspecs to the new location.
>
> Reland of https://dart-review.googlesource.com/c/sdk/+/243929
> without the removal of the old directory locations.
>
> R=devoncarew@google.com
>
> Change-Id: I3d3b3eb0722f3eba518a6a1034ed9c24f83c70f0
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244300
> Reviewed-by: Devon Carew <devoncarew@google.com>
> Commit-Queue: Nate Bosch <nbosch@google.com>
TBR=devoncarew@google.com,nbosch@google.com
Change-Id: Ied6d9aa685208eddea6d82d04ca8876937651051
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244302
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Keep the DEPS entries and directories for the old locations for these
packages, but ignore them in `generate_package_config`. Removing the
hashes and directories would invalidate the DEPS file in the flutter
engine repository.
Add the `shelf` repository to the specially handled directories with
nested packages in `generate_package_config`.
Update path dependencies in pubspecs to the new location.
Reland of https://dart-review.googlesource.com/c/sdk/+/243929
without the removal of the old directory locations.
R=devoncarew@google.com
Change-Id: I3d3b3eb0722f3eba518a6a1034ed9c24f83c70f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244300
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
* The wrapped abstract value domain is moved out of the powersets folder
since they're unrelated.
* {inferrer,ssa}/builder_kernel.dart renamed to just builder.dart since
we only operate on kernel.
* inferrer/inferrer_engine.dart renamed to engine.dart since it was
redundant.
Change-Id: I355e626431d8a49e9a944341360b2d6401895929
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243645
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
This reverts commit 072603d40a.
Reason for revert: Causing issues with rolling into flutter engine.
Original change's description:
> Sync packages from shelf mono repo
>
> Drop the DEPS entries for the repositories which will be archived. Each
> of the packages has been merged into the `shelf` repository.
>
> Add the `shelf` repository to the specially handled directories with
> nested packages in `generate_package_config`.
>
> Update path dependencies in pubspecs to the new location.
>
> R=devoncarew@google.com
>
> Change-Id: Iefca4fdb2abb6bafa273b9b6b1b4f25d6c91b005
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243929
> Reviewed-by: Alexander Thomas <athom@google.com>
> Reviewed-by: Devon Carew <devoncarew@google.com>
> Commit-Queue: Nate Bosch <nbosch@google.com>
> Auto-Submit: Nate Bosch <nbosch@google.com>
TBR=devoncarew@google.com,athom@google.com,nbosch@google.com
Change-Id: Ic610d47a3294a7dac9503e8a7b160173e0009056
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244140
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Drop the DEPS entries for the repositories which will be archived. Each
of the packages has been merged into the `shelf` repository.
Add the `shelf` repository to the specially handled directories with
nested packages in `generate_package_config`.
Update path dependencies in pubspecs to the new location.
R=devoncarew@google.com
Change-Id: Iefca4fdb2abb6bafa273b9b6b1b4f25d6c91b005
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243929
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Auto-Submit: Nate Bosch <nbosch@google.com>
Most of the change is changing `foo.isInt` to `foo is IntConstantValue` to get promotion and avoid downcasts.
Change-Id: Ie38bc5500dcb22ed9e194e6b810702dd94f2f79e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243926
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This migrates js/js.dart which will unblock the {ConstantValue,OutputUnit} cycle.
Change-Id: I6d49c2c588ac3a58e7698228e1b276d4cfb931d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243531
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
One pass to update the general description of the compiler pipeline.
Change-Id: I0597958139e9ea11b27dcb6072b8d70a90c9c937
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242505
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
- Wrap returns in Future.value to ensure the returned Future has the async function's return type.
- Skip any function that has try/catch/finally as these introduce more complex control flow. (Might be able to convert these using an onError callback in the future).
- Don't assume futureValueType since CFE might not populate it in Kernel when syntax is incorrect.
Change-Id: Ice3954da52a10a74f93b0adc6409a2d98e13cb3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241260
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
This CL reduces the number of part files in serialization/ by moving
classes into smaller libraries.
This allows the {Data,Binary,Object}{Sink,Source} to be migrated to
NNBD while sink.dart and source.dart still have dependencies.
Change-Id: I0ea44f95841f18978e78c2e1697fbc97a3bf73c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243711
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
These were far too sensitive to code size changes and causing unhelpful failures.
Change-Id: I5293c7d281a5db2d36af35f67966f4d47413a78a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243561
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
Some JS functionality is only exposed through operators, such as
implicit type conversions and BigInt arithmetic. Other than requiring
some minor additions for the exponentiation (`**`) operator, supporting
these through `dart:js_util` is trivial.
Change-Id: I010674303e4f99b42d43b73095de69b8ddcdeb47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242680
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This cleans up the temporary splitting of ParameterStructure into two
libraries.
Change-Id: I475ed3dfc67da81c1f4bcc85c5660095d5457374
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242781
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
These libraries are a cycle.
Change-Id: I0d1145876dd4dc341c426de9dafd4a2ff817fd81
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242780
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
- create a small 'facade' interface CommonElementsForDartTypes so that common/elements.dart can implement this interface to break the cycle between common/elements.dart and elements/types.dart
- Separate the tagging enums used into serialization into a separate 'tags.dart' library.
- Scattered hints to help the migration tool.
Change-Id: I8dbb993ebeb85f240392bafa53e4cc235825f63e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242506
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Currently we do not collect constants from UnevaluatedContants.
Change-Id: Ie9ff2cd09cdd654f2294f4eee42edbfdc652695f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242220
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
My local IDE was happy using the .packages file that used to be
pre-generated by default. That file was removed from the repo, so I
need to call "dart pub get" to generate it on my local workflow.
This changes makes it possible to do so.
Change-Id: I7c9433cb71423c60810c6a5fc18e7da73c9bbe0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242261
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
`diagnostic_listener.dart` is the last unmigrated import of
`common.dart`, which is imported in ~100 files.
`compiler_api.dart` is split to move the `compile` method with
unmigrated dependencies to another file to allow `compiler_api.dart` to
become migrated. Luckily there is only one reference to `compile`.
We no longer allow null `SourceSpan`s and use `SourceSpan.unknown()`
instead.
Added `SpannableWithEntity` as a migrated interface that `HInstruction`
can implement to break the dependency on a large unmigrated ssa library.
Change-Id: I0a5ff6e6c36a34ff55d98f634c671bb8f1fb9e1c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242161
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This fixes https://github.com/dart-lang/sdk/issues/48848
When the base URI is just a filename, then base was empty, and we accidentally
added a / in the first position. This made the deferred URI absolute by
mistake.
Change-Id: I4d6a773f6ef8bfefbbf61417bfe7c005aa5e63ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241990
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Checks for late sentinels now behave like null checks and refine the
local on each branch.
Change-Id: I71fdcf50529c52ef82e2cff81425a34174e5c366
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/225320
Reviewed-by: Stephen Adams <sra@google.com>
Always import 'lib/compiler_api.dart' with prefix 'api'.
Remove import of 'lib/src/compiler.dart' with prefix 'api'.
Some of the test helper files under 'compiler/test' are a little tedious
with lots of 'api.' prefixes and I could be convinced to change them
back but I think we should stick with always using a prefix under
'compiler/lib/'.
Change-Id: I3f82d7d31f1c90a860c9811fce031a64cea04ddb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241867
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
- Migrate five trivial libraries.
- Add 'show' on some imports to help understand imports that use only a few definitions.
Change-Id: Ibc26b78d65cb808fa6146e47e8ae8c7d336303b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241693
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Expressions like
List<VariableDeclaration> variables = ...
List<Expression> reads = variables.map((v) => VariableGet(v)).toList()
don't get the intended type argument `<Expression>` through inference,
but instead the type inferred from the return type of the closure, in
this case `<VariableGet>`.
This causes problems when used with the AST which assumes that
expressions are interchangeable wherever they are used, and is likely
the cause of https://github.com/flutter/flutter/issues/102077 .
This CL adds an explicit type argument in these cases.
TEST=general/infer_map
Change-Id: I0bcae21f06c54f290dc20686b0d84c065d8ea04c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241605
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
`entities.dart` is now a migrated library.
The definitions formerly moved to `entities_migrated.dart` have been
moved back.
There are a few methods of ParameterStructure that can't yet be
migrated.
The unmigrated methods of ParameterStructure have been moved to static
methods of ParameterStructureMethods and static extension methods in
`entities_parameter_structure_methods.dart`.
These methods will eventually be moved back into ParameterStructure.
The long file name is chosen to sort next to `entities.dart`.
Change-Id: Ie9e798315287b196db694fe66c323a92bc1a1f1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241701
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This ensures that the helpers are seen as being part of the main unit
for deferred-load compiles.
Prior to this change, debug dart2js would assert:
$ sdk/bin/dart2js_developer --test-mode --packages=.packages benchmarks/OmnibusDeferred/dart/OmnibusDeferred.dart --out=om1c/o.js
org-dartlang-sdk:///lib/_internal/js_runtime/lib/late_helper.dart@343+1:
Internal Error: The compiler crashed when compiling this element.
The compiler is broken.
When compiling the above element, the compiler crashed. It is not
possible to tell if this is caused by a problem in your program or
not. Regardless, the compiler should not crash.
The Dart team would greatly appreciate if you would take a moment to
report this problem at http://dartbug.com/new.
Please include the following information:
* the name and version of your operating system,
* the Dart SDK build number (build number could not be determined), and
* the entire message you see here (including the full stack trace
below as well as the source location above).
The compiler crashed: 'package:compiler/src/deferred_load/output_unit.dart': Failed assertion: line 272 pos 12: 'unit != null': No output unit for member j:method(throwLateFieldNI)
#0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
#1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
#2 OutputUnitData.outputUnitForMember (package:compiler/src/deferred_load/output_unit.dart:272:12)
#3 OutputUnitData.hasOnlyNonDeferredImportPaths (package:compiler/src/deferred_load/output_unit.dart:306:33)
#4 KernelSsaGraphBuilder._tryInlineMethod.heuristicSayGoodToGo (package:compiler/src/ssa/builder_kernel.dart:5922:12)
Change-Id: Ic31c4894105a9a22eb0821a489c8dd2a4e3d0110
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241686
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
The rich hierarchy of operators is no longer relevant since parsing
was moved to the common front-end.
All that remains is a Set of operator names that can be used to
declare instance methods.
This set is used for picking the 'operator' variety of Selector. I'm not
sure we even need operator selectors, but I am leaving that for future
consideration.
Change-Id: I7337c0cf82a3cb8f7ebf5fa17a737bac3a83f48b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241560
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Setup for dump info ID tests, which will rely on both AllInfo and the info maps
Change-Id: I92398c540d102fb2983ad77d4d20705009cc2f99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241345
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
Changes are mainly in elements/types.dart.
There are a few places where the code was rewritten to allow
non-nullable types, e.g. List.filled -> List.generate and changing an
assert into an if-test.
Change-Id: I0925c644c1152aa70d7a4cd3732307b898c2a68d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240919
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This change is in preparation for migrating dart2js to NNBD.
In serialization some methods have an 'allowNull' or 'emptyAsNull'
optional arguments.
I'm trying to remove these named parameters and replace
// @dart = 2.10
Foo readFoo({bool allowNull: false});
with
// TODO: @dart = 2.16
Foo readFoo();
Foo? readFooOrNull();
Having two functions with different return types helps keep the
nullability 'tight'. This helps the migration tool infer the correct
types.
For collections, we don't need two functions on the 'write' side, but
I think it is useful to keep the readers and writers consistent.
Change-Id: I40dc216b50c90e9bacf487436605f0bf2b1d94e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241206
Reviewed-by: Nate Biggs <natebiggs@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Note: Function parameter logic is incomplete, and some JElement tables need to be updated.
Change-Id: I429ff40160b0c4e96c6e6916ba371a01c7bb087c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240945
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
The Annotator appends closed-world info to the KernelDumpInfo data
(such as output unit, treeshaken status, and code size).
The annotator also processes closures (since these aren't visible to the kernel).
The general pattern is:
* Generate lookup key from JElement node
* Find the Kernel-generated info node with this lookup key
* Visit JElement node
* Annotate the Kernel info with new information
Note: Function parameter logic is incomplete
Change-Id: I9b2eaea7330aebb666042a61268128a4fc1074b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240944
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
- Annotations of /*?*/, /*!*/, /*late*/ and /*required*/ to help migration tool.
- Other cleanups (unused import, unnecessary 'implements').
Change-Id: Ibba552b4c5d1006c29ce9b40a8336c9438bf3ede
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241047
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Since the null-safety test migration we've been generating both a .packages file
and a package_config.json file. This deletes the use of the old .packages file
and updates all references to use the new file.
Change-Id: Iecef64ac8ed8579338795ad5327765118d643236
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240650
Reviewed-by: Joshua Litt <joshualitt@google.com>
These loops introduce control flow that is more complex and harder to represent with Futures.
Tests are back to their state prior to the start of the async/await lowering changes. (The one failing test was already timing out)
Change-Id: Ia65f1a11bd73f2a30e7a186d69c34774c9e361a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240381
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
This CL moves the handling of the runtime type use hint to when we build
impact data.
Change-Id: I2807f05f604103809f8b62da55f43dd89029e7ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239845
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
This CL moves the error processing for the ConstConstructorInvocation
logic to when we build impact data, and in doing so allows us to
eliminate one use of a tree node. This should not change any logic.
Change-Id: I69ba69cabedb4d73ec718f552d451647c7f0c51b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239843
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
This handles the case where all 'await' expressions are (direct) children of return statements (i.e. of the form: return await e).
In this case we can drop all the awaits and return the operands directly. We make sure to wrap each operand in Future.value since it might not be already be a future.
We also make sure to wrap any extra returns with Future.value.
Tested on cm_shell with the following results:
Before: Compiled 243,799,156 characters Dart to 155,109,419 characters JavaScript
After: Compiled 243,799,156 characters Dart to 154,742,407 characters JavaScript
Reduced output size by ~0.2%.
Later iterations of this will reduce JS size by ~0.7%.
Change-Id: I43a29d2e843c316c7b61f6daceb8b0e855931eb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239120
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
A bug in global inference made the analysis accidentally carry over
the state of a nested condition in a subexpression and conclude
that it was part of the state of the outer condition.
This was due to the fact that we didn't clear the state when
popping out of the context and reentering the conition state.
Fixes https://github.com/dart-lang/sdk/issues/48571
Change-Id: I4e8294bb1a05bb3b910b6aec374357d75acb67cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240321
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Global type inference incorrectly handles conditions nested within
subexpressions and accidentally carries information from those
in the context of outer conditions.
Change-Id: I99e0af3da65590acb9429771b318b7da8f3b7f14
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240320
Reviewed-by: Stephen Adams <sra@google.com>
In most case, id testing annotations can be regenerated automatical.
This updates the error reporting to include the regeneration commands.
The test system now also runs all tests in case of failures instead of
stopping after the first found failure.
Change-Id: Ice865bddccd8d1da416a1072b3927ed6adfa48fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240048
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Removes the ResolutionImpact, this should be significantly more
efficient in addition to making it much clearer how `ImpactData`
is actually used.
Change-Id: I8f12508469c784ec480ea351a34cf1477d33cf74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235481
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
The JS expansion of an async/await function is a complex state machine.
In many cases 'async' functions either do not use 'await' or have very
simple 'await' logic which is easily captured by [Future]. By making this
transformation we avoid substantial over head from the state machine.
This implements the simplest case of a function with no awaits which translates to a Future.value() call.
Tested on cm_shell with the following results:
Before: Compiled 243,799,156 characters Dart to 155,116,598 characters
After: Compiled 243,799,156 characters Dart to 154,781,536 characters
Reduced output size by ~0.2%.
Later iterations of this will reduce JS size by ~0.7%.
Change-Id: I918f820ed2a8b27081dad0de9f922b595113d21f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238461
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Historically dart2js accepted
-ofile
-o file
--out=file
The following are now also accepted:
--output=file
--output file
--out file
Adding `--output` makes the handling `dart compile js` consistent with
`dart compile exe`, and corrects a discrepancy between the help text
and actual accepted options.
`--output` is the preferred form going forward.
Some messages were fixed to prevent diagnostics having a double
"Error: ".
Bug: 48709
Change-Id: Ie5c6972706a720ced8ee948d384ac63296484d5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239467
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Years are the earliest year that can be reliably tracked using
'blame'.
TBR=sigmund@google.com
Change-Id: I1a7e650469a83d79e6eb65be899a5955dc74e1d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239620
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Per offline discussion, this, and the hints it suppresses, aren't really
useful, so it makes sense to remove them.
This suppression logic today appears to only affect hints and warnings
that come from Dart2js. Today the logic seems to assume that all
non-spannable elements are in user code(i.e. CFE messages). Meaning
today this is only suppressing a very limited set of hints from Dart2js
that should all probably be lints, if they aren't already(Dart2js
doesn't seem to use warn as far as I can tell).
Change-Id: Idc663e48d7dc67c92ed26b007a75f002853ac827
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238924
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Also fully unifies all of our phases in `runSequentialPhases` for
simplicity.
Change-Id: I51dc8993070fe20de3d10fd98edd07adda5e790f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239361
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
- Pulls dumpInfo out from the Linking phase.
- Forks dumpInfo into ElementInfoCollector and KernelInfoCollector.
- Introduces a temporary compiler variable that will be more cleanly integrated later.
Change-Id: I5f0970d9dbd5b1f215063ac161468b2774fb28a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239005
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
This CL is just a code move and contains no logic changes.
Change-Id: Id903f55558ba4f192bf3ae052d65e25f64668f28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233722
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Ordering makes it easier to see the differences when regenerating with
`-g`.
Change-Id: I855e29bbbee3c01d7cc2f5c5787c52d9208af707
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239003
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This will eventually be merged with --dump-info
Change-Id: I81884868521abc542bb0268912bfb37e6241cac5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238500
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
Rename DataSource -> DataSourceReader and SourceReader -> DataSource to more accurately reflect these classes' new roles. 'Writer' and 'Reader' are used for the higher level class that composes serialization operations. The 'Sink' and 'Source' handle the low-level conversions to/from the storage format.
Change-Id: I384b5f134beb040676f8e1ef4fba056e0c40358f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238243
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Copy comments from original interfaces to new DataSink and DataSource and organize methods based on original interface.
Note: If the reorganization makes the diff on this too complicated I can just add the comments and leave in the order it was in.
Change-Id: I959ae19d80ad330ef67334effb8aad8661689937
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238242
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Move DataSource/DataSink to implement serialization via composition rather than inheritance taking simple interfaces that do low-level writes/reads.
Note: Names and locations of classes will change throughout the next several CLs.
Change-Id: I04807d64a1238b42308ec93e5b5dda6ef2101c00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238241
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Combine AbstractData(Source/Sink) and Data(Source/Sink) into a single class. This simplifies the inheritance hierarchy before switching to a composition structure.
Note: Names of classes will change throughout the next several CLs and comments from the interface get added back in here:
https://dart-review.googlesource.com/c/sdk/+/238242
Change-Id: I50597e04f5b18a1150da4822c4886d12896bed8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238240
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Copy mixin logic into AbstractSink/AbstractSource classes since these are the only usages of the mixins.
Note: Names and locations of classes will change throughout the next several CLs.
Change-Id: Ie154741a83c3488a098f3ebf5cf340f19a1a9c52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238220
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Rename abstract class files in preparation for refactor.
Note: Names and locations of classes will change throughout the next several CLs.
Change-Id: Ibf1e56b9e1e550fd14f6b2b803b6bbbc2d7cae3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238162
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
While this adds an intermediary form for impact computation, it did not
seem to noticeably change the time it takes to compute the closed world
on a large application.
In addition, it will be a necessary change if we want to start moving
some of the validation currently being performed while building
`ResolutionImpact`s modularly.
Change-Id: I76d63a34bbd099103051ead67ec54fd38142929a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235482
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
This cl applies the mixin transform only on the full dill. In addition,
this cl also adds a concatenate dills step to more closely match
modular builds in production.
Change-Id: Icb37c5e2180c9e8246334143a6f772a203f80bf9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/238320
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Using a trusted type policy for the script elements injected to load
deferred libraries allows a content security policy to be enabled to
prevent untrusted scripts elements from loading code.
TEST=https://dart-review.googlesource.com/c/sdk/+/237638
Change-Id: Ie3505a68d83cb19c7f8bdbefa01df7fc58d9924a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237542
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Labeling nodes as direct / indirect seems to have been unstable and
unused, so this cl removes that logic. Also removed logic to process
_RtiNode._literalState which ssems to have been unused as well.
Change-Id: Ic463149ee353abcd55c22684f12ba11eb92cc91d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235722
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Fixes an issue where the allocations object was not always initialized for certain apps
Change-Id: I717bd20c1bef3e4a64d9d4243c4fe3d48178ae2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/235441
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
The Selector computed for InstanceGetterInvocation used the name of
the getter eventhough the invocation is actually a .call invocation.
This lead the computation of whether type arguments need to be parsed
to fail because it queried with the wrong selector.
Closes https://github.com/dart-lang/sdk/issues/48304
Change-Id: Ia08fb91fa24b5b04eba850f75f9b66cb89494dda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234288
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Unfortunately we have to give up on eager initialization of many maps
and sets due to unknown dependencies and effects in the hashCode
implemenation. Eager initialization of some cases could be recovered
as they are eligible to be `const` maps and sets.
Fixed: https://github.com/dart-lang/sdk/issues/48442
Change-Id: I6500123ff9d1fe42bacb53718a4b9e4e969ebc3f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233942
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This thin wrapper appears to be no longer necessary.
Change-Id: Ice608986e3579dd7c23591a44d7955ac3e92d7df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233720
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
1) Inlines ImpactBuilder into ImpactRegistryMixin + rename
to ImpactBuilder.
2) Inlines ImpactData into ImpactDataImpl + drop the Impl.
Change-Id: I47322a309708fd6345e4cf4e9a5de505bdbc81c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233685
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Also removes a few minor dead methods, and cleans up EnqueueTask which
can now just be a GenericTask.
Change-Id: Ib1614774df740739762f943df0a7bf901f7fdfc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233721
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
This CL inlines NativeBasicDataImpl, NativeDataImpl, and their
respective builder impls into their respective interfaces.
Change-Id: I40c02e0d4cbe1bc66f166db1b998726082be0606
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233725
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>