A FieldEntity is used as the entity for generating the setter of an
instance field (when a check is required), and as the entity for the
initializer expression for a static or top-level field.
I think it is a bit clearer to have a separate method for each case
rather than one method with conditional paths.
Change-Id: I32e63c3f3566a63e3d38315cab17d613f006405e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253562
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Deletes the outline stubber as it's not necessary on any backend.
DDC should compile the entire sources and outline dill in one step.
dart2wasm operates similarly, and so only needs the modular transformer.
dart2js moves the erasure to a global transform.
Also, this CL reverts now unnecessary plumbing that was needed for the
outline stubber.
Change-Id: Ic085c4fad5a6bdfc7d6916f7fa575c6ef9b20110
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253000
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Fields in mixin applications are copies of the fields from the
mixed-in class. As such, they don't need a getter or setter in the
mixin application.
Change-Id: I62a5779355e4ec57ad4b138bc17a29e42e903f79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/253021
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
env.dart and closure.dart have a circular dependency that is a bit
hard to break, but this is a step towards starting migrating them.
It may be worth migrating the cycle of env and closure together
in one go.
That said, the definitions moved from closure.dart to
element_map_migrated.dart (e.g. ClassDefinition) seem to match
other definitions already in the latter file
(e.g. MemberDefinition)
Change-Id: Ifa8114b992e75ec6662db702fa1dd51b31112276
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252964
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Because the compilation wasn't `await`ed properly, metrics reporting was
failing immediately rather than first waiting for the compilation to
occur. This fixes the issue and uses the `async`/`await` API instead of
`Future` methods, which should be easier to follow.
Change-Id: I2438a2de333a91c6918e5a286342448ff11f6823
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252843
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
Closes https://github.com/dart-lang/sdk/pull/49478
TEST=Manual
GitOrigin-RevId: f4c9c6869dfe73639295e86574a021523b3d374d
Change-Id: I134a97caed4eec59d70e9cbca16b7e9a472cf2c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251902
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Kevin Chisholm <kevinjchisholm@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
This test catches an issue previously uncaught by tests where offsets for indices were written incorrectly and could therefore lead to errors when deserializingelements in deferred mode.
Change-Id: I14bf80bbe4fa47c12e543679803c7be38582a0e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252300
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Annotations
@pragma('dart2js:late:trust')
@pragma('dart2js:late:check')
are now scoped, so that an annotation on a library or class will take effect unless shadowed by a closer `dart2js:late` annotation.
Currently the annotations affect only `late` fields.
Change-Id: Ida5c2b9387449263e29e74925aac9172fb3dc40c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251503
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This was misaligned with the default for the read path of these indexed values.
Change-Id: Ic00c894965a60383786831e95bc14e7380496e1f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251881
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
This change addresses a technical debt issue in dart2js, where
errors sometimes get reported as a binary offset location, instead
of a line/column position with contextual data from the source file.
The reason for this behavior is that dartj2s reports binary offsets
when it can't recover line/column data and show the contents of the
file. This typically happens if the file cannot be read directly
from disk.
The fix consits of adding an API to record the contents of files
that are not read directly by the compiler. We then use this API to
provide all sources collected by the CFE when parsing components
from .dill files.
Note: this CL also deletes the `autoread` feature in
source-file-provider. That feature was added for the same purpose.
The way it worked was that instead of registering source content, it
tried to read the sources from disk on-demand as errors got
reported. This doesn't always work for three reasons:
* First, we often use custom schemes (like the multi-root scheme) in
dill files to make the .dill deterministic in distributed build
systems, the autoload feature had no understanding of how to
translate those custom URIs to file URIs (that translation is only
define at the time the .dill is being built).
* Second, sometimes the files are simply not available, for example,
in hermetic build systems like bazel we have no access to those
files.
* Third, when files were found, there was no guarantee that the
contents were consistent. That is, the current version of the file
on disk could have been modified and have different contents than
those used when the .dill file was built.
I tested this manually by adding a crash in SSA and observing the
location in multiple scenarios, including running from source,
running from a .dill with file URIs, running from a .dill with
multi-root URIs, crashing in SDK locations in regular files and
patch files.
Change-Id: Ief09be577f4c9c4b345b4e2641918cafbe93c3fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251700
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Note: this info is not added to the proto format
Change-Id: Ic7407405dea7bcd7b9d3328cfe0850609dc007a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250785
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
The annotation data is queried on demand rather than being precomputed.
Methods that don't throw are computed after computing side-effects.
Change-Id: I4e31f0b7df668d41a15dcafee0c84fc7249e0699
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251340
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Not storing a collection of methods is a step towards processing
annotations more 'online'.
Change-Id: I378ec4db9526004a1f1dc56886bbc91a7acde7f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251322
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
This is required for apps that use split-phase compilation
Change-Id: I8ea20dd610781064af95d2ac3c7c612db3dd7e5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250948
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Calculates and prints the number of files blocked by each unmigrated file. Adds he option for a flag to sort by number of blocking files.
Change-Id: I565f565d2d68e6d630bb2c9bb6d7fc46b016e365
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251180
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
See: #49160
This doesn't offer a phase-specific view of the ram usage nor aggregate ram usage across split phase compilation.
Change-Id: Ia1f781f9bd35b40048ac23fe103b8fee3b4da584
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250947
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
This is very similar as the change Ivan sent in
https://dart-review.googlesource.com/c/sdk/+/250081, except that we additionally
skip updating the cache unnecessarily.
This should allow relanding the change that migrates this library.
Change-Id: I37684e66abe43446f4a5e8b3ed41d6573d93a3ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250440
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Resolves issue where some programs could not be compiled with dart2js and --enabled-asserts flag. The following assert was failing:
https://github.com/dart-lang/sdk/blob/main/pkg/compiler/lib/src/ir/static_type.dart#L987
This assert checks that the promoted static type that Dart2JS calculates for variables is a subtype of the promoted type calculated by the CFE. This was not true in some cases.
The cause of this discrepancy was that `as` expressions were not properly promoting casted variables. For example:
int func() {
dynamic x = 3.0;
x as double;
return x.asInt();
}
The cast on the second line of the function should promote the type of `x` through the rest of the function and `asInt()` should not be a dynamic invocation.
Change-Id: Iea2508627fb6b3f0cdde785624a00aa2d22d75de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250860
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
The type bounds in each case statement can diverge when a break is hit in a conditional control flow block. Previously the switch statement was just merging the end state after visiting each case block. Instead we need to merge all possible termination states for each case.
This is trivial when the switch only contains breaks. The termination states are just those when we reach each break (or the end of the switch if there's a default).
When there are switch-continue statements we must reconcile the states that flow into each targeted switch before reconciling the types of those targeted switches themselves. We achieve that by making two passes over the cases, the first to gather the continue states and the second to update the switches affected by those states. Similar to before this is done repeatedly until a fixed point is reached.
Fixed: 46770
Change-Id: I5795748a4591e6a1dc283f2a54129e09a20d13d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250200
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>