Commit graph

73200 commits

Author SHA1 Message Date
Alexander Thomas 42639262ea Revert "[infra] Update checked-in SDKs to 2.9.0-10.0.dev"
This reverts commit 79e0f19f2d.

Reason for revert: Breaks tryjobs because pre-approvals didn't get applied across builders.

Original change's description:
> [infra] Update checked-in SDKs to 2.9.0-10.0.dev
> 
> Change-Id: I350c35cd11ab2365e0e2a844c13b92ebc1fa39c9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149285
> Reviewed-by: William Hesse <whesse@google.com>

TBR=whesse@google.com,athom@google.com,askesc@google.com

Change-Id: Ia814e2d6cc7276293a5fca03b499377c37109647
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149324
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2020-05-28 16:17:41 +00:00
Alexander Thomas 79e0f19f2d [infra] Update checked-in SDKs to 2.9.0-10.0.dev
Change-Id: I350c35cd11ab2365e0e2a844c13b92ebc1fa39c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149285
Reviewed-by: William Hesse <whesse@google.com>
2020-05-28 13:31:04 +00:00
Jens Johansen 86f3fde23f [frontend_server] Plug leaks caused by saving the first compilation result
The first compilation result is leaked in two ways:
1) Directly by saving the component in a variable; and
2) Via an unfortunate context thing, probably a variation of
   http://dartbug.com/36983. I will update that bug with a reproduction
  example later.

The reason this creates a (big) leak is illustrated with an example:
* Say the first component (A) has 10 libraries in it. Each of these
  libraries has parent pointers and points (currently) to A, which again
  points to all of the 10 libraries.
* We then do a recompilation, say 5 libraries are reused and 5 are new.
  They are put into a component (B). We really should have 10 libraries,
  the 5 old ones and the 5 new ones (and for simplicity lets say these are
  the ones in B). Notice that the 5 old ones will have their parent
  pointers updated and also still be in the list of libraries in A.
  We keep 15 libraries alive because we have the 10 original ones saved via
  A and the 10 (where 5 is new) saved via B.
* We then do a recompilation, say 2 of the same libraries as was also
  recompiled before, these end up in compnent C which has 5 libraries from A,
  3 libraries from B and the 2 new ones. All of these libraries will have
  their parent pointers updated to point to C.
* Because we saved A we keep all the 10 libraries in A though.
  Because we saved A and some of the libraries in A had parent pointers
  updated to point to B we also keep B and all libraries in B.
  Because we keep B and some of the libraries in B had parent pointers
  updated to point to C we also keep C and all libraries in C.
  So instead of only having the 10 "live" libraries, we have 10 + 5 + 2 = 17
  libraries, a leak of 7. With more compilations this keeps happening and
  the leak keeps growing.

This CL stops the leak by not holding on to A (which, in turn, stops holding
on to B etc.)

Change-Id: If4f8b1e240b7c39f084df9cb2690570ff26fa9b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149280
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-05-28 11:59:08 +00:00
Vyacheslav Egorov 6ab62add0d [vm/compiler] Use unboxed constants when folding away unboxed ops.
Before this change we would replace unboxed definitions (those with
representation not equal to kTagged) which is too loose and causes issues
in subsequent passes, which assume that replacements have normalised
representation.

After this change we make sure that replacement has a matching
representation.

Closes https://github.com/dart-lang/sdk/issues/35371
Fixes https://github.com/dart-lang/sdk/issues/41971

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try
Change-Id: I48543893562acf4f8516651196eba7c0c0769a22
Fixed: 35371,41971
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103139
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-05-28 11:30:49 +00:00
Tess Strickland d881462eae [vm/aot] Clean up old assumptions in Serializer::WriteInstructions().
In the past, negative text offsets were used for instructions shared
by multiple code objects. This is no longer the case.

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try
Change-Id: I85085a06b8c955abb21573caea5554e839154979
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149281
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2020-05-28 10:14:18 +00:00
Alexander Thomas b718209dfd Revert "[co19] Enable tests migrated to null-safety"
This reverts commit 9a588de9f4.

Reason for revert: The tests need additional fixes before they can be enabled, and this CL makes it harder to land the support for running
the tests on tryjobs.

Original change's description:
> [co19] Enable tests migrated to null-safety
> 
> Change-Id: I738f5be6fe60aa4addb925101eb7f2912627ec8b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148527
> Reviewed-by: Sergey Grekhov <sgrekhov@unipro.ru>
> Reviewed-by: William Hesse <whesse@google.com>
> Commit-Queue: William Hesse <whesse@google.com>

TBR=whesse@google.com,athom@google.com,sgrekhov@unipro.ru

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

Change-Id: If758a0041214693aa6cd90f76b3e1a4f4db78c5b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149283
Reviewed-by: Alexander Thomas <athom@google.com>
2020-05-28 09:42:56 +00:00
Sam Rawlins 2eaac80e1a dartdev: skip 'pub outdated' check in tests
Fixes https://github.com/dart-lang/sdk/issues/42049

We should enable, and test this feature in these tests, I think.
But for now I just need the tests to start passing. I haven't wrapped
my head around how mock-y / end-to-end-y migrate_test is.

Change-Id: I7a2e2034b2a1f42b71d78f4776ee8711071f01f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149200
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2020-05-28 04:50:24 +00:00
Sigmund Cherem 521acb17e4 [dart2js ddc] make paths of dart2js and ddc platform files agnostic of nnbd.
Our platform .dill files show machine agnostic paths of the form:

  org-dartlang-sdk:///sdk/lib/foo/

and with the unfork:

  org-dartlang-sdk:///sdk_nnbd/lib/foo/

This change makes the path agnostic of the sdk_nnbd sources as well:

  org-dartlang-sdk:///lib/foo/

So that source-mapping tools can find the sources if needed (our sdk_nnbd vs sdk
is not visible on published sdks).

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

Change-Id: Iceea8a917fb9a6e5f305d22ba6ee0927354d4d8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148881
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2020-05-28 00:31:13 +00:00
Parker Lougheed 1fba93f7c7 [runtime/observatory] Clean up rewind command feedback
This check is also replicated later within [debugger.cc](https://github.com/dart-lang/sdk/blob/master/runtime/vm/debugger.cc#L4098), so it didn't necessarily matter that this check did not work.

Despite this, I think the earlier check does not hurt though, and I
also added feedback for when the supplied argument is not an int
rather than just throwing an error.

Bug: https://github.com/dart-lang/sdk/issues/38888
Change-Id: I8a7a237850957d13dbf0aa30873d3b9772eb6d1a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148567
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-05-28 00:12:04 +00:00
Srujan Gaddam df36449d72 [package:js] Add JS test for function parameters
Adds tests for JS objects with functions with positional and
optional parameters. It does not include named arguments as those
should be statically disallowed.

Change-Id: I24acadc8160d3515bb79b00dc6ab28b528e2b039
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148221
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-05-28 00:00:04 +00:00
Alexander Markov 7a63d5889c [vm/kernel] Fix --no-link-platform option of gen_kernel tool
Change-Id: I917374540831f9d0d75af9f03730e06ecf26602f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149020
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-05-27 23:37:24 +00:00
Konstantin Shcheglov c703e05689 Always provide --dart-sdk-summary in build mode tests.
Change-Id: Ief03ccfbc8b59c9fdf20e089ebe7c4ccd7db8d22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149244
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-05-27 22:12:03 +00:00
Paul Berry 2e261f9386 Migration: add locations to trace entries that refer to elements.
Bug: https://github.com/dart-lang/sdk/issues/41402
Change-Id: I0dc59ae9d64c6e8ab470b2ddcb5fd42557ba5704
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148742
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-05-27 21:52:14 +00:00
Paul Berry be6cbd3fb8 Sort declarations in instrumentation_test.dart
Change-Id: I0a9febdad57779b2d9d3f17e1d4909194ca15772
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148740
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Janice Collins <jcollins@google.com>
2020-05-27 21:52:14 +00:00
Brian Wilkerson b3cec0e400 Incorporate old relevance ideas into context support for new relevance
This doesn't improve the scores in the small app I've been using, but
it does move forward all of the old relevance computation support that
I could find into the new relevance computations.

The other thing done in the old relevance support is some filtering.
For example, in an extends clause, mixins will be filtered out. This
would improve the relevance scores (by reducing the number of
suggestions) but it doesn't seem like it ought to be done as part of
the relevance computation. We should think about a good way to better
filter the suggestions.

Change-Id: Icc671ff033cc5a2d2356c61555844b944d8890b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149204
Reviewed-by: Jaime Wren <jwren@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-05-27 21:19:57 +00:00
Nicholas Shahan d76b5318b4 [ddc] Make amd modules a named function
Apply the same naming used in the ddc module format to amd modules.

Change-Id: Ib766c20cb35c3c6e11a345e45cba5c49f3a34b3b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148941
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-05-27 20:44:07 +00:00
Konstantin Shcheglov a538c7fcc7 Non-nullify context type for FunctionExpression inference.
Bug: https://github.com/dart-lang/sdk/issues/42007
Change-Id: Id75956759c66aa6090ba52e07deb120ce44fd8d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149243
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-05-27 20:22:20 +00:00
Mike Fairhurst 76839d5e4d [nnbd_migration] Fix navigation urls on windows.
Change-Id: I226b36039c781e3f12b76e8ee3a5ae5e8eefcbed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149055
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2020-05-27 19:56:14 +00:00
Konstantin Shcheglov 00fa48fbb1 MockSdk does need to create summary.
Change-Id: Id62bc99394e9afd6306ba6a12118d7bcd045a598
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149202
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-05-27 19:39:10 +00:00
Konstantin Shcheglov 860d3c0697 Report UNUSED_LABEL when null safety, fix for crash.
Bug: https://github.com/dart-lang/sdk/issues/42077
Change-Id: I85325ae1f2d25f680182d07ef50ddb56633b89f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149240
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-05-27 19:36:30 +00:00
Konstantin Shcheglov 765cdc169c Update language/interface/interface2_test after analyzer changes.
Bug: https://github.com/dart-lang/sdk/issues/42076
Change-Id: Ia2d4d42540a702301c76ef35e05a9c86e2cee3d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149220
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-05-27 19:07:20 +00:00
Srujan Gaddam fecda739e6 Add mdn/browser-compat-data to DEPS
https://github.com/dart-lang/sdk/issues/41905

This repo is added for code generation for dart:html. There are
various instances of APIs being unsupported for some browsers,
and this repo provides metadata on which ones are unsupported.

Change-Id: I6740c022cec46352017c38f7c298581695ad33e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149051
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Auto-Submit: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2020-05-27 18:31:20 +00:00
Ben Konyi 3570d52a76 [ DartDev ] Always use the resolved executable as the preferred Dart binary
Fixes https://github.com/dart-lang/sdk/issues/42004

Change-Id: I4f30c938ea7a67672320245f6a2869ea0744a728
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148950
Reviewed-by: Jaime Wren <jwren@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-05-27 17:36:50 +00:00
Martin Kustermann 4cf584d4fe [vm/concurrency] Move locks up from Isolate to IsolateGroup
In --enable-isolate group is

  * turned off, then we have 1<->1 mapping between isolate and isolate
    group, so moving the locks should have no impact

  * turned on, then we have N<->1 mapping between isolates and isolate
    group, mutators need to use the same locks to guarantee exclusive
    access (e.g. to symbol table, type canonicalization, type arguments
    canonicalization, ...)

This is a follow-up to share the program structure in AOT mode across
multiple isoltes.

In order to move the existing `Isolate::type_canonicalization_mutex_` to
`IsolateGroup` (and thereby make all mutators use the same lock), we need
to remove the `RunWithMutatorsStopped()` usage in the runtime entry.

  => Without this it can lead to deadlocks.

In order to remove usage of `RunWithMutatorsStopped()` we will change
access to the cached type arguments array to use load-acquire barriers
in generated code and store-release barriers in runtime code.

A nice side effect is that it reduces `sizeof(dart::Isolate)`.

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

Change-Id: Ifd42691524fe41ffe8bb4e2623c5b8c1151de973
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148539
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-05-27 17:04:30 +00:00
Alexander Markov dae51f08d1 Reland "[vm/aot] Enable tree-shaking of write-only fields by default"
This is a reland of 9c50efcf07

There are no changes to the original CL.
Fixes for bugs revealed by this change are in separate CLs:

 * Crash in disassembler
   https://dart-review.googlesource.com/c/sdk/+/148942

 * Crash in --print_instructions_sizes_to
   https://dart-review.googlesource.com/c/sdk/+/149043

Original change's description:
> [vm/aot] Enable tree-shaking of write-only fields by default
>
> Tree-shaking of write only fields is implemented in
> https://dart-review.googlesource.com/c/sdk/+/143286
> This change just enables it by default.
>
> Flutter gallery in release mode
> armv7 app.so size -0.41% (gzip -0.24%, brotli -0.20%)
> armv8 app.so size -0.38% (gzip -0.23%, brotli -0.29%)
>
> Issue: https://github.com/dart-lang/sdk/issues/35310
>
> Change-Id: Iaae3e893b4a6bf4d468d6cd05aba5f8ee8810afc
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148543
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Alexander Markov <alexmarkov@google.com>

Change-Id: I609db3fec8b0798f55aa2067127dfdc90a21ead4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149044
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-05-27 16:52:30 +00:00
Brian Wilkerson cbc6de6c2d Update the relevance metrics tool
This adds tracking of how often type parameters are declared and how
often import prefixes are used.

It also removes the code to convert to and from JSON because we don't
need it.

Change-Id: I7f3b19e9f82bd8aa1b327797726839ff63837795
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149121
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-05-27 16:44:50 +00:00
Nicholas Shahan 2cc4d7ca2f [cfe] Set and check null safety mode in .dill
Validates that the .dill files provided for dependencies and the SDK
support sound null safety when compiling for strong mode.

Change-Id: Id1f7547a6bc473b901bfce62145cc918353c8ea4
Issue: https://github.com/dart-lang/sdk/issues/41694
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149080
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-05-27 16:27:50 +00:00
Konstantin Shcheglov b6af46dc30 Revert "Use allowed_experiments.json when building SDK summary."
This reverts commit 97d9412996.

Reason for revert: This causes some, probably temporary, issues internally. Reverting for a day or two.

Original change's description:
> Use allowed_experiments.json when building SDK summary.
> 
> Change-Id: I3fd73d9890d62cc7b3c19e061069979a6b65c9b7
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149052
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>

TBR=scheglov@google.com,brianwilkerson@google.com

Change-Id: I9c8142bfc5728dd773830b653bb31d28b5e81628
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149201
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-05-27 16:26:12 +00:00
Konstantin Shcheglov 97d9412996 Use allowed_experiments.json when building SDK summary.
Change-Id: I3fd73d9890d62cc7b3c19e061069979a6b65c9b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149052
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-05-27 15:28:19 +00:00
Konstantin Shcheglov 14f64f9db4 Add CrashReportingAttachmentsBuilder.forException()
R=brianwilkerson@google.com

Change-Id: I66793d61e02d25931d230e8b9e3541255ac6324a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149054
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-05-27 15:28:11 +00:00
James Lin 10e8d5d1a6 Try to clarify the RangeError.range message
The old RangeError.range message was confusing:

  RangeError (index): Invalid value: Not in range 0..2, inclusive: 9

The comma makes the message hard to parse.  I've seen a number of
people misinterpret "inclusive" as describing the invalid value (9)
instead of acting as a modifier on the range.

https://github.com/dart-lang/sdk/issues/29586 has a lot of
bikeshedding about this, but in the interest of mitigating confusion
sooner, I propose changing it to:

  RangeError (index): Invalid value: Not in inclusive range 0..2: 9

I'm intentionally trying to improve the message with minimal
disruption to the structure of the error message.  Although I'd much
prefer that "Invalid value" and the actual value be adjacent instead
of being interrupted by the explanation, such restructuring is rather
non-trivial.  RangeError allows the "Invalid value" message to be
customized, and rearranging terms could produce even worse
constructions.

I also considered:

  RangeError (index): Invalid value: Not in range [0, 2]: 9

And while I like that that is brief and clear, I chose not to use it
for people who are unfamiliar with interval notation and who might
mistake it as a Dart List.

Bug: https://github.com/dart-lang/sdk/issues/29586
Change-Id: I0f23b195437e4053ae5f76b5d303123979a8c9fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146024
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-05-27 14:59:39 +00:00
Clement Skau 205ba04c5e [SDK][Gardening] Fixes profiler_test broken in c4b7097e.
Test Profiler_ArrayAllocation used the non-existing List.empty()
constuctor.
This fix replaces it with the semantic equivalent List.filled(..).

TBR:bkonyi

Change-Id: I70913803a4d3585cb19a39375b14c1184f047644
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149160
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2020-05-27 13:33:09 +00:00
Vyacheslav Egorov b95a1bd567 [vm/aot] Clean static fields handling in precompiler.cc
Instead of maintaining separate list of static fields which
needs to be flushed into list of retained fields in Iterate()
keep track of which precompilation phase we are in - and add static
fields into the retained set only if we are in the fixpoint
code generation (aka Iterate()) phase.

Apply the same treatment to selectors as well.

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try
Change-Id: I2c7c7bdf268eaee9623ab1be5cf3eb022991a7c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148403
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-05-27 10:22:19 +00:00
Vyacheslav Egorov 7175ab7329 [vm/compiler] Fix code determining if object can be a smi in LoadClassId.
Previous variant of the code did not handle FutureOr<T> and Comparable<U>
correctly - variables of these types can contain a smi value if T can be a
subclass of num or if U can be num.

Rename HasNonSmiAssignableInterface to CanReceiverBeSmiBasedOnInterfaceTarget
to better conway its meaning.

Fixes https://github.com/flutter/flutter/issues/57398

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try
Change-Id: I67b29908e057632e62c46fb327a5c805fcc78d74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149063
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-05-27 10:06:49 +00:00
Parker Lougheed 6489a0c68d Fix error when modifying import on Windows
If there is an exception when checking if a resource exists, it is similar to it not existing. Open to feedback here though, perhaps the issue should be handled more specifically to Windows path requirements.

Bug: https://github.com/dart-lang/sdk/issues/37403
Change-Id: Ic5d4ed0cb22619897c3ccaf46feaadd297b55472
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148701
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-05-27 05:50:13 +00:00
Mayank Patke bbb8923ebb [dart2js] Ensure all top/raw type predicates go through DartTypes.
Conceptually, this makes sense because a type is not intrinsically top
or bottom or raw, but only in the context of a type system. This also
makes these predicates much more maintainable and puts them in a form
identical to the one at the RTI level.

Change-Id: I83154a82cef6cbaa9c4d0f27cb95f01473c1e015
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149049
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2020-05-27 05:28:03 +00:00
Mayank Patke d1546cac87 [dart2js] Make diagnostic message arguments strongly typed.
We were passing arguments as just a `Map` and forcing the Message to
handle the String conversion, but the caller is much better equipped to
do it and prevents the dynamic typing.

Change-Id: Icc4ab91edf233b81a64aa3b03462b541349fa751
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149048
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-05-27 05:28:03 +00:00
Mayank Patke 8d6a0541dd [dart2js] Always treat Never as a bottom type.
Previously, we were only treating it as a bottom type with strong NNBD,
but weak NNBD can still contain Never.

Change-Id: I88f1aac3d228918f82e7e75d01531df802613ddb
Bug: https://github.com/dart-lang/sdk/issues/41970
Fixes: https://github.com/dart-lang/sdk/issues/41970
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148940
Reviewed-by: Stephen Adams <sra@google.com>
2020-05-27 05:28:03 +00:00
pq 253022eb1b remove non-node-processing lint support
See: https://github.com/dart-lang/linter/issues/2105

Change-Id: I8895c567813d7757e659f8e0d2c700268eae4a6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149050
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2020-05-27 00:40:02 +00:00
Sam Rawlins 3c6a3fba30 Migrator: Add some failing tests for extensions
Bug: https://github.com/dart-lang/sdk/issues/39387
Change-Id: I2187db2433255fd950789942712d215c2472db4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149005
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-05-26 23:24:22 +00:00
Alexander Markov 2ec934d267 [vm] Fix crash on trampolines in --print_instructions_sizes_to
Trampolines which are generated in use_bare_instructions mode should be
taken into account when dumping sizes in --print_instructions_sizes_to.

This change fixes failing pkg/vm/test/snapshot/instruction_sizes_test on
Windows after https://dart-review.googlesource.com/c/sdk/+/148543.

Change-Id: I343f82699407ba54d9ccb9a9800875c61a6e8df3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149043
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-05-26 23:14:32 +00:00
Konstantin Shcheglov 279024d823 Deprecate InstanceCreationExpression.staticElement
Change-Id: I3c2de8ce22944963418d543b887720db15badd0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148981
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-05-26 22:56:42 +00:00
Ben Konyi c4b7097e97 [ VM ] Migrate VM tests to support null safety and return errors from Dart_GetType and Dart_NewListOf when --null-safety is enabled
These methods return legacy types, which aren't valid with null safety
enabled.

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

Change-Id: I1181f0f3b9a8df156dea4dc4c82fef8afdf97ab9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148685
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-05-26 22:40:52 +00:00
Stephen Adams e007545c42 [dart2js] Add HFunctionReference
Defer representation of function reference until codegen pass.
Not using opaque HForeignCode allows GVN and dead code removal to work.

Change-Id: I481094acca49c8b47d4ed9813a5150cbc8c9e4ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145340
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2020-05-26 22:17:42 +00:00
Konstantin Shcheglov 0b3ece9287 Expose FeatureSetProvider from AnalysisDriver for dartdoc.
R=brianwilkerson@google.com

Change-Id: I790737f7538e1104d27b71d0b789e09f22e49e0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149046
Reviewed-by: Janice Collins <jcollins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-05-26 22:13:35 +00:00
Mayank Patke 570de5884f [dart2js] Run some units tests in weak mode.
If we don't pass the flag explicitly, the code in these tests will be
compiled in NNBD strong mode due to the language version of the
entrypoint.

Change-Id: Id6ed574ad932cf7fb6d9681e1d514e79fb3cbe04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148647
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2020-05-26 22:08:52 +00:00
Mayank Patke 46dc9fb9a7 [dart2js] Set NNBD mode based on entry point.
Tested with https://github.com/dart-lang/null_safety_sample_package/.

Change-Id: Icecbee11da44eb9eb9cb3eb36f905f4a7126996b
Bug: https://github.com/dart-lang/sdk/issues/41208
Fixes: https://github.com/dart-lang/sdk/issues/41208
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148580
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-05-26 22:08:52 +00:00
Konstantin Shcheglov fc1a782168 Remove support for '--package-root'.
Bug: https://github.com/dart-lang/sdk/issues/41197
Change-Id: Ia10946b4db2204cc11e78a1d114578ba79904e78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149045
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-05-26 21:33:32 +00:00
Konstantin Shcheglov 571f564eda Rewrite TypeName to ConstructorName in one place, consolidate error reporting.
Change-Id: I5ea1369d65c5eb47e920f68806d28f34931d372e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148983
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-05-26 21:32:22 +00:00
Ryan Macnak 9b9ca0178f [vm/tools] Update references to snapshot_analysis.dart.
Change-Id: I93ddca77cb9b2594493298c1ca41403bd92fd3aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149021
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-05-26 21:21:19 +00:00