Results after follow up CL:
Without the --deferred-serialization flag the linker phase finishes with ~10.2GB in ~120s.
With the --deferred-serialization flag the linker phase finishes with ~8.4GB in ~118s.
All other phases have negligible changes.
This is a ~17.6% reduction in memory usage and a small improvement in runtime.
Summary of this change:
We add the concept of a Deferrable which is a potentially lazy object to be read from serialized bytes.
We then specialize the DataSourceReader to either use an 'eager' or 'deferred' strategy when reading a deferrable entity. When writing the data we write the data with the ability for it to be read in either manner.
To start we will use an eager read strategy in all but the linker phase. This will mean an inconsequential memory in increase in all the other phases (a few extra _Eager objects which should only have 2 words each). The serialized bytes should get GCed immediately after the deserialization 'phase' just as they are today.
For the linker phase we will use the deferred read strategy. This will mean that we will hold on to the serialized bytes for each phase (_Deferred -> DataSourceReader -> DataSource -> bytes) but we avoid the creation of many many objects (lots of the Kernel AST and much of the closed world and global analysis data).
Change-Id: Ifa9fad3536dac96ec1fc071953dc0f9899544da8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247280
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Break cycle by passing in the MemberEntity being compiled rather than
its HGraph.
Add some 'show' clauses to some imports.
Change-Id: I89557fa45320ccbd7c564ebe7d396b3628bfacd4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249241
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
dart2js chunks the writing of the JavaScript file. With `--utf8`, the
output can contain code points that are represented as two surrogate
pairs code units in the UTF-16 string. If the chunking splits the the
surrogate pair then the lower level UTF8 encoding does not see the
other element of the pair, so encodes the illegal unpaired surrogate
as U+FFFD � (REPLACEMENT CHARACTER).
The code point U+10000 ("𐀀") is encoded as the surrogate pair U+D800
followed by U+DC00, which normally is emitted as the UTF8 bytes
... F0 90 80 80 ...
If split, each surrogate is converted to U+FFFD, resulting in bytes
... EF BF BD EF BF BD ...
This change avoids splitting the surrogate pair by adjusting the index
at which the string is split.
Change-Id: I9629bf07d391005934c99d1dd649c55c4c58c3bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249066
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Move JsToFrontendMap to its own file.
This will unblock migrating native/behavior.dart.
Change-Id: I13f44509e83e16a77f7128e20804338445390a64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248940
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Fixes b/235393918
@staticInterop replaces factories with a new named node, a static
method. In order to persist this transformation in modular
compilation, this needs to be done to outlines that can then be
consumed by the source library. In order to allow erasure at the
time of 'performOutlineTransformations', coreTypes is added to that
API.
Change-Id: I90d17fff8bbe143982fcd12cfb06dc3e8d58781a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247928
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This enables the serialization to handle references to libraries that
are not part of the serialized libraries. This is a step towards
removing the need to call computeCanonicalNames from outside the
serialization and to always use library filters for serialization
of a subset of the libraries in a component.
In response to b/235393918
TEST=existing
Change-Id: I48cd8b027795850ac2411a80e4b55efd517bb2cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248588
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Split NativeThrowBehavior into its own file to allow native/js.dart
to be migrated.
Add methods to serialization_interfaces.dart to unblock
native/behavior.dart
Change-Id: Ia6798b41d1b698a24f16eddfeceb4978e32e75c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248920
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Suppose phi A is an input to phi B. Prior to this change, it was
possible for `cleanPhis` to visit A before B. If B got removed or had
its inputs zapped, this could leave A in an unused state. Now, B will
always be visited first, so A can be cleaned up after.
Change-Id: I9cb7c2e6d930e336612be98987cbde82e7447f1f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248706
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Even if a function doesn't have an RTI-need for type arguments, locals
for those type variables must still be updated with default values. Some
incorrect control flow caused _setupStateForInlining to skip all type
variable local setup when the function has no RTI-need for type
arguments.
Fixes: #48762
Change-Id: I5d770b6fcd563afa9454026e4b79eb021cf38a37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247609
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Fixes#49241
TEST=ci
Change-Id: I6117bf816fc8c4613cce66927f952fef75632725
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248120
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This annotation prevents inlining at call sites within the method that
is annotated.
The main expected use is to control inlining in unit tests.
Change-Id: Ib6652f0b4cb7a34c6bf829b1be5c09e241ffbde2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248345
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
These allocation nodes are not used beyond the global type inference phase so we can avoid serializing them. The values will just be null in later phases.
Change-Id: I0a1dd02658e0e6621d635c89ff97d4b2c07ac86a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247740
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Results after this CL:
Without the --deferred-serialization flag the linker phase finishes with ~10.2GB in ~120s.
With the --deferred-serialization flag the linker phase finishes with ~8.4GB in ~118s.
All other phases have negligible changes.
This is a ~17.6% reduction in memory usage and a small improvement in runtime.
Summary of this change:
This introduces the idea of an UnorderedIndexed(Source/Sink) which removes the invariant that all data must be deserialized in the same order it is serialized.
The ordered (current) version of Indexed(Source/Sink) writes a list index in place of previously indexed values. On deserialization it assumes that if it sees a new index the data must be written at that location since the read/write order are the same.
The unordered (new) version of Indexed(Source/Sink) uses the data offset as the index for the data. This way whenever an index is read we know exactly where in the byte array to look it up. We move the "read head" to the specified index and perform the read operation.
There is an extra complication in that indices are shared across serialized files. So an offset written in one file can refer to a location in a different file. To deal with this we offset all of the file offsets by the size of the previous files. This effectively treats all the files as chunks of contiguous memory and the offsets are within that shared address space.
We must then allow for the DataSource being used by the DataSourceReader to be that of a different file for the duration of a read operation so that the data is read from the correct file. The "outside world" is unaware that the source of the data being read changed.
Change-Id: I3896e3c839d8e4c4512cb5bf209dc7d2b8f60191
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246220
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
* Replaces <unnamed> with a package name for certain library info objects
Change-Id: Ib98b661c1c5830283c1691b2a7a6efa80743cd57
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247932
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
Moving this enum to its own file breaks a dependency of the element
maps on SSA.
Change-Id: If66d1ddf0af6ccdc5380b4f65d5e447e3cebd8de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248081
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This CL remove the support for mixing in classes that don't extend
Object. An error has been report by the analyzer for some time and
now also by the CFE.
This puts the breaking change https://github.com/dart-lang/sdk/issues/48167 into effect.
TEST=pkg/front_end/testcases/general/issue48167.dart
Change-Id: Ia7715a27dc1aa18a7c85b24ed86d19a91b6924d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247551
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This reverts commit 69f32d6ad7.
Reason for revert: We seem to have a number of tests failing with timeouts in CBUILD after this change, please see logs at
69f32d6ad7
Original change's description:
> Refactor `_Future`.
>
> This is a major rewrite of the `_Future` class,
> which is the default implementation of the `Future` interface.
>
> The main goal was to reduce the number of expensive type checks
> in the internal passing around of data.
> Expensive type checks are things like
> * `is _Future<T>` (more expensive than just `is _Future`, the latter
> can be a single class-ID check.
> * Covariant generic parameter checks (using `T` covariantly in a
> parameter forces a run-time type check).
>
> Also removed some plain unnecessary casts and turned some
> implicit casts from `dynamic` into `unsafeCast`s.
>
> This seems to be an success, at least on very primitive benchmarks, according to Golem:
> FutureCatchErrorTest 41.22% (1.9 noise)
> FutureValueTest 46.51% (2.8 noise)
> EmptyFutureTest 59.15% (3.1 noise)
> FutureWhenCompleteTest 51.10% (3.2 noise)
>
> A secondary goal was to clean up a very old and messy class,
> and make it clearer for other `dart:async` how to interact
> with the future.
>
> The change has a memory cost: The `_FutureListener<S,T>` class,
> which represents a `then`, `catchError` or `whenComplete`
> call on a `_Future`, now contains a reference to its source future,
> the one which provides the inputs to the callbacks,
> as well as the result future returned by the call.
> That's one extra memory slot per listener.
>
> In return, the `_FutureListener` now does not need to
> get its source future as an argument, which needs a covariant
> generic type check, and the methods of `_Future` can be written
> in a way which ignores the type parameters of both `_Future`
> and `_FutureListener`, which reduces complex type checks
> significantly.
>
> In general, typed code is in `_FutureListener`, which knows both
> the source and target types of the listener callbacks, and which
> contains the futures already at that type, so no extra type checking
> is needed.
> The `_Future` class is mostly untyped, except for its "public"
> API, called by other classes, which checks inputs,
> and code interacting with non-native futures.
> Invariants ensure that only correctly typed values
> are stored in the untyped shared `_resultOrListeners` field
> on `_Future`, as determined by its `_state` integer.
> (This was already partially true, and has simply been made
> more consistent.)
>
> Further, we now throw an error in a situation that was previously
> unhandled: When a `_Future` is completed with *itself*.
> That would ensure that the future would never complete
> (it waits for itself to complete before it can complete),
> and may potentially have caused weird loops in the representation.
> In practice, it probably never happens. Now it makes the error
> fail with an error.
> Currently a private `_FutureCyclicDependencyError` which presents
> as an `UnsupportedError`.
> That avoids code like
> ```dart
> import "dart:async";
> void main() {
> var c = Completer();
> c.complete(c.future); // bad.
> print("well!");
> var d = Completer();
> d.complete(c.future);
> print("shucks!");
> }
> ```
> from hanging the runtime by busily searching for the end of a cycle.
>
> See https://github.com/dart-lang/sdk/issues/48225
> Fixes#48225
>
> TEST= refactoring covered by existing tests, few new tests.
>
> Change-Id: Id9fc5af5fe011deb0af3e1e8a4ea3a91799f9da4
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244241
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>
TBR=lrn@google.com,kustermann@google.com,sra@google.com,sigmund@google.com,nshahan@google.com
Change-Id: I455be5a04b4c346df26d4ded0fa7388baccb0f8c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247762
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
This is a major rewrite of the `_Future` class,
which is the default implementation of the `Future` interface.
The main goal was to reduce the number of expensive type checks
in the internal passing around of data.
Expensive type checks are things like
* `is _Future<T>` (more expensive than just `is _Future`, the latter
can be a single class-ID check.
* Covariant generic parameter checks (using `T` covariantly in a
parameter forces a run-time type check).
Also removed some plain unnecessary casts and turned some
implicit casts from `dynamic` into `unsafeCast`s.
This seems to be an success, at least on very primitive benchmarks, according to Golem:
FutureCatchErrorTest 41.22% (1.9 noise)
FutureValueTest 46.51% (2.8 noise)
EmptyFutureTest 59.15% (3.1 noise)
FutureWhenCompleteTest 51.10% (3.2 noise)
A secondary goal was to clean up a very old and messy class,
and make it clearer for other `dart:async` how to interact
with the future.
The change has a memory cost: The `_FutureListener<S,T>` class,
which represents a `then`, `catchError` or `whenComplete`
call on a `_Future`, now contains a reference to its source future,
the one which provides the inputs to the callbacks,
as well as the result future returned by the call.
That's one extra memory slot per listener.
In return, the `_FutureListener` now does not need to
get its source future as an argument, which needs a covariant
generic type check, and the methods of `_Future` can be written
in a way which ignores the type parameters of both `_Future`
and `_FutureListener`, which reduces complex type checks
significantly.
In general, typed code is in `_FutureListener`, which knows both
the source and target types of the listener callbacks, and which
contains the futures already at that type, so no extra type checking
is needed.
The `_Future` class is mostly untyped, except for its "public"
API, called by other classes, which checks inputs,
and code interacting with non-native futures.
Invariants ensure that only correctly typed values
are stored in the untyped shared `_resultOrListeners` field
on `_Future`, as determined by its `_state` integer.
(This was already partially true, and has simply been made
more consistent.)
Further, we now throw an error in a situation that was previously
unhandled: When a `_Future` is completed with *itself*.
That would ensure that the future would never complete
(it waits for itself to complete before it can complete),
and may potentially have caused weird loops in the representation.
In practice, it probably never happens. Now it makes the error
fail with an error.
Currently a private `_FutureCyclicDependencyError` which presents
as an `UnsupportedError`.
That avoids code like
```dart
import "dart:async";
void main() {
var c = Completer();
c.complete(c.future); // bad.
print("well!");
var d = Completer();
d.complete(c.future);
print("shucks!");
}
```
from hanging the runtime by busily searching for the end of a cycle.
See https://github.com/dart-lang/sdk/issues/48225Fixes#48225
TEST= refactoring covered by existing tests, few new tests.
Change-Id: Id9fc5af5fe011deb0af3e1e8a4ea3a91799f9da4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244241
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
- Pass options to all DataSourceReader and DataSinkWriter constructor calls.
- Add DataAndIndices to replace ClosedWorldAndIndices. Maintains the same indices as before for now.
Change-Id: I2e25d4a4c25ef12276fa808146ff8aae27da792c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247401
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Late fields start out holding a sentinel value and after they are initialized or assigned, never hold a sentinel value again.
This CL implements some removal of checks and loads based on this monotonic behaviour.
On two large Dart Angular apps, this reduces the number of late-instance-field checks by ~25%.
One app is 0.44% smaller, the other is 0.98% smaller.
The optimization_test.dart no longer forces `--disable-inlining` because that prevents the inlining that exposes the optimization opportunities.
Most tests already use `@pragma('dart2js:noInline')` to prevent inlining where relevant.
Change-Id: I2327a96e69191313ed6c07eabe94aa2962fb2648
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246881
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Ensures that kernel dump info doesn't break the original dump info's behavior.
Change-Id: I9bfe22cea0d1a5597db9c98fe736f20369b80c82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247122
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
- Rename to OrderedIndexed(Sink/Source)
- Add an interface to be shared with UnorderedIndexed(Sink/Source).
- Move 'reshape' logic into subclass.
Change-Id: I1f891aab961bde6685d77af342729ed6b5f31260
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247400
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Prelude to adding kernel dump info tests
Change-Id: I9b349700ec422da3833ee08514946fcd9b7d9b30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246860
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
When generating the tear-off stub of a JSInterop method, dart2js
associated the full JSName as the target name, as opposed to a
target path. This meant that code like:
@JS('console.log')
external consoleLog(arg1, [arg2]);
main() => (consoleLog)(1);
Generated a tear-off with code like:
self[console.log](arg);
Instead of:
self.console.log(arg);
Fixes https://github.com/dart-lang/sdk/issues/49129
Change-Id: I7abb320ce790e2ce533031fefd3abc15f8958b5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246340
Reviewed-by: Stephen Adams <sra@google.com>
This is dead code, the field 'isFixedArrayCheckedForGrowable' is never read. Also drop code used to set this field.
The check suggested in the TODO in ssa/builder.dart doesn't reduce code size for cm_shell at all so it seems like all arrays that go through there end up getting "marked" anyway.
Change-Id: Ia4bf3eec3757fc7eadb503a7ccc58b8f60f86b6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244482
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
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>
At this point we only have one backend. Maybe in the future we will have
a second backend, but that will be far enough in the future that it
makes sense to 'rediscover' the value of this pattern.
Change-Id: Ic4f5d3494c48325ea73ea2e64f923a9c532e9c52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233764
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
1) KernelElementMapImpl is inlined into KernelElementMap.
2) KernelBehaviorBuilder is inlined into BehaviorBuilder.
3) KernelClassQueries / ClassQueries are removed.
4) NativeMemberResolver is inlined into KernelNativeMemberResolver.
5) NativeClassFinder is inlined into BaseNativeClassFinder.
Change-Id: I04d14a64155de54aafc2abe8579304c018ad9490
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233658
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Inlined KClosedWorldImpl into KClosedWorld
Inlined ResolutionWorldBuilderImpl into ResolutionWorldBuilder
Change-Id: Id88abac06f7cd279413ae56ea8b021b349009649
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233655
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
GVN pure stringifiers and string concatenation.
I removed the comment regarding #9293. I could not understand it.
Removing the 'setDependsOnSomething()' does occasionally produce
worse-looking code, but at the application level, the code is
marginally smaller.
https://github.com/dart-lang/sdk/issues/48243 is a more general
description of the 'looks better' problem that pure operations tend to
sink to their use, increasing live-ranges of the operands. The
sinking is sometimes advantageous - e.g. when the new location is on
an error path.
I see common subexpression elimination often in the pattern of
constructing default strings for Intl.plural:
Intl.plural(...,
one: '$first (+$howManyMore language)',
other: '$first (+$howManyMore languages)',
...);
--> old JavaScript
var
t1 = A.S(first) + " (+" + howManyMore + " language)",
t2 = A.S(first) + " (+" + howManyMore + " languages)";
return A.Intl__plural(..., t1, t2, ...);
--> new JavaScript
var
t1 = A.S(first) + " (+" + howManyMore;
return A.Intl__plural(..., t1 + " language)", t1 + " languages)", ...);
Change-Id: I56aff26c9e5e31954fef224378f3723a05b318ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233641
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This is analogous to what we do for other control flow constructs.
Without this, a `break` to the label causes the outer scope to also
appear aborted.
Fixes: #48317
Bug: https://github.com/flutter/flutter/issues/96394
Change-Id: I575a5bf96b25b49df6f15d429881e310b3b34d15
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233446
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
Removing the indirection now that there is only one ImpactTransformer.
Change-Id: I20644113d4fce046138df4adc4b1f836d81c2523
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232964
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
These appear to be no longer necessary.
Change-Id: I8ec8a13394b6e56697de3ccee3a5326b149a137a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233000
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
This CL cleans up some indirection now that we only support
KernelFrontendStrategy.
Change-Id: Iaee8d41e061cc88957cae00d61111cbd8c076d65
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232963
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Remove dead phis including back-edges and cycles.
Add a postcondition validation for optimization phases.
Add post-phase validation test for dead-phi removal and dead-code elimination.
Bug: https://github.com/dart-lang/sdk/issues/48397
Change-Id: I178cda52dd165e825b9e2d9ae642c22162cee2e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232782
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This indirection is no longer needed.
Change-Id: Ic917ec758dc8a8a648fea9f74ddf75f47b6b9d4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232485
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
The bad codegen reported in #48383 was due to an unused phi confusing
the expression-tree construction algorithm. It was trying to generate
data = cond ? callWithSideEffects() : null;
but `data` is unused, so somehow we generated only
cond;
We should not have unused phis at this point so I put a safety check
in the above code to not try to build an unused conditional, and
changed the dead-code eliminator to eliminate dead phis.
Now we get
if (cond)
callWithSideEffects();
I compared the output for some large apps and there were about a dozen
changes. All looked like improvements, e.g. not assigning to an unused
variable. There was some code missing that is now present, but luckily
for the large apps, it was all code that did not have real-world side
effects.
Fixed: 48383
Change-Id: Id7b32cfa0cbfb47a4d9eff174ad9ae52da99f6a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232781
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
* Add team "groups" in tools/OWNERS_<group name>.
* Add top-level OWNERS as a fallback.
* Add OWNERS for all top-level directories.
* Add OWNERS to all packages.
For additional background information see go/dart-sdk-owners.
TEST=No op until code-owners is enabled.
Bug: b/200915407
Change-Id: I7fe6116cc599c749cd50ca16151d6d6a801d99d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229147
Reviewed-by: Jonas Termansen <sortie@google.com>
This strategy is no longer necessary with the single frontend, and
inlining all the logic makes the code much easier to follow.
Change-Id: I73995aa6249b52a932dbfb2d459c2d6633a620d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232029
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
This is a reland of e77ea8a17b. I've
undone the change to the name of the platformScript setter, restoring
the previous behavior of accepting anything and casting.
TEST=Existing tests.
Change-Id: I7e36935ef3784035769527dc5624191f38faaa40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232487
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Leaf Petersen <leafp@google.com>
Tighten types to eliminate some dynamic calls from the core libraries.
Also remove some unnecessary abstraction from the json parser.
TEST=Existing tests for the library.
Change-Id: Ieb4cdec5b8c26709b5f70774c392bd373a203113
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231800
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Leaf Petersen <leafp@google.com>
Most of these tools have been replaced by better tools.
We may re-add some of these in the future, but if so then maybe they should live in pkg/compiler/tool.
Change-Id: I673dd27dafad59cc01b0be0705c2032c11fca713
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231980
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
This cl mostly just removes indirection around clearing the Impact cache.
However, there is one minor logic change, today we clear the impact cache
before calling DeferredLoadTask._buildResult, but after this cl the
impact cache is cleared by its owner(Compiler) in the compiler pipeline
itself.
Change-Id: I5845b786887f861c61a0ac79a3c8f2de2a3a2a14
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232026
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
This cl removes an unnecessary concrete interface, and makes the
existing base class abstract.
Change-Id: I41891a7b3c57008de05a7c4a20a70452983ab441
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232125
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Use `hasScheme` in place of comparing against the empty string, and
`isScheme` to compare against all other schemes.
TEST=No behavior changes.
Change-Id: Ifc9fd13c6cf37933ebd4a754c4b500dedbcb291b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231185
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Removes reference to web portion of site-www as it is minimal and not standalone anymore.
Change-Id: I62e92d0dd90afffa5d90c3f3fd4e903251c5672b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229280
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
This is implemented in dart2js rather than using a Kernel transform
because dart2js has additional context about the 'as dynamic' trick.
Change-Id: I4f7abe6bb95cff8209a683406cfaf2d82b3245ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231745
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This CL fixes one part of #48118 by no longer accidentally calling
String.prototype.at.
- Update the list of names that should not be used for minified instance
method names.
- Expand comment.
- Add a script in tools for finding all the names from within a browser.
Bug: 48118
Change-Id: Iac41bd707d7b447a998d0d94a8b37576dc7d1493
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/228300
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This is something I noticed when 'gardening': HStringify can throw but
the node was using the default 'canThrow' which returns 'false'. This
has the potential for bad codegen, though I am not aware of an instance
of it happening.
This CL makes the default for `HStringify.canThrow` be `true`.
Stringification for primitive types is pure, so this is added as an
optimization. There are a few improvements from this, including removing
an unused stringification.
Change-Id: I9285d91ec906fb544f8793944578b7e3feb8a634
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/230221
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This cl makes Fuse an unnamed ordering node, and allows ors / ands
within the fuse. For examples of the benefits of this new Fuse, please
see:
pkg/compiler/test/custom_split/data/fuse_with_and/main.dart
and
pkg/compiler/test/custom_split/data/fuse_with_or/main.dart
Change-Id: I5076abcd617d138b03dc8944737c61645e42e038
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/228685
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
This is the first deprecation step, moving towards having dart2js
under the more general dart command line interface.
Going forward 'dart compile js' is the recommended way to invoke
dart2js.
This CL adds:
* an internal flag used to detect how was dart2js invoked and
provide a warning when invoked in an unsupported way.
* ensures the flag is provided in the dart cli, as well as our
(developer's only) scripts. These scripts will likely move to a
different location in the future. Note that the `dart2js_sdk*`
scripts are not providing this flag (these are the script that get
eventually shipped with our built SDK), as such, invokations of the
dart2js binary will show the new warning.
Change-Id: I96e40ecf01598eadab20dfc59114f5fff7438084
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229062
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
`dart:html` types have changed to inherit `JavaScriptObject`. Therefore,
the dart2js runtime needs to be changed so that interceptors are still
created for those types, and they're properly handled in `toString`
calculations. Includes tests on `Object` members that are currently
inconsistent between both compilers.
This test passes on dart2js with and without making the types in `dart:html`
extend `JavaScriptObject`. This test fails in DDC for the following reasons:
- `toString` of native types calls the native `toString`
- `hashCode` for interop objects are random and not 0
- `runtimeType` of interop objects is `LegacyJavaScriptObject` not `JSObject`
Change-Id: Ibf80109174615120df9e64995fa13016f7a1677b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/228741
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
This causes a crash when invoking dart2js.dart with no arguments.
This is however minor, turns out that all environments invoking
dart2js always include an argument (and by default our snapshots
include the parameter to find the platform.dill file, for example).
Change-Id: I1c830768427f0c95e94100d092df445fee4224b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/228262
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
This CL changes the way dart: libraries are considered supported when
used in conditional imports or bool.fromEnvironment constant using
the "dart.library.*" values.
Library nodes now has an isUnsupported flag which is set according to
the "supported" property in the libraries specification. Furthermore
the Target now supplies a DartLibrarySupport interface that allows
targets to override whether dart: libraries are unsupported.
This allows the JIT/AOT to use the same platform file but still
consider dart:mirrors unsupported in AOT mode, and dart2js to consider
the internal library `dart:_dart2js_runtime_metrics` supported.
Furthermore, the internal handling is changed so that condition imports
and bool.fromEnvironments constants are computed through the same logic
for "dart.library.*" values, avoiding the need for passing these values
through the environment.
TEST=pkg/front_end/testcases/general/supported_libraries/main
Closes https://github.com/dart-lang/sdk/issues/48057
Closes https://github.com/dart-lang/sdk/issues/47814
Closes https://github.com/dart-lang/sdk/issues/47243
Closes https://github.com/dart-lang/sdk/issues/32657
Closes https://github.com/dart-lang/sdk/issues/36460
Change-Id: Ie8f8dff99167de64ced51b71d89918bf0f3bbd13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/227020
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
If we were to use ES6 Maps, we should try to use a single one for
all 'identity' keys (numbers, strings, enums etc).
Change-Id: Idc600b7cb48b58a074fd4c9bb6205d544f86dbc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/226540
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This adds support for an 'include' tag in libraries specifications
that enable composite declarations. With this, we can avoid relying on
copied portions of (other) specifications.
Closes https://github.com/dart-lang/sdk/issues/47998
Change-Id: I694d5c006741e6625feb7cdd5898946cc6caee50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224952
Reviewed-by: Sigmund Cherem <sigmund@google.com>
This should help investigation of #47916.
Change-Id: I1db9d97e963593ab7f8778c8470328419633155d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/226220
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
`BaseVisitor<R>` has two methods that return `null`, which will not
match the generic return type with NNBD.
The fix is to make the methods abstract, and provide a convenience
specialization `BaseVisitorVoid` with the default methods.
Change-Id: I62cd69c5ed1c912b2804da5044e2cda93d70b878
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224460
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Stephen Adams <sra@google.com>