Commit Graph

56 Commits

Author SHA1 Message Date
Johnni Winther 8053c43dde Compute static types for for-in loops
Change-Id: I47e98eaf6df7d04286cb737bfdff135e6c0d34d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100843
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-05-01 14:06:39 +00:00
Johnni Winther ea6e83004b Use @pragma instead of package:meta/dart2js in tests
Change-Id: I16c0ed6f391a417d8faa55e68cde902d91e3db32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95220
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2019-03-06 08:32:05 +00:00
Johnni Winther 013cf68624 Replace js_helper annotations with @pragma
@ForceInline is still used by dart:html, will be removed in a later CL.

Change-Id: I480325fe91cc6baefb17ead49f839442e023d441
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95160
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2019-03-05 08:56:18 +00:00
Johnni Winther c591454dd3 Inline unprovided optional parameters
Change-Id: I61c82216965062feee8e01ba2533d0ea7c0052ef
Reviewed-on: https://dart-review.googlesource.com/c/90700
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-02-07 08:44:49 +00:00
Johnni Winther 477de6b84b Cleanup unittests
- remove use of '_strong', '_trust', and '_checked' suffices
- test omit-implicit-checks by default

Change-Id: I2a83f6fb23a22c894cc7867c51ab460abb4cc524
Reviewed-on: https://dart-review.googlesource.com/c/88454
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-01-07 15:01:10 +00:00
Johnni Winther ec1dfa8716 Add @pragma('dart2js:disableFinal')
Change-Id: I9b3f878803f946d08979144028d08b1a4dc4612f
Reviewed-on: https://dart-review.googlesource.com/c/86924
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-12-13 09:35:13 +00:00
Johnni Winther c987c9e5a7 Propagate cached static types to inference and ssa
+ use it to skip unnecessary casts.

Change-Id: Ib503a6fb74907f7e6367c8ee44548268e03045cf
Reviewed-on: https://dart-review.googlesource.com/c/86560
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-12-07 19:57:05 +00:00
Johnni Winther c18225d98c Implement guarded type promotion in dart2js
Change-Id: Ic284990c73ff5cb4b201ed4bbcc57ec0d7b0b66f
Reviewed-on: https://dart-review.googlesource.com/c/85923
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-12-05 11:52:26 +00:00
Johnni Winther e62951fd3d Use assigned variables data to infer static types for effectively final locals.
Change-Id: I3687d28628b0476c6a848f135bbda97e594449c2
Reviewed-on: https://dart-review.googlesource.com/c/84629
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-11-21 09:16:21 +00:00
Johnni Winther b4341f02db Remove unneeded method rti need
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>
2018-09-25 09:16:41 +00:00
Johnni Winther 5e263044e8 Enable StrongModeWorldStrategy
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>
2018-09-10 07:09:07 +00:00
Johnni Winther 760a9690c2 Remove tests irrelevant for Dart 2
Change-Id: Iedbab2ce11d7446ce28546f06ad97fd909f389c6
Reviewed-on: https://dart-review.googlesource.com/71404
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-08-29 07:29:38 +00:00
Johnni Winther 2c3e093208 Register implicit .call invocations.
Change-Id: I3dbfbe8d974474aaf8488a4432eeb988bc380be6
Reviewed-on: https://dart-review.googlesource.com/69966
Reviewed-by: Stephen Adams <sra@google.com>
2018-08-17 12:05:48 +00:00
Johnni Winther 1c673b1046 Include bounds in type literals
Change-Id: Ieb3e5b09e88c98f8943a6e7ca9031c8a6ab776e1
Reviewed-on: https://dart-review.googlesource.com/63820
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-07-09 12:24:04 +00:00
Johnni Winther da9705b356 Split compileLoadedLibraries
- into computeClosedWorld, performGlobalTypeInference and generateJavaScriptCode
+ pass closed world and inference results directly
+ this prepares for (de)serialization after global inference

Change-Id: I1180de35eea78a107c9e95fc6e904084b63ba0f2
Reviewed-on: https://dart-review.googlesource.com/63943
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-07-06 22:02:57 +00:00
Johnni Winther 25286e4a7d Add tests for optimization of Flutters use of Widget.runtimeType
Change-Id: I0432e8622b5e111a964b6a7b0cd0c1812573c053
Reviewed-on: https://dart-review.googlesource.com/62143
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-06-27 09:45:58 +00:00
Johnni Winther 2c98fb3c1d Add tests showing the async impact on function type checks
Change-Id: I8a59560dc18a8d491150d2c72287c2025e13beda
Reviewed-on: https://dart-review.googlesource.com/62061
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-06-26 08:11:04 +00:00
Johnni Winther a8d805055a Handle covariant parameters in function types
Closes #33575

Change-Id: I743a951f5864ca538b588441ecba2680eba2081f
Reviewed-on: https://dart-review.googlesource.com/61924
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-06-22 20:24:55 +00:00
Johnni Winther 216e8dfe85 Stop using !kernel annotations
Change-Id: I097253c0eb9ceb27322494194fbc6d899434807e
Reviewed-on: https://dart-review.googlesource.com/61263
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-06-21 07:36:42 +00:00
Johnni Winther f59389b688 Optimize .runtimeType impact based on usage
Change-Id: If6c24d4115241dcb8ac2ed82eee58c4025e3d8e2
Reviewed-on: https://dart-review.googlesource.com/59090
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-06-15 19:51:14 +00:00
Johnni Winther 52d7a3043a Track RTI dependency through instantiations
Closes #33093

Change-Id: Ia7d9cd1235cd4fe60858f37533689f5eeb600540
Reviewed-on: https://dart-review.googlesource.com/59400
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-06-12 08:00:09 +00:00
Johnni Winther f3502f9051 Fix bug in RTI optimization
Change-Id: Iec3026f0a79ac54dd125e15f00e4beb21e9a371c
Reviewed-on: https://dart-review.googlesource.com/58020
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-06-01 22:20:59 +00:00
Johnni Winther d0112f4431 Remove old frontend equivalence tests
Change-Id: I18b4b9979aea44b4dec64a5f1a32e67118b54a97
Reviewed-on: https://dart-review.googlesource.com/54222
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-09 07:55:08 +00:00
Johnni Winther d13bf49870 Check type-variable bounds on generic methods
Closes #32711

Change-Id: I86c123f5a8b9eda393b276248cdd27d1b109354b
Reviewed-on: https://dart-review.googlesource.com/53201
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-03 09:36:58 +00:00
Johnni Winther f373cfed83 Add omit-implicit-checks mode to equivalence tests.
Change-Id: Ifd98727384943d167b0ef39caaa9c1351b16e9ee
Reviewed-on: https://dart-review.googlesource.com/52805
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-01 12:41:59 +00:00
Johnni Winther 93511d523c Track RTI for noSuchMethod
Change-Id: I1fd66c48061556f8950bad471744eab4e2f40eb7
Reviewed-on: https://dart-review.googlesource.com/52560
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-04-26 08:07:02 +00:00
Johnni Winther f74ee52c70 Optimize signature need computation.
Change-Id: Ied6dfbfe71a9d323e189dbcacdb5ae2985c3fbb8
Reviewed-on: https://dart-review.googlesource.com/52221
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-23 08:00:02 +00:00
Johnni Winther 74a69a03c4 Add tests for method/local function signatures
Change-Id: I608303b91e0a4ed0d83130841719f0f5116102de
Reviewed-on: https://dart-review.googlesource.com/52105
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-20 20:26:07 +00:00
Johnni Winther 1f2f8be33a Add tests for closure/rti optimization
Change-Id: Iedf1d63cb7d87ecd87a059988b1fd95431aeab6a
Reviewed-on: https://dart-review.googlesource.com/51641
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-19 12:51:50 +00:00
Johnni Winther 62670f05ad Update rti and deferred tests to run strong mode
Change-Id: I3b209f720c7f35f4dd977c2d2b373e45d063f29d
Reviewed-on: https://dart-review.googlesource.com/49502
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-06 21:20:12 +00:00
Sigmund Cherem 8d689fcca7 step 4 of ??: add omit-implicit-checks and preview-dart-2 flags, strong-mode
defaults to include implicit checks.

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

Change-Id: Iad5311234dec50a3f8dbd6557264b3feeb92afc8
Reviewed-on: https://dart-review.googlesource.com/48459
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-03-29 22:13:09 +00:00
Johnni Winther 36c2a71fcf Handle FutureOr in RuntimeTypeNeed/Checks computations.
Change-Id: I3b5b3f3feb665ff2f34b0975fb0062515a7b6ffd
Reviewed-on: https://dart-review.googlesource.com/48400
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-03-27 08:03:32 +00:00
Johnni Winther 85720e4eb3 Fix status of dart2js-with-kernel tests
Change-Id: I2f5a1589b800fc1d453f5dd6f941f77c42250acc
Reviewed-on: https://dart-review.googlesource.com/46242
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-03-13 11:22:44 +00:00
Johnni Winther b08bedee7e Update RuntimeTypesNeed to disable rti optimization
- for local signatures in strong mode.

Change-Id: I0cafead24b24a534813449b6bf710eeafcb569bd
Reviewed-on: https://dart-review.googlesource.com/46064
Reviewed-by: Emily Fortuna <efortuna@google.com>
2018-03-13 10:09:26 +00:00
Johnni Winther 42e7598f5d Don't emit function signatures for non-closure classes in Dart 2
Change-Id: I144ddd60abebe41549c1f5304d73cb56042c7289
Reviewed-on: https://dart-review.googlesource.com/46043
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-03-13 09:50:39 +00:00
Johnni Winther 26e689de05 More work on signatures
Change-Id: Ifd8c20f1947149d60cca7c69e40ad85533519746
Reviewed-on: https://dart-review.googlesource.com/45700
Reviewed-by: Emily Fortuna <efortuna@google.com>
2018-03-09 08:30:28 +00:00
Johnni Winther 8f4db274f1 Compute which selectors that need type arguments
Change-Id: I0e48ff67353d676ea77d13008ae46f79bb69336e
Reviewed-on: https://dart-review.googlesource.com/45321
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-03-07 13:46:49 +00:00
Sigmund Cherem 7fd5294bb3 Add rules to build dart2js platform in strong mode
This must land after we make the libraries strong clean.

Change-Id: I3a49a2be3b2bcb15842434266f55ce49e3800fc6
Reviewed-on: https://dart-review.googlesource.com/42140
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-03-02 22:19:19 +00:00
Johnni Winther 41118c438e Reimplement runtime type checks computation
Change-Id: Ic1baa96e60db30cf9afe3414e605f0200361583b
Reviewed-on: https://dart-review.googlesource.com/37560
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-02-12 13:29:30 +00:00
Johnni Winther ca8aacc981 Add rti_emission_test.dart
Closes #32055

Change-Id: Ic33be29a70b88dee2271d121958c25716dc4e6db
Reviewed-on: https://dart-review.googlesource.com/38540
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-02-12 10:35:20 +00:00
Lasse R.H. Nielsen 6f78471687 New methods on Iterable, List, Set, Queue, Map.
Changes signature of Iterable.singleWhere.
Makes LinkedHashMap no longer be a HashMap.

Change-Id: I7a12fea533d42b0fc8357086649df38ad01f3cdd
Reviewed-on: https://dart-review.googlesource.com/39140
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-02-07 06:12:53 +00:00
William Hesse 9c35cff5cd Revert "New methods on Iterable, List, Set, Queue, Map."
This reverts commit 0b59f24f97.

Reason for revert: Creates crashes in dart2js with kernel, see
https://luci-milo.appspot.com/buildbot/client.dart/dart2js-linux-d8-minified-1-5-be/9751

Original change's description:
> New methods on Iterable, List, Set, Queue, Map.
> Changes signature of Iterable.singleWhere.
> Makes LinkedHashMap no longer be a HashMap.
> 
> Change-Id: Ibd7e56e1ac03cb9fb10d19d1328d452fcd06d89f
> Reviewed-on: https://dart-review.googlesource.com/32541
> Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
> Reviewed-by: Leaf Petersen <leafp@google.com>

TBR=lrn@google.com,leafp@google.com

Change-Id: Iab904f5885a5213ae2e16ef496eed0b6843185f3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/39060
Reviewed-by: William Hesse <whesse@google.com>
2018-02-06 13:32:19 +00:00
Lasse R.H. Nielsen 0b59f24f97 New methods on Iterable, List, Set, Queue, Map.
Changes signature of Iterable.singleWhere.
Makes LinkedHashMap no longer be a HashMap.

Change-Id: Ibd7e56e1ac03cb9fb10d19d1328d452fcd06d89f
Reviewed-on: https://dart-review.googlesource.com/32541
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-02-06 11:17:46 +00:00
Johnni Winther abaabd4773 Remove unneeded RuntimeTypeChecks object
Change-Id: Ia0d7e842edff4694a74a6d3e43c3c912093c3e9b
Reviewed-on: https://dart-review.googlesource.com/37520
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-01-31 08:00:31 +00:00
Johnni Winther 9b0d9a2882 Track type variable tests through generic method invocations.
Change-Id: Ibb4fdf92ca1085034db5d10c3f10b46f60c70c16
Reviewed-on: https://dart-review.googlesource.com/36941
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-01-29 09:20:02 +00:00
Johnni Winther f0b5e3466a Refactor collection and printing features for annotations.
Change-Id: Ib1c1790d883acd51c690237fd4d3374d6e0b92e5
Reviewed-on: https://dart-review.googlesource.com/36740
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-01-29 08:30:11 +00:00
Johnni Winther 09bb73427e Compute implicit is-tests more precisely.
Closes #21969

Change-Id: If446df1e1ae4cdfb4d32580abb7f12fb213d678c
Reviewed-on: https://dart-review.googlesource.com/35865
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-01-26 22:26:17 +00:00
Johnni Winther 588a60f15b Add test for needed runtime checks
This is added as a precursor to
https://dart-review.googlesource.com/c/sdk/+/35865 to detect to an error
in dart2js_extra/inline_generic_test/04 otherwise introduced.

Change-Id: I25e475709ee821d01694904ef0cade8100b7548b
Reviewed-on: https://dart-review.googlesource.com/36640
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-01-26 21:51:41 +00:00
Johnni Winther ffd18a37ef Track type arguments of static and dynamic calls
- and use these to optimize for type argument need on instance
methods and closurized static methods.

Change-Id: Id41d8f8aa7639da15fbd24844e397a4524b6ed20
Reviewed-on: https://dart-review.googlesource.com/35261
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-01-19 22:31:37 +00:00
Johnni Winther 73e35eb035 Update RTI optimization to handle type literal uses
... for generic methods and local function. Also update capture
conversion to recognize the new kinds of type variables.

Change-Id: I9b8771b0ebe6c9e926712fa31b0bdea966cc6a25
Reviewed-on: https://dart-review.googlesource.com/34600
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Emily Fortuna <efortuna@google.com>
2018-01-17 15:12:55 +00:00