This speeds up the computation of static type by avoiding repeated
visits of subtrees. The change also paves the way for improving
static type computation beyond what is specified. For instance by
handling negative type promotions.
Change-Id: Ifa3ea0f9760251f43cbbcc97b684004741a97b11
Reviewed-on: https://dart-review.googlesource.com/76020
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
We don't need to mark generic methods (not local functions) as needing
rti if subtypes of Functions need support for .runtimeType.
Unlike local functions, generic methods only have function type when
they are torn off. The tear-off itself doesn't add the need for type
arguments: either the function is instantiated, in which case the
instantiation carries the type arguments, or it is uninstantiated, in
which case the function type is still generic.
Change-Id: I5fc849aad443f49c4b0b26b18d6eccc409e43fb9
Reviewed-on: https://dart-review.googlesource.com/76000
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
This includes the unknown potential targets of access to js-interop
members. Since we don't know actual classes implementing the js-interop
classes we just assume it could be any of them.
Change-Id: I4d91ab673fa8221eb701b34e9c32fd16e5a1c381
Reviewed-on: https://dart-review.googlesource.com/74980
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This is a step towards making our own code use Dart 2 rather that
Dart 1 semantics.
For instance, the js-runtime libraries often use `dynamic` to avoid
extra type checking in Dart 1 checked mode, which has the consequence
that we have _more_ checking in Dart 2 (or just worse inference
baselines).
The VM is now optimizing for the typed paths and we should therefore
avoid unneeded dynamic accesses in dart2js code itself.
Change-Id: I793ef6c478c4c1b8caa1513990baafc598c462d8
Reviewed-on: https://dart-review.googlesource.com/74380
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Calls that return constants and calls that forward to calls of the
same or smaller size should be inlined in static initializers.
Change-Id: I55284b7455bc70e34607c0a218a5bf6ca31fc6b4
Reviewed-on: https://dart-review.googlesource.com/74020
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This ensures that entities only used in metadata is part of the K-world
and doesn't have to be created late in (only) the J-world.
Change-Id: If9a264c51fba99093a196538fb655b1d5fafd47a
Reviewed-on: https://dart-review.googlesource.com/73880
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
* The J model is in the /js_model/ folder and KernelToElementMapForBuilding is renamed
to JsToElementMap.
* The K model is in the /kernel/ folder and KernelToElementMapForImpact is renamed
to KernelToElementMap.
* Code shared between JsToElementMap and KernelToElementMap is in the /ir/ folder using
the interface IrToElementMap internally.
* KernelToElementMap and JsToElementMap do _not_ implement IrToElementMap so all code
that is not part of the implementation must explicitly use one or the other.
* Both KernelToElementMap and JsToElementMap extend KernelToElementMapBase
but this will be changed in a follow-up.
Change-Id: Id6b762984d25354477cb099dc2f8301b83a7ba07
Reviewed-on: https://dart-review.googlesource.com/73382
Reviewed-by: Stephen Adams <sra@google.com>
* All helpers in /helpers/
* Tests of user-facing behavior in /end_to_end/
* Tests of internal models and unittests of internal classes in /model/
Change-Id: Ic7a7e58aa01f92f8572514ae81230804f36af67e
Reviewed-on: https://dart-review.googlesource.com/72644
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
This makes closed world computation take the static type of the receiver
into account and removes non-live members from the J-world.
Change-Id: I5547aaae4685c6417a94916df0bc4e621296ce8d
Reviewed-on: https://dart-review.googlesource.com/72643
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Previous implementation didn't include subtypes of the specified type.
For instance `JS('Rectangle', ...)` should have triggered the inclusion
of `_DomRect` but the use of this-type in the subtype test,
`_DomRect <: Rectangle<T>`, prohibited this.
This fix is to use the raw type instead of the this-type. The subtype test
will therefore be `_DomRect <: Rectangle<dynamic>` which correctly
includes `_DomRect`.
The change has the effect that `JS('List', ...)` now actually includes subtypes of
`List`. For this reason uses of `List` have been updated to use `JSArray` or
explicitly use `returns:...` to avoid unintended inclusion of native lists such
as the native typed arrays.
Change-Id: I06ab55d9bf694829596875d9c3a0a6c954d396b7
Reviewed-on: https://dart-review.googlesource.com/73903
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Removed all sections labeled $compiler == dart2js and !$fasta.
Removed $fasta from all sections with $compiler == dart2js and merged
with existing sections as appropriate.
Some additional cleanup and normalization.
Change-Id: I8b93283a2cce22ce60e29d364c8d0e70dccbb6e3
Reviewed-on: https://dart-review.googlesource.com/71840
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Bug: https://github.com/dart-lang/sdk/issues/33022
This commit adds an error when a final field is not initialized at all
(and there is at least one generative constructor). A later commit
will add an error for the case where a field is initialized by some,
but not all, generative constructors.
A number of classes in the Dart2js and DDC support libraries use
uninitialized final fields to indicate getters in the corresponding
native classes. This commit adds a temporary whitelist for the
affected files, which can be removed when the fields have been
replaced by external getters.
This is tracked by https://github.com/dart-lang/sdk/issues/33762
Change-Id: I6b5cee230c7cd5554da2b61da7ebddb6b0b9396e
Reviewed-on: https://dart-review.googlesource.com/63781
Reviewed-by: Daniel Hillerström <hillerstrom@google.com>