| commit | aef81ef08e4763569e986505c9f65179cb5157f7 | [log] [tgz] |
|---|---|---|
| author | Paul Berry <paulberry@google.com> | Mon Aug 28 15:01:56 2023 +0000 |
| committer | Commit Queue <dart-scoped@luci-project-accounts.iam.gserviceaccount.com> | Mon Aug 28 15:01:56 2023 +0000 |
| tree | 94819e122bffba1a295c67cdd49db66a2846beda | |
| parent | a675a79f3941c7cf3f6f84af2c7863ecff414691 [diff] |
Flow analysis: fix scrutinee promotion for fields. Prior to this change, the SSA node stored in `PromotionModel.ssaNode` was only correct for promotion models that represented variable references. If a promotion model represented a promotable field, its `ssaNode` pointed to a bogus SSA node. This had two undesirable effects: - It meant that `FlowModel.rebaseForward` needed to contain a hack to prevent it from looking at the bogus SSA node for a promotable field, and falsely concluding that the field's value had been reassigned (which is impossible for promotable fields)--see https://dart-review.googlesource.com/c/sdk/+/321752. - It meant that if a promotable field was used as a scrutinee in a refutable pattern match, the promotion logic would look at the bogus SSA node for the field, and falsely conclude that its value had been reassigned, preventing field promotion from working during pattern matching. This change ensures that the correct SSA node is always stored in `PromotionModel.ssaNode`, and removes the hack in `FlowModel.rebaseForward`. This required some re-ordering some of the logic for control flow joins, to ensure that when a join creates a fresh promotion model for a property, it has already created the corresponding `_PropertySsaNode` (previously, it created the `_PropertySsaNode` afterwards, but that is too late since the `PromotionModel` class is immutable). Unit tests and language tests are introduced to validate the newly fixed behavior for promotable fields used as a scrutinee in a refutable pattern match. Also, the uses of `FlowModel.infoFor` in queries such as `getMatchedValueType`, `isAssigned`, `isUnassigned`, and `promotedType` were changed to simple map lookups, to prevent bogus SSA nodes from being created and then immediately discarded. This resulted in a fairly significant boost to CFE compilation speed: page-faults:u: -1.2664% +/- 0.1535% (-2531.33 +/- 306.73) instructions:u: -0.6210% +/- 0.0009% (-119891846.00 +/- 180585.35) branches:u: -0.6765% +/- 0.0014% (-26637478.67 +/- 54272.64) branch-misses:u: -0.9562% +/- 0.8909% (-548444.00 +/- 510991.65) Change-Id: I30f82e8a4ba11236735258077d61d36717fa32c2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322443 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Paul Berry <paulberry@google.com>
Dart is:
Optimized for UI: Develop with a programming language specialized around the needs of user interface creation.
Productive: Make changes iteratively: use hot reload to see the result instantly in your running app.
Fast on all platforms: Compile to ARM & x64 machine code for mobile, desktop, and backend. Or compile to JavaScript for the web.
Dart's flexible compiler technology lets you run Dart code in different ways, depending on your target platform and goals:
Dart Native: For programs targeting devices (mobile, desktop, server, and more), Dart Native includes both a Dart VM with JIT (just-in-time) compilation and an AOT (ahead-of-time) compiler for producing machine code.
Dart Web: For programs targeting the web, Dart Web includes both a development time compiler (dartdevc) and a production time compiler (dart2js).
Dart is free and open source.
See LICENSE and PATENT_GRANT.
Visit dart.dev to learn more about the language, tools, and to find codelabs.
Browse pub.dev for more packages and libraries contributed by the community and the Dart team.
Our API reference documentation is published at api.dart.dev, based on the stable release. (We also publish docs from our beta and dev channels, as well as from the primary development branch).
If you want to build Dart yourself, here is a guide to getting the source, preparing your machine to build the SDK, and building.
There are more documents on our wiki.
The easiest way to contribute to Dart is to file issues.
You can also contribute patches, as described in Contributing.