This rule checks that a parameter to an `operator ==` implementation has
a non-nullable type.
I intentionally did not enforce, in this rule, that the parameter is
exactly `Object`. It is legal to narrow the parameter type to a
different non-nullable type, like `int`. I can't imagine doing it, but
it seems to be unrelated to whether the type should be nullable or not.
Fixes https://github.com/dart-lang/linter/issues/3441
Replaces https://github.com/dart-lang/linter/pull/3923
Change-Id: I61d4a7b1ab8318dc9403da1633c352de95bfac61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277700
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Records can be constructed, returned, and field accessed in non-dynamic code. Type checks don't work, so records cannot be added to generic collections like `List<(int,int>)`.
- Add runtime for base classes for records of various arities.
- Use impacts to collect record static types used.
- Create record classes for each record shape. Record classes have
extra metadata properties on the prototype. This allows slower,
general operations at the root of the hierarchy that can be
overridden with specialized operations lower in the hierarchy.
Change-Id: Ic1b38a5076c2d05f2ecff0a9ed3255b43645386e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278699
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
This reverts commit c70d266270.
Reason for revert: Crash detected
Original change's description:
> [cfe] Support external constructor with final fields
>
> This adds support for having a final field and an external constructor
> without error, assuming that the external constructor initializes the
> final field. This supports the inline class with external members use
> case.
>
> Change-Id: Ie297ccc39b0a0731c146f9ac0698bba3fd83bfeb
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278502
> Reviewed-by: Srujan Gaddam <srujzs@google.com>
> Commit-Queue: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: I339d9008cb84cda8dc20f29d1e103289bb5596b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278820
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Auto-Submit: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
`null` is a valid key in the cache as it has a specific serialization index that gets tracked.
Change-Id: Id39e44bb1cd8e8015a851aeb89620e6891430940
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278580
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
This adds support for having a final field and an external constructor
without error, assuming that the external constructor initializes the
final field. This supports the inline class with external members use
case.
Change-Id: Ie297ccc39b0a0731c146f9ac0698bba3fd83bfeb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278502
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Closes https://github.com/dart-lang/sdk/pull/50774
GitOrigin-RevId: 41028b5de4e2e0719e08f180e32ccc1f2bef8dac
Change-Id: I5e6675d490a44feb0ea008582879266e421939f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276561
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
The `bitWidth` computation sometimes visits a large dependency DAG a
tree. This change fixes the performance problem.
- Cache results from previous visits. This fixes the occasional
exponential time.
- Move computation earlier 'instruction selection'. This allows the
result to be used for detecting when assignment-ops can be used. I
didn't see any changes due to this.
- Strengthen bitWidth computation to fall back on type inference results.
Bug: 50759
Change-Id: I482cc7d3b8a1e9af5798d22252cd9bc111be711d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276301
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
It is being removed in Dart 3.0 and a `TypeError` should be used
instead. This is true in legacy code as well and all test
expectations will be updated.
Change-Id: I021fa4ecb1a9bbc404598113c65349e17926cd91
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275782
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
These are scattered changes to get to type inferrence.
- Add some impact tracking for used record types
- Add RecordTypeInformation and FieldInRecordTypeInformation
- Add a simple test to show inference is currently very conservative.
Change-Id: Icb81033b11588c1bddd01c8c5fcf69950fdb77e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275161
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
`null` was being included in the set of called nodes and this was causing members normally called once to not be inlined.
Change-Id: Ie42302e47691bb924dea1e54b82e08072c0ecd7b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275122
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
This message was meant to be presented as an extra diagnostic message when the
compiler was running with the verbose flag, but it was accidentally
presented in the help message when running 'dart compile js -h -v'.
Change-Id: Ic2e76fc117bfd76f071756cc48ee6ce28d0f0391
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275042
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
This recovers the accuracy of types that were previously being widened and even performs better than today's algorithm for some specific cases.
Change-Id: I0139a0fd662a91315282ba94e4c1a29d44056b9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273501
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
This prepares dart2js to default to sound null safety in Dart 3.0.
The compiler no longer infers the default mode based on the input
program, instead uses sound null safety unless
'--no-sound-null-safety' is specified.
On a separate change, we expect to remove the option of disabling
null safety.
Note: this change should also be reflected in the CHANGELOG, but
we've currently not included it to redeuce merge conflicts, as we plan
to land multiple 3.0-alpha changes in a short window of time
Change-Id: Id87498cc5976548ec89d1f36c60674b72406950a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270860
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
This will be used from DynamicCallSiteTypeInformation nodes to get a list of receivers for dynamic calls. The InferrerEngine will also use it to calculate overrides of a given function and mark them as called.
Change-Id: I5738e393ae2de4cb93fd55c60e944a2db067b448
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266422
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
This hashCode is rarely used today so there shouldn't be any significant change from this. But in terms of code health it's better to remove this now.
Change-Id: Iff3ea93a4d82c3977ca7903888def7cbcb2f138f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272401
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
- Remove the dynamic 'apply' operation from `constant_system.operation`.
- Create all range expressions from ValueRangeInfo.
Change-Id: I008d941141e2b91056173a317f387f0986fce4fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270321
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
The info dump processor ends up deserializing most of the deferred data anyway so there is no benefit to the deferred logic. This saves ~600MB on info dump.
Change-Id: Ib9a1154b38594a3f046d5da96b477de9f2c90b9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271041
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Based on Martin Kustermann and Slava Egorov's versions of memory mapped views.
This feature is disabled by default and even if the flag is enabled, it will fall back to the current strategy if the platform is not Linux or the new strategy fails.
Phase 1 stats from 50 runs:
---Before---
Max memory: 8786.766
Median memory: 8116.242
Average memory: 8327.404081632654
---After---=
Max memory: 7805.691
Median memory: 7137.203
Average memory: 7305.301122448978
Phase 2 stats from 50 runs:
---Before---
Max memory: 9273.359
Median memory: 8742.133
Average memory: 8868.929124999999
---After---
Max memory: 9409.672
Median memory: 7500.148
Average memory: 7650.154000000001
Phase 3b stats from 50 runs:
---Before---
Max memory: 8979.367
Median memory: 8705.215
Average memory: 8703.982755102037
---After---
Max memory: 7809.898
Median memory: 7455.609
Average memory: 7449.96102040816
Change-Id: I73d73cfb26218399367c72c886f247836b89925c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269640
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Add annotations
@pragma('dart2js:load-priority:normal')
@pragma('dart2js:load-priority:high')
The test shows that these annotations are scoped.
This CL is just plumbing the annotation through as an argument to the runtime call to the code that implements `loadLibrary()`. Actual prioritization is not yet implemented.
Change-Id: Iff1404baf34192139dab95e2dbb01c2d4e8dae45
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270283
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
See patch 2 for failures coming from this new analysis option.
Change-Id: I6bb10c2eb12431f6c503cc817a9c9bb45ba597a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269800
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Effects of this change are minimal on a large application:
- ~9100 new members being tracked.
- +500KB closed world serialized output (.3% increase)
- No discernible difference in closed world runtime
- Heap space in global inference after closed world deserialization increase is <1MB.
- No change in JS output
These abstract members will be used by the new hierarchy-based dynamic call type graph linearization.
Change-Id: I4ce56d12e039effe0a855fd23f2a5e69d0847025
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264900
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Both the calls to ClassHierarchy.commonSubclasses and UnionTypeMask.flatten (in the worse case) are expensive for large programs. Certain programs can have a type structure that ends up in the UnionTypeMask.flatten case very often which can be especially taxing.
Change-Id: I7799d2f5a7f764162a4ca753bfa37b11f583373f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269221
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Sometimes entities have the same name and location. For example, the
synthesized getter and setter for a late instance field have the name
of the field and the location of the original field declaration. Some
transforms inject multiple closures with the same location and name
('xxx_closure').
We used to 'break ties' by sorting on `hashCode`. The `hashCode` was
somewhat deterministic as it relied on the `index` of Indexed
entities. The same program unchanged, or under minor changes, tended
to process the entities in the same order and, as the index-derived
hashCode was monotonic in the index, the relative visit order was
invariant when the program was recompiled without changes, and mostly
stable for small changes.
When the deterministic `hashCode` was removed and replaced by the
default `Object.hashCode`, this lead to nondeterministic output, since
the hashCode is different each run.
This could mainly be seen in the sourcemaps where the name might
change between 'foo' and 'foo=' as the relative order of the late
instance field getter and setter changed.
This change removes the comparison on `hashCode`. Instead, we use a
stable sort, and rely on the entities being sorted having been
collected in some stable order.
Change-Id: I7c8749fea6d2f43bde84bc3991501572f35b1ffa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268660
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
All nodes that match must be visited and compared to the queried selector. By organizing private nodes by URI the scope of nodes that need to be visited us much smaller.
In a big application this reduced the runtime of phase 2 by ~20s (~180s -> ~160s).
I see no significant memory difference from this change. +.1GB RSS according to DevTools directly after FunctionSets are initialized.
Change-Id: Id9c3a5ae84c7f0aad589cff89d4bec15e97758d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268408
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Previously both updated locations were using an expensive 'any' operation to see if one of the concrete targets was the 'currentUser'. This required iterating every target, which there could be many of for dynamic call sites. Looking for the member itself with a 'contains' operation on the concrete target list is much faster since the concrete target lists are backed by Setlets.
Locally this change lead to a ~15% improvement in runtime. The time spent tracing closures in a particular large app went from ~30s to ~2s.
Change-Id: Id9cd1cb9a8d8f0990893c827b9a3b49003180d8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268166
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
This is a reland of https://dart-review.googlesource.com/c/sdk/+/266803.
Performance regressions came from visiting core libraries. To avoid
this, this CL skips all core libraries that aren't in an allowlist.
Change-Id: I68bbf8b8df6863dfc9deeca487a66ff60947b841
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267769
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
These are needed for the 'views' feature. No nodes are created yet.
TEST=existing
Change-Id: I0c7a34e460a4d17bd39ee23e7aa6bd8851f4275e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266620
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
These are trivially migrated too. Removing static members makes it easier to
migrate later some downstream dependencies and make the Namer interface just be
an interface.
Change-Id: Ia9227577887a9428c3bd8e4cb46952eab5ef6983
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266862
Reviewed-by: Mayank Patke <fishythefish@google.com>
Many libraries are either ready for migration, or only blocked
by other libraries in the same folder.
Change-Id: If18032e916c23b81aff04ec293f002f7aa446b01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266722
Reviewed-by: Mayank Patke <fishythefish@google.com>
With this change, namer.dart no longer depends on unmigrated libraries
from other folders (only within js_backend)
Change-Id: Ib7c4b98a04dd157400f5e196a48db86eaaf334ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266721
Reviewed-by: Mayank Patke <fishythefish@google.com>
This reverts commit 700b94eb04.
Reason for revert: Revert due to internal failures: b/256219908
Original change's description:
> [dart2js] Change default for canPerformGlobalTransforms to false
>
> Fixes the staticInterop type erasure issue in dart2js when compiling the
> sdk separately from the code being compiled. With this change, the
> Angular hello_world app runs successfully with the dart:html prototype.
>
> Change-Id: Iaf5071f0f05d4fe1d17349adce4f1ce494154b9c
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262842
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Commit-Queue: Riley Porter <rileyporter@google.com>
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: I42c5c1ff5eddb675354dbe0e719390df1656e281
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266306
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
- Support interface types without generic parameters in type tests.
- Add '|' symbol to recipes to separate the library identifier from
the type. This is used in the modular setting where types are not
guaranteed to have a unique name.
- Add a runtime method to strip library identifiers when printing
type names.
- Add a runtime method to retrieve original Dart type name from
constructors.
Issue: https://github.com/dart-lang/sdk/issues/48585
Change-Id: Ib2a69c29177ebb7c582bff3246ee985666cd5919
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243362
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Fixes the staticInterop type erasure issue in dart2js when compiling the
sdk separately from the code being compiled. With this change, the
Angular hello_world app runs successfully with the dart:html prototype.
Change-Id: Iaf5071f0f05d4fe1d17349adce4f1ce494154b9c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262842
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>
This removes most unmigrated dependencies, only 4 remain. 3 in the same ssa
folder, and one to js_backend/type_reference.dart
Change-Id: I15596d6f5a915c5043f87861ac1a9fa4327f8c4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265680
Reviewed-by: Mayank Patke <fishythefish@google.com>
Per previous review comment - this separates the three components into
separate files.
Change-Id: I601bd9ac29ddd032e913a60ce2b5b7dd81e39efc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264603
Reviewed-by: Riley Porter <rileyporter@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Normal dart2js invocations will continue using the existing abstract
value domains with `emptyType` as the initial type for type graph nodes.
When an appropriate debug flag is passed, all abstract values will be
wrapped so that the underlying empty type is only used when a value is
known to be empty. Abstract values which have not yet been computed will
print as "[uncomputed]" in order to aid in debugging but will otherwise
behave like the empty type during type graph construction.
Change-Id: I1ec41e42e8b566a0a6bfe969c2ff96f4e53d5f4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243844
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
This now breaks the cycle in this folder, so all libraries can be migrated in a
specific order.
Change-Id: Ib76d813804e2d0eac485bbeb84a1e0aac0027e7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264360
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Creates an external createDartExport function in js_util.
Adds a number of checks for the annotation:
- Classes with the annotation should not have value in the annotation
- Classes with the annotation should have at least one instance member
somewhere in the hierarchy
- There are no export name collisions that are unresolvable accounting
for overrides
- Members with this annotation are instance members with a body only
Also adds checks to createDartExport:
- Checks that the type is a Dart class
- Checks that the type is marked as exportable
Change-Id: I52f27275966e9603e88921ce7897b7615178c4d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259511
Reviewed-by: Riley Porter <rileyporter@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Now that type parameters can occur nested within type literals there
is no reason to special-case type parameters. Now that we don't
consider type literals to be always constant, it is safe to remove
this extra check and handle type parameters the same as a generic
type literal containing a type parameter.
Change-Id: I887d162e20fd29f3285d73149927e51e1f1d1753
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264894
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Long ago Dart didn't support generic type literals and the deferred
loading algorithm assumed that in the ConstantCollector visitor. Now that Dart supports them, we need to ignore them if they get encountered.
Fixes#49851
Change-Id: I637f70a74bbe5ca8fc76c2f8ff79e97eeac19182
Fixed: 49851
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264884
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
This also fixes a couple nullability signatures in world.dart and class_set.dart
Change-Id: I11b383c312a2320ae4ea7bac36c46c3f80fb7e0e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264341
Reviewed-by: Nate Biggs <natebiggs@google.com>
This seems to speed up inferrer by 5-10%
Change-Id: I733159e9ec79212821444b4e502b28aa2bf81bdd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/263220
Reviewed-by: Nate Biggs <natebiggs@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This is to avoid confusion as we implement the records language feature.
Change-Id: I35aee0d88a42b7b4960332c3d81c0551d6e3ebde
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262506
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
The correct normalization should only normalize FutureOr<Never>
when Never is non-nullable.
Change-Id: I592f3a4856c219b33a8f1ac8377567a956e1148c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261000
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Add RecordType to the dart2js DartType hierarchy.
The RecordShape is made explicit so that processing the record type usually means processing the list of field types.
This pattern of shape + combined-fields will be used elsewhere, e.g. constants.
Filled out some uses of ir.RecordType until it gets converted to a dart2js DartType.
Change-Id: I6aa4d4a920cbb0e4f37e7079bc4d9d10e366a849
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261581
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Also prepare some ssa/ files by importing world_iterfaces.dart
Change-Id: Ifa1c61d27a32619baec60ab7835f66e36dee3bf5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261283
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This reapplies f740b500e2
The change is not that different from the original, except that a
few changes have landed in between to address the failure
encountered by the SDK roll last time. Namely, the map lookup on
`resolvedUri` is normalized, so that the lookup will always match
how the store operation is done, and hence will succeed when copying
cache entries between resolvedUri and uri (see also
https://dart-review.googlesource.com/c/sdk/+/250440).
Change-Id: Ic3ad778a3e9ea465b515de9800f296c71683970c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260081
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
The changes between inferrer/ and inferrer_experimental/ are identical. The changes were made in one and then the files were re-copied into the other.
Change-Id: I2bb9d54ee39e8b9acba55e5e4c83392e5ab59586
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260320
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
The changes between inferrer/ and inferrer_experimental/ are identical. The changes were made in one and then the files were re-copied into the other.
Change-Id: I5efd388913a2bdab9d6da028c0b753ba7264f3c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260246
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Small follow up cleanup in element_map_impl addressing comments from the
previous code review.
Change-Id: I1eea8bba35575b953de4686351e60f0cbf353d84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260066
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
A few private methods in common/elements.dart are used to lookup classes
and members. This is a step in normalizing these methods, so that we use
different APIs when the values are required and when they are not.
Ideally this is a change we'd do more generally in our APIs (e.g. the env APIs
should be split).
Change-Id: Iacc2f012f6f60ae960c61d8897630f6a7f1d60e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260080
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Bug: https://github.com/dart-lang/sdk/issues/49351
Adds checks for the following cases:
- Type arguments to createStaticInteropMock are correct
- No missing members in implementing class
- Inherited and non-overridden @staticInterop members are implemented
- Dart class can implement through inheritance and mixins
- Implemented members are correct subtypes of @staticInterop members
- Potential extension member conflicts that are attempted to be
resolved through subtyping rules
Change-Id: Iacbe5846040ba7fab41459aa19be77351cf1efca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255761
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
Will be used during call hierarchy analysis in combination with explicit call graph construction.
Currently typemasks do not support the `difference` operation and so we cannot fully narrow the type cones based on the call hierarchy. An implementation is included here of the applies-to set with subtraction of overrides.
Change-Id: I3f6c113787a4d26e9751added482791365c12832
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259560
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Changes to experimental inferrer include:
- Subtyping the experimental results classes so that they can be passed around in place of the base results classes.
- Leave out 'abstract_value_domain.dart' and 'abstract_value_strategy.dart'. All references to these in the experimental inferrer refer to the version in the base inferrer. These AbstractValue* types leak out of the inferrer and require more significant changes to duplicate. If necessary we can revisit these down the road.
Change-Id: I91ff44336c0471cb64ad4e0d36d727a38caea2fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259261
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
The fragment emitter already tries to skip the call to `addRules` if the
ruleset is empty, but this occurs too early. The ruleset encoder strips
tautologies like `T <: T` and `InterfaceType <: Object`, but this occurs
after the empty check.
This CL removes the preprocessing from the encoder and instead performs
checks when entries are added to the ruleset, fixing the issue.
Change-Id: I62f937e0ff6abac12973f82b2c89d8ea6f3162b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258040
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
Likely we can merge back closure_migrated into closure, but I'll keep them
separate to make the review process simpler.
Change-Id: I505a5b758f866fb9280a3453e57818be09ce8150
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/257163
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
There is a cycle between env and closure, so this also pulls out a subset
of closure to closure_migrated.dart
Change-Id: I7350c6a6efcb58c8343d93da93712e387925ca15
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256967
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Change-Id: I2d8ae1db222fc70729fda9eeb62296285de9da33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256760
Auto-Submit: Kevin Moore <kevmoo@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Also cleans up and unifies some behavior across the backends:
- avoiding reinstantiating JsInteropChecks for every library
- having the native classes as a member instead of recomputing on dart2js
Now that these checks exist, we can add lib/js/static_interop_test to
the test directories the wasm trybot runs.
Change-Id: I912aae988afe7915e80cc13d00b8c47818dfa520
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255760
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Since we are reading data in the context of a different reader, we should make sure that we use that reader's helpers.
Change-Id: Id7fbf3662104d131c1b31bff080a171bd3d38a88
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255800
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
These subtypes were previously colliding with instances of the base ir.InterfaceType class in the interner map.
Change-Id: Iec6b53fa82e0994142c408a0a2be1ddd045898e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255257
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Add several more inlining metrics to SSA:
- getters (ellisions vs. inlines)
- setters (ellisions vs. inlines)
- intercepted length calls
- if conditions
- is checks
- late sentinel checks
After digging these are all the opportunities for optimization that I saw that I thought might be affected by changes in global inference. Open to feedback on whether any of these are unnecessary or if there's any other things worth tracking.
Change-Id: I70ff279a797f71b39b2bc02c00fbb3f6e149cb2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255202
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
This reverts commit a547cfc096.
Reason for revert: With 15 shards this ends up holding too much serialized data and causes an increase in memory usage.
Original change's description:
> [dart2js] Defer deserialized CodegenResults by members.
>
> For large applications only ~60% of these objects are used. This defers their deserializtion until they're accessed in the codegen member map.
>
> In local testing on large applications this saved ~200MB of memory usage in the linker phase.
>
> Change-Id: I8ff87803fc23ef2d3f954646687e3fc67b68a4f7
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254600
> Commit-Queue: Nate Biggs <natebiggs@google.com>
> Reviewed-by: Joshua Litt <joshualitt@google.com>
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: I51d292531be30b358a025d7c472f25e8aba4dc3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255283
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Measures inlines (and skipped opportunities) during SSA and records them within the metric framework.
This can hopefully be used as a signal into the effectiveness of changes to the global analysis phase.
Change-Id: I9da5bad5792db8b089dbfc8725664ec13d32ab1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/255200
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Default value of `dependencies` should be `const {}` (and narrow field type) so that VM can devirtualize calls to the `_CompactLinkedHashSet` when iterating.
Change-Id: I112d9cd9a3cd060a38e292bc1a3c54a8a2847dfe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252301
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Long ago the compiler had logic for reading sources via an http
connection. This is not a supported use case and there is no need to
keep this around anymore.
Change-Id: Ic59c154def264a52d9310133f76b153c9972899c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251701
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
For large applications only ~60% of these objects are used. This defers their deserializtion until they're accessed in the codegen member map.
In local testing on large applications this saved ~200MB of memory usage in the linker phase.
Change-Id: I8ff87803fc23ef2d3f954646687e3fc67b68a4f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254600
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
The library wasn't taken into account when handling computing class
members in the K/J-model and not handled correctly when computing
applicable selectors. This made dart2js unable to handle members with
a name private to a different library than the enclosing library.
Fixes#33732Fixes#49226
Change-Id: I5ba143d87662bbd42e0ff02355054e4a937be8f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252665
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
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>