Commit Graph

2317 Commits

Author SHA1 Message Date
Johnni Winther 5271cc4e81 Support FutureOr at runtime
Change-Id: I6d442ac160739490c2591367055aaa0ba0c00047
Reviewed-on: https://dart-review.googlesource.com/48143
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-03-26 12:54:58 +00:00
Johnni Winther e6636a5c34 Fix error in function subtyping
Change-Id: I5ccc4e2823c1dcdb84929f9fc0216822808d522a
Reviewed-on: https://dart-review.googlesource.com/48281
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-03-23 23:49:49 +00:00
Alexander Markov 7386d7b5ec Revert "[vm/kernel/aot] Tree shaking based on results of TFA"
This reverts commit 06ebf884db.

Reason for revert: buildbot failures.

Change-Id: Ie6b33061cad80ae3b20b773cc435d64a755620fc
Reviewed-on: https://dart-review.googlesource.com/48263
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-03-23 22:57:19 +00:00
Alexander Markov 06ebf884db [vm/kernel/aot] Tree shaking based on results of TFA
This CL adds tree shaking transformation into TFA transformer, replacing
simple DropMethodBodiesVisitor. In addition to removing bodies of
unreachable members, tree shaker is able to remove unused classes, typedefs
and member declarations, and replace unreachable calls with 'throw'.

Total(CodeSize) of flutter_gallery in --release mode
before: 11,671,369
after:  11,499,694

https://github.com/dart-lang/sdk/issues/30480

Change-Id: I966cf222eb9725b7a75dd193ac479436b9b9b4c3
Reviewed-on: https://dart-review.googlesource.com/46942
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-23 22:21:39 +00:00
Dan Rubel 6180f12ccf Update parsing as/is expressions to use computeType
This introduces a new TypeInfo.ensureType method which recovers
when a type is required but there is no type.

Change-Id: Ie9080864f814329bc7a7dcdf73440fd184e9e0f8
Reviewed-on: https://dart-review.googlesource.com/47944
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-23 17:58:59 +00:00
Sigmund Cherem b66971a45d Fix config specific imports to dart.io and dart.mirrors in dart2js
This uses the environment_overrides section that I'm adding to the libraries
specification files.

Change-Id: I95c175533f21320dd44eab9988afe2644ed0c9d3
Reviewed-on: https://dart-review.googlesource.com/47406
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-03-23 00:02:54 +00:00
Sigmund Cherem ef919c5eb3 fix commit queue: update nSM test expectation on ddc too.
TBR=sjindel@google.com

Change-Id: Ia6cf344d1071b5c70979605df45f7c21974ad7b7
Reviewed-on: https://dart-review.googlesource.com/48022
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-03-22 21:51:00 +00:00
Samir Jindel d014fce4de Update dartkp NSM expectations.
Change-Id: I28cc42a05b25e25184cf4fda1742c016179ac9ef
Reviewed-on: https://dart-review.googlesource.com/47962
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-03-22 20:26:43 +00:00
Samir Jindel 790b7b98fb [kernel] Update more NSM expectations.
Change-Id: I016098763f40b4d5286264a6de9241e3fb11a30d
Reviewed-on: https://dart-review.googlesource.com/47961
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-03-22 19:54:59 +00:00
Samir Jindel 8d669c9d4e [kernel] Update NSM-forwarding test expectations.
Change-Id: Ib212a109a8115e2e387526f61c07840be5c35b76
Reviewed-on: https://dart-review.googlesource.com/47960
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-03-22 19:49:09 +00:00
Samir Jindel 95e9e890a9 [kernel/vm] Implement NSM-forwarding in the VM.
Change-Id: I43ce98235a7fdb43f99f433ef8dd10a6ed08fbbb
Reviewed-on: https://dart-review.googlesource.com/47621
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-03-22 19:14:04 +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
Jenny Messerly d9878ae0da fix regression in DDC handling of top-level field named 'name'
Also refactors the code to make this sort of issue less likely.

Change-Id: Iff72e53720ba78e84c3d219e69ccd0d6a47c09a0
Reviewed-on: https://dart-review.googlesource.com/47188
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2018-03-20 00:49:58 +00:00
Emily Fortuna db21add40c Adding test for async closures with type variables, and fixing how we emit stubs
with type parameters in the meanwhile.

Change-Id: I5fe1e94e7423af30adf4020b46269b8ea81ac07f
Reviewed-on: https://dart-review.googlesource.com/46700
Commit-Queue: Emily Fortuna <efortuna@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-03-16 17:46:18 +00:00
Karl Klose a461573294 Remove test expectations for a test that actually passes
R=kmillikin@google.com

Change-Id: I02b4f4231e7d9c775153d265beb96b3565a651ee
Reviewed-on: https://dart-review.googlesource.com/46724
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Karl Klose <karlklose@google.com>
2018-03-15 12:18:28 +00:00
Kevin Millikin 65b19ffa3c Translate asserts in the VM-specific async translation
Translate assert statements in async functions.  The translation of
the condition subexpression can produce a sequence of statements that
have been hoisted out of it.  These need to be guarded so they are
executed only when asserts are enabled.

For this purpose, we introduce an AssertBlock.  The semantics of the
assert block:

assert { s0; ...; sn; }

is the same as:

if (assertsEnabled) { s0; ...; sn; }

where assertsEnabled is a more primitive nullary expression that is
true iff. assertions are enabled.  We chose not to encode this using a
construct like assertsEnabled because (1) we would have to support it
appearing as an arbitrary expression which we don't currently need
and (2) it requires deeper pattern matching to detect and skip the
guarded code when desired.

The translation is more complicated because if there is a message
subexpression in an assert, it is conditionally evaluated only if the
assert's condition is false.

Fixes https://github.com/dart-lang/sdk/issues/28498

Change-Id: I0912a57104ede3160533e49f65b6fb79b76f1500
Reviewed-on: https://dart-review.googlesource.com/46442
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-03-14 19:41:09 +00:00
Alexander Markov 881c0196aa [vm] Fix type test '_Closure class IS FunctionType' in strong mode
Closes https://github.com/dart-lang/sdk/issues/32508

Change-Id: Ib3455edd393d0ce5ccd5fe315f8d54f14606cc25
Reviewed-on: https://dart-review.googlesource.com/46201
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-13 19:08:56 +00:00
Dmitry Stefantsov f8995da6aa Report a compile-time error on magic const
When inferring const or new for expressions that aren't required to be const,
Fasta always choses new. That's not correct, and this is a short-term work
around to avoid introducing a breaking change in the future. The plan is to
implement this feature correctly, but that will require more time than we have
right now.

Originally submitted by ahe@google.com.  Added: status file fixes.

Change-Id: I2d70bd2488de6b69fcd5546c1f4654dfbbb30b7f
Reviewed-on: https://dart-review.googlesource.com/46340
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2018-03-13 19:07:12 +00:00
Alexander Markov 38f598bf80 [Gardening] Mark timed-out test as Slow
The test language_2/vm/precompiled_static_initializer_test times out
on kernel/precompiler/debug bots. This test enables uncontrollable inlining
which results in a huge amount of code to precompile. Most probably,
it started to time-out because type flow analysis, which was enabled in
https://github.com/dart-lang/sdk/commit/d58887eaf6cb8460e2283d8531bbd8c0611a146d,
does more devirtualization and provides more opportunities for inlining.

Change-Id: I915132f81529cc967f62f9546d16a60cb4e8aed7
Reviewed-on: https://dart-review.googlesource.com/46303
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-03-13 17:32:09 +00:00
Martin Kustermann 8dadc89bfb [VM] Disallow ConstructorInvocation/ListLiteral/MapLiteral in constant evaluator
Change-Id: I4ef12bd25974bba9aa69127630b05f2e4fd46657
Reviewed-on: https://dart-review.googlesource.com/46241
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-13 12:59:09 +00:00
Johnni Winther f58659399d More status fixes
Change-Id: Ib43800c9fe0da786a154d7b42f9784e45c690a77
Reviewed-on: https://dart-review.googlesource.com/46245
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-03-13 12:12:17 +00:00
Johnni Winther 85720e4eb3 Fix status of dart2js-with-kernel tests
Change-Id: I2f5a1589b800fc1d453f5dd6f941f77c42250acc
Reviewed-on: https://dart-review.googlesource.com/46242
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-03-13 11:22:44 +00:00
Johnni Winther b08bedee7e Update RuntimeTypesNeed to disable rti optimization
- for local signatures in strong mode.

Change-Id: I0cafead24b24a534813449b6bf710eeafcb569bd
Reviewed-on: https://dart-review.googlesource.com/46064
Reviewed-by: Emily Fortuna <efortuna@google.com>
2018-03-13 10:09:26 +00:00
Johnni Winther 42e7598f5d Don't emit function signatures for non-closure classes in Dart 2
Change-Id: I144ddd60abebe41549c1f5304d73cb56042c7289
Reviewed-on: https://dart-review.googlesource.com/46043
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-03-13 09:50:39 +00:00
Alexander Markov d58887eaf6 [vm/kernel/aot, test tool] Enable global type flow analysis
Issue: https://github.com/dart-lang/sdk/issues/30480
Change-Id: I984869a8cdd9c52cab677cab64b562d002cde490
Reviewed-on: https://dart-review.googlesource.com/46122
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-03-12 22:45:39 +00:00
Vyacheslav Egorov f0455493de [vm/kernel] Do not skip type checks on closure functions.
Fixes https://github.com/dart-lang/sdk/issues/32502

Bug: 32502
Change-Id: I3e4e9d6dd884f9660380994b24b7a263777f1a18
Reviewed-on: https://dart-review.googlesource.com/46066
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-03-12 17:13:20 +00:00
Dmitry Stefantsov 2fcdfc1f23 Rename bug32353{,_2}_test.dart to issue32353{,_2}_test.dart
Change-Id: Id00f2713dda2fcb62d43d5f7f2034b8f09bb12c1
Reviewed-on: https://dart-review.googlesource.com/46020
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2018-03-12 10:50:17 +00:00
Dmitry Stefantsov 6cef6625ef [kernel] Record supertypes after the query intervals in CHA are built
Fixes #32353.

Bug: http://dartbug.com/32353
Change-Id: I80199222ad5e44b954ed424f82752381653c63d3
Reviewed-on: https://dart-review.googlesource.com/45681
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2018-03-12 08:57:17 +00:00
Stephen Adams 70d715f115 Substitute return type too
TBR=johnniwinther@google.com

Change-Id: I82cc6d6e7af8fb42956fbe538d770de66a449bd3
Reviewed-on: https://dart-review.googlesource.com/45924
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-03-10 03:44:28 +00:00
Jenny Messerly 40738b8884 fix #32481, generate signatures for mock members induced by nSM
This bug prevented various DDC features from working correctly at
runtime, such as tearoffs, dynamic call checking, generic methods, and
parameter type checks.

Change-Id: I02cd27abbcb1d5f42b9d4ac504c7dd8bc80c866a
Reviewed-on: https://dart-review.googlesource.com/45960
Reviewed-by: Vijay Menon <vsm@google.com>
2018-03-10 01:11:23 +00:00
Brian Wilkerson 7a0b6f8f4a Fix the analyzer bots
Change-Id: I707211ea0698c4b684e13caccb099e3fdcc66409
Reviewed-on: https://dart-review.googlesource.com/45940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-10 00:20:08 +00:00
Dmitry Stefantsov e66733dd60 Simplify test case bug32353_test and decouple it from dart:io
Bug: http://dartbug.com/32353
Change-Id: I941e15ed9f7dcc10c1ea1a0b3ff3acdee92487de
Reviewed-on: https://dart-review.googlesource.com/45503
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2018-03-09 13:45:58 +00:00
Emily Fortuna feac6cfc20 Deal with Function type parameter contexts in closure conversion.
They don't have a context, so just set context as "null" for the TypeVaribleTypeWithContext.

Change-Id: I50944c787d4bd88dd55b402d137da1ca99a55566
Reviewed-on: https://dart-review.googlesource.com/45748
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Emily Fortuna <efortuna@google.com>
2018-03-09 02:31:17 +00:00
Alexander Markov 7aa3e54acf [vm] Fix computation of hashCode of a closure with null receiver
As tests/language_2/tearoff_dynamic_test.dart shows, it is perfectly
valid to take a tear-off of an instance method from null, and then call
hashCode from such tear-off.

The implementation of hashCode for closures, Closure::ComputeHash()
was calling Instance::Cast(receiver) which asserts for null.
This code is revised to allow null receiver.

Change-Id: I85cc7abf25aab99590b53403904e8bac25328308
Reviewed-on: https://dart-review.googlesource.com/45749
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-03-09 00:26:31 +00:00
Lasse Reichstein Holst Nielsen b3c12d4e3a Dart 2 Libraries Wave 3
Add `typeArguments` to Invocation.
Add constructors to Invocation, making it less necessary for users to create their own implementations.
Add tests.
Add Symbol.unaryMinus and Symbol.empty constants.

Change-Id: I70cb3265f9413617cf57fce1297e393a29eeb26a
Reviewed-on: https://dart-review.googlesource.com/40741
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-03-08 16:36:07 +00:00
Paul Berry 021a29d68f Move analyzer-specific status lines into language_2_analyzer.status
Change-Id: Ib1f7be60c9e5e14e0794e31ca5747f2f409e0a94
Reviewed-on: https://dart-review.googlesource.com/45525
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-03-08 14:55:17 +00:00
Régis Crelier 383517d292 [VM runtime] Fix type canonicalization (fixes #32425).
A reused type argument vector that is longer than necessary needs to be
shortened to the correct length upon type canonicalization.
The runtime call comparing two instance runtime types also needs to consider
reused vectors.
Add regression test.

Change-Id: Ib3b9620409b9cff313f270c4f3fb7051fecbb604
Reviewed-on: https://dart-review.googlesource.com/45340
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-03-08 09:55:35 +00:00
Johnni Winther 0fdbc331f6 Fix dynamic type dependencies in codegen
Change-Id: Id3d8e89d55cc4ad8cc23c4be4012b4798d5abe4e
Reviewed-on: https://dart-review.googlesource.com/45424
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-03-08 09:51:55 +00:00
Emily Fortuna 24507da9da Fix stack overflow when analyzing type variables in generic methods.
Change-Id: Id182bb5f0511911662c1a758fce7792c686538c4
Reviewed-on: https://dart-review.googlesource.com/45560
Reviewed-by: Stephen Adams <sra@google.com>
2018-03-07 22:49:11 +00:00
Peter von der Ahé 9d17f3a92d Tests no longer crash
Change-Id: Iec0b6de33083cdce7a2fd16c3589ff96adc6913b
Reviewed-on: https://dart-review.googlesource.com/45507
Reviewed-by: Alexander Thomas <athom@google.com>
2018-03-07 19:06:31 +00:00
Paul Berry 440b58d644 Start running analyzer tests with --preview-dart-2.
The changes to the CQ bot should take effect immediately.  The changes
to the other bots will take effect once those bots are switched over
to use the test matrix.

Change-Id: Ibfe59817a11f730fd1847cdc60b3244b4a71a480
Reviewed-on: https://dart-review.googlesource.com/45300
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-03-07 15:04:33 +00:00
William Hesse dc0f4c840c Fix status of map_literal1_test on analyzer
Change-Id: I98b1fc2ec3298ba104fc9b32aa34cd8ecd0a8ce1
Reviewed-on: https://dart-review.googlesource.com/45423
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-07 14:45:20 +00:00
Peter von der Ahé a55cdaee08 A bit of gardening
Change-Id: I5cee2e167e283c7e89d2a5c9a3f83edc1cf005b3
Reviewed-on: https://dart-review.googlesource.com/45422
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-03-07 14:11:40 +00:00
Paul Berry db08061424 Handle implicit tear-off of .call when an implicit downcast is required
Previously, we were setting `expression` incorrectly after generating
the implicit tear-off of .call, so if an implicit downcast was needed
as well, it was not attached to the proper kernel node, and the
resulting kernel representation was invalid.

Addresses the front end manifestation of #32426.

Change-Id: Ibd86b75c54a53db1fc4606b7583910c57e1c4aae
Reviewed-on: https://dart-review.googlesource.com/45522
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-03-07 13:59:39 +00:00
Johnni Winther 8831dd1308 Remove failing assertion
Change-Id: Idfc2656460e2e6e63948172d63f90585be65d19d
Reviewed-on: https://dart-review.googlesource.com/45320
Reviewed-by: Emily Fortuna <efortuna@google.com>
2018-03-07 12:22:33 +00:00
Paul Berry d17db1d5f3 Pass type inference context down to field initializer when type inferred via override
Fixes #32412.

Change-Id: I52660ffd5a6eadd10c6d62a17c64872946aa2a4a
Reviewed-on: https://dart-review.googlesource.com/45520
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-03-07 11:45:34 +00:00
Peter von der Ahé 94aa20dd07 Update status for $compiler == fasta
Change-Id: I5d073d1c678dc313e79193074c6491085c093596
Reviewed-on: https://dart-review.googlesource.com/45381
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2018-03-07 10:32:33 +00:00
Paul Berry 615f40bc1d Ensure that null is not used as a context in more places.
This CL changes the handling of writeContext (for complex
assignments), returnOrYieldContext (for closures), expectedType (for
ensureAssignable), and receiverType (for findInterfaceMember) so that
they no longer use `null` to represent a context; they use UnknownType
or DynamicType as appropriate.

It also changes the handling of expectedType (for ensureAssignable) so
that it does not require the type to be known.  That makes this CL
simpler and paves the way for fixing #31792.

Change-Id: Ib1be06182f9a9e9f77a9eb81f5daf2364de0f3a7
Reviewed-on: https://dart-review.googlesource.com/44800
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-03-07 09:30:33 +00:00
Lasse R.H. Nielsen 619434d38d Remember that C() is a compile-time constant expression.
Actually make default value expression not constant.

Change-Id: Id9082716a6606618b91545f427726925849fb61c
Reviewed-on: https://dart-review.googlesource.com/45323
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2018-03-06 16:07:23 +00:00
Peter von der Ahé 9f56e28372 Mixin Applications with a Vengeance
Change-Id: I213f99234f29abd7e2ec03dc8451ed6dd16f3d03
Reviewed-on: https://dart-review.googlesource.com/45021
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-03-06 15:15:57 +00:00