Commit Graph

51 Commits

Author SHA1 Message Date
Johnni Winther f889bd7067 Delete JavaScriptBackend
* move names to Identifiers
* move resolution parts to front end strategy
* move codegen parts to backend strategy
* remove now unneeded methods from FrontendStrategy and BackendStrategy

Change-Id: I0675d56045dd212ad195177ecd23b27b0d849a80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105742
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-06-13 10:09:46 +00:00
Johnni Winther 0e5ebcaa96 Add InlineData and InlineDataCache
Merges InlineWeeder and InlineReductive into one visitor and computes
an InlineData object from which all decisions can be made.

Next step is to compute InlineData in the scope visitor (the first visitor
of the first modular phase).

Change-Id: I0c435ae1b3d7afdff1cee7abac657c9362995a67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103632
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-05-27 09:01:25 +00:00
Johnni Winther 05f3b12960 Add test for native declarations
Change-Id: Iea9d8d27e6fdefa6f47471a459cdb4363aab65e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98011
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-03-28 10:29:11 +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 8e2fcf7782 Advanced tracking of field initialization
Change-Id: I8c8edb517bc3a3805ac0d72388f4e5c7fc34247f
Reviewed-on: https://dart-review.googlesource.com/c/93680
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-02-22 16:08:16 +00:00
Johnni Winther 45f55183c5 Refactor processing of pragma annotations
Change-Id: I3d4efdab560557d5d9bbab748d003cd360efbe3d
Reviewed-on: https://dart-review.googlesource.com/c/92264
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-02-08 09:55:28 +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 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
Stephen Adams 20fa7815f0 Add @pragma('dart2js:noInline') and @pragma('dart2js:tryInline')
This is a redo of "[dart2js] Simplify noInline / tryInline annotations"
but keeping compatibility between different versions of dart2js and package:meta

Change-Id: I30e48f374aeef13d99f41af81eb0b8f339ab8bb8
Reviewed-on: https://dart-review.googlesource.com/76581
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-09-26 01:19:50 +00:00
Stephen Adams ded73cdd08 Revert "[dart2js] Simplify noInline / tryInline annotations"
This reverts commit 8bae3a1cfd.

There are versioning issues that need to be addressed.

TBR=kevmoo@google.com

Change-Id: Ia82e94f127523db650e4df03af1179ef94463bee
Reviewed-on: https://dart-review.googlesource.com/76564
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2018-09-25 22:11:42 +00:00
Stephen Adams 8bae3a1cfd [dart2js] Simplify noInline / tryInline annotations
Use @pragma for dart2js.noInline / dart2js.tryInline

Change-Id: Id7932ad7f85b91e4c1e427bb88e782ede81d5926
Reviewed-on: https://dart-review.googlesource.com/76341
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2018-09-25 19:08:14 +00:00
Johnni Winther cf5cdea808 Add J/K versions CommonElements and ElementEnvironment
This is a step towards separating the element map implementations.

Change-Id: Iaf8cee48bd0c127a981b1661773d9036b419fecf
Reviewed-on: https://dart-review.googlesource.com/75300
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-09-20 07:37:32 +00:00
Stephen Adams bd660a5707 Better inlining in execute-once paths
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>
2018-09-11 20:43:11 +00:00
Johnni Winther 5ab5c00ea4 Compute annotations in the K-World
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>
2018-09-11 11:10:37 +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
Stephen Adams e02ec040cb @dart2js.tryInline should not inline methods that can't be inlined
Change-Id: I1efc13b64d7740dbe904364e44fa6e6b9be0fd81
Reviewed-on: https://dart-review.googlesource.com/70440
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-08-17 22:14:03 +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 7c6211b1d8 Make unittests work with Dart 2
Change-Id: Ic2c105747dfba067464fc15e158f58417c8636a8
Reviewed-on: https://dart-review.googlesource.com/61922
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-06-22 20:25:05 +00:00
Johnni Winther b58cc36ddc Extract KClosedWorld from ClosedWorld.
Change-Id: I2db59cea5081fde2f0b35c6518d6b618df617ac1
Reviewed-on: https://dart-review.googlesource.com/57827
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-06-04 09:22:41 +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 831a6ba598 Remove useOldFrontend testing from various tests
Change-Id: Iff97dd60756ae18cb0a3203cffd87c8da9e53757
Reviewed-on: https://dart-review.googlesource.com/53944
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-05-08 08:31:43 +00:00
Johnni Winther e5a2fe6435 Update jump, side effect and inlining tests to test strong mode
Change-Id: I0c8073f5bc72fae63b012033dc23b15c1913fec7
Reviewed-on: https://dart-review.googlesource.com/52223
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-04-24 08:37:24 +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 c438f8b3f4 Dart2js defaults to the new common front-end
Change-Id: Id0f69d258b010a746b56e259335185bcca7dafec
Reviewed-on: https://dart-review.googlesource.com/45143
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-03-13 19:25:59 +00:00
Stephen Adams 23a7b62c42 Use type of receiver for setter target identification
This 'almost typo' was preventing any setters from being inlined.

Change-Id: Idca5ba35df34f2328e3f926790e093ce02ac8863
Reviewed-on: https://dart-review.googlesource.com/45367
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-03-07 20:48:52 +00:00
Johnni Winther 94fc11388a Port inference tests, #5 of 5
Change-Id: I384056289dfa99991aa42fbe0baadedc6c208b6f
Reviewed-on: https://dart-review.googlesource.com/34586
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-01-17 10:19:53 +00:00
Johnni Winther b11cf5e3b5 Support class data in equivalence test
Change-Id: I084af2503ba783de4280f520c5a3000f0b84abe7
Reviewed-on: https://dart-review.googlesource.com/32560
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-01-08 10:38:55 +00:00
Johnni Winther 410c3c4a69 Move unittests, part #9 of ?
Change-Id: Ief32bb619da08133a4247b2e4f80cad592f18d77
Reviewed-on: https://dart-review.googlesource.com/31423
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-12-29 11:40:45 +00:00
Johnni Winther f2c2c99714 Adjust inlining heuristics for in-loop calls
Change-Id: Ifaa1e3ac5405cb9159fd2e6c462e076d9f48b120
Reviewed-on: https://dart-review.googlesource.com/30444
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-12-20 08:20:03 +00:00
Johnni Winther 12ee4edbb8 Implement inlining heuristics on conditional expression.
Change-Id: I183b6345e29d6c00f140dcbd1ffff05faf0e781f
Reviewed-on: https://dart-review.googlesource.com/30442
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-12-20 08:02:14 +00:00
Johnni Winther 0edef589d4 Ensure type variables for inlined constructors and mixin fields
Change-Id: I348acffb7842ff1c9f28ebf73c507e282c6a045e
Reviewed-on: https://dart-review.googlesource.com/29080
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-12-14 08:53:21 +00:00
Johnni Winther 9df549a2d0 Avoid inlining of external functions
Change-Id: I43aed9e484c55d40a9fa7d5db029e0d11a698b3e
Reviewed-on: https://dart-review.googlesource.com/28562
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-12-13 09:28:09 +00:00
Johnni Winther 59106e8f55 Fix crashes caused by inlining
Change-Id: I7fef190a4b5248f1508f0122c5dcb5ee7fdc4c40
Reviewed-on: https://dart-review.googlesource.com/27940
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-12-12 08:07:29 +00:00
Johnni Winther 2fe5db885d Fix inlining 'too difficult' test
- include reason for 'too difficult' in the expectations
- fix inlining of dynamic call with optional argument

Change-Id: I02e4885ff3eb4a991501bb3f5d8432d35165491e
Reviewed-on: https://dart-review.googlesource.com/27220
Reviewed-by: Stephen Adams <sra@google.com>
2017-12-08 16:05:42 +00:00
Johnni Winther 12a94d7035 Initial kernel based inlining heuristics
- currently for number of calls outside loops.

Change-Id: Iedafe54ab70f65969bf89db3bfd98d45be493893
Reviewed-on: https://dart-review.googlesource.com/26300
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2017-12-08 15:55:10 +00:00
Johnni Winther dbc907a6a0 Include inlined instance type for constructors and factories
Change-Id: Ia9be24f02f07e0d3329125b2ffed28e16bf34be3
Reviewed-on: https://dart-review.googlesource.com/26280
Reviewed-by: Stephen Adams <sra@google.com>
2017-12-08 15:17:00 +00:00
Johnni Winther b6f1bd02e8 Inline constructor bodies.
Change-Id: Iaf7d206ff92aa07ddfd3934340888dcd617fc47c
Reviewed-on: https://dart-review.googlesource.com/25900
Reviewed-by: Stephen Adams <sra@google.com>
2017-12-07 09:13:23 +00:00
Johnni Winther c1f148ec42 Handle inlining of dynamic invocations.
Change-Id: I1982938b1af5b234f1eade14077778f87c455cac
Reviewed-on: https://dart-review.googlesource.com/25840
Reviewed-by: Stephen Adams <sra@google.com>
2017-12-06 08:34:34 +00:00
Johnni Winther 8df5357378 Implement too difficult computation for kernel.
Change-Id: Ib167b356fcf7e869ecb91b3e268021e2747760c4
Reviewed-on: https://dart-review.googlesource.com/24901
Reviewed-by: Stephen Adams <sra@google.com>
2017-12-01 16:13:26 +00:00
Johnni Winther 7b1a097f86 Add inlining tests for code considered too difficult to inline
The tests include the parts where we unconditionally consider the
function too difficult to inline, i.e. where the node count is not
taken into account. For this reason, these cases are not considered
part of the heuristics but of the inlining capabilities.

Regarding loops, I'm not sure if we disallow them by default due to
heuristics, or only allow forced inlining due to incomplete
capabilities.

Change-Id: Iee37f972c694251e0e1390fbb82bc30a4fc0bd6a
Reviewed-on: https://dart-review.googlesource.com/24109
Reviewed-by: Stephen Adams <sra@google.com>
2017-11-30 08:34:20 +00:00
Johnni Winther 1f3288e95c Add tests for inlining of constructor and dynamic call.
Change-Id: I328819ca3f357c21e5dc575c7098fcd6cf66dec7
Reviewed-on: https://dart-review.googlesource.com/23678
Reviewed-by: Stephen Adams <sra@google.com>
2017-11-28 08:57:58 +00:00
Johnni Winther 77f8e2fa36 Add inlining test for package:meta
Change-Id: Ia69aede0fc5da7fd329eb010666395519915ac5b
Reviewed-on: https://dart-review.googlesource.com/23670
Reviewed-by: Stephen Adams <sra@google.com>
2017-11-28 08:35:07 +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