Index cache maps should be copied instead of used directly. And the set of indices (DataSourceIndices.caches) needs to be copied as well since we alter it when reading each shard.
Change-Id: If7a640ead07a54e3cb6003eee89c44db8f449812
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250202
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Includes skipping duplicated installation code.
For more info, see #49348
Change-Id: I34833df32156d9fe090b579b665dd9cb93860f8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250020
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Fixes#49301
From https://github.com/dart-lang/sdk/issues/49301#issuecomment-1165536192
Adds referenceFromIndex to outline transformations so that the eraser
can use it to find the reference for the stub if it was already created.
This is needed when the module where the stub exists is invalidated.
Since references in other modules should still be valid, we should
attempt to get that reference.
Change-Id: I5905a002480444aecd57de650cd439bdc34d4eba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249729
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
`element_map_interfaces.dart` contains temporary interfaces that exist for the duration of the nnbd migration.
`element_map_migrated.dart` contains 'real' code from `element_map.dart` that has been migrated. This will get re-combined with the `element_map.dart` once it is all migrated.
Change-Id: I55cc414de471adbe2d63c0e226558d5b4773d409
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249744
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
At this point the only imports of the pre-nnbd DataSourceReader and DataSinkWriter are files that need to instantiate the class. Other references have been migrated.
Change-Id: I79672fc5f8c681d05a183990e184535f1becc0e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249742
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
This allows `e!` to be replaced by `e ?? failedAt(...)` where a more descriptive internal error is desired.
`failedAt` used to return `bool` so that you could write
assert(condition || failedAt(...));
We have had assertions with messages for a long time, so that was changed to
assert(condition, failedAt(...));
This still works with the type `Never`.
Change-Id: I132665d898a6aefe1fcf73235e88c156bab1e21e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249730
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
In response to https://github.com/dart-lang/sdk/issues/47406
The error is currently not reported if the mixin declaration is from
an outline dill.
Change-Id: I94a61d6409d0c238614d9f377b5f324153360bc6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249184
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This CL:
* Removed the redirect from .packages to .dart_tool/package_config.json
(whenever such a file existed).
* Removes support for the old format entirely.
* Updates all tests etc that were found.
Fixes https://github.com/dart-lang/sdk/issues/48939
TEST=Existing tests updated.
Change-Id: Iccf711c455ac1885189aa773ca74dd8f55012964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248603
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Codegen deserialization was inadvertantly loading the nodes for many ClosureMemberDefinitions, specifically ones for generators. The node doesn't actually end up being used after this point though so the Deferrable is unnecessarily triggered.
To get around this we have the SpecialMemberDefinition constructor copy the Deferrable out of the ClosureMemberDefinition.
To avoid exposing the deferrable I've moved the ClosureMemberDefinition into the same library as SpecialMemberDefinition.
This brings the number of Kernel AST function bodies being deserialized down to 2 in cm_shell (down from many thousand).
Change-Id: I0781ab490dc1972118cf2ac2359f467916031633
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247283
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Also:
- KFieldAnalysis takes an elementMap instead of the whole strategy.
- Fix a missing `?` from a previous migration
Change-Id: I7f8fab61c644d14d1f037603a8539a2db5090d8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249547
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This is a step towards improving the semantics of these nodes.
TEST=existing
Change-Id: I95bdb86790414b38af73e9e932cc228b3c0f1f6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249040
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
The static type visitor only needs to be a TreeVisitor.
Change-Id: I5501a7e71719e711895c0ac18b49c9323665c9d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249460
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
This for instance avoids an exponential blowup that would previously
have occurred in certain cases.
Change-Id: I258d8153e75f7059bca346826b5dec62cc1bac84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249000
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Jens Johansen <jensj@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:
With this change we target the new Deferrable concept to places that are triggering Kernel AST loads. By deferring the deserialization of these high-level data objects, we avoid the cascading deserialization of many other objects including much of the Kernel AST.
There are still a few locations that load the bodies of some functions. Some are slightly harder to defer for various reasons but represent a small number of function bodies.
This is a first pass and further improvements can probably be achieved with similar changes.
Change-Id: I7449f4222669a7ad8af0a6549d30117133aed03a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247281
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
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>