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
Sigmund Cherem
c26f1c6bf7
Do not assume stack trace is not null
...
Change-Id: Ib795cfdbcf9599f7e4bc2688b9a965f50c0b7c3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98421
Commit-Queue: Sigmund Cherem <sigmund@google.com >
Reviewed-by: Stephen Adams <sra@google.com >
2019-04-02 00:02:53 +00:00
Johnni Winther
7baae76480
Always use ir constants in annotations when constant-update-2018 is enabled
...
Change-Id: Ib5ba6a908904c36a8580f6f47424b6982800dddd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98002
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Sigmund Cherem <sigmund@google.com >
2019-03-28 09:34:21 +00:00
Johnni Winther
87c553bf3c
Ascribe constants to the member world impacts
...
Change-Id: I978a6453196b47dd4ed5f51dde1d81feaa4f2008
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97502
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Sigmund Cherem <sigmund@google.com >
2019-03-22 12:58:40 +00:00
Johnni Winther
7dd4259d87
Handle ir constants in inferrer
...
Change-Id: Ie7b6ff9e62b3b8c78f6c04359cb72f77b249440c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97240
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Sigmund Cherem <sigmund@google.com >
2019-03-21 11:25:40 +00:00
Nate Bosch
f2579a8ede
Add override annotations in dart2js tests
...
In preparation of enforcing these in the analysis options.
Change-Id: I316f2efea510ecc8ff1b975e96d166a5f8c0286c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96834
Commit-Queue: Nate Bosch <nbosch@google.com >
Reviewed-by: Sigmund Cherem <sigmund@google.com >
2019-03-14 00:15:46 +00:00
Johnni Winther
440b4cd84e
Insert implicit casts when setting interface targets
...
This preserves the invariant that method invocations and property sets
with an interface target handle static types at the call site.
This is a prerequisite to improving dart2js with implicit checks.
With this we can mark dynamic invocations a statically safe and
discover when instance methods don't need to check parameter types.
Change-Id: Ife7a3f947952b3c1f73316b922b2aa107343068e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95400
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Sigmund Cherem <sigmund@google.com >
2019-03-11 13:08:34 +00:00
Johnni Winther
204651f3ab
Replace package:expect annotations with @pragma
...
Change-Id: Ib43d0d71a3ee8b0f0e6d676e6a3e448a107b7ca5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95180
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Stephen Adams <sra@google.com >
2019-03-05 11:00:17 +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
1720704594
Recognize effectively constant static fields
...
Change-Id: Ic8f7a014a6af2f9d8854e0731fe0d2df11b554da
Reviewed-on: https://dart-review.googlesource.com/c/94281
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Sigmund Cherem <sigmund@google.com >
2019-02-28 09:12:26 +00:00
Johnni Winther
b79e2a8882
Fix equivalence/show_helper
...
Change-Id: I95952b42bbaa882cedc4c3ab20182381d8424173
Reviewed-on: https://dart-review.googlesource.com/c/94224
Reviewed-by: Sigmund Cherem <sigmund@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2019-02-27 10:48:22 +00:00
Sigmund Cherem
5192cd1008
Narrowing improvements in dart2js global inference.
...
* no longer narrow by selector use, only narrow by type and non-null
* check for narrow nesting
* add non-null in a couple known places
One large apps, I compared the type-masks in dump-info and all differences were improvements with non-null. We weren't doing any narrowing based on the possible targets of a selector.
Change-Id: I270f360f70fbe3171d09ccd71d10517be9140194
Reviewed-on: https://dart-review.googlesource.com/c/90340
Reviewed-by: Stephen Adams <sra@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Sigmund Cherem <sigmund@google.com >
2019-02-23 00:10:11 +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
e14472c46b
Use getters/setters found through the static types.
...
This uses the information from the static types now used in inference which
can improve the precision in particular for generic classes. Since type
masks lose the type argument information, we cannot expect locating members
based on the type mask to be more precise than what has been found through
the static types.
This CL also expands the unit test framework to support unit test of
optimizations and the emission model, including tests of the improved
field access handling.
Closes #35433
Change-Id: Ia5de15efaf8b60c8723943bb34de6eec7d380798
Reviewed-on: https://dart-review.googlesource.com/c/88440
Reviewed-by: Stephen Adams <sra@google.com >
2019-01-07 15:01:10 +00:00
Johnni Winther
5fdab895a2
Use static types in inferrer
...
Change-Id: I284ca47dbaab452bd67c688b461fcbbe9a69e751
Reviewed-on: https://dart-review.googlesource.com/c/87402
Commit-Queue: Sigmund Cherem <sigmund@google.com >
Reviewed-by: Sigmund Cherem <sigmund@google.com >
2018-12-20 19:23:52 +00:00
Johnni Winther
8c7be910d0
Support compilation with the trivial abstract value domain
...
Change-Id: I1b42ee48f440db9e424448e794a8f8cc9d8f5f3a
Reviewed-on: https://dart-review.googlesource.com/c/86921
Reviewed-by: Sigmund Cherem <sigmund@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2018-12-18 12:20:36 +00:00
Johnni Winther
6d4d3c6b07
Remove TrustTypeAnnotations
...
Change-Id: I7404d10c30642f5282d079e36cb4a20ee2066060
Reviewed-on: https://dart-review.googlesource.com/c/87401
Reviewed-by: Sigmund Cherem <sigmund@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2018-12-18 11:00:09 +00:00
Johnni Winther
3cb3fd2b20
Move types/* to inferrer/*
...
Change-Id: Iff27cf92c6e0fec2c304dfbc0d2e4cb8901403cc
Reviewed-on: https://dart-review.googlesource.com/c/86567
Auto-Submit: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Sigmund Cherem <sigmund@google.com >
Reviewed-by: Sigmund Cherem <sigmund@google.com >
2018-12-07 18:06:35 +00:00
Johnni Winther
0a2ed86935
Infer general flow through && and ||
...
Closes #34993
Change-Id: Ifb849e4525ba9e5518932b8fba2ae556fb49acb3
Reviewed-on: https://dart-review.googlesource.com/c/85502
Reviewed-by: Sigmund Cherem <sigmund@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2018-11-30 08:32:11 +00:00
Johnni Winther
406d0b3e9c
Remove unused code from LocalsHandler
...
+ add test for issue 34993
Change-Id: Icd73c865e80ac9dca0e126c6b7e2c6c5320aef94
Reviewed-on: https://dart-review.googlesource.com/c/85240
Auto-Submit: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Sigmund Cherem <sigmund@google.com >
2018-11-27 14:07:01 +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
73eadf53c2
Move JsClosedWorld and JsClosedWorldBuilder to their own libraries.
...
Change-Id: I5bf75fcb443a591d460fd9e0f7c2258e345fff40
Reviewed-on: https://dart-review.googlesource.com/c/82640
Reviewed-by: Sigmund Cherem <sigmund@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2018-11-02 17:34:33 +00:00
Johnni Winther
843b4c9c23
Refactoring to prepare for serialization
...
- pipes GlobalLocalsMap, ClosureData and OutputUnitData through JClosedWorld
Change-Id: Id1d8353a9c75217aab7e06a276bfb503f50a5811
Reviewed-on: https://dart-review.googlesource.com/c/79683
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Auto-Submit: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Sigmund Cherem <sigmund@google.com >
2018-10-17 12:05:05 +00:00
Johnni Winther
4659cb9480
Fully split JsToElementMap and KernelToElementMap
...
- including the first benefit: Removing Class/Member definitions from the K-world.
Change-Id: I440dce2e37758dd276a417851f67a1403f6535a0
Reviewed-on: https://dart-review.googlesource.com/76641
Reviewed-by: Sigmund Cherem <sigmund@google.com >
2018-09-27 08:17:56 +00:00
Johnni Winther
db1570bdcd
Split element maps for J/K further
...
* 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 >
2018-09-11 11:10:37 +00:00
Johnni Winther
f8633aeae7
Move KernelToElementMapForBuilding and friends to js_model/element_map*
...
- this is part of splitting element map classes between K/J worlds
Change-Id: I82e4373f0849b12cb0d1586b77bfa411f55d26a7
Reviewed-on: https://dart-review.googlesource.com/72822
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Stephen Adams <sra@google.com >
2018-09-10 14:44:02 +00:00
Johnni Winther
e311e12bc4
Move all data for collection for testing behind one flag
...
- to ensure that we don't retain unneeded data in production
Change-Id: I2f702e040ed99cb8540a5b60efcf88a2c6b33af0
Reviewed-on: https://dart-review.googlesource.com/72720
Reviewed-by: Stephen Adams <sra@google.com >
2018-09-10 14:44:02 +00:00
Johnni Winther
6616ddeb88
Move dart2js unittests to subfolders
...
* 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 >
2018-09-10 08:22:53 +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
134bb884de
Handle generic types in native behavior
...
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 >
2018-09-07 22:28:37 +00:00
Johnni Winther
c715e8125d
Refactor global inference data to prepare for serialization
...
Change-Id: If88b948ca80b1a7915d87a49ba4e1d05de669282
Reviewed-on: https://dart-review.googlesource.com/72401
Reviewed-by: Stephen Adams <sra@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2018-09-06 07:11:44 +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
Aske Simon Christensen
a4b3009ca5
Require super initializer to be at the end of the initializer list.
...
Drops code to handle special evaluation order rules for super
initializer before the end.
Initializer check code now also recovers from initializer errors.
Fixes https://github.com/dart-lang/sdk/issues/33101
Change-Id: I1024853bfd3acfef42630bdc2fc47782746b07c0
Reviewed-on: https://dart-review.googlesource.com/68060
Commit-Queue: Aske Simon Christensen <askesc@google.com >
Reviewed-by: Kevin Millikin <kmillikin@google.com >
2018-08-22 10:43:08 +00:00
Johnni Winther
3af2f793ac
Remove --no-preview-dart-2 from dart2js
...
Change-Id: I17a18ebe905fa60ba2a1b41af2f444cfe58a38a2
Reviewed-on: https://dart-review.googlesource.com/70512
Reviewed-by: Stephen Adams <sra@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2018-08-20 09:18:02 +00:00
Aske Simon Christensen
eb37da8344
It is an error if a final field is initialized by some, but not all, constructors
...
closes https://github.com/dart-lang/sdk/issues/33022
Change-Id: I96549fcb2650a6efd685de41c972fd30a345fcf3
Reviewed-on: https://dart-review.googlesource.com/66563
Commit-Queue: Aske Simon Christensen <askesc@google.com >
Reviewed-by: Daniel Hillerström <hillerstrom@google.com >
2018-08-17 12:37:52 +00:00
Johnni Winther
4f1d6a33fc
Remove --analyze-* flags
...
Change-Id: I72f7834ba754bd5affec1a72d1d7be203031aa42
Reviewed-on: https://dart-review.googlesource.com/64041
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Sigmund Cherem <sigmund@google.com >
2018-07-10 08:40:59 +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
1717371c99
Move InferredData to GlobalTypeInferenceResults
...
- and make a pure GlobalTypeInferenceResults interface to prepare for (de)serialization.
Change-Id: I3c2f5f43d686c0d247c611185730134394d86844
Reviewed-on: https://dart-review.googlesource.com/63946
Reviewed-by: Sigmund Cherem <sigmund@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2018-07-06 22:02:57 +00:00
Johnni Winther
403e7c8022
Use DataComputer class to implement equivalence based tests
...
This prepares for more sharing of the boilerplate code.
Change-Id: I146a5c53e800ecb832288ca05e06a33a15177e00
Reviewed-on: https://dart-review.googlesource.com/63945
Reviewed-by: Sigmund Cherem <sigmund@google.com >
2018-07-06 22:02:57 +00:00
Johnni Winther
5dbf6da529
Remove generics where only ir.Node is used
...
Change-Id: I500b237a871ee21aca1a800806cdc95828713b5c
Reviewed-on: https://dart-review.googlesource.com/63944
Reviewed-by: Sigmund Cherem <sigmund@google.com >
2018-07-06 22:02:57 +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
04168fa922
Move more methods to ClassHierarchy.
...
Change-Id: I6f7f0266a77db1e64a40307a4878bfd9b1ca5f07
Reviewed-on: https://dart-review.googlesource.com/61932
Reviewed-by: Sigmund Cherem <sigmund@google.com >
2018-07-06 22:02:57 +00:00
Sigmund Cherem
a4c47afcae
Fix global-inference bug.
...
We incorrectly tracked is checks that are nested within subexpressions of
conditions that do not affect control-flow.
Fixes https://github.com/dart-lang/sdk/issues/33761
Change-Id: If8a9b64273998aed5c4ea8854ea8d717588d5658
Reviewed-on: https://dart-review.googlesource.com/63981
Commit-Queue: Sigmund Cherem <sigmund@google.com >
Reviewed-by: Johnni Winther <johnniwinther@google.com >
2018-07-06 22:01:37 +00:00
Johnni Winther
9276b27acd
Add unittest for InferenceData
...
Change-Id: Ic2ce5a66f2fa7227f029dfd38903bb686f0ab622
Reviewed-on: https://dart-review.googlesource.com/61925
Reviewed-by: Sigmund Cherem <sigmund@google.com >
Commit-Queue: Johnni Winther <johnniwinther@google.com >
2018-06-22 23:15:45 +00:00
Johnni Winther
1c4b362ba5
Support noSuchMethod forwarders in dart2js
...
Closes #32750
Change-Id: Ib2f358b14ae5a079e3df8413013ecfc006f0e69b
Reviewed-on: https://dart-review.googlesource.com/60250
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Sigmund Cherem <sigmund@google.com >
2018-06-20 10:15:41 +00:00
Sigmund Cherem
c96f23243b
Enable Dart2 in dart2js by default
...
Change-Id: Id197fc734bcb45f0805e49e89c0d03419384bb0b
Reviewed-on: https://dart-review.googlesource.com/60448
Reviewed-by: Stephen Adams <sra@google.com >
Commit-Queue: Sigmund Cherem <sigmund@google.com >
2018-06-19 19:20:36 +00:00
Johnni Winther
37425618d5
Narrow to static types in invoke/get in inference
...
Change-Id: Ifb085cf881c21a6161a22cb1f2b6058a9947f321
Reviewed-on: https://dart-review.googlesource.com/55920
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Sigmund Cherem <sigmund@google.com >
2018-06-13 13:11:10 +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
d17ec7c131
Move inference data from JClosedWorld to GlobalTypeInferenceResults.
...
Change-Id: I19fdd6771c78c022fd5ca9a3f63c01064bc34d07
Reviewed-on: https://dart-review.googlesource.com/58220
Commit-Queue: Johnni Winther <johnniwinther@google.com >
Reviewed-by: Stephen Adams <sra@google.com >
2018-06-06 07:49:08 +00:00