Commit Graph

1538 Commits

Author SHA1 Message Date
Dmitry Stefantsov 142d09fed7 [cfe] Provide better context in verifier's diagnostics
Change-Id: I599eb100acab431fc5630305951120dfe98e79b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148763
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-05-26 10:02:05 +00:00
Jens Johansen 857fca710f [kernel/VM] Fix 'infinite' loop with memory crash on specific invalid dill
The dill file has an index at the end. The last 4 bytes of that index is
a size that indicates how big the file is. This is done to support
concatenated dill files. If the dill is invalid and the size is read as 0
both the VM and the dart kernel reader will go into an infinite loop where
it allocates another list entry on every loop iteration (making the whole
loop not infinate because we will run out of ram soon enough).

This CL fixes the issue by checking the size to be possitive.

Change-Id: I42da0557c6d4a274fdbe1a729fdaf5b8f149b187
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148538
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-05-26 08:24:05 +00:00
Jens Johansen 53ac4d53f2 [CFE] Set compilation mode if no main found
Change-Id: I2c3121e54f6c12b7ecdd8784851ca0611ff0b9d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148401
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-05-20 10:29:42 +00:00
Johnni Winther 6708394f03 [cfe] Add predicates to detect late lowered fields.
Needed for https://github.com/dart-lang/sdk/issues/41892

Change-Id: I049e76655cf62a5558c18319e80ab9702c7a3c22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148321
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-05-19 08:55:20 +00:00
Alexander Markov cbb5305f78 [vm/nnbd] Optimize type casts
Add a kernel transformation which removes redundant casts and reduces
some casts to null checks. This transformation assumes that type
system is sound and subtyping relation is transitive. So in NNBD weak
mode this transformation is always correct. In NNBD strong mode
this transformation is correct only if opted-out libraries are not
allowed.

The following patterns are handled:
If S <: T (this includes S <: T? in weak mode)
  S x; x as T => x
If S <: T? in strong mode
  S x; x as T => (x == null) ? x as T : x

This kernel transformation is not specific to the VM and can be reused
by other back-ends such as dart2js and DDC.

Fixes https://github.com/dart-lang/sdk/issues/40892
Issue https://github.com/dart-lang/sdk/issues/40893

Change-Id: I466ba96d763d5358011c768400c5225fa7bf5e67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139314
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-05-19 02:35:12 +00:00
Vyacheslav Egorov 22aa820bd2 [kernel] Fix round trip serialization of metadata when nodes are lazy loaded.
Metadata repository might be populated lazily as we are traversing the
component, so it is incorrect to skip empty metadata repositories early
in the serialization process.

Instead we filter empty repositories at the very end - after all nodes
were written out.

Change-Id: I159e0c0213a034388855944af03e72786d9e951b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148065
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-05-18 21:30:16 +00:00
Johnni Winther c10b41a4e2 [kernel] Add DartType.toTypeText and Constant.toConstantText
These are used to provide a testable textual representation
of types and constants that do not rely upon Node.toString.

Change-Id: Iff77ebb44e8299b262f4f263666b2e1d4dd5794b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147909
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-05-18 11:48:20 +00:00
Jens Johansen 6fb1efd584 [flutter/vm] Update dartdoc for WidgetCreatorTracker.transform
Change-Id: I6afbc4cc5f975052c9dd05e4befea572e8a91505
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148400
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-05-18 10:35:07 +00:00
Dmitry Stefantsov 8294d4c41a [cfe] Complete support for types in round-trip serialization
Change-Id: I9053875814ae771108269cd6c23e952a9dd63ef2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148261
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-05-18 08:37:04 +00:00
Jens Johansen 7929b4223e [CFE] Fix memory leak via WidgetCreatorTracker
Change-Id: Iebb961955bcd6cf2513cdec6036dfbd126e45231
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148240
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-05-15 14:09:02 +00:00
Dmitry Stefantsov e53e5f2475 [cfe] Separate nullability and declared nullability
For some types it makes sense to distinguish between nullability as a
property of including null and the declared nullability, such as for
type-parameter types and FutureOr types.  This CL introduces the
separation between the two concepts.  The plan is to use that when
implementing FutureOrType.

Bug: https://github.com/dart-lang/sdk/issues/40123
Change-Id: I90b45bea768e89c213d021d360a481d38377c682
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147903
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-05-15 07:38:05 +00:00
Dmitry Stefantsov c2cf179812 [cfe] Use negative test for support in rount-trip unit testing
Using the negative test (what is not supported yet) will help keep
track of what is yet to be done in order to serialize any Kernel ASTs.

Change-Id: Ie47ac0d3b5a215d4296f7e977f19a30bc19bc94b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147911
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-05-14 17:10:55 +00:00
Johnni Winther d5650235a2 [cfe] Handle ProblemBuilder in binary expression
Closes #41787

Change-Id: I81fcf0aee975b58b3b44d0de94054ae87bdd265d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147140
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-05-12 11:44:19 +00:00
Dmitry Stefantsov 7cbd5f6f78 [cfe] Add round-trip serialization support for loop nodes
The following nodes are supported now:
* ForStatement
* ForInStatement
* WhileStatement
* DoStatement

Change-Id: I42d43b949da80a631887996fac4b6a6f4c2a8c79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147100
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-05-07 17:21:38 +00:00
Dmitry Stefantsov e86e4d6183 [cfe] Add round-trip serialization support for more statement nodes
The support is added for the follwing statements:
* YieldStatement
* Block
* VariableDeclaration (as a statement)
* IfStatement
* EmptyStatement

+ improve diagnostics in related unit tests

Change-Id: Ib738227c6e8c1963aeaee52630953e07cef4b093
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146800
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-05-07 10:07:37 +00:00
Jens Johansen a2e7c24cd7 [CFE/kernel] Grab bag of small fixes/improvements
* Refactor a test to make it easier to extend it later.
* Allow the crashing reproduction minimizer to search for a new target
  if it finds another interesting crash.
* Fix update_expectations tool to include textual_outline
* Fix leakingDebugToString on Library

Change-Id: I9a59151f2ad5c2d91b4cbbe10d864fe9928221eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146804
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-05-07 07:29:47 +00:00
Clement Skau 2359f4dc68 [VM] Reworked: Remove unnecessary Closure.clone() from sync*.
Removes the Closure.clone() in sync* by adding an additional closure
around the rewritten sync* function body.

This is a re-worked version of the now reverted:
- https://dart-review.googlesource.com/c/sdk/+/136190
- https://dart-review.googlesource.com/c/sdk/+/144948

This CL includes changes from both the above CLs, in addition to:
- A new 'ShadowRewriter' transformer to do deep rewriting of
  shadowed parameters.
  Previous versions only rewrote the immediate sync* function, missing
  references in nested rewritten functions.

Note: This CL is re-landing largely unchanged since the roll-blocking
issues suspected to be caused by this was later attributed to a
different set of changes.
I have independently re-run all failing external tests to verify
them passing for this CL.

Bug: https://github.com/dart-lang/sdk/issues/37753
Change-Id: Id1670a93961180e8558d7c7eca65fe7e9115f07b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145402
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-05-05 12:04:03 +00:00
Dmitry Stefantsov c0e7543c98 [cfe] Add support for InterfaceTypes in round-trip serialization
Change-Id: Ie39848adf7c72e9171e6551717a67ae070c66985
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145802
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-05-01 12:03:44 +00:00
Dmitry Stefantsov b67a1313ae [cfe] Add an option to inspect internal state of text serialization
The option is added to the unit testing framework and is supposed to
be used locally.

Change-Id: Ia043ca35d27c15e597fe1b66429f923ccb24f3dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144825
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-04-29 10:36:40 +00:00
Clement Skau 12a5c93d4a Revert "Reland "[VM] Remove unnecessary Closure.clone() from sync*.""
This reverts commit 1bf25798fa.

Reason for revert: Rolling back as it breaks more external targets and is currently blocking rolls.

Original change's description:
> Reland "[VM] Remove unnecessary Closure.clone() from sync*."
> 
> This reverts commit 430c75b5fa.
> 
> Reason for revert: We probably don't care about the dartkb breakages.
> 
> Original change's description:
> > Revert "[VM] Remove unnecessary Closure.clone() from sync*."
> > 
> > This reverts commit ca94ad7112.
> > 
> > Reason for revert: Appears to break dartkb.
> > 
> > Original change's description:
> > > [VM] Remove unnecessary Closure.clone() from sync*.
> > > 
> > > Instead, this CL wraps sync*'s sync_op in an additional function
> > > that captures local copies of the necessary closure state.
> > > Notably this state includes the parameters of the original sync* function
> > > as these also need to be cloned for each instance.
> > > 
> > > 
> > > Note: a large number of .expect files have a small number of changes
> > > due to the additional wrapper function, as well as some extra plumbing.
> > > 
> > > Bug: https://github.com/dart-lang/sdk/issues/37753
> > > Change-Id: If099dbfe9e5d62979626b852386fd0173fc76de5
> > > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136190
> > > Commit-Queue: Clement Skau <cskau@google.com>
> > > Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> > 
> > TBR=vegorov@google.com,cskau@google.com
> > 
> > Change-Id: I89e517196f03622337f909f0fcecbdc77c9dda93
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Bug: https://github.com/dart-lang/sdk/issues/37753
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144920
> > Reviewed-by: Clement Skau <cskau@google.com>
> > Commit-Queue: Clement Skau <cskau@google.com>
> 
> TBR=vegorov@google.com,cskau@google.com
> 
> Change-Id: I78589c83cbb17151ca4ab8f811b4f18f252fb9c1
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: https://github.com/dart-lang/sdk/issues/37753
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144921
> Reviewed-by: Clement Skau <cskau@google.com>
> Commit-Queue: Clement Skau <cskau@google.com>

TBR=vegorov@google.com,cskau@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: https://github.com/dart-lang/sdk/issues/37753
Change-Id: I879df17bd282d01468fa010b94a8c89afdb8cd0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145361
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2020-04-29 09:52:30 +00:00
Clement Skau 871983d8ae Revert "[VM] Fixes missing bits for new sync* transform."
This reverts commit 05b7f49c72.

Reason for revert: This appears to break other external targets. Rolling this and original CL back to unblock rolls until deeper investigation can be done.

Original change's description:
> [VM] Fixes missing bits for new sync* transform.
> 
> The missing part of the transform fixes an issue that manifested
> as a crash when running tests for [0].
> Which was caused by un-transformed yields in nested functions in sync*s.
> 
> The second half of this CL updates the type_checker tool for the new
> transform of sync*s.
> 
> [0] https://github.com/KhronosGroup/glTF-Validator
> 
> TBR: To unblock roll blocked by crash.
> 
> Bug: https://github.com/dart-lang/sdk/issues/37753
> Change-Id: Ie20f351b16f2f87e92f0731fc96b0a5ea29e0300
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144948
> Commit-Queue: Clement Skau <cskau@google.com>
> Reviewed-by: Clement Skau <cskau@google.com>

TBR=kustermann@google.com,cskau@google.com

Change-Id: Ided526100e7393375445545d0fe16806333b0d20
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/37753
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145360
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2020-04-29 08:35:52 +00:00
Clement Skau 05b7f49c72 [VM] Fixes missing bits for new sync* transform.
The missing part of the transform fixes an issue that manifested
as a crash when running tests for [0].
Which was caused by un-transformed yields in nested functions in sync*s.

The second half of this CL updates the type_checker tool for the new
transform of sync*s.

[0] https://github.com/KhronosGroup/glTF-Validator

TBR: To unblock roll blocked by crash.

Bug: https://github.com/dart-lang/sdk/issues/37753
Change-Id: Ie20f351b16f2f87e92f0731fc96b0a5ea29e0300
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144948
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2020-04-29 06:56:14 +00:00
Clement Skau 1bf25798fa Reland "[VM] Remove unnecessary Closure.clone() from sync*."
This reverts commit 430c75b5fa.

Reason for revert: We probably don't care about the dartkb breakages.

Original change's description:
> Revert "[VM] Remove unnecessary Closure.clone() from sync*."
> 
> This reverts commit ca94ad7112.
> 
> Reason for revert: Appears to break dartkb.
> 
> Original change's description:
> > [VM] Remove unnecessary Closure.clone() from sync*.
> > 
> > Instead, this CL wraps sync*'s sync_op in an additional function
> > that captures local copies of the necessary closure state.
> > Notably this state includes the parameters of the original sync* function
> > as these also need to be cloned for each instance.
> > 
> > 
> > Note: a large number of .expect files have a small number of changes
> > due to the additional wrapper function, as well as some extra plumbing.
> > 
> > Bug: https://github.com/dart-lang/sdk/issues/37753
> > Change-Id: If099dbfe9e5d62979626b852386fd0173fc76de5
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136190
> > Commit-Queue: Clement Skau <cskau@google.com>
> > Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> 
> TBR=vegorov@google.com,cskau@google.com
> 
> Change-Id: I89e517196f03622337f909f0fcecbdc77c9dda93
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: https://github.com/dart-lang/sdk/issues/37753
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144920
> Reviewed-by: Clement Skau <cskau@google.com>
> Commit-Queue: Clement Skau <cskau@google.com>

TBR=vegorov@google.com,cskau@google.com

Change-Id: I78589c83cbb17151ca4ab8f811b4f18f252fb9c1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/37753
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144921
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2020-04-28 06:17:20 +00:00
Johnni Winther 3f18d37333 [cfe] Implement NNBD_TOP_MERGE update
Change-Id: I6b204b5d7def6a9d1dd4709e47f95eb102741489
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144763
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-04-27 16:28:08 +00:00
Johnni Winther 3c0e9642d2 [cfe] Ensure default type on generic forwarding stubs/method signatures
Change-Id: Iad6246c55f45953bffe2c3de4a2e30a32db347d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144820
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-04-27 16:25:18 +00:00
Clement Skau 430c75b5fa Revert "[VM] Remove unnecessary Closure.clone() from sync*."
This reverts commit ca94ad7112.

Reason for revert: Appears to break dartkb.

Original change's description:
> [VM] Remove unnecessary Closure.clone() from sync*.
> 
> Instead, this CL wraps sync*'s sync_op in an additional function
> that captures local copies of the necessary closure state.
> Notably this state includes the parameters of the original sync* function
> as these also need to be cloned for each instance.
> 
> 
> Note: a large number of .expect files have a small number of changes
> due to the additional wrapper function, as well as some extra plumbing.
> 
> Bug: https://github.com/dart-lang/sdk/issues/37753
> Change-Id: If099dbfe9e5d62979626b852386fd0173fc76de5
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136190
> Commit-Queue: Clement Skau <cskau@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>

TBR=vegorov@google.com,cskau@google.com

Change-Id: I89e517196f03622337f909f0fcecbdc77c9dda93
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/37753
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144920
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2020-04-27 07:45:04 +00:00
Clement Skau ca94ad7112 [VM] Remove unnecessary Closure.clone() from sync*.
Instead, this CL wraps sync*'s sync_op in an additional function
that captures local copies of the necessary closure state.
Notably this state includes the parameters of the original sync* function
as these also need to be cloned for each instance.


Note: a large number of .expect files have a small number of changes
due to the additional wrapper function, as well as some extra plumbing.

Bug: https://github.com/dart-lang/sdk/issues/37753
Change-Id: If099dbfe9e5d62979626b852386fd0173fc76de5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136190
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-04-27 07:37:39 +00:00
Johnni Winther 6c21ed6314 [cfe] Support class hierarchy changes in ChangedStructureNotifier
Closes #40707

Change-Id: I0a9e0b11d0f597dfed7182dd869382057d04e5dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144821
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-04-26 19:51:29 +00:00
Dmitry Stefantsov 52df6d0eb7 [cfe] Clean up the remaining TextSerializationFailure statuses
Change-Id: I96ea244589ae9c103b0f061198ebd0b57b8184d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144401
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-04-23 06:28:48 +00:00
Dmitry Stefantsov 64b8ded48b [cfe] Leave unrecognized types in substitution unchanged
The CL allows type substitution to run over types with implementations
of DartType unknown to it.  Such types will be left unchanged in the
substituted type.

Closes #41199.

Bug: https://github.com/dart-lang/sdk/issues/41199
Change-Id: I335056ff02576d621a815dbd14fad3b3ffab017e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144361
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-04-22 13:18:07 +00:00
Aske Simon Christensen 8800e65ae1 [kernel] Specialized string (de)serialization.
This makes the string (de)serialization independent of the core library
UTF-8 encoder/decoder so we can change that without affecting kernel
serialization.

It also speeds up serialization and deserialization by a few percent.

Change-Id: I347e471ed0174cc5cb191335dd7c47e6eb3dad59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140293
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2020-04-22 11:46:24 +00:00
Dmitry Stefantsov 56df960ddf [cfe] Refine text serialization testing: skip free variables
The CL reduces the number of false positive cases in the round-trip
serialization unit testing by refining the verifier analysis.  Not it
doesn't attempt to make the round trip over the sub-trees containing
free variables.

Change-Id: Ib6fb2e72f7543ea7d99c5273c337801f3ad1bec4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144285
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-04-22 10:27:08 +00:00
Jens Johansen 4084c4cc24 [kernel/CFE] Use kernel 'Version' class for versions
Define a "Version" class in kernel that allows easy comparison between
versions (e.g. a < b, a >= b etc).

Use this Version class in CFE.

Change-Id: I2f382e7bb3c2083258743b9b66a909a88d575dbc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144283
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-04-21 09:44:52 +00:00
Dmitry Stefantsov 5b342eb9a3 [cfe] Refine analysis of text serialization verifier
The verifier now determined what is supported for the serialization
more precisely, resulting in less TextSerializationFailures in the
unit tests.

Change-Id: I3728f56c9cb5042420b6a13acb2ed06f4be6a924
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143809
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-04-20 10:01:46 +00:00
Dmitry Stefantsov d5dea0056b [cfe] Improve diagnostics on text serialization failures
This CL also includes the following changes:
- The .registerTags() method is added to the Case combinator.
- The actual canonical names' root is passed into the deserializer.
- Some text serialization failures are fixed and the corresponding
status entries in text_serialization.status removed.

Change-Id: I222dfa3fc348dddf83e0c6edb92f15d08b8e73e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143803
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-04-17 10:53:47 +00:00
Jens Johansen a85a7fc254 [kernel/CFE] Better mixed compilation mode handling
* Throw a specific error on mixed compilation mode; let the incremental
  compiler ignore that error when trying to initialize (i.e. it doesn't
  initialize from it, but it doesn't show any warning either).
* Allow some mixed mode stuff: Eventually the SDK should be in agnostic
  mode, so we should allow mixing agnostic with non-agnostic.

Fixes #41493.

Change-Id: Idb33fb31afe6bbba6d74134cb722ca825751898b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143583
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-04-17 10:22:46 +00:00
Dmitry Stefantsov ae0eca8318 [cfe] Add text serialization support for libraries
Change-Id: Ia36efcc433df573abf2f82c1b402fa031276c652
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143587
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-04-17 07:27:06 +00:00
Dmitry Stefantsov 3fa2d81240 [cfe] Add serialization support for top-level methods
Change-Id: Ie2f949142dc8fd97a0ad937b1ccc38918f3aae87
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143584
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-04-16 10:52:01 +00:00
Alexander Thomas 3c85da7778 [release] Bump version to 2.9
Change-Id: I2fc393cbb7a9111f4c09db6a2a7a202eeb88992c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142996
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-04-15 18:36:42 +00:00
Johnni Winther eb18db2116 [cfe,kernel] Add Field.isInternalImplementation
This bit is required to support synthesized field used for the late
lowering. These fields should not be seen as part of the interface,
that is, classes that implement the class declaring the late field should
not be required to override these fields.

Closes #41436

Change-Id: I9a98322bdd1842b46bde34fff1176a7577672e0f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142998
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-04-15 13:46:43 +00:00
Martin Kustermann e2b6cc93b6 [vm/async] Update async transformation to take NNBD mode into account
The removal of unsafeCast causes flutter galley size regressions:

  - armv7: -0.43%
  - armv8: -0.21%

which we should look into recovering by having better inlining heuristics.

Issue https://github.com/dart-lang/sdk/issues/41373
Closes https://github.com/dart-lang/sdk/issues/41307

Change-Id: I7c0ba4c9598e13f01e807a607c83d50cf03e9abe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142501
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-04-11 08:56:52 +00:00
Anna Gringauze 9f65693f57 Use offset for detecting scope in ExpressionCompiler
ExpressionCompiler currently translates offsets of scopes to line
numbers during the binary search in the library in order to find
the inner-most scope containing the line where debugger has stopped.
This results in many offset-to-line translations per evaluation request,
each translation also performing a binary search in Source.lineStarts
table.

To make scope lookup more efficient, this change uses Source.lineStarts
table to find the offset for the debugger stop once, and uses integer
offset comparisons instead in the scope binary search.

Closes: https://github.com/dart-lang/sdk/issues/40281
Change-Id: I72052b144d15acef684a5f8d29b40f6c5774b723
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142461
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-04-09 22:29:14 +00:00
Johnni Winther 0d16ff6d86 [cfe] Handle static type of access on Never
Closes #41273

Change-Id: Ia236481ab47033198d7952086cdf5c9c8f5a34b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142366
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-04-08 08:46:02 +00:00
Johnni Winther 04b6c6a116 [cfe] Handle Null <: Never in mixed inheritance bounds check
Change-Id: I994f76b3b4f6d498a8e41f7e34849616960dca08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142368
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-04-06 15:18:31 +00:00
Johnni Winther 32f82b5852 [CFE] Add NNBD compilation mode into kernel component
Fixes https://github.com/dart-lang/sdk/issues/41311

Change-Id: I2f4345f8ca7a31da705fcae37a28a8b801feb5e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142149
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-04-06 14:00:01 +00:00
Johnni Winther a7f1a5e677 [cfe] Handle A extends FutureOr<B> <: FutureOr<B>
Change-Id: Ib5580328f006b033b2c004083b575a2cf5aed551
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141541
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-04-05 06:31:19 +00:00
Martin Kustermann c4a7c3488e [vm/async] Make async transformer use typed variables, make async patch use function types
This gets rid of a slow AssertAssignable (function type test)
in _asyncThenWrapperHelper/_awaitHelper, which currently falls back to the slow table
search:

  AssertAssignable
    ^--> TypeTestingStub
          ^--> SlowTypeTestStub
               ^--> Subtype6TestCacheStub

Issue https://github.com/dart-lang/sdk/issues/37668

Change-Id: I3b6517b7e348e39619e8096d6ac2a4b179bb3242
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142022
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2020-04-03 08:28:47 +00:00
Johnni Winther 46bb15edf3 [cfe] Fix inheritance test data discrepancies.
Change-Id: I367aace60324a7755f795d2f24aaf0d138bc8d59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141602
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-04-02 13:14:39 +00:00
Johnni Winther 0a9e57419b [kernel] Make verbose qualified names conditional in toStringInternal
Including the library name/uri in types and member names makes these
unreadable in most cases. This changes that default toStringInternal
to omit the library name/uri but supports a verbose mode that includes
the library name/uri for debugging the rare occasions where they matter.

Change-Id: I783e8bd0ac5d2f19c3051e8e7f226b240c8d1bc8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141546
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-03-30 08:41:15 +00:00
Jens Johansen 3e053b7da2 [kernel] Polish toString implementation on AST nodes
Change-Id: I0c21ded156243d8f8ff178d1b31bf0512758ebe1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141101
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-03-27 07:33:38 +00:00