Commit graph

91787 commits

Author SHA1 Message Date
Brian Quinlan a75e857df5 Add a Platform.lineTerminator static method
Bug: https://github.com/dart-lang/sdk/issues/52379
Change-Id: Ic3a7f06252f8a69dcfdb29c00f16557c34529652
CoreLibraryReviewExempt: Aske is on holiday
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297260
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-05-18 19:57:58 +00:00
Helin Shiah a48d2cf02c Reland "Use dap package in dds, dds_service_extensions"
This is a reland of commit 59bb1fce82

Original change's description:
> Use dap package in dds, dds_service_extensions
>
> Change-Id: I678c810e02a5989ee1b4edebaf9d741e2fc7d026
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302849
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Helin Shiah <helinx@google.com>

Change-Id: Ib5b9cad1d0c19dac79c73e65c5de8721d1768285
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304105
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Helin Shiah <helinx@google.com>
2023-05-18 19:25:28 +00:00
Sigmund Cherem cc8b3f792e [analyzer] minor updates to the quick_fix.md documentation
The changes are:
* Use the current tear-off syntax for constuctors in the example
* Add references to the code where certain maps are defined.

Change-Id: I5710090c1ecb2939d74a3822b8c7b35090be378c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304323
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-05-18 18:53:39 +00:00
Srujan Gaddam eb8e3d549a [dart:js_interop] Add new diagnostic reporter so we can avoid transforms
Adds a delegating reporter so we can keep track of whether there are
interop errors. If there are, we do not do the transforms on the JS
backends.

Change-Id: Ib0f36b748443cb7fe8f8bb427692d653557d59fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304261
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-05-18 18:53:03 +00:00
Alexander Markov 0bff5652ba Reland "[vm/compiler] Remove unnecessary type check from optimized switches"
This is a reland of commit 43ce5487c1

In addition to removing type check, switch range checks are adjusted
in order to avoid call to 'int.operator<=', which can be removed by
tree shaker in AOT/product mode, causing NoSuchMethodError at runtime.

Original change's description:
> [vm/compiler] Remove unnecessary type check from optimized switches
>
> Switch optimization now relies on static type of the tested value,
> so it is safe to omit the type check (with sound null safety) or
> reduce it to a null check (without sound null safety).
>
> TEST=co19/LanguageFeatures/Patterns/Exhaustiveness/exhaustiveness_enum_A01_t01
> Fixes https://github.com/dart-lang/sdk/issues/52422
>
> Change-Id: Ic93f4f212bee9ed3bfe5035f3c8d7535274c2f63
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304102
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Alexander Aprelev <aam@google.com>

TEST=co19/LanguageFeatures/Patterns/Exhaustiveness/exhaustiveness_enum_A01_t01
TEST=language/async/switch_test

Change-Id: I70bf480bf376f946d66caa504120c8f85093ea8d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304322
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-05-18 18:33:37 +00:00
Danny Tuppeny 34a21f5691 [analysis_server] Switch to using FuzzyMatcher instead of RegExp for LSP workspace symbols
See https://github.com/Dart-Code/Dart-Code/issues/4106#issuecomment-1552948926.

In my tests on the Flutter repo, this reduces the matching from around 200ms to around 40ms.

Before:
(name: request, count: 1, elapsed: 0:00:00.708230, elapsedSelf: 0:00:00.000487)
  (name: findDeclarations, count: 1, elapsed: 0:00:00.707656, elapsedSelf: 0:00:00.002735)
    (name: discoverAvailableFiles, count: 1, elapsed: 0:00:00.000187, elapsedSelf: 0:00:00.000187)
    (name: ownKnown, count: 1, elapsed: 0:00:00.023311, elapsedSelf: 0:00:00.023311)
    (name: findDeclarations, count: 1, elapsed: 0:00:00.681423, elapsedSelf: 0:00:00.016362)
      (name: getLibraryByUri, count: 7276, elapsed: 0:00:00.295596, elapsedSelf: 0:00:00.295596)
      (name: finder, count: 7272, elapsed: 0:00:00.369465, elapsedSelf: 0:00:00.055566)
        (name: addDeclaration, count: 317711, elapsed: 0:00:00.313899, elapsedSelf: 0:00:00.080608)
          (name: doNothing, count: 317711, elapsed: 0:00:00.020405, elapsedSelf: 0:00:00.020405)
          (name: regExp, count: 317711, elapsed: 0:00:00.212886, elapsedSelf: 0:00:00.212886)
  (name: convert, count: 1, elapsed: 0:00:00.000087, elapsedSelf: 0:00:00.000087)(declarations: 1)


After:
(name: request, count: 1, elapsed: 0:00:00.522033, elapsedSelf: 0:00:00.003331)
  (name: findDeclarations, count: 1, elapsed: 0:00:00.518648, elapsedSelf: 0:00:00.002939)
    (name: discoverAvailableFiles, count: 1, elapsed: 0:00:00.000213, elapsedSelf: 0:00:00.000213)
    (name: ownKnown, count: 1, elapsed: 0:00:00.021037, elapsedSelf: 0:00:00.021037)
    (name: findDeclarations, count: 1, elapsed: 0:00:00.494459, elapsedSelf: 0:00:00.016197)
      (name: getLibraryByUri, count: 7276, elapsed: 0:00:00.292021, elapsedSelf: 0:00:00.292021)
      (name: finder, count: 7272, elapsed: 0:00:00.186241, elapsedSelf: 0:00:00.050400)
        (name: addDeclaration, count: 317711, elapsed: 0:00:00.135841, elapsedSelf: 0:00:00.072235)
          (name: doNothing, count: 317711, elapsed: 0:00:00.019244, elapsedSelf: 0:00:00.019244)
          (name: isMatch, count: 317711, elapsed: 0:00:00.044362, elapsedSelf: 0:00:00.044362)
  (name: convert, count: 1, elapsed: 0:00:00.000054, elapsedSelf: 0:00:00.000054)(declarations: 1)
Change-Id: Ib8775536fb7b16b9d29c2839167ce41de9ecc874
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304341
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-05-18 18:31:28 +00:00
Ryan Macnak 2bce12b977 [vm, gc] Coarsen the freelist lock used by the concurrent sweeper.
The scope of the lock is coarsened from per-element to per-page. This effectively causes the concurrent sweeper to pause during a scavenge in the case the sweeper encounters empty pages, preventing the sweeper from performing munmap during the scavenge.

TEST=ci
Change-Id: I7b2b077c748234e6d3dc48e2229c546d854ca93a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303087
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-05-18 17:03:02 +00:00
Konstantin Shcheglov c207dafe77 Instrument WorkspaceSymbolHandler.
Change-Id: Ia822b253124b53e5ee283f7b3cce15db050eedb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304280
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-05-18 15:43:17 +00:00
Konstantin Shcheglov 2223d8b324 Issue 52388. Report 'await super', without selector.
Bug: https://github.com/dart-lang/sdk/issues/52388
Change-Id: I19fe6d3e638e75ff36739949b9ea9e24cb043b73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304220
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-05-18 15:39:26 +00:00
Alexander Markov 35307d406a Revert "[vm/compiler] Remove unnecessary type check from optimized switches"
This reverts commit 43ce5487c1.

Reason for revert: test failures on vm-aot-*-product-* bots.

Original change's description:
> [vm/compiler] Remove unnecessary type check from optimized switches
>
> Switch optimization now relies on static type of the tested value,
> so it is safe to omit the type check (with sound null safety) or
> reduce it to a null check (without sound null safety).
>
> TEST=co19/LanguageFeatures/Patterns/Exhaustiveness/exhaustiveness_enum_A01_t01
> Fixes https://github.com/dart-lang/sdk/issues/52422
>
> Change-Id: Ic93f4f212bee9ed3bfe5035f3c8d7535274c2f63
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304102
> Commit-Queue: Alexander Markov <alexmarkov@google.com>
> Reviewed-by: Alexander Aprelev <aam@google.com>

Change-Id: Ifa6ee75be49f7264fa4dfc08183d5ccb731c60d1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304321
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
2023-05-18 15:12:18 +00:00
Konstantin Shcheglov 64fcb8de1b Prepare for removing deprecated methods from NamedType.
The actual removal will happen in (to be rebased on top of this):
https://dart-review.googlesource.com/c/sdk/+/303280

Fixing direct uses of the deprecated `Identifier get name` is apparently
only about a half of the work. I should have followed my own advice to
the clients and prepared better.

These changes are necessary because we will stop creating and
visiting `Identifier`, and so `NamedType` should be handled directly.

Change-Id: Ie07b75b15eab277ed6c9b29a838561a7eb71f588
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303425
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-05-18 01:54:21 +00:00
Parker Lougheed deddb64ff7 [pkg/analyzer] Fix meta annotation links in diagnostic messages
Bug: https://github.com/dart-lang/site-www/issues/4901
Change-Id: I238d9508984846c4bbe2bb1b23eb2b12fd262ed8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304260
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-05-18 00:55:53 +00:00
Eric Seidel dfca8d333e Add an explicit Visual Studio Code workspace
This allows users of Visual Studio Code to open the sdk/ directory.

Without this, attempting to open the root of the repository results
in over 200k analyzer errors eventually hanging/crashing VSCode.

This matches what Fuschia and other large projects do to be able
to open large monorepo checkouts in VSCode. e.g.
https://fuchsia.googlesource.com/fuchsia/+/main/fuchsia.code-workspace

Bug: https://github.com/dart-lang/sdk/issues/52380
Change-Id: I1a69627bb6ca25e8f7f036a50534eaf0804e893e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303841
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Auto-Submit: Eric Seidel <eric@shorebird.dev>
2023-05-17 23:08:19 +00:00
Liam Appelbe 4f98a2dc9f [vm] Add VirtualMemory::DuplicateRX function.
Change-Id: I1f56687bf140faae113b2a4d2f34192cb87b68f7
TEST=DuplicateRXVirtualMemory
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303960
Auto-Submit: Liam Appelbe <liama@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2023-05-17 22:46:37 +00:00
Liam Appelbe e730b171ea [vm] Fix asan errors in Disassembler_InvalidInput
The bug is that the disassembler doesn't do any bounds checking, other
than the outer while loop in Disassembler::Disassemble. For multi byte
instructions it relies on having well-formed input to avoid OOB errors.

This test is testing something that doesn't happen in real disassembly,
because usually the invalid machine code is embedded in valid machine
code, so there would be plenty of buffer between the invalid section
and the end of the input. The ideal fix would be to rewrite the
disassembler to do bounds checks, but short of that we can just add
some buffer to the end of bad_input.

Bug: https://github.com/dart-lang/sdk/issues/52421
Change-Id: If68d5485a130523ddf2a4d37f1c8e2ddf1cf485a
Fixes: https://github.com/dart-lang/sdk/issues/52421
TEST=Disassembler_InvalidInput
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304240
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Auto-Submit: Liam Appelbe <liama@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-05-17 22:36:03 +00:00
Ilya Yanok 0c5e1e8e48 Revert "Add auto-snapshotting and usage reporting."
This reverts commit 5fa6c5ed2a.

Reason for revert: breaks G3, we need to update //third_party/dart/leak_tracker first

Original change's description:
> Add auto-snapshotting and usage reporting.
>
> First attempt merged without passing bots and was rolled back: https://dart-review.googlesource.com/c/sdk/+/300862
>
> Change-Id: I782bf4d92394055e1f60a4275b5045e3622e239f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304101
> Reviewed-by: Samuel Rawlins <srawlins@google.com>
> Commit-Queue: Polina Cherkasova <polinach@google.com>

Change-Id: I8f1643e20f8d134cbf917dc43731798a1234cc2b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304181
Commit-Queue: Ilya Yanok <yanok@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2023-05-17 22:03:17 +00:00
Konstantin Shcheglov 92faa11311 When resolve a priority library, cache all ResolvedUnitResultImpl(s).
...not just the result for the immediately requested file.

Change-Id: I85f74708fb32ff79b3c8a8b68c9cea5db8093000
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303980
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-05-17 20:46:38 +00:00
Alexander Markov 08d00454ab [vm/compiler] Add assertions for non-empty flow graph fragments without an entry
TEST=ci

Change-Id: If30c745857ab033697d7ac3e7225847dbe9cb7e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304121
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
2023-05-17 19:36:03 +00:00
Eric Seidel 40946d2527 Roll protobuf-gn deps to include fix for mac builds
BUG=https://github.com/dart-lang/sdk/issues/52407

Change-Id: I3486b94d5a53ddbd708c8f853854853de9f98af7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304146
Commit-Queue: Derek Xu <derekx@google.com>
Auto-Submit: Eric Seidel <eric@shorebird.dev>
Reviewed-by: Derek Xu <derekx@google.com>
2023-05-17 19:32:49 +00:00
Devon Carew 45aba19ae7 [deps] rev convert, dartdoc, http, mockito, native, protobuf, test, test_process, tools, webdev
Revisions updated by `dart tools/rev_sdk_deps.dart`.

convert (b652c00..9a387f0):
  9a387f0  2023-05-16  Devon Carew  blast_repo fixes (#83)

dartdoc (2952f6b..702f3ff):
  702f3ff7  2023-05-16  Devon Carew  Update dependabot.yaml (#3415)

http (981b63b..fb3b4be):
  fb3b4be  2023-05-16  Brian Quinlan  Revert "Support the NSURLSession WebSocket API (#921)" (#931)

mockito (51a7728..3fadd2d):
  3fadd2d  2023-05-17  Ilya Yanok  Let users provide dummy values for types
  b14d571  2023-05-15  Googler  Fix for InvalidType

native (e01aa63..3d89166):
  3d89166  2023-05-16  Daco Harkes  Add iOS x64 back (#41)

protobuf (05058a7..038872b):
  038872b  2023-05-16  Oleh Prypin  Remove implementation of `hashCode` because it makes enum values non-const in Dart 3 (#831)

test (8e444df..cdedf40):
  cdedf40c  2023-05-16  Nate Bosch  Prepare to publish (#2016)

test_process (b6a6cd5..d7a1711):
  d7a1711  2023-05-16  Nate Bosch  Prepare to publish (#44)

tools (62c9604..49da4ca):
  49da4ca  2023-05-12  Polina Cherkasova  Add memory events. (#92)

webdev (60616ba..2b2ae0e):
  2b2ae0e8  2023-05-15  Elliott Brooks  Try to fix dependabot PRs (#2112)
  d19dafe0  2023-05-15  Elliott Brooks  Manual update deps (#2113)
  c0eb1069  2023-05-15  Elliott Brooks  Disable tests using webdriver (#2115)
  a16bc9f2  2023-05-15  Elliott Brooks  Dart Debug Extension builder fix (#2117)

Change-Id: Icd714c5d54cd3aee999e4ae3cc3a97928dc1a821
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304120
Commit-Queue: Devon Carew <devoncarew@google.com>
Auto-Submit: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-05-17 19:28:01 +00:00
Jake Macdonald 8b826b8a92 Reland "Bump file to f05f5db0733274bed584e9915c39d34bb812fbb8"
This reverts commit ce22951112.

Reason for revert: Underlying internal issue fixed in cl/532838245

Original change's description:
> Revert "Bump file to f05f5db0733274bed584e9915c39d34bb812fbb8"
>
> This reverts commit b9ad3d21c2.
>
> Reason for revert: b/282823291, breaks Flutter on Android (at least) tests
>
> Original change's description:
> > Bump file to f05f5db0733274bed584e9915c39d34bb812fbb8
> >
> > Changes:
> > ```
> > > git log --format="%C(auto) %h %s" e90e5ed..f05f5db
> >  https://dart.googlesource.com/external/github.com/google/file.dart/+/f05f5db Make MemoryFile.openRead and _ChrootFile.openRead return Stream<List<int>> again (217)
> >  https://dart.googlesource.com/external/github.com/google/file.dart/+/f2f3076 MemoryFileSystem addStream onError (220)
> >  https://dart.googlesource.com/external/github.com/google/file.dart/+/5e76f74 Fix MemoryFileSystem to treat an empty path as non-existent (213)
> >  https://dart.googlesource.com/external/github.com/google/file.dart/+/7941466 Make `FileSystem.isLink` actually work (214)
> >
> > ```
> >
> > Diff: e90e5ed8e9..f05f5db073/
> > Change-Id: I526c98d80a809511f928d19b44fb89eb9a77a5e3
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303784
> > Auto-Submit: Devon Carew <devoncarew@google.com>
> > Reviewed-by: Jake Macdonald <jakemac@google.com>
> > Commit-Queue: Jake Macdonald <jakemac@google.com>
>
> Change-Id: I70aabfce6343746a093b41b1f490c7a723e116f4
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304003
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Ilya Yanok <yanok@google.com>

Change-Id: I446fd73621ff169c631341a85f4e944f097c354b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304143
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2023-05-17 19:12:59 +00:00
Konstantin Shcheglov 44de52b412 Issue 52427. Fix AddEnumConstant when the target enum has no constants.
Bug: https://github.com/dart-lang/sdk/issues/52427
Change-Id: Ia86928155dd63d81bf90cbae8cac669e8c02b79b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304144
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-05-17 18:54:32 +00:00
Brian Wilkerson 5bf2e8c782 Convert closure completion tests
This also removes the tests converted in the previous CL because I
forgot to delete the file.

Change-Id: I306d64d227e2b5f632a9da9b547ce649e5d33767
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304142
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-05-17 18:48:58 +00:00
Konstantin Shcheglov 464235a29e Issue 52426. Handle InvalidType in CorrectionUtils.getTypeSource()
Bug: https://github.com/dart-lang/sdk/issues/52426
Change-Id: I34fde1bf0836990ecb41a75c1684795d75d286fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304103
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-05-17 18:32:26 +00:00
Christian Findlay e43939dd5d Some work on the issue #40614 now that we have soundness
Closes https://github.com/dart-lang/sdk/pull/52383

GitOrigin-RevId: 70014d0575d1623c1f777fab479cfa93088efa2a
Change-Id: Ibf4ad3d862b07873317785389799ee8dfc80290f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303161
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2023-05-17 18:25:11 +00:00
Konstantin Shcheglov b54783f2f3 Issue 52425. Ignore SwitchCase when it (erroneously) happens in 3.0 library.
Bug: https://github.com/dart-lang/sdk/issues/52425
Change-Id: Ifa621eb10af698664cb9461cb3db8839eb73d3e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304141
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-05-17 18:15:48 +00:00
Polina Cherkasova 5fa6c5ed2a Add auto-snapshotting and usage reporting.
First attempt merged without passing bots and was rolled back: https://dart-review.googlesource.com/c/sdk/+/300862

Change-Id: I782bf4d92394055e1f60a4275b5045e3622e239f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304101
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Polina Cherkasova <polinach@google.com>
2023-05-17 17:56:47 +00:00
Lasse R.H. Nielsen 066106d19a Make Uri.base see IOOverrides changes to current directory.
Fixes #39796.

Tested: Case added to `io_overrides_test.dart`.
Bug: https://dartbug.com/39796
Change-Id: Id72f75f972f59f4f9b7d17e79b4bcffd6d79f2c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304006
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2023-05-17 17:27:13 +00:00
Alexander Markov 43ce5487c1 [vm/compiler] Remove unnecessary type check from optimized switches
Switch optimization now relies on static type of the tested value,
so it is safe to omit the type check (with sound null safety) or
reduce it to a null check (without sound null safety).

TEST=co19/LanguageFeatures/Patterns/Exhaustiveness/exhaustiveness_enum_A01_t01
Fixes https://github.com/dart-lang/sdk/issues/52422

Change-Id: Ic93f4f212bee9ed3bfe5035f3c8d7535274c2f63
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304102
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2023-05-17 17:11:28 +00:00
Nicholas Shahan 027d0738d0 Revert "[ddc] Avoid .__proto__ in super constructor call"
This reverts commit 8ed4c94893.

Reason for revert: Breaks tests during roll into internal.
b/283081451

Original change's description:
> [ddc] Avoid `.__proto__` in super constructor call
>
> Issue: https://github.com/dart-lang/sdk/issues/52372
> Change-Id: I0ee52ea11eeaea8b444ca2deaafb5ee1fe734fdc
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303089
> Commit-Queue: Nicholas Shahan <nshahan@google.com>
> Reviewed-by: Sigmund Cherem <sigmund@google.com>

Issue: https://github.com/dart-lang/sdk/issues/52372
Change-Id: I2fac7da10c35e61d85e7085fa90cd2207341048c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304140
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2023-05-17 16:23:39 +00:00
pq 1178e96bc1 add quick fix for cast_nullable_to_non_nullable
See: https://github.com/dart-lang/lints/issues/28

Change-Id: Ic0dac81467a3a3fbe7f7bf805ee59e3844edb6a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303681
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-05-17 16:18:54 +00:00
Zach Anderson 1b9198c679 Revert "[dart:js_interop] Disallow ffi and JS interop in the same library"
This reverts commit 1c5d23e8a2.

Reason for revert: https://github.com/flutter/flutter/issues/127027

Original change's description:
> [dart:js_interop] Disallow ffi and JS interop in the same library
>
> dart2wasm can use both dart:ffi and JS interop libraries. To avoid
> confusion around external members, this disallows JS interop from
> being used in the same library as dart:ffi.
>
> Change-Id: I53e0426306be99c43b2bbfc14d65075128f0d5c5
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301200
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Joshua Litt <joshualitt@google.com>
> Commit-Queue: Srujan Gaddam <srujzs@google.com>

Change-Id: I1fd872e6d0cd679ec9c1842557745647385ec3af
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304100
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-05-17 16:15:36 +00:00
Ryan Macnak e04d826d1a [vm, reload] Defensively check against identity mapping for Enum.values.
Print additional information upon detecting an invalid become mapping.

TEST=ci
Bug: https://github.com/flutter/flutter/issues/126884 (speculative)
Change-Id: If15713e1f25561da4a12a6f1954bd57864df18db
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303860
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-05-17 16:10:49 +00:00
Ilya Yanok ce22951112 Revert "Bump file to f05f5db0733274bed584e9915c39d34bb812fbb8"
This reverts commit b9ad3d21c2.

Reason for revert: b/282823291, breaks Flutter on Android (at least) tests

Original change's description:
> Bump file to f05f5db0733274bed584e9915c39d34bb812fbb8
>
> Changes:
> ```
> > git log --format="%C(auto) %h %s" e90e5ed..f05f5db
>  https://dart.googlesource.com/external/github.com/google/file.dart/+/f05f5db Make MemoryFile.openRead and _ChrootFile.openRead return Stream<List<int>> again (217)
>  https://dart.googlesource.com/external/github.com/google/file.dart/+/f2f3076 MemoryFileSystem addStream onError (220)
>  https://dart.googlesource.com/external/github.com/google/file.dart/+/5e76f74 Fix MemoryFileSystem to treat an empty path as non-existent (213)
>  https://dart.googlesource.com/external/github.com/google/file.dart/+/7941466 Make `FileSystem.isLink` actually work (214)
>
> ```
>
> Diff: e90e5ed8e9..f05f5db073/
> Change-Id: I526c98d80a809511f928d19b44fb89eb9a77a5e3
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303784
> Auto-Submit: Devon Carew <devoncarew@google.com>
> Reviewed-by: Jake Macdonald <jakemac@google.com>
> Commit-Queue: Jake Macdonald <jakemac@google.com>

Change-Id: I70aabfce6343746a093b41b1f490c7a723e116f4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304003
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Ilya Yanok <yanok@google.com>
2023-05-17 15:24:41 +00:00
Devon Carew b9ad3d21c2 Bump file to f05f5db0733274bed584e9915c39d34bb812fbb8
Changes:
```
> git log --format="%C(auto) %h %s" e90e5ed..f05f5db
 https://dart.googlesource.com/external/github.com/google/file.dart/+/f05f5db Make MemoryFile.openRead and _ChrootFile.openRead return Stream<List<int>> again (217)
 https://dart.googlesource.com/external/github.com/google/file.dart/+/f2f3076 MemoryFileSystem addStream onError (220)
 https://dart.googlesource.com/external/github.com/google/file.dart/+/5e76f74 Fix MemoryFileSystem to treat an empty path as non-existent (213)
 https://dart.googlesource.com/external/github.com/google/file.dart/+/7941466 Make `FileSystem.isLink` actually work (214)

```

Diff: e90e5ed8e9..f05f5db073/
Change-Id: I526c98d80a809511f928d19b44fb89eb9a77a5e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303784
Auto-Submit: Devon Carew <devoncarew@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2023-05-17 15:02:35 +00:00
Johnni Winther 4d37cc40ff [cfe] Support redirecting initializers in inline classes
Closes #52119

Change-Id: Id9322ba7c4571786c8c07b6a36c3b1e3ef94aec9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303740
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-05-17 12:35:07 +00:00
Jens Johansen 4fd173a43e [CFE] Various small optimizations
Looking at instructions this seems to speedup compilation of
`compile.dart` with about 1.00% in AOT mode.

Occasionally there's also a measurable time improvement, e.g.

```
msec task-clock:u: -1.3447% +/- 1.1644%
seconds time elapsed: -1.3438% +/- 1.1638%
seconds user: -1.8838% +/- 1.4478%
```

Change-Id: I98866740b00bc01c70dd82d7591864bcb278394d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303701
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-05-17 12:20:08 +00:00
Martin Kustermann 2d230aa0b5 [vm/ffi] Move ffi-callback related state from Thread to ObjectStore, move jit trampolines from Isolate to IsolateGroup
The ffi-callback related information on the [Thread] object is metadata
corresponding to ffi-callback-trampoline [Function] objects. There is
nothing thread or isolate specific about it.

Moving it away from [Thread] is needed because an [Isolate] can
have different [Thread] objects across its lifetime (see [0]): When
the stack of an isolate is empty, we reserve now the right to
re-cycle the [Thread]. If the isolate later runs again, it may
get a new [Thread] object.

This CL moves this information from [Thread] to the [ObjectStore]. In
addition we make the compiler be responsible for populating this
metadata - instead of doing this per-call site of
`Pointer.fromFunction()`. It will be preserved across snapshot writing
& snapshot reading (for AppJIT as well as AppAOT).

Similarly the JIT trampolines that are on Isolate aren't isolate
specific and can go to [IsolateGroup]. This simplifies doing the above
as the compiler can allocate those as well.

The effect is that [Thread] object gets smaller, GC doesn't have to
visit the 2 slots per-thread. It comes at expense of 2 more loads
when invoking the callback.

[0] https://dart-review.googlesource.com/c/sdk/+/297920

TEST=Regression test is vm/ffi{,_2}/invoke_callback_after_suspension_test

Change-Id: Ifde46a9f6e79819b5c0e359c3d3998d1d93b9b1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303700
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2023-05-17 11:23:28 +00:00
Eric Seidel 4c20cedd30 Fix analysis issues in benchmarks/ directory
Now that I'm able to open the entire SDK in VSC, I'm fixing some
of the analysis issues in various files (carefully) without changing
their meaning.

In this case, I removed unnecessary imports from benchmarks.
In regexp_benchmark I ignored one warning which likely would
have changed the behavior of the code.

BUG=https://github.com/dart-lang/sdk/issues/52419

Change-Id: I9a195a4e45121313bd9f065f2579a165c3fec05b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303901
Auto-Submit: Eric Seidel <eric@shorebird.dev>
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: William Hesse <whesse@google.com>
2023-05-17 09:14:50 +00:00
Daco Harkes 987c7a7c35 Revert "Use dap package in dds, dds_service_extensions"
This reverts commit 59bb1fce82.

Reason for revert: Breaks arm64 bot with
`Couldn't resolve the package 'dap' in 'package:dap/dap.dart'.`


Original change's description:
> Use dap package in dds, dds_service_extensions
>
> Change-Id: I678c810e02a5989ee1b4edebaf9d741e2fc7d026
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302849
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Commit-Queue: Helin Shiah <helinx@google.com>

Change-Id: Ie5895dc958ee6bad798007d380bc7e75a67b8926
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304000
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
2023-05-17 07:50:07 +00:00
Daco Harkes dba0758120 Revert "Add auto-snapshotting and analytics for memory usage."
This reverts commit 5f1e7ade45.

Reason for revert: bots are failing

Original change's description:
> Add auto-snapshotting and analytics for memory usage.
>
> See video linked to issue: https://github.com/flutter/devtools/issues/5606
>
> Change-Id: I9f22031871e30bc7160e2c49b0423fb64df62223
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/300862
> Reviewed-by: Samuel Rawlins <srawlins@google.com>
> Reviewed-by: Jacob Richman <jacobr@google.com>

Change-Id: I54cb3943230ab1229cc8b2c9df40e9c71765df19
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303881
Auto-Submit: Polina Cherkasova <polinach@google.com>
Reviewed-by: Polina Cherkasova <polinach@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-05-17 07:43:26 +00:00
Konstantin Shcheglov bd0e77c4fc Issue 52409. Reading a Never typed getter makes the flow unreachable.
Bug: https://github.com/dart-lang/sdk/issues/52409
Change-Id: I675ed8f8cfa0d2e5327c2c6bc0fb1bda7bde038c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303840
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-05-17 03:28:07 +00:00
Helin Shiah 59bb1fce82 Use dap package in dds, dds_service_extensions
Change-Id: I678c810e02a5989ee1b4edebaf9d741e2fc7d026
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302849
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Helin Shiah <helinx@google.com>
2023-05-17 03:26:57 +00:00
Brian Wilkerson 614de8dddf Convert the named constructor completion tests
Change-Id: I095571f486feead2ee4dad0a700bac46901e16a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303903
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-05-17 00:31:43 +00:00
Paul Berry 280c9c70c2 Make "mini ast" data structures public.
Changes all the node structures used by the "mini ast" representation
of Dart (which is used in flow analysis unit testing) to be public.

This prepares for some follow-up work in which I plan to make use of
these data structures from multiple test files.

Change-Id: I07483ad7778e16a45c664c4229c98d75ad6686ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303802
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-05-16 23:23:40 +00:00
Srujan Gaddam 1c5d23e8a2 [dart:js_interop] Disallow ffi and JS interop in the same library
dart2wasm can use both dart:ffi and JS interop libraries. To avoid
confusion around external members, this disallows JS interop from
being used in the same library as dart:ffi.

Change-Id: I53e0426306be99c43b2bbfc14d65075128f0d5c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301200
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2023-05-16 22:50:46 +00:00
Alexander Markov db89fe08f8 [vm/compiler] Decide to optimize switch statements using static type of the tested value
TEST=runtime/tests/vm/dart/regress_52214_test.dart
Fixes https://github.com/dart-lang/sdk/issues/52214

Change-Id: Iaddd00e79ee814feda998f14750ec8980309ae74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301480
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-05-16 22:36:22 +00:00
Polina Cherkasova 630cec473e Update AUTOSNAPSHOTTING.md
Change-Id: I363993bd54ddc01c1224f2ec53ce7c383aac2a68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303801
Commit-Queue: Polina Cherkasova <polinach@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-05-16 22:08:47 +00:00
Ryan Macnak 5ad110fc4c [infra] Remove unused legacy configs and builders.
Change-Id: Id1c942eeb4c09b25a1349a98d5e783507a3b342b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303010
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-05-16 21:06:43 +00:00
Polina Cherkasova 5f1e7ade45 Add auto-snapshotting and analytics for memory usage.
See video linked to issue: https://github.com/flutter/devtools/issues/5606

Change-Id: I9f22031871e30bc7160e2c49b0423fb64df62223
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/300862
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Jacob Richman <jacobr@google.com>
2023-05-16 20:15:12 +00:00