Commit graph

72132 commits

Author SHA1 Message Date
Sam Rawlins
01251b8a42 Bump linter to 0.1.115
Change-Id: I88316694213f8ab8fc7dd160614467d42b84aa09
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144460
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-04-22 18:18:39 +00:00
Alexander Aprelev
17654b70d7 [vm/isolates] Introduce sendAndExit.
sendAndExit allows for fast data passing from worker isolate back to
parent.

```
                                              | linux x64  | spawnIsolate | sendAndExit |
                                              |us per iter | over sync    | over send   |
                                              +------------+--------------+-------------+
IsolateJson.Decode50KBx1(RunTime):               43,175.000   339.83%
IsolateJson.SendAndExit_Decode50KBx1(RunTime):   22,070.000   124.83%        -48.88%
IsolateJson.SyncDecode50KBx1(RunTime):            9,816.284

IsolateJson.Decode50KBx4(RunTime):               77,630.000   104.56%
IsolateJson.SendAndExit_Decode50KBx4(RunTime):   46,307.000   22.02%         -40.35%
IsolateJson.SyncDecode50KBx4(RunTime):           37,949.528

IsolateJson.Decode100KBx1(RunTime):              71,035.000   270.42%
IsolateJson.SendAndExit_Decode100KBx1(RunTime):  43,056.000   124.52%        -39.39%
IsolateJson.SyncDecode100KBx1(RunTime):          19,176.733

IsolateJson.Decode100KBx4(RunTime):             120,915.000   54.66%
IsolateJson.SendAndExit_Decode100KBx4(RunTime):  67,101.000  -14.17%         -44.51%
IsolateJson.SyncDecode100KBx4(RunTime):          78,179.731

IsolateJson.Decode250KBx1(RunTime):             173,574.000  202.52%
IsolateJson.SendAndExit_Decode250KBx1(RunTime): 103,334.000   80.10%         -40.47%
IsolateJson.SyncDecode250KBx1(RunTime):          57,375.314

IsolateJson.Decode250KBx4(RunTime):             292,118.000   20.30%
IsolateJson.SendAndExit_Decode250KBx4(RunTime): 168,444.000  -30.63%         -42.34%
IsolateJson.SyncDecode250KBx4(RunTime):         242,831.000

IsolateJson.Decode1MBx1(RunTime):               631,578.000  166.34%
IsolateJson.SendAndExit_Decode1MBx1(RunTime):   371,127.000   56.50%         -41.24%
IsolateJson.SyncDecode1MBx1(RunTime):           237,135.778

IsolateJson.Decode1MBx4(RunTime):             1,322,789.000   36.16%
IsolateJson.SendAndExit_Decode1MBx4(RunTime):   657,179.000  -32.35%         -50.32%
IsolateJson.SyncDecode1MBx4(RunTime):           971,473.333

```

Bug: https://github.com/dart-lang/sdk/issues/37835
Bug: https://github.com/dart-lang/sdk/issues/36097
Change-Id: I386641e1431ed9f2e34fac36f562607a666ee4a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142823
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-04-22 17:34:09 +00:00
Nicholas Shahan
23cbe39355 [ddc] Remove error handler from number parse helpers
This copies the logic from dart2js and brings the two patches closer
together. There is no need to pass the error handler to the helper
function shared between `parse()` and `tryParse()`.

Update JS foreign function types in parseDouble to match the NNBD
version.

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

Change-Id: I85d39f8ba6bd76459cf6263099983b8b96d3a669
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144304
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-04-22 16:07:29 +00:00
Konstantin Shcheglov
a934ec2961 If possible, reuse the last completion result.
Also rename "character" to "column".

R=brianwilkerson@google.com, keertip@google.com

Change-Id: I6167de6e1fd5aede2a619603635e96f16bfbcc8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144352
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-22 14:50:38 +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
Jens Johansen
66ab9407cd [CFE] Add (experimental) tool to minimize a compiler crashing reproduction
E.g.
```
$ out/ReleaseX64/dart pkg/front_end/test/crashing_test_case_minimizer.dart pkg/front_end/parser_testcases/error_recovery/utf_16_le_content.crash_dart
[...]
Got it down to 12 bytes: [100, 59, 100, 59, 110, 40, 41, 123, 34, 34, 100, 33]
That's 'd;d;n(){""d!' as text
```

Change-Id: Ic71a258c590d3e1ca5cff0c1dcb724c9578dbfc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144289
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-04-22 11:45:34 +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
Martin Kustermann
25011b80b9 [vm/compiler] Keep one ReversePcLookupCache on the isolate group (instead of making one per-isolate)
There is no need to make each isolate have it's own PC -> RawCode lookup
table, now that we share the program structure.

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

Change-Id: Iba2bbf7e735655b52c07a61c399c6d2409598145
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144297
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-04-22 09:21:48 +00:00
Stephen Adams
e6baa97e9a [dart2js] Fix bug with unused generator type parameters
Ensure that a generator entry point only passes type arguments for
parameters that are not erased.

The generator header was passing too many arguments to the generator
body, causing the element type to be misaligned.

Change-Id: I062df5f7172ed8bb410c81013a3faee35d66ef1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144351
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-04-22 04:58:44 +00:00
Siva Annamalai
af4330d382 Revert "[tests] rewrite and format several tests on http"
This reverts commit e35120cfd1.

Reason for revert: This CL caused some breakages in the bot.

Original change's description:
> [tests] rewrite and format several tests on http
> 
> Resolve comments in previous cls.
> https://dart-review.googlesource.com/c/sdk/+/140564
> https://dart-review.googlesource.com/c/sdk/+/136322
> https://dart-review.googlesource.com/c/sdk/+/138860
> 
> Change-Id: I9549019fe871f35187af5ff75df320748792498b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141845
> Commit-Queue: Zichang Guo <zichangguo@google.com>
> Reviewed-by: Jonas Termansen <sortie@google.com>

TBR=sortie@google.com,rmacnak@google.com,zichangguo@google.com

Change-Id: I1ae183dcc4b202b7b1e21d30a1407f9b038791ba
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144306
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2020-04-22 03:27:36 +00:00
Konstantin Shcheglov
ea58996b27 Issue 41593. End dead code flow at TryStatement body.
Bug: https://github.com/dart-lang/sdk/issues/41593
Change-Id: I7d8bc076143a253ea40d0ed04bbceab507c33bc3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144348
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-22 03:15:28 +00:00
Srujan Gaddam
01da93f053 [dart:html] Change visualViewport to be nullable
Closes https://github.com/dart-lang/sdk/issues/41612

visualViewport can be nullable on Firefox. This is a workaround
until https://github.com/dart-lang/sdk/issues/41616 is addressed.

Change-Id: I386d8fc8716026191bace912e46a2c56358d079a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144350
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
Auto-Submit: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2020-04-22 02:34:54 +00:00
Nicholas Shahan
1f22cd0573 [dart2js] Cleanup unused local variable
While I was referencing the dart2js implementation to fix a bug in DDC I
noticed an unused local variable here.

Change-Id: I4e6dfd961cbc54ee346f1796eb1b5184d3c01ed7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144347
Auto-Submit: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2020-04-22 01:39:13 +00:00
Liam Appelbe
87b829bacd [nnbd] Fix some more strong mode tests
All these tests now pass in both weak and strong mode, except for
relation_subclass_test and typedef_reflected_type_test. For those 2
tests I fixed the compile time error and now they have the same runtime
errors in both weak and strong mode (they were already failing at
runtime in weak mode).

Change-Id: If0157f811fffcf72a12ce6690ac0568c8f4419a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144343
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-04-22 00:12:24 +00:00
Sam Rawlins
29bc716241 Migrator: Add a late inference component
Fixes #38747

Change-Id: I045a6481424c75828eb7ae1e71c890b10e9d402c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144244
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-04-21 23:54:54 +00:00
Konstantin Shcheglov
65a944f78f Add CiderCompletionComputer.compute2(), tests.
R=brianwilkerson@google.com, keertip@google.com

Change-Id: Ie6acad3873f78060cde85a350ebd48b854ea1314
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144345
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-21 23:46:04 +00:00
Janice Collins
2274b51c7e Update dartdoc version to 0.31.0.
Release notes:  https://github.com/dart-lang/dartdoc/releases/tag/v0.31.0

Change-Id: I0222d3849a1a932f6793c05a64e69b5766992206
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144344
Commit-Queue: Janice Collins <jcollins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Auto-Submit: Janice Collins <jcollins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-04-21 23:02:59 +00:00
Paul Berry
dd883c749d Remove inadvertent imports from nnbd_migration to analysis_server
Change-Id: I001d00d5f1a8d4c503523f9ec4b09b38a908d8ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144301
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-04-21 21:55:19 +00:00
Zichang Guo
e35120cfd1 [tests] rewrite and format several tests on http
Resolve comments in previous cls.
https://dart-review.googlesource.com/c/sdk/+/140564
https://dart-review.googlesource.com/c/sdk/+/136322
https://dart-review.googlesource.com/c/sdk/+/138860

Change-Id: I9549019fe871f35187af5ff75df320748792498b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141845
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2020-04-21 21:41:08 +00:00
Liam Appelbe
d78c783d75 [nnbd] Fix corelib/list_test in strong mode
Change-Id: I5dff3bdd62adde0ea78b93e8bf1b747082d6cd8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143963
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-04-21 21:13:58 +00:00
Joshua Litt
430b11670a [dart2js] add unit tests to nnbd bot.
Change-Id: I5ba15f4a43ede211608f6789edaf5c42247f8ea0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144200
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2020-04-21 20:38:25 +00:00
Konstantin Shcheglov
6f97affca2 Don't apply substitution for top-level function members.
Bug: https://buganizer.corp.google.com/issues/154516150
Change-Id: I353701ec0e6d2384644685a4d950be7751a6c6b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144341
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-21 20:10:55 +00:00
Ryan Macnak
160046f44c [vm] Move CID predicates out of RawObject.
When using C++ value types to represent tagged pointers, we cannot use forward declarations for tagged pointers. This helps to break include cycles when attempting to keep IsXYZ predicates as tagged pointer member functions.

class_id.h also seems like a more natural place for these predicates, which were written before there was a class_id.h.

Change-Id: I0677560a794ed084d10f844606e202feb0c3820a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144321
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-04-21 20:09:55 +00:00
Filip Filmar
595cd384d3 Add dart::ComponentContext() for Fuchsia
This allows the program to get at the singleton component context
for the currently running component.  The component context can
be meaningfully instantiated only once; and since dart doesn't
have a predefined way to wire platform-specific values into
platform-specific code, we instantiate a singleton here, so all
code that is interested can use it.

The users of this functionality will be the dart and flutter
fuchsia runners.  See issue
https://github.com/dart-lang/sdk/issues/41523 for details.

Tested:
  manual compile for fuchsia, check behavior.

Change-Id: Ib4e15af376ecb932c2d2b28d6f099383d53ccc84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136524
Commit-Queue: Filip Filmar <fmil@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-04-21 19:09:25 +00:00
Sam Rawlins
511baaae48 migrator: Switch help link to the shortened URL
Fixes #41488

Change-Id: I272e9dbe32311454767a99d309a694e8d0fc9730
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144300
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-04-21 18:39:34 +00:00
Martin Kustermann
b53ea77e6b [vm/gc] Take new space lock when donating TLABs after scavenge, avoid leaks with double Dart_Initialize
This is a follow-up to [0] and fixes TSAN.
This is a follow-up to [1] and fixes ASAN (restored old code with comment)

[0] https://dart-review.googlesource.com/c/sdk/+/143817
[1] https://dart-review.googlesource.com/c/sdk/+/144260

Change-Id: I30cf8409e742785a923b6e48ffb050fff1c808c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144295
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Auto-Submit: Martin Kustermann <kustermann@google.com>
2020-04-21 16:57:24 +00:00
Erik Ernst
ad8ed8bd46 Add test: await voidExpression is an error iff null-safety is enabled.
Change-Id: Ibdd201b595b8835015a1a17417ee1d6e76030676
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144140
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-04-21 15:30:03 +00:00
Alexander Thomas
0c28ddc170 [release] Prepare changelog for the 2.8.0 stable release
* Add tentative release date.
* Fix some bad characters.
* Move changes that didn't make the cut to 2.9.0.

Change-Id: I13d7ffa45ec96057d7b3d08b4437662d48d4d732
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144288
Reviewed-by: William Hesse <whesse@google.com>
2020-04-21 14:28:53 +00:00
Martin Kustermann
72320b6c9a [vm/concurrency] Avoid quadratic complexity when closing ports on isolate shutdown
When an isolate dies it has to close all it's open ports. Right now this
is done by walking all ports in the system.
  => O(#num-isolates x #num-ports) complexity

Instead we let each isolate remember it's own open ports: When the
isolate dies we iterate over those ports that particular isolate has
open and close them.
  => O(#num-isolates + #num-ports) complexity

On a many-isolate test of the form:

    foo(int n) {
      if (n == 1) return 1;
      return foo(n-1) + 1;
    }

for `foo(50k)` this reduces the runtime from 90 seconds to 30 seconds.

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

Change-Id: I3ac68c5334a1d5e8cac47e89e15cbb50c26b65ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144261
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-04-21 14:05:53 +00:00
Martin Kustermann
d5137fac1a [vm/compiler] Fix linker error when building with -mdebug -d0
For some reason constexpr seems to need a definition, because the linker
complains about not being able to find the symbol:

    % tools/gn.py -ax64 -mdebug -d0
    % tools/build.py -ax64 -mdebug
    ...
    ld.lld: error: undefined symbol: dart::FlowGraphBuilderHelper::kPhiSelfReference
    >>> referenced by constant_propagator_test.cc:53 (../../runtime/vm/compiler/backend/constant_propagator_test.cc:53)
    ...

We may also want to consider passing `-fmerge-all-constants` explicitly
in the future - though it is not standards compliant.

See also http://crbug.com/829795.

Change-Id: I1cc125a01751c8a83092b033e80afdcc591c7b92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144287
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-04-21 13:12:42 +00:00
Jens Johansen
676c2df9a2 [CFE] Fix parser expect output when there's errorTokens all over the place
Change-Id: I5509f866bb33e91f49d873678761e00ce8601654
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144284
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-04-21 13:03:43 +00:00
Martin Kustermann
4d3ae12d9f [vm/concurrency] Extract the hashset implementation out of PortMap into PortSet
This CL extracts the hashset implementation from PortMap into
it's own (template) class into port_set.h:PortSet.

This splits the functionality (a nice cleanup in itself) and will
make it re-usable (via template) for a follow-up CL which makes
each message handler aware of it's own open ports.

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

Change-Id: I4a56c997414672a4efc9330077110ac5f54d03d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144260
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-04-21 12:43:12 +00:00
Martin Kustermann
2d97e97feb [vm/concurrency] Make isolates return their TLAB on unscheduling and re-acquire on scheduling
When a mutator get's de-scheduled, it should not hold on to it's TLAB
during the time there is nothing to do to ensure other threads which
are scheduled and ready can use it.

When having many isolates this can improve the performance by 10x+.

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

Change-Id: I994b584102a9777b8e57dc7b0942588344c34675
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143817
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-04-21 12:35:52 +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
Konstantin Shcheglov
704642a9b0 Report DEAD_CODE using flow analysis when NNBD.
Bug: https://github.com/dart-lang/sdk/issues/35716
Change-Id: I066d744e30ec582f0c79a238dc5bf8194eaef578
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143900
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-04-21 03:47:54 +00:00
Konstantin Shcheglov
61c8ac8b46 Issue 40088. Promote to NonNull of the declared type on assignment.
Bug: https://github.com/dart-lang/sdk/issues/40088
Change-Id: Icc2c720e24c2e6a85994497cd12bf34957d99d4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144040
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2020-04-21 03:01:54 +00:00
Konstantin Shcheglov
7e4673f497 Check overrides using only direct superinterfaces.
Change-Id: Ib17c3fb18d6ec4ff4541835a78c645a7b13affd2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142760
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-04-21 02:42:04 +00:00
Konstantin Shcheglov
85336d761f Fail building SDK summary if diagnostics during parsing.
Change-Id: I1ec1d45b362177ae883f7c0d3a78c081ffaa27bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144180
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-21 00:40:04 +00:00
Ben Konyi
de6cfe7e15 [ VM ] Fixed issue where resolving symlinks while trying to get the executable directory path would fail resulting in a "No such file" error
As part of adding support for brew installations, a bug was introduced
which resulted in the executable directory path not being resolved
correctly if the process was launched via a symlink. This resulted in
the script path passed to the CFE not being fully qualified relative to
the executable location which would cause lookup failures for relative
script paths.

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

Change-Id: I31813ccbc024eb0e4dd6dc265986ba3aefd9898e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144005
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-04-21 00:09:04 +00:00
Sigmund Cherem
906e1dfae2 [dart2js] include null when checking or trusting the type of operator==
Change-Id: I8f60fd1176062f8341d22fec4dc1c0bbf78ed485
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144081
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2020-04-20 23:35:05 +00:00
Alexander Markov
69791c50f8 [vm/nnbd] Use InitInstanceField instruction for late instance fields
Fixes https://github.com/dart-lang/sdk/issues/41299
Issue https://github.com/dart-lang/sdk/issues/41417

Change-Id: I1219ddaffcf3a2b17226305eeea8455c73f4ca78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143189
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-04-20 23:30:14 +00:00
Liam Appelbe
3929f299ae [nnbd] Fix json_utf8_chunk_test in strong mode
Change-Id: I1ad9e525520de99dd50cad14f7ed20fa50f50535
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144242
Auto-Submit: Liam Appelbe <liama@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2020-04-20 23:17:54 +00:00
Leaf Petersen
301612d495 Fix missed breaking change in http.dart
Change-Id: I924c6a082113a6ba80435ea78de49bf8ceddfb8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144220
Auto-Submit: Leaf Petersen <leafp@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2020-04-20 22:41:04 +00:00
Konstantin Shcheglov
b779c938eb Convert element type in for-each to legacy if opt-out library.
R=brianwilkerson@google.com, paulberry@google.com

Bug: https://buganizer.corp.google.com/issues/154515220
Change-Id: Ic62feab5fa090a9994b25769729d56fdfed97335
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144241
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-04-20 22:12:54 +00:00
Alexander Markov
7e88e4b075 [vm/aot/tfa] Handle calls to unsafeCast more accurately
Async transformation sometimes inserts additional unsafeCast calls in
order to make sure kernel AST is typed.
We can recognize these calls in TFA and handle them more accurately,
maintaining type flow through these native (and otherwise opaque) calls.

Change-Id: I3e316507e0a37f36dcf8a9621dbd7b342ce5f19d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138661
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-04-20 20:57:22 +00:00
Paul Berry
52b04b3d28 Migration: code inside a switch statement should not imply non-null intent.
Fixes #41407.

Change-Id: Iec9a520bbbab6f55da569ecc863d92674c351207
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144160
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-04-20 19:09:32 +00:00
Paul Berry
4c8da7543e Migration: handle field formal parameters properly in FixBuilder.
Previously, all parameters returned by
MigrationResolutionHooksImpl.getExecutableParameters were synthetic
ones that came from translating the executable element's decorated
function type to its final post-migration type.  Synthetic parameters
can't be field formal parameters, so this meant that when the
FixBuilder was re-resolving a constructor containing field formal
parameters, references to the field in the constructor body would get
incorrectly interpreted as pointing to the parameter rather than the
field, and that would cause them to be subject to promotion.

The fix is to only return synthetic parameters from
MigrationResolutionHooksImpl.getExecutableParameters when the
executable in question is in a library *not* being migrated.  When
it's in a library that *is* being migrated, we can just return all of
the executable's parameters without translating them, because we know
that the parameters themselves have been visited by the NodeBuilder
and EdgeBuilder, hence they all have thier own associated decorated
types.

Fixes #41405.

Change-Id: I5e3c411dc92fe242a959a5670b9253fbccea2b31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144122
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2020-04-20 19:09:32 +00:00
Paul Berry
b471ac55a0 Migration: apply guards to conditional branch expression values.
Consider the following code:

  int f(int i) => i == null ? null : i + 1;

Previously, migration would mark the return type of `f` as nullable
even if `i` was non-nullable.  This happened because the edge
connecting the explicit `null` (in the "then branch" of the
conditional) to the return type of `f` is created after visiting the
conditional expression, so the condition guards are no longer in
scope.

With this CL, we create an extra graph node when needed to ensure that
the guard is applied to the expression type.

Change-Id: Ie00eea0b431905241612c6661d69bdb55c0910d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144121
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2020-04-20 19:09:32 +00:00
Paul Berry
925e3fe782 Migration: detect weak-only code in conditional expressions.
This change adds the ability to detect when one branch of a
conditional expression is weak-only due to nullability.  For example,
in the following code:

  int f(int/*!*/ i) => i == null ? g(null) : i;
  int g(int j) => ...;

the call to `g` can only happen in weak checking mode.  The migrator
also now understands that j only needs to be nullable if i is
nullable.

Fixes #41555.
Partially addresses #41551.

Bug: https://github.com/dart-lang/sdk/issues/41555
Change-Id: I02c9c3072f0104db0f1a5b432fb1f2f8f06d5282
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144120
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2020-04-20 19:09:32 +00:00