Commit Graph

4770 Commits

Author SHA1 Message Date
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 4ee949c154 Add an async version of dependency_walker.dart.
This is intended to be used in situations where computing dependencies
and/or evaluating nodes is an asynchronous operation.  (For example,
when performing a compilation, computing dependencies of a library
requires file I/O to read the files constituting the library;
evaluating a library cycle might potentially be performed
asynchronously by a separate isolate).

At the moment the implementation is nearly the same as that of
dependency_walker.dart, except asynchronous.  In future CLs I will
look into allowing computeDependencies(), evaluate(), and
evaluateScc() to operate in parallel.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/2552383002 .
2016-12-06 12:29:07 -08:00
Paul Berry 11d43180af Add missing copyrights
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2550323003 .
2016-12-06 11:20:05 -08:00
Paul Berry 2bf75c0550 Move dependency walker logic to front end.
R=scheglov@google.com

Review URL: https://codereview.chromium.org/2554973002 .
2016-12-06 10:18:24 -08:00
Paul Berry 4e530c1203 Make PhysicalFileSystem the default
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2554933002 .
2016-12-06 10:09:35 -08:00
Paul Berry eb9f3ba931 Fix incorrect type in override of CompilationError.span.
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2550283002 .
2016-12-05 14:35:56 -08:00
Sigmund Cherem d79ef86af7 Implement the generate-kernel api by invoking dartk. Add example that uses this API to generate a byte buffer with the results.
R=paulberry@google.com

Review URL: https://codereview.chromium.org/2508933003 .
2016-12-05 13:02:24 -08:00
Paul Berry 1c2268b13e Move scanner tests into the front_end package.
This required moving the following classes into front_end as well:
- CharSequenceReader
- SubSequenceReader
- JenkinsSmiHash

A small amount of the functionality of GatheringErrorListener and
AnalysisError had to be replicated, to avoid a dependency on the
analyzer package.  In a future CL I will either refactor this code to
make it available to the rest of the front end, or, if
GatheringErrorListener and AnalysisError wind up getting moved into
the front end, I will un-do the replication.

I also took the liberty of addition functionality to JenkinsSmiHash to
make it easier to use.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2508483002 .
2016-11-15 14:53:49 -08:00
Paul Berry da70cf3be2 Rename CompilationError.location to CompilationError.span
This should avoid some confusion since its type is SourceSpan, not
SourceLocation.

R=scheglov@google.com

Review URL: https://codereview.chromium.org/2503853003 .
2016-11-15 10:36:51 -08:00
Paul Berry 0c928771fc Revert "Connect analyzer's AnalysisError object to front_end's CompilationError."
This reverts commit fc5270df72.

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

Review URL: https://codereview.chromium.org/2503803003 .
2016-11-15 10:00:34 -08:00
Paul Berry fc5270df72 Connect analyzer's AnalysisError object to front_end's CompilationError.
AnalysisError implements CompilationError but provides additional
services, such as extensibility via the `getProperty` method.

Note: CompilationError.location has been renamed to
CompilationError.span to avoid confusion (since its type is
`SourceSpan`, not `SourceLocation`).

R=scheglov@google.com

Review URL: https://codereview.chromium.org/2498133002 .
2016-11-14 15:30:10 -08:00
Paul Berry 4cd9b28eb6 Create pkg/front_end/src/base and begin populating with general use classes.
In the long run, pkg/front_end/src/base is intended to contain code
that is useful to many components of the front end.

In this initial implementation, it contains:
- Source and the classes it references
- ErrorCode, ErrorSeverity, and ErrorType
- SyntacticEntity

Note that AnalysisTarget is included (even though strictly speaking it
is part of the analyzer task model) because it was too hard to
disentangle from Source.

Note that Token classes remain in pkg/front_end/src/scanner for now; I
plan to reorganize them at the time the parser is moved into the front
end.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2486923007 .
2016-11-14 09:20:18 -08:00
Paul Berry 981e2660bf Remove deprecated members from ErrorCode.
These existed as an effort to avoid causing breaking changes in the
analyzer package, but it turns out that the analyzer package already has
breaking changes in progress, so there is no benefit.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2491593003 .
2016-11-09 18:11:42 -08:00
Paul Berry e790b44c63 Update copyright notices in front_end package.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2483313003 .
2016-11-08 14:23:58 -08:00
Paul Berry 0a1fb8d248 Move scanner into pkg/front_end/lib/src/scanner.
Several support classes also had to move to front_end along with the
scanner.  Some of these support classes arguably don't belong to the
scanner itself, since they have other uses (e.g. SyntacticEntity,
ErrorCode, ErrorSeverity, ErrorType, and StringUtilities).  They will
be reorganized into a more appropriate location in future CLs, at the
time that they become needed by other components of the front end.

In order to avoid dragging in a lot of dependencies, the following
changes were made:

1. Scanner no longer reports errors through Source and
AnalysisErrorListener objects passed to the constructor.  Instead, it
provides an abstract reportError() method which clients may override
to perform error reporting in any way they wish.  Analyzer contains an
override of Scanner that mimics the old behavior in order to maintain
compatibility.

2. Static members of ErrorCode (`values` and `byUniqueName`) have been
moved to top level, and remain in analyzer.  To maintain
compatibility, these static members remain in ErrorCode (as deprecated
members that simply wrap the implementations in analyzer).  This means
we have a reverse dependency (front_end depends on analyzer), but this
dependency will go away as soon as we publish the next breaking change
release of analyzer.

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

Review URL: https://codereview.chromium.org/2486873003 .
2016-11-08 13:47:17 -08:00
Paul Berry 28b6a1f7ea Add implementations of the front end FileSystem API.
This required some small changes to the API contract.

Note that the tests use supermixins.  I'm assuming that supermixin
functionality will be available on all platforms by the time this is
needed.  If not, I will be happy to rewrite them.

R=scheglov@google.com, sigmund@google.com

Review URL: https://codereview.chromium.org/2471283002 .
2016-11-03 08:21:10 -07:00
Paul Berry 78ed4066c8 Add a "correction" field to front end compilation errors.
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2429213008 .
2016-10-20 12:33:12 -07:00
Paul Berry 8fca9ba968 First cut at a file system abstraction for the front end.
R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/2426773004 .
2016-10-18 14:10:14 -07:00
Paul Berry 8c42e56964 Add "not intended to be implemented/extended" warnings to pkg/front_end.
This ensures that we may safely add methods to the classes in this
package without causing a breaking change.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/2431733002 .
2016-10-18 13:31:40 -07:00
Paul Berry 0753607dea Initial API for the Dart front_end package.
R=brianwilkerson@google.com, scheglov@google.com

Review URL: https://codereview.chromium.org/2417043003 .
2016-10-17 12:36:08 -07:00