Commit graph

82955 commits

Author SHA1 Message Date
Konstantin Shcheglov ace6170572 Issue 47715. Remove the last signature on removeFile().
Bug: https://github.com/dart-lang/sdk/issues/47715
Change-Id: I0e4a75c7517a3103a32f57e33e62efb108b96e0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220801
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-11-19 01:37:36 +00:00
Brian Quinlan 001df490a7 Move breaking change (#47653) to 2.16.0
made in 0e5f3f49c3

Change-Id: Ic7e9a91512661d3a1999f933e9d6caab6db340a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220700
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2021-11-18 21:26:56 +00:00
Konstantin Shcheglov 9d7df725f6 Deprecated restoreAbsolute(), use pathToUri().
Change-Id: Id705e4f0eda7beba4c3d2dd2f6ba4b82691ef1f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220480
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2021-11-18 21:17:17 +00:00
Mayank Patke 6dbbd4b7d7 [dart2js] Handle ir.DynamicType in StaticTypeVisitor.visitForInStatement
Fixes: https://github.com/dart-lang/sdk/issues/47691
Change-Id: Ic584bfe10aa240361f149660151cb2a19bea0833
Fixed: 47691
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220781
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2021-11-18 20:37:36 +00:00
Mayank Patke 6b382a03b0 [dart2js] Add failing tests for #47691.
Bug: https://github.com/dart-lang/sdk/issues/47691
Change-Id: I14a0b5f027b6a5ed74dd22b63e3c103b380823eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220780
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-11-18 20:37:36 +00:00
Ben Konyi 46f9ae9568 [ VM / Service ] Stream light-weight version of CpuSamples for CPU
profiler events.

`Event.cpuSamples` is now a `CpuSamplesEvent` rather than a `CpuSamples`
object, where `CpuSamplesEvent` returns `(@Object|NativeFunction)[]` rather
than `(@Func|NativeFunction)[]`, resulting in a smaller JSON payload.

TEST=get_object_rpc_test.dart,get_cached_cpu_samples_test.dart

Change-Id: I1ad5e3df8840b8c41735d10c6c8669f6503e54a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219284
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-11-18 19:45:26 +00:00
Liam Appelbe 1427f15f67 [vm] Ignore coverage for constructors of all-static classes
More precisely, ignore private constructors with no parameters, on
abstract classes with no subclasses, no non-static members, and no
non-static functions (other than the constructor).

This is an idiom used to make static utility classes, and these
constructors are not intended to be used. So counting them as coverage
misses incorrectly lowers the coverage percentage.

Fixes: https://github.com/dart-lang/sdk/issues/47021
TEST=Added unit test
Change-Id: Ib94dd939c4637d5c04fe45009fc92be435e164da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220225
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-11-18 18:22:29 +00:00
Alexander Markov 071d50f679 [vm/compiler] Fix generation of Smi immediates when using compressed pointers
When compiler generates 32-bit instructions with immediate operand
(such as add/sub etc) it expects to find 32-bit immediate value.
In compressed pointers mode Smi occupies 32 bits with unspecified
upper bits. So getting a raw value of a Smi using

  static_cast<int64_t>(constant.ptr())

is not correct. For example it may yield 0xfffffffe instead of
0xfffffffffffffffe for -1 value.

This change fixes a few places in code generator to use Smi::RawValue
instead of doing a static_cast.

TEST=runtime/tests/vm/dart/regress_47704_test.dart
Fixes https://github.com/dart-lang/sdk/issues/47704

Change-Id: I1f649c5a22f221c7f4e69a884c88c265973be606
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220660
Auto-Submit: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-11-18 17:12:18 +00:00
Johnni Winther 8dcc1dcf5e [cfe] Migrate (more) CFE tests (part 7)
Change-Id: I11f667e9e0f6d96c8b57708da1485414e3b9f8da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220743
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-11-18 14:58:26 +00:00
Clement Skau edc0675e6e [vm] Adds offsets to sync gen.
Sync generators contain two implicit wrappers (:sync_op_gen
and :sync_op), which do not directly correspond to any user
code - and therefore do not have fileOffsets.

Some tools however rely on fileOffsets to e.g. compute code
coverage, so this change adds fileOffset inherited from the
non-synthetic code to :sync_op_gen and :sync_op.

Bug: https://github.com/dart-lang/sdk/issues/47681
Change-Id: I0c54bc3eaf5892e591fead845b5d31d2dfc9481f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220543
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2021-11-18 12:31:16 +00:00
Johnni Winther cb1f1b8102 [cfe] Migrate text serialization suite
Change-Id: Ib44e1c69f5e9aa0e17794b647c50b28fe4cf3d62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220741
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-11-18 12:07:26 +00:00
Clement Skau cb33212b18 [vm] Elaborate on DartDev missing error.
This change refactors CreateAndSetupDartDevIsolate slightly to
exit as soon as we know we cannot resolve DartDev.
Expands on the error message to be a bit more informative about
what went wrong.

Before:
  Failed to start the Dart CLI isolate
  (null).
  Observatory server failed to start after 1 tries
  [...]

After:
  Failed to start the Dart CLI isolate. Could not resolve DartDev snapshot or kernel.
  [...]

TEST=CQ

Change-Id: Iad3302dc4e64eef06b97c8b76a82b04c97a7089e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220546
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2021-11-18 06:56:57 +00:00
Joshua Litt 3d1f6a48b7 [dart2js] Add dart2js target to build summaries.
Change-Id: I1ef0b3f87124333e44cb15001c556b1767ddf28f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219841
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-11-18 00:58:40 +00:00
Ryan Macnak dc3cf83bb6 [vm] Allow the embedder to provide a task runner in lieu of the VM's thread pool.
This allows the embedder to control the degree of parallelism and thread priorities.

TEST=engine
Bug: https://github.com/dart-lang/sdk/issues/44228
Change-Id: I4e8430749fcfbcbfc221c3733ee27ccbe6bcc1ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215941
Reviewed-by: Kaushik Iska <kaushikiska@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-11-18 00:54:20 +00:00
Konstantin Shcheglov 76ddb43454 Try to work around invalidation exceptions.
We have a spike in exceptions internally, and I suspect that it was
caused by https://dart-review.googlesource.com/c/sdk/+/219942

But I was unable to understand why it happens.
So, this workaround is the best I can think of now.

Change-Id: I714eb6666706aad457b72e066978aa2d734fb89f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220640
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-11-17 23:26:21 +00:00
Brian Quinlan 051c198bff Add a test where we attempt to rename a file.
Change-Id: I9901f8abefe1e652307e15f05ef66d033a16a02f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220420
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2021-11-17 21:59:20 +00:00
Brian Quinlan 0e5f3f49c3 Fix an issue where rename on Windows would delete the target directory.
TEST=tests updated
Bug: https://github.com/dart-lang/sdk/issues/35217, https://github.com/dart-lang/sdk/issues/47633, https://github.com/dart-lang/sdk/issues/47634
Change-Id: I9582c76e8eb75548ba2d67205353de63d110c294
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219501
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2021-11-17 19:41:50 +00:00
Brian Wilkerson 0d6df5a1f1 Use contractions in the docs in a couple more places
Change-Id: Ic685ba6d74f3f495d740b3396663aa9ad25df768
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220221
Reviewed-by: Kathy Walrath <kathyw@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-11-17 18:22:48 +00:00
Ben Konyi 0cad0e7224 Reland "[ VM / Service ] Add setIsolatePauseMode RPC"
This reverts commit 6ae9f31081.

TEST=N/A

Change-Id: I98dcee3002f9f0882b1bbd5ad461d28ba2c874f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220485
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-11-17 16:17:24 +00:00
Simon Binder 0d6c343196 [dart:io] Add overrides for stdio
Add overrides to control the `stdin`, `stdout` and `stderr` getters in
`dart:io`.

Closes https://github.com/dart-lang/sdk/issues/33643

Change-Id: I6071ad0845df96f8508d2281a6c013f1745ca880
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219792
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-11-17 15:40:15 +00:00
Nicholas Shahan 86d6e30946 [ddc] Delete unused CastErrorImpl class
All uses were changed to TypeErrorImpl in
https://dart-review.googlesource.com/c/sdk/+/139490 but the class was
never cleaned up.

Change-Id: I20c0ca1661efda9a98d245e03a56342c6848c38f
Fixes: https://github.com/dart-lang/sdk/issues/41007
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220462
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2021-11-17 15:13:54 +00:00
Alexander Aprelev fd31242f2b Revert "[vm/concurrency] When generating Store/Load instructions use guard information that is kept on a slot."
This reverts commit 67baa5848a as it
breaks internal test b/205961373.

Addresses https://github.com/dart-lang/sdk/issues/47722

TEST=ci

Change-Id: Idc4a08a0a8cca2faf287a42eab8ff6af43f4e6c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220484
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2021-11-17 15:06:24 +00:00
Johnni Winther 2007dadb9c [cfe] Migrate (more) CFE tests (part 6)
Change-Id: I143431f394aea8e06bb7d055871b490a85279f2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220542
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-11-17 13:19:53 +00:00
Vyacheslav Egorov 12b1773deb [vm] Fix issues with flutter_regress_91370_il_test
* Add Canonicalize pass after CSE to erase graph differences between
64-bit and 32-bit platforms. These differences originate from different
treatment of integers (we unbox more eagerly on 64-bit platform) and
consequently affect load forwarding - which generates some redundant[1]
phis on 64-bit platform, but not on 32-bit platform. Adding this pass
also addresses other cases of unpredictable performance when IL changes
can cause CSE not to trigger a Canonicalize inside itself and regress
performance, by inhibiting subsequent optimizations.
* Allow IL tests to check whether the graph was compiled in sound
null safety mode or not - because graphs can have minor differences.
* Use `"$i"` instead of `i.toString()` in the test to allow TFA to
infer non-nullability of fields in non-sound-nullsafety mode.

[1] The definition of redundant phi differs between canonicalization
pass and load forwarding pass. The former unwraps redefinitions and
the latter does not. We are going to address this difference in a
more systematic way when we split input dependencies from control
dependencies.

TEST=ci

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-simarm_x64-try
Change-Id: Ifbd68fbb7f3b374ecee8ada1b3a4a2249139a108
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220541
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-11-17 12:12:31 +00:00
Vyacheslav Egorov bfbcfa6dc5 [vm/aot] Eliminate InlinedIntoICF retain reason
We should not need to retain functions which do not have any code,
the only reason to retain them would be for runtime to be able to
find the implicit closure (when performing lookup through API).

Additionally drop closure_functions array when producing
PRODUCT snapshot - because this array is not going to be used.

TEST=ci

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-dwarf-linux-product-x64-try
Change-Id: I29110ce613fdb347e2627d857f790e82602926d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219481
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-11-17 11:02:01 +00:00
Konstantin Shcheglov 48b45db358 Remove clearCache() from SourceFactory and UriResolver.
We don't use them anymore, the whole context collection is recreated.

Change-Id: Ie07d330a4928c3f85663a86d1dc83d8e3e28ab95
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220460
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-11-17 08:13:52 +00:00
Konstantin Shcheglov 935e0f028f Extract shared _newFile() for getFileForPath/Uri().
Change-Id: Ie5c7036cf31779d31789f400df48ca975a4aafda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220442
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-11-17 08:13:12 +00:00
Konstantin Shcheglov db642a008a Fix resynthesizer tests on Windows.
Change-Id: I09e1642ae4344115141b2bf7eb7cca3d8a69ccc0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220440
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-11-16 20:41:42 +00:00
Danny Tuppeny 3dbd06bdfc [analysis_server] Use relative imports for completion imports when prefer_relative_imports lint is enabled
Change-Id: Ib72066102db1883a21cf7a42e18a81efcfb47c54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220200
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-11-16 20:05:51 +00:00
Joshua Litt ce8bd6d17a [ddc] Move dartdevc.dart to lib/.
This minor change makes it a bit easier to consume ddc as a library.

Change-Id: Ie98a4fa78c313d827cf1a395b26a4f7859a9413c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220120
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2021-11-16 18:50:52 +00:00
Konstantin Shcheglov 635bd112a3 Use single FileState for a path.
For some time now we decided to use canonical URIs for files in lib/.

Change-Id: I416ef87e7c4e6b27be9e1bc274deee67286a9d05
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220223
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-11-16 17:44:42 +00:00
Danny Tuppeny 327389b86f [analysis_server] Prevent duplicate parens on completion for members without prefix
Fixes https://github.com/Dart-Code/Dart-Code/issues/3672.

Change-Id: I3c4bab180ecf27bfddf590d0f0915e916e701773
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220380
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-11-16 17:06:51 +00:00
asiva 3edd0832d6 [VM/Runtime] - Remove unused Dart C API function
Remove Dart_SetNativeServiceStreamCallback which is not in use by
any embedder.

TEST=cq

Change-Id: Ic6ecadb80d94b14cd2f89b5297d65c3ab7de75e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220131
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2021-11-16 16:59:13 +00:00
Vyacheslav Egorov 6d9c58957b [vm] Bump max ELF page size to 64K
Some Linux distributions have 64K pages on ARM64.

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

TEST=manually tested on a ARM64 Linux with 64K pages

Change-Id: Ia96deb5b850785f2ee4402bfaee18c101c02048f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220381
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-11-16 16:23:36 +00:00
Danny Tuppeny b74e8e5cec [analysis_server] Fix stack overflow when generating minimal edits for LSP range formatting
Fixes https://github.com/dart-lang/sdk/issues/47702.

Change-Id: I221427cb78eb6346fe6c78bf09c41bb22c78e8d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220324
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-11-16 15:35:42 +00:00
Clement Skau 798f2ff442 [analyzer] Nit: Doc: Add missing FunctionBody.
Change-Id: Ia63b9828452161b891e58052137870bb2866d672
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220010
Auto-Submit: Clement Skau <cskau@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-11-16 15:25:41 +00:00
Johnni Winther 73e7ae60fa [cfe] Migrate (more) CFE tests (part 5)
Change-Id: I87fd9ad06173597e93d767a1a4c3d9064ae0eef2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220323
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-11-16 14:38:42 +00:00
Vyacheslav Egorov d4ced16301 [vm/compiler] Ignore redefinitions in CSE.
Redefinitions exist to prevent code motion and don't affect
the meaning of instructions they flow into as inputs.

Consequently, when comparing two instructions for equality
we should unwrap all the inputs.

The only exception from the rule is LoadField instruction:
we would like to avoid replacing a load from a redefinition
with a dominating load from the original definition because
that would break a dependency chain on the redefinition.

This change is done to address code size regressions caused
by retaining and/or inserting more redefinitions to prevent
illegal code motions. These new redefinitions impact CSE
optimizations and (without this CL) lead to redundant boxing
being left over in the optimized code.

TEST=ci

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try
Change-Id: Idd917fcb8c7117670a1d9c5c32f1bae57569d3b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219242
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2021-11-16 13:55:31 +00:00
Jonas Finnemann Jensen b1d1c76844 Enable lints for repository/issue_tracker in pubspec.yaml
Change-Id: I5d82d5b7fc3898505b21844da91123c25d8a936f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220180
Auto-Submit: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2021-11-16 13:49:11 +00:00
Vyacheslav Egorov c6fe9e21f0 [vm/compiler] Avoid invalid code motion
In Dart doing a type check against one value can constrain the type
of another value in an indirect fashion. This possibility needs to be
taken into account when inserting Redefinitions to inhibit the code
motion. This CL addresses two previously ignored situations:

* Given a generic container `C<T> c` which holds a value `T v` doing a
type check against `c` might narrow the type of `v`.
* Given two generic classes `C<T>` and `H<T>`, doing a type-check
against an instance of type `C<X> c` might narrow the type of an
unrelated instance of `H<X> v` within the same scope.

The second situation is currently limited to a situation when we do an
invocation on `this` and the target of the call has constrained generic
parameter (e.g. because the target of the call is in the subclass which
instantiates the base class with a more specific type
`class C_ extends C<int>`). Calls on `this` are special because
they are allowed to bypass argument type checks which are
usually performed due to covariance.

In both cases we need to ensure that all uses of `v` which are
using narrowed type are pinned to stay within the true successor
of the type-check against `c`.

Previously we would only insert redefinitions for the value that is
being type checked, but this is not enough and this CL tries to
address the newly discovered cases:

* When replacing loads in load optimizer we must ensure that
if replaced load was dependant on the redefinition (and thus
was pinned) the replacement is similarly pinned (if the type of the
load might have been narrowed). If neccessary we must insert a
redefinition for the loaded value itself.
* When performing inlining of calls on `this` we must insert
redefinitions for all parameters that might have their types
narrowed.
* When replacing phis which have redefinitions as all inputs.

Fixes https://github.com/flutter/flutter/issues/91370
Fixes https://github.com/dart-lang/sdk/issues/43652

TEST=vm/dart{,_2}/flutter_regress_91370_il_test

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try
Change-Id: I89c1f165615dd827102e9f6af90365af7d8f32b2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219241
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-11-16 12:48:52 +00:00
Vyacheslav Egorov a643e537fb [vm/infra] Improve IL testing framework
* Add support for dumping flow graphs in JSON (to make it machine
readable);
* Add support for controlling which functions are dumped through
a pragma annotation:
`@pragma('vm:testing:print-flow-graph'[, "passes filter"])`
* Replace simple matching DSL with programmatic matching
* Support obfuscated builds

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

TEST=vm/dart{,_2}/aot_prefer_equality_comparison_il_test

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-x64-try
Change-Id: Ie067ba451d311e6019a8c3a88c012231b0c50eb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219240
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-11-16 12:39:11 +00:00
Johnni Winther c8595fdee2 [cfe] Migrate (more) CFE tests (part 4)
Change-Id: I47741cb3dc5714f765d9b45698c2ae05dbf5349a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220322
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-11-16 12:13:14 +00:00
Johnni Winther f10a70ebda [cfe] Migrate (more) CFE tests (part 3)
Change-Id: I3079cc05a342743c95a143b5ec9dfc32e4f1c0de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220321
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-11-16 10:37:22 +00:00
Johnni Winther 597ae56fc0 [cfe] Migrate (more) CFE tests (part 2)
Change-Id: I1a0115a512943239e3665209ca082a140b94ab6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220320
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-11-16 10:15:11 +00:00
Johnni Winther f7815b26da [cfe] Migrate (more) CFE tests
Change-Id: Id460b605bef0cff33c35771f0c2701818d687e0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220201
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-11-16 10:00:14 +00:00
Nate Bosch 8154fff6c0 Update to the latest package:stream_channel
Change-Id: I8e2c41d480249b02f9645abda58469557091fc85
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220281
Auto-Submit: Nate Bosch <nbosch@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
2021-11-16 02:25:11 +00:00
Sam Rawlins 2ee6eb28d0 analyzer: Remove unused addExtensions method from sdk
Change-Id: I3b78827ad939c55f87a294cc225440ef86b610ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220128
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-11-16 00:20:41 +00:00
Konstantin Shcheglov ffcc3e667e Reuse relative URI resolution logic.
Change-Id: Ic27b0870bde9842bf9bd60498b5410e7beb570af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220224
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-11-16 00:15:01 +00:00
Stephen Adams 405734f18b [dart2js] lazyFinal can use a variable for the result.
Returning the value is faster than reading the holder slot on V8.
Some benchmarks which read a lazy final in a tight loop are up to
40% faster.
JSC and SM unchanged.

Change-Id: I72afa456160469e4ccfe6ab80f8a53694133d794
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220132
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2021-11-15 22:25:31 +00:00
Brian Wilkerson 7bc9ca5ee9 Allow import fixes to run after other fixes
Change-Id: I820332ac17b7e2d9d981271ce2c6f544dc2b2080
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220041
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-11-15 19:20:01 +00:00