Commit Graph

63 Commits

Author SHA1 Message Date
Johnni Winther a1dd732ec6 Extract WorldBuilder results into an immutable BuiltWorld object
For resolution this is the KClosedWorld and for codegen this is the new
CodegenWorld object. This change removes the use of the world builders
after the world building has ended. It prepares for computing more of the
result data from the collected member usages.

Change-Id: I80032e3fc0e29179137b8c0380f09f68ab6fa03b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100540
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-04-26 07:52:58 +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 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 33bc628235 Treeshake unread fields
Change-Id: I188df5fd18163e5b32213a364d0fc163300db7b9
Reviewed-on: https://dart-review.googlesource.com/c/92130
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-02-07 09:58:19 +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 2776108a8f Remove LocalsHandler._capturedAndBoxed
Change-Id: I1f91a59d1e64dedad61dec77dd74aa6cd8e360dd
Reviewed-on: https://dart-review.googlesource.com/c/84524
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-11-16 07:58:56 +00:00
Johnni Winther d062a41404 Make resolution/codegen_world_builder into libraries
Change-Id: Ic8c00b2b3cf13a21e165486c1c825df75edd7d7b
Reviewed-on: https://dart-review.googlesource.com/c/84021
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Auto-Submit: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-11-09 23:05:58 +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 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 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
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 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 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
Peter von der Ahé 2514a67614 Import link.dart directly
I'd like to deprecate and remove the Link class,
as best as I can tell, it doesn't offer the same
performance benefits as I've seen on other platforms.

Fasta mostly uses "null" to represent empty lists, and
after the old dart2js front was deleted, there are few
uses remaining.

This CL makes it easier to find the remaining uses.

Change-Id: I73ac9b6b8b1bf5fed9669ae939cb3252cedbef0f
Reviewed-on: https://dart-review.googlesource.com/56781
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2018-05-29 07:40:27 +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 20c7725954 Handle deferred constant instantiations
Closes #32997

Change-Id: I31661bb223ca9d9bdee2e7cabe4e62bf18e87509
Reviewed-on: https://dart-review.googlesource.com/53007
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-01 08:31:01 +00:00
Johnni Winther 6a8cad4877 Optimize RTI capture
Change-Id: I1b1b363de442e118ccb1e2018748a2ba7c5fe9e6
Reviewed-on: https://dart-review.googlesource.com/51642
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-19 16:00:28 +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 1fc73bf1a6 Compute ClassFunctionType from signature function in Dart 2
- and reinsert assertion.

Change-Id: I2edd119dc53c46e764c07d095213183a186d9a22
Reviewed-on: https://dart-review.googlesource.com/47042
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Emily Fortuna <efortuna@google.com>
2018-03-21 10:48:39 +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 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
Johnni Winther 69106c6c8c Support simple static inlining from kernel.
Change-Id: Ie9a062b2d825c9fb0ed7bd5933eb7cf841509409
Reviewed-on: https://dart-review.googlesource.com/23660
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2017-11-27 10:19:41 +00:00
Johnni Winther 0daecdf552 Skip captured variables in refinement.
Change-Id: Iad54833db0dbdc683790fccec3dca4f5cf435657
Reviewed-on: https://dart-review.googlesource.com/12442
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-10-12 07:59:13 +00:00
Emily Fortuna 0eca8a1748 Add RTI while walking closure info.
Bug:
Change-Id: If1b33706d3b7a784f292a9f133779109109d8d25
Reviewed-on: https://dart-review.googlesource.com/8321
Commit-Queue: Emily Fortuna <efortuna@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-10-04 19:24:31 +00:00
Emily Fortuna 088989920a Fix boxing of variables in for-in and while loops.
Bug:
Change-Id: I8355f1b46a9dda03440fb8cadf1dbaf48572b41a
Reviewed-on: https://dart-review.googlesource.com/9430
Commit-Queue: Emily Fortuna <efortuna@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2017-09-29 19:11:53 +00:00
Johnni Winther fae35af7d6 Remove this local from factory constructors
Change-Id: I54a02e519066336aacc9e1729994225c49f856fd
Reviewed-on: https://dart-review.googlesource.com/7263
Reviewed-by: Emily Fortuna <efortuna@google.com>
2017-09-21 14:42:54 +00:00
Emily Fortuna 5402179bd4 Properly pass on this as a free variable when inside closures.
Bug:
Change-Id: Iba32dbc40e9361030a885b50a9e816c0ac123884
Reviewed-on: https://dart-review.googlesource.com/7102
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-09-19 20:16:45 +00:00
Johnni Winther 563304f174 Include constructors in equivalence tests
Change-Id: I3725d6801b19b1737c60ee0d8c07f21a71d8f470
Reviewed-on: https://dart-review.googlesource.com/6582
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Emily Fortuna <efortuna@google.com>
2017-09-19 10:08:53 +00:00
Emily Fortuna 553e4a0967 Don't make field entities for variables in boxes.
Bug:
Change-Id: Ie31e88438da93a1d54c8c688a5ccd212bb81bb28
Reviewed-on: https://dart-review.googlesource.com/4241
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Emily Fortuna <efortuna@google.com>
2017-09-11 23:32:51 +00:00
Johnni Winther f97a961cbe Support annotations on assignment and postfix operations
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/3007903002 .
2017-09-01 16:31:41 +02:00
Emily Fortuna ea038bd8e0 Pass in this as a free variable to the closure class
BUG=
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/3009903002 .
2017-08-31 10:41:19 -07:00
Johnni Winther 40858f5f50 Handle switch continue
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/3007783004 .
2017-08-31 12:32:01 +02:00
Emily Fortuna 98e36f719e Add boxing for modified variables
BUG=
R=sra@google.com

Review-Url: https://codereview.chromium.org/3007743002 .
2017-08-29 16:27:28 -07:00
Emily Fortuna 63754bba71 Add more tests for closures and change closure indexing to be by FunctionExpression or FunctionDeclaration rather than FunctionNode.
BUG=
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/3003963002 .
2017-08-28 14:24:58 -07:00
Emily Fortuna fba36729ec Revert "Revert "Reduce use of getClosureInfoForMember and cleanup closure_test""
This reverts commit e94ff86b2b.

Reapply Johnni's change with the status file updates.

BUG=

Review-Url: https://codereview.chromium.org/3008603002 .
2017-08-25 18:14:34 -07:00
Emily Fortuna e94ff86b2b Revert "Reduce use of getClosureInfoForMember and cleanup closure_test"
I tried to land  https://codereview.chromium.org/2998113002/ on behalf
of Johnni, but it wouldn't let me update the status files, and this
change modifies status files. Reverting.

This reverts commit 6b3f8665c0.

BUG=

Review-Url: https://codereview.chromium.org/3011433002 .
2017-08-25 17:57:51 -07:00
Emily Fortuna 6b3f8665c0 Reduce use of getClosureInfoForMember and cleanup closure_test
R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2998113002 .
2017-08-25 17:48:14 -07:00
Johnni Winther 0b643a69c4 Support enabling of type inference with useKernel
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/3004593002 .
2017-08-25 18:57:28 +02:00
Johnni Winther 2c3e487503 Prepare inference test for kernel based inference
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/3003323002 .
2017-08-25 09:44:31 +02:00
Johnni Winther 0b48a5880e Support unittest of jumps
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/3001223002 .
2017-08-19 10:53:06 +02:00
Johnni Winther 3c8096e040 Split getClosureRepresentationInfo into MemberEntity and (ir/ast) nodes
R=efortuna@google.com

Review-Url: https://codereview.chromium.org/3002953002 .
2017-08-19 10:36:49 +02:00
Johnni Winther fcc22bcb9a Add more info to closure_test output
R=efortuna@google.com

Review-Url: https://codereview.chromium.org/3002823002 .
2017-08-18 10:24:53 +02:00
Johnni Winther 7ad43da779 Test closure data on anonymous local functions
R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2996053002 .
2017-08-17 09:39:53 +02:00
Johnni Winther 9ab9598918 Add more tested features to closure_test
R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2999003002 .
2017-08-16 09:30:29 +02:00