Commit Graph

187 Commits

Author SHA1 Message Date
Johnni Winther 7580e77ef2 Support modular code generation
Change-Id: Id5511296eb0b6acf812bc464d71efa4019f211d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103523
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-05-24 07:38:13 +00:00
Johnni Winther 3d7405f198 Separate CodegenImpl from JavaScriptBackend
Change-Id: I9644ca0cd6cb60bf20142d7fa74a559dc516a22d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101292
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-05-07 07:57:06 +00:00
Johnni Winther 8d4816b7ff Reimplement member usage tracking
We now track member usage in terms of static, dynamic and super access
for reads, writes and invocations. The information collected during
closed world computation is now the basis for the potential member usage
in codegen, thus ensuring that we cannot conclude in codegen that for
instance a field is read dynamically when the closed world knows that
it is never read dynamically.

Closes #36516

Change-Id: I3a1cb87c71268c34bcd67e14a035d9d1be324ab0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100840
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-05-01 08:58:34 +00:00
Johnni Winther 5fc8029587 Remove StaticMemberUsage and cleanup codegen world builder
Change-Id: I4fdc6148af671010d1aca55c05d08e55e9c1e9fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100245
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-04-25 08:45:20 +00:00
Johnni Winther 7ef28f0b03 Handle constant field init registration correctly.
+ avoid side-effects of checking enqueuer invariants

Change-Id: Id327371bc70e4b1b5fd4d326b8c8cf8caf50ea0e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98142
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-03-29 16:44:15 +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
Nate Bosch 69a4f20347 Add override annotations consistently
This makes it easier to follow class hierarchies and understand where a
class is changing the interface. I hit this when I found a class that
had the annotation on some methods it was overriding, but not all, which
made it confusing.

Prepares for adding the lint rule and enforcing it.

40% of overridden methods were annotated - add annotations to the remaining 60%.

Change-Id: I02472f4b6c5026a820cf9ff1a7ada663a60f1868
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96666
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-03-13 22:36:11 +00:00
Johnni Winther c7f6c86128 Fix registration of (un)provided parameters.
Change-Id: I5cf1b7543561a728a219a62c8fa6633d4d25846a
Reviewed-on: https://dart-review.googlesource.com/c/91223
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-01-25 21:20:42 +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 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 0d588bf50c Add --omit-as-casts option
Change-Id: I0e5b122c28aefb6badc95882e95a97bdd4b8edd3
Reviewed-on: https://dart-review.googlesource.com/56801
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-09-24 07:22:28 +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 814738b273 Remove CompilerOptions.strongMode/enableTypeAssertions/trustTypeAnnotations
Change-Id: I4a51b081f42d76f12c70c140286c28375fcbd5ce
Reviewed-on: https://dart-review.googlesource.com/70515
Reviewed-by: Stephen Adams <sra@google.com>
2018-08-21 08:21:02 +00:00
Johnni Winther 4273bb2e2a Remove TypeUse.mirrorInstantiation
Change-Id: I7a85970a2559489cb8fda5612a300c53562856ed
Reviewed-on: https://dart-review.googlesource.com/65544
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-07-20 12:28:28 +00:00
Johnni Winther 335f0ab333 Remove EnqueuerStrategy
Change-Id: Id36d4a77d40ca9a70130a4c3ee6e84f68435153d
Reviewed-on: https://dart-review.googlesource.com/65543
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-07-19 08:10:15 +00:00
Johnni Winther 117f651f7b Emit classes used in type variable replacements
Change-Id: Iad3bf28790172e364d83a96003fb7ef96f25747e
Reviewed-on: https://dart-review.googlesource.com/64322
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-07-16 10:09:06 +00:00
Johnni Winther 97319b838a Decouple library loader from the K-world
Change-Id: I74cb28960b29a63c225bb259c19b9023424ea74a
Reviewed-on: https://dart-review.googlesource.com/64340
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-07-12 08:07:05 +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 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 82755aa303 Rename ClosedWorld to JClosedWorld and merge it with ClosedWorldRefiner
Change-Id: I858695194fe4b0dffb7c85a93e2d6bcc04dd6229
Reviewed-on: https://dart-review.googlesource.com/58022
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-06-04 09:22:41 +00:00
Johnni Winther 89514bd8cf Cleanup library_loader.
Change-Id: I0255580cd9292bcd3a5997c7d97d83b25d888372
Reviewed-on: https://dart-review.googlesource.com/55960
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-24 09:52:50 +00:00
Johnni Winther 21b65a9732 Remove unused typedef code
We only use the name of typedef type literals. These are passed through
TypeConstantExpression to TypeConstantValue and used directly as the
nominal identity (!) of the emitted typedef type literal constant value.

Note that the emitted typedef type literal has no relation to its alias.

Change-Id: I1cdc5a88a9b3d75faa0786ecd07226b5075df1c4
Reviewed-on: https://dart-review.googlesource.com/55898
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-24 09:52:50 +00:00
Johnni Winther 7afa0812ee Implement strong mode open world strategy.
Implements a new strategy for closed world computation that takes
the static type of the receiver into account when processing dynamic
calls.

For this to work, the J-model needs to only contain live members,
meaning queries can no longer assume that a J-model member exists for
instance for JSString.split because it might not be live.

This is the initial implementation which only uses
ir.MethodInvocation.invocationTarget. Later we will use the static
type of the expression on ir.MethodInvocation, ir.PropertyGet, and
ir.PropertySet.



Change-Id: I2dcc5a9148f27127d4e89c414a7d24f90f9cf2a4
Reviewed-on: https://dart-review.googlesource.com/48480
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-23 07:58: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 1c8c84fcfd Update kernel impact to match Dart 2 semantics.
Change-Id: Ia360bc42bd52ca9d81224a3ab1c4e4571451638f
Reviewed-on: https://dart-review.googlesource.com/48280
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-03-26 13:42:05 +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 3b6d39cc2c Correctly defer typedef references
Change-Id: I61fb5ebb399dcfca5193b7ae870badc10add23e5
Reviewed-on: https://dart-review.googlesource.com/37880
Reviewed-by: Emily Fortuna <efortuna@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-01-31 21:10:29 +00:00
Johnni Winther 65956edb23 Use KernelTypeGraphBuilder in KernelInferrerEngine
+ parameterization of LocalsHandler and friends.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/3002313002 .
2017-08-29 09:59:30 +02:00
Johnni Winther 73d99c5645 Support typedef type literals
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2996723002 .
2017-08-10 10:30:32 +02:00
Stephen Adams f4946f54e8 Use failedAt in more places
I saw some inconsistency in one file so I did a global cleanup.

BUG=
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2982783003 .
2017-07-14 12:10:31 -07:00
Peter von der Ahé 69d6e8e55a All strong mode cleaning of dart2js.
Fixes https://github.com/dart-lang/sdk/issues/29886

Supersedes CLs 2939193003, 2950433002, and 2947583002.

R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2944843002 .
2017-06-19 14:06:38 +02:00
Peter von der Ahé b4066914eb Late night strong mode cleaning.
R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2942763002 .
2017-06-15 09:44:50 +02:00
Johnni Winther b97d158b9a Add model test of CodegenWorldBuilder to compile_from_dill_test
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2913713004 .
2017-05-31 12:57:18 +02:00
Stephen Adams d5f2138349 Use failedAt in more places
BUG=
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2898403002 .
2017-05-31 03:12:11 -07:00
Johnni Winther b30ff8ed66 Use entities in runtime_types
- and make it its own library.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2884233002 .
2017-05-18 10:09:40 +02:00
Johnni Winther 17c1f2710b Move ResolutionEnqueuer.hasBeenResolved to Resolver
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2868813003 .
2017-05-09 10:48:59 +02:00
Johnni Winther f8be1f4429 Move ResolutionWorkItem to resolution_strategy.dart
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2865953003 .
2017-05-09 10:38:53 +02:00
Johnni Winther a4960a1507 Run closed_world2_test using the normal compiler pipeline.
This is a step towards running the front end of the compiler from
'.dill' files.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2846433003 .
2017-04-27 08:55:38 +02:00
Johnni Winther 0390e9f0af Implement subtype relation for kernel based elements.
+ check BackendUsage equivalence

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2827283002 .
2017-04-24 10:53:05 +02:00
Johnni Winther 9cff58233f Extract ClosedWorldRefiner implementation from ClosedWorldImpl to ClosedWorldBase
- to make it reusable for kernel based elements.

R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2814973003 .
2017-04-18 09:45:00 +02:00
Johnni Winther 0924b17267 Create LookupMapAnalysis late.
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2745133002 .
2017-03-15 14:46:02 +01:00
Johnni Winther 5ec55890fa Add ConstantUse to WorldImpact
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2742283002 .
2017-03-15 14:34:40 +01:00
Johnni Winther 4b9297caad Create ResolutionEnqueuer after library loading.
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2735763002 .
2017-03-15 13:46:48 +01:00
Johnni Winther b08686ba67 Prepare for late creation of ResolutionEnqueuer
- late as in 'after library loading'

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2729383002 .
2017-03-15 13:33:19 +01:00
Johnni Winther 452c380db1 Late creation of CodegenEnqueuerListener and CodegenWorldBuilder
- now with no reference to JavaScriptBackend!

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2727373003 .
2017-03-15 11:08:43 +01:00
Johnni Winther c7011e2d82 Late creation of CodegenEnqueuer
This is part of a general move towards creating codegen-specific object at codegen start instead of at resolution start. Many of the don't even make sense before, for instance, ClosedWorld has been computed.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2732663002 .
2017-03-15 10:52:52 +01:00
Johnni Winther 22d4992101 Remove Enqueuer.nativeEnqueuer
- moves logic into the backend instead.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2732633002 .
2017-03-15 10:02:37 +01:00
Johnni Winther 1edc68323e Reduce use of elements/resolution_types in enqueuer.
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2725933006 .
2017-03-14 18:25:16 +01:00
Johnni Winther 916ec8abbb Cleanup registration of closures
+ split methods and local functions in rti.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2729613004 .
2017-03-14 17:59:01 +01:00