Commit Graph

46 Commits

Author SHA1 Message Date
Johnni Winther 34fb48bb8a [kernel,front_end] Migrate first wave of pkg/kernel and pkg/front_end
Migrates libraries dependent only on already migrated libraries.

Change-Id: I0e85ee8dbc2afce031b92e0009e71c206a55af28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179502
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-01-18 15:40:21 +00:00
Sam Rawlins 090e234172 Remove unused dart:async imports
As of Dart 2.1, Future/Stream have been exported from dart:core.

Change-Id: Ia4d70d1ccb55ac117bafe630a24b4ee2f60ff993
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170126
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-11-03 18:49:54 +00:00
Konstantin Shcheglov 2b7fc8f134 Update FeatureSet to the new rules.
Bug: https://github.com/dart-lang/sdk/issues/43032
Change-Id: I6c7d7dc56fd0d4edcc3c6f6cc6fb0422316b8f4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159187
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-08-19 18:27:37 +00:00
Mike Fairhurst 3095a082cd [analyzer] Add an API to get a language comment token off a unit.
Change-Id: I377fdc44d5e514d6d9a601b3947c3908e5a4497a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140768
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-03-26 03:47:57 +00:00
Konstantin Shcheglov 5940821f4e Issue 37487. Add CompilationUnit.languageVersion override.
Initial:  https://dart-review.googlesource.com/c/sdk/+/136802
Reverted: https://dart-review.googlesource.com/c/sdk/+/136851

Bug: https://github.com/dart-lang/sdk/issues/37487
Change-Id: Ida3bf049840e7bda32ecdd54309ea0b141aa6800
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137201
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-02-26 18:08:07 +00:00
Paul Berry b0b06bff31 Revert "Issue 37487. Add CompilationUnit.languageVersion override."
Reason for revert: it was a breaking change to the analyzer public API.

There were two breakages:

- A @required `languageVersion` parameter was added to
  AstFactory.compilationUnit, which is part of the officially
  supported analyzer public API.

- A @required `languageVersion` parameter was added to the Parser
  constructor, which is not part of the officially supported analyzer
  public API, but is part of its de facto public API due to the fact
  that it is used by dart_style.

This reverts commit ce26dfda7d.

Change-Id: I507103ea6f6ffabf915d6f56e9f24454725c3930
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136851
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-02-25 04:39:10 +00:00
Konstantin Shcheglov ce26dfda7d Issue 37487. Add CompilationUnit.languageVersion override.
Bug: https://github.com/dart-lang/sdk/issues/37487
Change-Id: I57fbcdd6771d9004ba1fc43902c19514dab2a23d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136802
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-02-21 20:19:43 +00:00
Konstantin Shcheglov c3a2ed9555 Fix failing tests on unittest-asserts-release-win after analyzer Packages change.
Change-Id: Iec83b5d02d10e3b93f2e1e734bd155189f9ef2d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131780
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-01-15 03:10:24 +00:00
Konstantin Shcheglov c0b1a0a599 Switch analyzer perf to using analyzer Packages.
Change-Id: Ib6fe433e9fcf956058913589f434954cc18fdd41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131444
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-01-14 01:41:34 +00:00
Konstantin Shcheglov 763b682963 Provide packages map to PackageBuildWorkspace.
Change-Id: Ibca7748c5c1260f392e931063cd1990eb26f8117
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130934
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-01-10 21:51:22 +00:00
Johnni Winther 00c2962db8 [cfe+analyzer] Move messages, scanner and parser to package:_fe_analyzer_shared
Change-Id: I4fa87aee65f30a9868a6cf8f0342591869ece7ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/123663
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-11-01 09:37:57 +00:00
Jens Johansen 9552646dc4 [CFE] First batch of fixes for requiring explicit types
Change-Id: Ic27f8508bc95409a5ee8f90b72f34a73d0f8e2e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113034
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-08-15 13:13:20 +00:00
Jens Johansen 48af666c9f [CFE] apply curly_braces_in_flow_control_structures lint
Change-Id: Id6c7e60b40f7dd0ffd68d007fe86abb785ac0dba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113025
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2019-08-14 13:00:44 +00:00
Paul Berry e2d0f5a50b Add featureSet parameter to Parser constructor.
And deprecate old parser configuration setters.

Change-Id: Ib1507b8d2b20be7c883061e2a92ec9205d6a378f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100664
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2019-04-29 16:42:19 +00:00
Paul Berry 3d0cdc8956 Switch perf.dart completely over to Fasta parser.
The only remaining code in perf.dart that was using the legacy
analyzer parser was in parseDirectives, which is part of setup, and
not part of the code being performance tested, so there should be no
effect on the benchmark.

Change-Id: I4676b10c367d477499c96f5220e622bb390752a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100680
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-04-29 13:04:38 +00:00
Sam Rawlins 3154bb0d37 Stop using external deprecated members in front_end
Change-Id: I3fa03de568f72bfc3adb46efcfa2b61b781c706b
Reviewed-on: https://dart-review.googlesource.com/c/89020
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2019-01-15 18:55:10 +00:00
Sigmund Cherem b484aada21 Remove library-root option - replace it with a libraries-spec option instead
Change-Id: Ie1df52cdaa7ab4381a4c1b94c61a1210f0f31b5f
Reviewed-on: https://dart-review.googlesource.com/c/83641
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-11-09 22:40:28 +00:00
Paul Berry 9a243b35eb Remove summary-related code from pkg/front_end/tool/perf.dart.
This was needed back when we thought the front end would be based on
the analyzer, and so we thought its performance characteristics would
depend on those of the analyzer summary mechanism.  But since the
front end is not based on the analyzer, and the performance of the
analyzer summary mechanism is performance tested elsewhere, we can
remove this code.  Removing it will make it easier to do some re-work
of summaries that is needed for Dart 2.1 support.

Change-Id: I4aa8b5251f26ba7fd59b99d325c66da642d410ed
Reviewed-on: https://dart-review.googlesource.com/71661
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-08-30 00:09:55 +00:00
Janice Collins f40ff153a9 Enable --use-fasta-parser with the analyzer by default.
Based on Devon's change at:

https://dart-review.googlesource.com/c/sdk/+/67090

Change-Id: I80b7943826e248bf37d9bbbb769330d24b0dd6ae
Reviewed-on: https://dart-review.googlesource.com/70160
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Janice Collins <jcollins@google.com>
2018-08-28 19:29:17 +00:00
danrubel 61fe321224 Update perf tool to use new scanner
Change-Id: I5fca03cf95db9079afb06b839cb554f366d83099
Reviewed-on: https://dart-review.googlesource.com/70400
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-08-17 01:13:24 +00:00
Brian Wilkerson 7054d92a02 Remove some classes from the analyzer public API
Change-Id: Ic53a8426818b06f44c2876abd16c789589bf78b5
Reviewed-on: https://dart-review.googlesource.com/52421
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-04-24 15:28:15 +00:00
Konstantin Shcheglov 462542b734 Report UNUSED_ELEMENT for top-level variables.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/25323
Change-Id: I751ee82742ff622a9b28b3cb05886b5ee775f9ed
Reviewed-on: https://dart-review.googlesource.com/13929
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-10-16 17:44:06 +00:00
Sigmund Cherem d96b29378a Delete use of rasta and dartk from perf.dart scripts.
Change-Id: Id8cd7f01c68dbcb6f814ef51627a2f4b377f6819
Reviewed-on: https://dart-review.googlesource.com/9790
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2017-10-03 23:12:21 +00:00
Sigmund Cherem 1aa139bc94 Unifying compiler context
Changes in this CL:
 - Updated CompilerContext:
    - it now contains a ProcessedOptions object

    - it no longer depends on CompilerCommandLine/CommandLine

    - it delegates to ProcessedOptions.report so all error reporting
      goes to one single place.

    - use "withContext" term instead of "withGlobalOptions" to be
      more clear about the intent

 - Changes in public API
    - added more options that correspond to flags in command-line
      fasta tools

    - default onError is different: we now use the
      command_line_reporting report, which prints and throws
      on fatal messages, but doesn't throw eagerly on all messages
      as before.

    - introduced "printMessages" option: make it easy to have
      both onError + command_line_reporting  (kernel-service.dart
      is the main use case at this time, other ideas welcome!)

    - renamed CompilationError to CompilationMessage

 - Other changes

    - set exit code is done on report, not on format
    - fixed corner cases not covered in previous CL
        - error reporting with missing-main needs to happen with
          a context
        - missing error cases when inferring .packages and input
          URIs are not file:* URIs

Ideas for follow up after this CL:
 - combine ProcessedOptions and CompilerContext into a single class
   (or extend one from the other)
 - switch onError to a stream

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2982093003 .
2017-07-18 17:02:59 -07:00
Sigmund Cherem a7865761d4 Use messages for (some) public API errors
not entirely ready - looking for comments.

BUG=
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2979623002 .
2017-07-12 14:55:17 -07:00
Sigmund Cherem b71bd543a9 Reapply "Tweak public APIs and use them in patch_sdk, dart2js, and kernel-service.""
Original CL had a bug that wasn't visible unless you delete your
out/ReleaseX64/patched_sdk folder.

Patchset #1 is the original CL, patchset #2 shows the fix.

This reverts commit 4aadfe09df.

BUG=

Review-Url: https://codereview.chromium.org/2976543002 .
2017-07-07 15:32:24 -07:00
Sigmund Cherem 4aadfe09df Revert "Tweak public APIs and use them in patch_sdk, dart2js, and kernel-service."
Reason: broke VM bots, still investigating.

This reverts commit 610d081947.

TBR= paulberry@google.com

Review-Url: https://codereview.chromium.org/2979463002 .
2017-07-07 15:21:37 -07:00
Sigmund Cherem 610d081947 Tweak public APIs and use them in patch_sdk, dart2js, and kernel-service.
This CL tweaks the public APIs in package:front_end, and
starts using those APIs outside the package. For example, this
removes 9 uses of DillTarget, so it is not longer mentioned
outside pkg/front_end and the analyzer_target.

Actual changes:
 - in package:front_end

   * added kernel_generator_impl: new file contains code that
     used to be in kernel_generator. Code has some modifications:
     it uses a single canonical-root when loading summaries, and
     it supports generating both outlines and kernel in one go.

   * removed code that didn't belong here:
     a. most of calculating deps for .GN moved to patch_sdk
     b. vm-specific outcomes moved to kernel-service

   * updated how `native` is implemented, so we can more easily
     support dart2js and ddc

   * updated how we check where `int`, `bool`, etc can be implemented.

   * added support "hermetic mode" in modular builds
     ('chaseDependencies = false' option)

   * moved `trim` step out of fasta, and for now call it only within
     the public API. This is not yet exposed, and I stopped covering it in
     most tests (now only covered in shaker tests). The plan is to add
     tests for the public API covering this in the future.

   * removed `uriToSource` when serializing outlines

   * added unit tests for public APIs

 - patch_sdk
   * use the public API to craete platform.dill, outline.dill (now
     500K insted of 3Mb because it excludes sources), and vmservice_io.dill
   * moved here logic internal to .GN

 - kernel service
   * use the public API
   * moved here logic that depends on VM internals (e.g. status enum,
     compilation results)

 - package:compiler
   * use the public API in tools and unit tests
   * simplified patched-sdk generation: no more extending fasta's internals

 - package:kernel
   * fix bug in deserialization: initializers and other lists were
     overwritten accidentally with external definitions.
   * updated unit tests, moved shared logic to frontend/src/fasta/testing

R=johnniwinther@google.com, paulberry@google.com

Review-Url: https://codereview.chromium.org/2953703002 .
2017-07-07 15:14:22 -07:00
Sigmund Cherem 938d1ba524 Implement the kernel_generator API using fasta
BUG=
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2856223003 .
2017-05-04 12:02:05 -07:00
Dan Rubel c22c6bad6c flag to enable fasta scanner in analyzer
R=brianwilkerson@google.com

Review-Url: https://codereview.chromium.org/2784363002 .
2017-03-30 14:16:12 -04:00
Paul Berry 9a82ada085 Remove hardcoded paths from perf.dart.
This lets perf.dart find the SDK and the .packages file regardless of
the architecture that's being tested and the working directory in
which the script is started.

Fixes #28676.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2687723002 .
2017-02-08 16:48:20 -08:00
Sigmund Cherem 25e94e2e0b Small fix to perf.dart.
This also makes perf_test.dart do something useful. It now executes perf.dart on
a small file from pkg/front_end. This may help to detect early when the
peformance bots will see a failure. I've only tested this in linux, but given
that's the OS of the perf bots, I'm ok skipping this in other OSs.

R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2677423002 .
2017-02-07 15:07:57 -08:00
Paul Berry ba241c0c8d Use URIs rather than paths in front end API.
This carries a number of benefits:

- It allows the front end to trivially support schemes other than
  "file:" (e.g. "http:") by allowing the client to supply a FileSystem
  implementation that handles them.

- It is more consistent with the functionality of the ".packages" file
  (which allows packages to map to any kind of URI).

- It allows the "bazel root" feature to be rewritten to use a magic
  scheme rather than a magic path.  (This eliminates concerns about
  the magic path overlapping with a user's use case).  Note that this
  feature has been renamed to "multi root" since it is sufficiently
  generic to be applicable to build systems other than Bazel.

- It reduces the risk of forgetting to use the front end's FileSystem
  abstraction to access the file system, since the native file system
  interfaces do not accept URIs.

R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2614063007 .
2017-01-09 11:19:38 -08:00
Sigmund Cherem cc3682f134 fe: minor change to benchmarks to match what the runners expect and some minor refactoring.
I'm happy to split the style/refactorings as separate CLs if you prefer. Here is a summary of the changes:
  - update the reported strings to match the names expected by our benchmark runners ("unlinked summaize + parse" => "unlinked_summarize")
  - invert the benchmark results (like Paul did in 2551533003)
  - stop counting input-size while scanning, count that separately once
  - combine the multiple summarization steps into a single function
  - clean up the logic that dispatches into each benchmark

R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2602003002 .
2017-01-05 11:31:35 -08:00
Paul Berry 62edaa7a63 Fix front end perf after addition of Source to kernel.
Commit aecb572d76 introduced errors into
the front end perf script by making it ambiguous whether "Source"
refers to the kernel's "Source" or the front end's.

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2610753002 .
2017-01-03 13:25:54 -08:00
Paul Berry 0c81fbc411 Fix "unused import" warnings and sort declarations.
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2562643006 .
2016-12-12 11:02:22 -08:00
Sigmund Cherem 02d557d134 Use sdk summaries in front_end/kernel_generator.
This CL adds support for using sdk summaries when building kernel using the
front_end entrypoint. I didn't expose this functionality in the dartk binary,
I'm hoping we can delay doing so until we integrate dartk and front_end.

I also switched front_end/tool/perf.dart to use kernel_generator directly.

This makes some observable difference for small scripts, but not so much with large apps like dart2js. Makes sense considering that the sdk is about 2Mb, and dart2js is 6Mb of sources.

The most interesting number I got is building the a library kernel file (not the whole program) for a small hello-world script on a warmed up vm:
no summaries: 500ms
with summaries: 30ms

R=asgerf@google.com, paulberry@google.com

Review-Url: https://codereview.chromium.org/2562923002 .
2016-12-09 13:29:41 -08:00
Paul Berry 926dfb751e Add a perf test for generating linked summaries.
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2556723005 .
2016-12-07 16:27:27 -08:00
Paul Berry b8b68f5a5e Add a benchmark for summary prelinking.
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2554573006 .
2016-12-06 13:18:51 -08:00
Paul Berry fe1a684789 Subtract scan/parse time from unlinked summary perf statistic.
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2545073004 .
2016-12-05 11:50:24 -08:00
Paul Berry cb2fef0c45 Add a front end perf test that computes unlinked summaries.
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2544643002 .
2016-12-01 05:46:47 -08:00
Asger Feldthaus 709c1e0b75 Store library paths relative to a given application root folder.
In kernel, library import URIs now support an "app" scheme as an
alternative to the "file" scheme, representing a path relative to
the application root.

dartk takes an --app-root flag giving the application root. If none
is given, file URIs are used instead.

The intention is that kernel binaries should not carry irrelevant
path information, such as the path to the home directory of the
user who compiled a given file.

It is not the intention that end-users should see an app URI.
Import paths are currently not shown to users at all, and if we need
to do this, they should be translated to file paths first.

In theory we could stick to file URIs with relative paths, but the Uri
class from dart:core makes this difficult, as certain operations on it
assume that file paths should be absolute.

Source mapping URIs are not yet affected by this change.

R=kmillikin@google.com

Committed: https://github.com/dart-lang/sdk/commit/60adb852ad706ecf9424c77d47fa05583d543def

Review URL: https://codereview.chromium.org/2532053005 .

Reverted: https://github.com/dart-lang/sdk/commit/bb540416f27c39d75ee7f243899939fc37a2cd03
2016-11-30 10:39:48 +01:00
Sigmund Cherem 618cbad43a switch perf tool to use scanner in front_end
R=paulberry@google.com

Review URL: https://codereview.chromium.org/2507093003 .
2016-11-16 11:13:20 -08:00
Paul Berry 72fc9805d9 Add analysis options for front end, and fix a bug discovered by strong mode.
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2489573002 .
2016-11-08 10:39:48 -08:00
Sigmund Cherem 2bcd189f2d add kernel generation to the front_end/tool/perf script
BUG=
R=paulberry@google.com

Review URL: https://codereview.chromium.org/2439053003 .
2016-10-21 09:10:19 -07:00
Sigmund Cherem 5964bdfa0b Copy perf.dart into front_end/tool.
This keeps analyzer_cli/perf.dart for now: I need to make the change in two
parts so I can update the benchmark runners after I submit this.

BUG=
R=paulberry@google.com

Review URL: https://codereview.chromium.org/2432043008 .
2016-10-21 09:07:48 -07:00