Commit Graph

133 Commits

Author SHA1 Message Date
Samir Jindel 225a301637 [vm/ffi] Re-land "[vm/ffi] FFI callbacks on X64."
There are minor fixes for dartkb and windows.
The original revision is in patchset 1.

Change-Id: I9ab6e5fdb33fb4e84ea520c283fe94323616a8ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103129
Commit-Queue: Samir Jindel <sjindel@google.com>
Auto-Submit: Samir Jindel <sjindel@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2019-05-24 02:39:13 +00:00
Samir Jindel ed169c4bb0 Revert "[vm/ffi] FFI callbacks on X64."
This reverts commit be209f7846.

Reason for revert: failures on dartkb and windows bots

Original change's description:
> [vm/ffi] FFI callbacks on X64.
> 
> For context on the design, see go/dart-ffi-callbacks
> 
> Change-Id: I2482e3c932e73f9a4c00fa7e218ff85f9328fc51
> Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-simdbc64-try, vm-kernel-linux-release-simdbc64-try, vm-kernel-mac-debug-simdbc64-try, vm-kernel-mac-release-simdbc64-try, vm-kernel-reload-mac-debug-simdbc64-try, vm-kernel-reload-mac-release-simdbc64-try, vm-kernel-linux-debug-ia32-try, vm-dartkb-linux-debug-simarm64-try
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100240
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Daco Harkes <dacoharkes@google.com>

TBR=sjindel@google.com,ajcbik@google.com,dacoharkes@google.com

Change-Id: I4cb3d93675d68a51ac9e125ad1d572c47e8b5903
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-simdbc64-try, vm-kernel-linux-release-simdbc64-try, vm-kernel-mac-debug-simdbc64-try, vm-kernel-mac-release-simdbc64-try, vm-kernel-reload-mac-debug-simdbc64-try, vm-kernel-reload-mac-release-simdbc64-try, vm-kernel-linux-debug-ia32-try, vm-dartkb-linux-debug-simarm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102983
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2019-05-18 15:29:19 +00:00
Samir Jindel be209f7846 [vm/ffi] FFI callbacks on X64.
For context on the design, see go/dart-ffi-callbacks

Change-Id: I2482e3c932e73f9a4c00fa7e218ff85f9328fc51
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-simdbc64-try, vm-kernel-linux-release-simdbc64-try, vm-kernel-mac-debug-simdbc64-try, vm-kernel-mac-release-simdbc64-try, vm-kernel-reload-mac-debug-simdbc64-try, vm-kernel-reload-mac-release-simdbc64-try, vm-kernel-linux-debug-ia32-try, vm-dartkb-linux-debug-simarm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100240
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2019-05-18 06:15:46 +00:00
Alexander Markov 5ee20c99ac [vm/aot/tfa] Workaround for crash in getStaticType
Issues: b/131091988, https://github.com/dart-lang/sdk/issues/34496
Change-Id: I9ef8edfff39848e6f240402682d119fe35f7f776
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99972
Reviewed-by: Aart Bik <ajcbik@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-04-22 22:49:24 +00:00
Alexander Markov 8924c18003 [vm/tests] Revert changes in pkg/vm unit tests after constant-update-2018 was disabled
Pkg/vm tests were adjusted after constant evaluation was enabled in the front-end.
As constant evaluation was reverted (4b7d256a06),
we also need to revert corresponding changes in pkg/vm unit tests.

Revert "[vm/bytecode] Update expectations for bytecode generator unit test"

This reverts commit 734c50cbf2.

Revert "[vm/aot/tfa] Update TFA tests after front-end starts evaluating constants"

This reverts commit 25cb45c02f.

Change-Id: I2fcc30571bec2dd904925724ddb7105567c7ecda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99782
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-04-19 18:12:21 +00:00
Alexander Markov 25cb45c02f [vm/aot/tfa] Update TFA tests after front-end starts evaluating constants
Usually TFA takes kernel AST with all constants evaluated.
However, in order to avoid calling constant evaluator pass in TFA unit tests
there is a special implementation of pragma annotation parser (for testing)
which accepts annotations which are not ConstantExpressions.

After CFE starts evaluating all constants (constant-update-2018 was enabled in
e9ca6a5335), TFA unit tests need be
switched to use ConstantPragmaAnnotationParser.

Also, empty environment defines are passed to CFE to avoid unevaluated constants
and unit test expectations are updated.

Closes https://github.com/dart-lang/sdk/issues/36602

Change-Id: I2e7b0647e065cca129449b4531c6278c1d98061d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99269
Reviewed-by: Samir Jindel <sjindel@google.com>
2019-04-12 19:33:35 +00:00
Alexander Markov 852b72b65e [vm/kernel] Integrate protobuf tree shaker into kernel compilers
This change adds option --protobuf-tree-shaker to enable protobuf tree
shaker transformation in gen_kernel and Fuchsia kernel compiler.

Protobuf tree shaker requires closed world and only works with --aot
and --tfa.

Change-Id: I9fcc7934624f2d11f9b04215f1a81367f8ec82e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98781
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Sigurd Meldgaard <sigurdm@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2019-04-09 21:22:27 +00:00
Johnni Winther 4fc0e1f13d Use .nullType as type of null and fix null type handling in getStaticTypeAsInstanceOf
The .getStaticType results for NullLiteral and NullConstant are inconsistent. The former returns `const BottomType()` and the latter return `TypeEnvironment.nullType`.

To avoid this inconsistency and since `const BottomType()` is really the "unreachable" type, used for instance of for the type of a throw expression, the implementation is changed to consistently use the .nullType.

For this to work, getStaticTypeAsInstanceOf (and the equivalent dart2js implementation), and the `Type.fromStaticType` constructor in the VM type flow analysis have to special case the .nullType.

Change-Id: If6b806d4a39ef7b906275c43fa2089b9d140523b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98563
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-04-09 06:49:17 +00:00
Daco Harkes 395e5f6037 [cfe/vm] make dart:ffi compatible with constant-update-2018
I added TODOs for removing the old code after the constants update has landed.

Change-Id: Icde8d68e4e7c4b51e9536f09ce4e514e3b00336d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98661
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-04-04 11:09:51 +00:00
Samir Jindel 154c324786 [vm/ffi] Lock out structs on 32-bit platforms.
Addresses https://github.com/dart-lang/sdk/issues/36334

Change-Id: I880812941748207ea93a789db2f2d4d2938d3f37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97961
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Samir Jindel <sjindel@google.com>
2019-04-01 10:30:58 +00:00
Aske Simon Christensen 0b57b67ecb [CFE] Move const set desugaring to constant evaluator.
To properly recognize control-flow constructs in sets, the constant
evaluator needs to get un-desugared set literals. This commit skips the
desugaring of const set literals if the constant evaluator is enabled
and adds a similar desugaring in the constant evaluator.

Doing the desugaring in the constant evaluator (which can be called
independently of Fasta) necessitates that dart:collection is indexed
in CoreTypes. We can remove this indexing again when the VM gains
native support for set constants.

Change-Id: Ibddafdcb182e4471012801745b51b529805b7b9f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98008
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2019-03-28 15:00:58 +00:00
Aske Simon Christensen c10ee9971f [CFE] Move constant evaluator to Fasta.
Reland of https://dart-review.googlesource.com/c/sdk/+/96081

Change-Id: Ie9e6a0d26703469396fa6ea4803f49ce387f495b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97224
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-03-18 15:42:05 +00:00
Sigurd Meldgaard 9d3988eb67 [vm] First stab at a protobuf aware treeshaker
Relies on https://dart-review.googlesource.com/c/sdk/+/96782
Change-Id: I820e884f96923f9eb9a856faef6442f6ed645fe1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96162
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-03-18 13:07:44 +00:00
Aart Bik e6f56a8adf [vm/compiler] first vm implementation of block expression
Rationale:
Implementation of control-flow collections is
done through the notion of block expressions.
This is a first implementation to get this
working. It takes a few shortcuts (like disabling
OSR inside block expressions for now) that may be
refined later.

https://github.com/dart-lang/language/issues/78
https://github.com/dart-lang/language/issues/47

Change-Id: I966bf10942075052fcfd9bac00298a179efc551b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/94441
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-03-08 20:48:31 +00:00
Sigurd Meldgaard ca24e7aa10 [vm] Allow no main method when doing type flow analysis
Change-Id: I97fce485ad1792766d34ad365b359b44c8aacb61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95385
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2019-03-05 10:38:38 +00:00
Daco Harkes 9b10476092 [kernel/ffi] fix library paths
Follow up of: https://dart-review.googlesource.com/c/sdk/+/93081

Change-Id: Ie4a71d0aa723fc8f9b9ed0d244a921445a81b394
Reviewed-on: https://dart-review.googlesource.com/c/93543
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2019-02-20 12:54:21 +00:00
Daco Harkes 620743fb6b [vm/ffi] void functions
Change-Id: I1544e0985d934dfa354143764dee61feb08b2592
Reviewed-on: https://dart-review.googlesource.com/c/93422
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2019-02-18 13:15:21 +00:00
Daco Harkes 20c3cd62fc Revert adding dart:ffi to core_types and fasta kernel_target
Change-Id: I0c8a05cf8715962ab6ebe787dafd14fe611a8a0e
Reviewed-on: https://dart-review.googlesource.com/c/93172
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2019-02-15 10:14:00 +00:00
Samir Jindel 3b2144fa93 [vm] Respect entry-point annotation on constructors during obfuscation.
Change-Id: Ia61d582fb6dd647b8fcab051b57ff08682076d9d
Cq-Include-Trybots: luci.dart.try:vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try, vm-kernel-precomp-mac-release-simarm64-try, vm-kernel-precomp-win-release-x64-try, vm-kernel-precomp-obfuscate-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/93225
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-02-14 20:18:19 +00:00
Samir Jindel ae7bf9e999 [vm] Support closurization of methods through @pragma entry-points.
Fixes dartbug.com/35720.

Also enable native extensions in AOT.
Increases Flutter Gallery snapshot size by 0.19%.

Change-Id: I1b24c3b9a49a13fd48452e9a89595516a7f01780
Cq-Include-Trybots: luci.dart.try:vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try, vm-kernel-precomp-mac-release-simarm64-try, vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/92283
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-02-14 17:47:28 +00:00
Daco Harkes 6a5c9597c6 Revert adding enclosingLibrary to ast.dart
Change-Id: Iacc24b512d1ff40bd54e37ba0ad0611fa46234b7
Reviewed-on: https://dart-review.googlesource.com/c/93169
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2019-02-14 15:49:08 +00:00
Samir Jindel c8a2a7b719 [vm/ffi] Move FFI transformations from pkg/kernel to pkg/vm.
Change-Id: I8bc0c60ceb98ad88aca31934b6eaaf1e55128a10
Reviewed-on: https://dart-review.googlesource.com/c/93081
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2019-02-13 15:53:35 +00:00
Aske Simon Christensen f066c05319 Rename klass getter on InstanceConstant to classNode
This achieves consistency with similar getters in the API.

This is technically a breaking change, since it changes a published
part of the Kernel API. Since the constants API is relatively new and
so far only used internally in the AOT compiler, the change is
expected to be unproblematic.

Closes https://github.com/dart-lang/sdk/issues/35696

Change-Id: I3ca30922580d226ccbdb6f77496983c21ef2102b
Reviewed-on: https://dart-review.googlesource.com/c/90220
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2019-01-28 13:31:05 +00:00
Alexander Markov d821a2ec96 [vm/aot/tfa] Correctly tree shake initializers of write-only fields
Fixes https://github.com/dart-lang/sdk/issues/35632

Change-Id: I9736268087a90fd409509f35bf2fc0637443a9fb
Reviewed-on: https://dart-review.googlesource.com/c/89161
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-01-11 20:46:30 +00:00
Peter von der Ahé 8e5ad9b3bd Prepare the VM for removing TypeEnvironment.hierarchy
Validating the class hierarchy requires subtype tests. Previously,
Fasta has worked around this by computing the hierarchy twice, as
well as visiting the hierarchy several times. In order to improve
performance of modular compilation, we're working on changing this.

To enable creating a TypeEnvironment without a hierarchy, we're
removing the field from the API.

Change-Id: I7c9f88d5c6495aaa8223eaeff7d2dfd5669e9e95
Reviewed-on: https://dart-review.googlesource.com/c/88823
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-01-10 05:21:24 +00:00
Samir Jindel b58e8d7307 [vm] Use TFA to remove explicit type-checks (including keyword-covariant parameters).
- Also allow using the unchecked entry-point for invocations of generic functions where
  there are no bounds or the bounds don't require dynamic checks.

Change-Id: I6ca1ebec777ecf2989c4fb77425d65d542d5adf2
Cq-Include-Trybots: luci.dart.try:vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try, vm-kernel-precomp-mac-release-simarm64-try, vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/87181
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-01-08 08:36:58 +00:00
Alexander Markov 3b29f5ad81 [VM/AOT/TFA] Do not attribute calls via fields/getters with inference results
MethodInvocation nodes which have field or getter as interface target
actually correspond to 2 calls: 1) getter; 2) implicit call() on the result
of the getter.

While this was correctly modeled in summaries in TFA, it is not correct
to attribute such MethodInvocation nodes with results of the inference,
as results correspond to an each distinct call. To fix this, Call
statements in summaries are created without attaching them to a
corresponding kernel AST node.

Change-Id: I3ea28ed85550192f8b592a926cac0eae23810811
Reviewed-on: https://dart-review.googlesource.com/c/88424
Commit-Queue: Martin Kustermann <kustermann@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-01-07 10:22:40 +00:00
Peter von der Ahé e45e334548 Rename strong mode to legacy mode in package:kernel
Change-Id: Ia4a8a9cac7817a8db5771ec82541b556c705f7c8
Reviewed-on: https://dart-review.googlesource.com/c/86353
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-12-20 18:06:34 +00:00
Dmitry Stefantsov a116759784 [vm] Fix super refs in non-synthetic constructors in mixin deduplication
Change-Id: I50bc48b6956aadd770ee73bc09b6292f33eac2ea
Reviewed-on: https://dart-review.googlesource.com/c/87078
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-12-14 11:21:58 +00:00
Samir Jindel 921e62f1bf [vm] Introduce multiple entrypoints to AOT.
Cq-Include-Trybots: luci.dart.try:vm-kernel-win-release-x64-try, vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try, vm-kernel-precomp-win-release-x64-try
Change-Id: I8643033febf9bdc57c8298dca5f43346fb8bf6d1
Reviewed-on: https://dart-review.googlesource.com/c/80304
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-12-07 13:19:24 +00:00
Martin Kustermann 0ef66e0f5c [VM] Add @pragma("vm:non-nullable-result-type") annotation
A field/function annotated with this pragma must be guaranteed to not
return `null` at runtime.

Make use of this non-nullable annotation in the VM's type propagator.

Annotates the "_TypedListView._typedData" field to ensure the VM knows it
returns a non-nullable _TypedListView.

Furthermore annotates methods on the integer implementation.  Those particular
methods are recognized methods with a "dynamic" return type.  This caused
the type propagator to use CompileType::Dynamic() as result type.  Since a
previous CL started to only utilize the annotated type if it is better than
"dynamic" more integer operations got handled in-line, though with null-checks.
Annotating those methods to return non-null improves the in-line handling of
integer operations.

This improves dart-aot

On arm7hf:
  SHA256: +5%, SHA: +6%, JsonObjectRoundTrip: +7%, ...

On arm8:
  SHA1: +28%, MD5: +25%, SHA256: +15%, TypedData.Int16ListViewBench: +18.5%, StringInterpolation: +18%, ...


Issue https://github.com/dart-lang/sdk/issues/31954
Issue https://github.com/dart-lang/sdk/issues/35154

Change-Id: Ia4263a37241a36c9dc35e8a48893297effa6f4b2
Reviewed-on: https://dart-review.googlesource.com/c/84421
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-11-22 16:18:27 +00:00
Alexander Markov 056fdb8734 [vm/kernel] Fix kernel tree shaker after FunctionType.typedefType change
Fixes https://github.com/dart-lang/sdk/issues/34995

Change-Id: Ieef2696ea9cfe689a661dc7d1ebd86b257b49bbb
Reviewed-on: https://dart-review.googlesource.com/c/82261
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-11-01 15:41:12 +00:00
Samir Jindel e23acaaf90 [vm/aot] Fix obfuscation.
Test Plan:

Make vm-kernel-precomp-obfuscate-linux-release-x64-try green, ensuring status file changes
reflect design gaps and not bugs.

Tested locally that obfuscated Flutter Gallery runs.

Change-Id: Ifcdc334de58f43c310e15b58dbcf6fe1597206f2
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-obfuscate-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/81009
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-10-26 13:00:33 +00:00
Samir Jindel 3e7ce992cf [vm/tfa] Implementation of type arguments tracking in TFA.
Change-Id: I9398186e27ae7a040e249df010ae16fb6ab6da89
Cq-Include-Trybots: luci.dart.try:vm-kernel-win-release-x64-try, vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try, vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/74962
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-10-11 19:09:42 +00:00
G?nter Z?chbauer 2da0b9f4f1 fix some typos
Closes #34738
https://github.com/dart-lang/sdk/pull/34738

GitOrigin-RevId: d211bbacfe65355cf7304c990ffb6c79d7a229cf
Change-Id: If690e6d378e543b300e1f6a353ceae73e39c29db
Reviewed-on: https://dart-review.googlesource.com/c/78900
Reviewed-by: Alexander Thomas <athom@google.com>
2018-10-10 19:15:30 +00:00
Alexander Markov f939503b50 [vm/aot] Make mixin deduplication transformation more robust wrt new mixins
Previously, mixin deduplication transformation expected that isAnonymousMixin
classes could occur only in a superclass position. After this change,
deduplication also handles (canonicalizes) isAnonymousMixin classes in
implementedTypes, as CFE uses isAnonymousMixin classes in implementedTypes
to represent superclass constraints for mixin declarations.
No other uses of isAnonymousMixin classes supported.

Fixes https://github.com/dart-lang/sdk/issues/34704

Change-Id: I8558ce53c4fb1e5a06f839fa5ec8022958d9dafd
Reviewed-on: https://dart-review.googlesource.com/c/78383
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
2018-10-08 19:05:54 +00:00
Alexander Markov 46983c2de9 [vm/aot/tfa] Detect if a method/setter is called from this
This information could useful in AOT to omit unchecked entry points.

Change-Id: I1c54720e46d578dc64f67306abdf4619a34ae122
Reviewed-on: https://dart-review.googlesource.com/c/77921
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2018-10-04 11:26:44 +00:00
Alexander Markov 270fd8e4a8 [vm/aot] Handle annotations on parameters in tree shaker and constant evaluator
Fixes https://github.com/dart-lang/sdk/issues/34644
Issue https://github.com/flutter/flutter/issues/22355

Change-Id: Iaf1e5da9a2d33cf4cd8ea2510cf1faff1a20c886
Reviewed-on: https://dart-review.googlesource.com/c/77673
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-10-03 16:16:46 +00:00
Alexander Markov c78f67cc7e [vm/aot] Use TFA to detect dynamic, non-this and tear-off uses
TFA is improved to detect if a method was called using dynamic selector,
was ever called not via this, and whether the tear-off was taken.
This information is used to remove parameter type checks in AOT.

Less accurate selector-based analysis, which was used previously to get
this information, is now used only if TFA is disabled.

Also, precompiler is improved to omit method extractors and implicit
closure functions if analysis proved that tear-off is not taken.

Flutter gallery snapshot size: -0.8%

Change-Id: Iec01257dfdc78104752104df14e2ce078d326a96
Reviewed-on: https://dart-review.googlesource.com/77005
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2018-09-28 23:49:09 +00:00
Alexander Markov 0f5968945c [vm/aot] Do not tree shake type arguments used in constant instances
Change-Id: I2a3c6f8ed8e31ebcbd1329fbf5997d1cad558daf
Reviewed-on: https://dart-review.googlesource.com/76744
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-09-26 21:42:36 +00:00
Alexander Markov f81709c3e3 [vm/aot] Use field types inferred in TFA and remove inference in precompiler.cc
Type inference for final fields in precompiler.cc is limited and
does not properly handle constant objects.

This change hooks up field types inferred by TFA and removes the
inference in precompiler.cc.

Fixes: https://github.com/flutter/flutter/issues/22131

Change-Id: Ida65cd211074623928bb2a7d48dc58d5e53511b8
Reviewed-on: https://dart-review.googlesource.com/76562
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-09-25 23:26:09 +00:00
Alexander Markov 53497549ab [vm] Specialize 'new List()' on kernel AST
In VM, 'new List' is equivalent to either 'new _GrowableList' or
'new _List' depending on the number of arguments.
This change does the transformation early (on kernel AST), in order
to have specialized representation in TFA and in bytecode.

Change-Id: I46f0db8cc19efb3a53fdbe971ac26bdd2736fbda
Reviewed-on: https://dart-review.googlesource.com/76283
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-09-25 00:38:57 +00:00
Alexander Markov afd4cc9d1a [vm/tfa] Infer concrete class of int literals in TFA
Teach TFA that small integer literals, which fit into Smi on all
platforms have a concrete class _Smi.

Change-Id: I4aec5389fc0a83f36077c1f1c0c9a5e59ff4b260
Reviewed-on: https://dart-review.googlesource.com/76302
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-09-25 00:16:51 +00:00
Alexander Markov a4d48f49e7 [vm/tfa] Infer concrete class of string literals in TFA
Depending on a value of a string literal, it is possible to determine
concrete class at compile time (either _OneByteString or _TwoByteString).

Change-Id: Ied696b328021e9a61f1ad14d02b88681a9ed4fed
Reviewed-on: https://dart-review.googlesource.com/76260
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-09-25 00:16:51 +00:00
Alexander Markov 19e2040f35 [vm] Cleanup the ability to specify entry points via JSON and text files
Entry points files (both JSON and text) are replaced with
@pragma("vm:entry-point") annotations.

This change removes obsolete:
* --embedder_entry_points_manifest option in gen_snapshot;
* --entry-points option in gen_kernel and frontend_server;
* --print_precompiler_entry_points VM option;
* 'entry_points' argument in Dart_Precompile() API.

Change-Id: I503f50f51df27e8e9635388c013058686b3b6ff1
Reviewed-on: https://dart-review.googlesource.com/75793
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-09-21 16:51:48 +00:00
Alexander Markov 4134b95a3d [vm/tfa] Streamline handling of tear-offs in TFA
When building a summary, instead of adding a raw call for a torn off
method immediatelly, add a call with PropertyGet kind.
Calls of methods with PropertyGet kind are already handled as
they could appear from dynamic calls.

This has the following advantages:

* Duplicated handling of tear-offs is removed. Now only
  _DirectInvocation._processFunction handles tear-offs, both from
  dynamic and non-dynamic calls.

* This change allow us to more accurately figure out whether the
  tear-off was taken from a particular method, as tear-offs of
  interface methods are now routed through a dispatchable call which
  figures out targets.

Change-Id: I49692577728c03285cb22863c53e4ea3cdd2ab5e
Reviewed-on: https://dart-review.googlesource.com/75386
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-09-19 02:27:24 +00:00
Alexander Markov d44ffba254 [vm/tfa] Stop accepting non-empty entry points json files
Entry points JSON files are deprecated (replaced with pragmas).
So TFA should not require them. As a sanity check, it will complain
if an entry points JSON file is not empty.

Change-Id: Ie64121ab4cdd0c330f81a8cb71a671e1df82f136
Reviewed-on: https://dart-review.googlesource.com/75423
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-09-19 01:41:30 +00:00
Samir Jindel cdb9336fc0 [vm/tfa] Use concrete types for list and map literals and constants.
Change-Id: Ieaeb64501c78e31a38c1aa350a7f112f51bcc7f0
Cq-Include-Trybots: luci.dart.try:vm-kernel-win-release-x64-try, vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try, vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/74881
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-09-18 08:58:11 +00:00
Vyacheslav Egorov b6e2e158dd [vm/kernel] Make call site annotator transformation more robust
Currently we can't rely on getStaticType due to various issues with
Kernel AST - so we just wrap the invocation in try-catch and swallow
the exception if any.

Fixes https://github.com/dart-lang/sdk/issues/34463

R=alexmarkov@google.com

Change-Id: I48af952c4df4e124a895f0e1b9bf50a50b94a047
Reviewed-on: https://dart-review.googlesource.com/75221
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-09-17 22:48:13 +00:00
Samir Jindel 7c5b3dc485 [vm/tfa] Pass receiver type into field initializer summaries.
This is required for tracking type arguments, since field initializers can
reference type variables from the enclosing class.

Also a few drive-by spelling fixes.

Change-Id: I91e33f7d8c61e288ccb2d8e18b33f4e67ac22a1b
Cq-Include-Trybots: luci.dart.try:vm-kernel-win-release-x64-try, vm-kernel-optcounter-threshold-linux-release-x64-try, vm-kernel-precomp-linux-debug-x64-try, vm-kernel-precomp-linux-release-simarm-try, vm-kernel-precomp-linux-release-simarm64-try, vm-kernel-precomp-linux-release-x64-try, vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/74666
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-09-13 19:17:26 +00:00