Commit Graph

440 Commits

Author SHA1 Message Date
Peter von der Ahé 27761fd369 Read SDK and patches from a JSON file.
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2895983002 .
2017-05-25 15:57:57 +02:00
Konstantin Shcheglov 97d587520c Add LimitedBinaryPrinter, tests and switch incremental generator to it.
R=ahe@google.com, kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2896493002 .
2017-05-24 16:17:28 -07:00
Konstantin Shcheglov 2b8fd9dee8 Transform async code only for source libraries.
R=ahe@google.com, kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2905463002 .
2017-05-24 15:51:18 -07:00
Paul Berry e642722f42 Implement subtyping rules for FutureOr in kernel.
These rules are only enabled when in strong mode, so existing Dart 1.0
functionality should be unaffected.

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

Review-Url: https://codereview.chromium.org/2900113002 .
2017-05-24 06:14:22 -07:00
Konstantin Shcheglov 625129ac01 Make LibraryIndex lazy.
With this change it takes about 0.03% to create CoreTypes.

R=ahe@google.com, kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2896423002 .
2017-05-23 14:28:19 -07:00
Konstantin Shcheglov 77d4eb609b Use LibraryIndex in CoreTypes instead of extending it.
A smaller step this time - change only clients, but keep implementation
the same for now.

Not all patched SDKs have all classes and procedures, so I have to make
some them lazy. All of them could be done for consistency, but this
might slightly affect performance for often used dart:core classes.

Also it's a bit of mess now.
Maybe group these classes into logical structures, coreTypes.core.list,
coreTypes.async.future, coreTypes.async.futureMicrotask, etc. Something
like it was before this change, but fixed types and names instead of
more flexible (but in general slower) strings.

R=ahe@google.com, kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2890933002 .
2017-05-23 09:30:37 -07:00
Peter von der Ahé 425626363a Fix closure and interpreter suites.
Review-Url: https://codereview.chromium.org/2897933004 .
2017-05-22 18:19:37 +02:00
Peter von der Ahé 4fddc2e4d5 Move code for instantiating Invocation to Target.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2897683002 .
2017-05-22 15:59:06 +02:00
Paul Berry bf15116d0f Handle FutureOr type when inferring async closures.
R=asgerf@google.com, scheglov@google.com

Review-Url: https://codereview.chromium.org/2892593005 .
2017-05-20 20:16:59 -07:00
Konstantin Shcheglov 00525a056c Update cli description for a couple of benchmarks.
R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2896613003 .
2017-05-19 15:11:17 -07:00
Asger Feldthaus 1ea216e6de Add metadata annotations to library definitions.
BUG=
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2893803003 .
2017-05-19 11:35:26 +02:00
Régis Crelier 9aafded095 Pass type argument vector to generic functions (if --reify-generic-functions is
true, still false per default).
Work in progress, not functional yet (passed vector is still ignored in callee).

R=vegorov@google.com, zra@google.com

Review-Url: https://codereview.chromium.org/2859673002 .
2017-05-18 14:03:47 -07:00
Zhivka Gucevska e68b664383 Add support for execution of constructor body
BUG=
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2880343002 .
2017-05-18 15:30:22 +02:00
Asger Feldthaus 876db33bf4 Add import/export declaration AST node boilerplate to kernel.
Previously only deferred imports were represented. They have been
merged with the general form.

BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2852373002 .
2017-05-18 14:38:08 +02:00
Zhivka Gucevska 4030e2de6c Modify new instance allocation
A fresh new instance should be allocated after the evaluation of the
argument list for the constructor.

This change modifies the ConstructorInvocation application continuation
to allocate a new object and introduces :
 * continuation applications for Redirecting and Super constructor
invocations, applied on evaluated arguments for Redirecting and Super
constructors respectively
 * expression continuation for instance initialization, applied to the
new instance

BUG=
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2888913002 .
2017-05-18 12:31:20 +02:00
Dmitry Stefantsov 60be18b4a9 Add tool to extract LaTeX-formatted text from comments in Dart programs
R=zhivkag@google.com

Review-Url: https://codereview.chromium.org/2889953002 .
2017-05-18 10:48:29 +02:00
Konstantin Shcheglov 06e9b4b503 Rename buildOutline() and separate 'build' and 'writeProgram()'.
Also rename KernelTarget.program to _program to prevent clients from
reaching into internals. I think eventually we want to make more
stuff private. And rationalize errors handling. And... many things :-)

R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2893563003 .
2017-05-17 11:10:06 -07:00
Konstantin Shcheglov e3f4ed94b1 Rename Target.writeOutline() into computeOutline(), add separate KernelTarget.writeOutline().
For DillTarget write does not make sense, and even for KernelTarget
we usually don't want to write anything.

R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2885923002 .
2017-05-16 14:38:24 -07:00
Zhivka Gucevska d4b73fd9ee Refactor string concatenation evaluation
BUG=
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2883813004 .
2017-05-16 12:53:44 +02:00
Zhivka Gucevska 614f9207b6 Add support for super constructor invocation
BUG=
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2881053002 .
2017-05-15 13:58:42 +02:00
Zhivka Gucevska c545954a2a Add tests for initializer list execution in object initialization
BUG=
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2883823003 .
2017-05-15 12:14:18 +02:00
Zhivka Gucevska 1dc564bc13 Fix local initializer execution
BUG=
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2874253002 .
2017-05-15 09:54:09 +02:00
Jens Johansen d26558b7be [kernel] [partial] Streaming of kernel binary without AST nodes
This CL allows for streaming big parts of the binary,
i.e. without using the AST nodes.
It is thus a stepping-stone in getting rid of the AST nodes in the VM.

Generally, all Expressions except "FunctionExpression",
and all Statements except "FunctionDeclaration" can be streamed.

There are currently not streamed because they create new functions,
which has a pointer to an AstNode (which we don't have when streaming).

Once we no longer need AstNodes at all these can be streamed as well.
This is, I think, mostly a matter of streaming the ScopeBuilder as well,
something that is not currently done.

The way the streaming is build, one has to stream an entire subtree.
That means, that if an expression (or statement), A, that is generally
streamable contains an expression or a statement, B, that is not streamable,
A cannot be streamed.
The way this is build is by marking AstNodes as streamable or not
("cannot_stream_" field). That way we know up front whether we can stream
a subtree or not.

The streaming is done via "kernel_binary_flowgraph".

In this file there are many obvious comments, e.g.
```
  TokenPosition position = ReadPosition();  // read position.
```
This has been done in an attempt to add a comment to everything that
reads from the binary to make it stand out more.

All changes from kernel_to_il up to and including May 2nd 2017
should be included.

R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2854393002 .
2017-05-15 09:01:22 +02:00
Konstantin Shcheglov bdedd6768b Add a way to use shared CanonicalName root to deserialize Program.
This allows for example to add SDK into a Program, then load the
"incomplete" Program A that has only the library A, and name sequences
that references SDK classes. Because we look into the nameRoot which
aleady has SDK CanonicalName(s), we can find these names while filling
the link table and use references which point to the existing SDK
AST nodes.  Then we can load another set of library cycles, etc.

At the end we have a set of self-consistent libraries that we can
feed into DillTarget/DillLoader and resolve anothersource target
against it.

This CL is based on https://codereview.chromium.org/2872903005/
which has not been reviewed yet.

R=kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2874723002 .
2017-05-12 10:42:08 -07:00
Konstantin Shcheglov 8751b91062 Rework DillLoader to allow adding multiple dills.
This allows us to compose a consistent bundle with SDK and the transitive
closure of required libraries for a libarary, and then compile it
separately (or as a part of its own library cycle).

There is still more data public than I'd like, but I will leave this
clean up fo later.

R=ahe@google.com, kmillikin@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2872903005 .
2017-05-11 08:56:36 -07:00
Paul Berry 06bba1e551 Add FunctionType.getNamedParameter.
This functionality was duplicated both in
TypeCheckingVisitor.handleFunctionCall and in the front end's
TypeInferrerImpl._getCalleeFunctionType.  I kept the implementation
from TypeInferrerImpl._getCalleeFunctionType since it does a binary
search, so it should theoretically be faster.

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

Review-Url: https://codereview.chromium.org/2876533004 .
2017-05-11 06:03:37 -07:00
Zhivka Gucevska a9ce0c53f7 Add test for initialization of instance fields with initializer expressions
BUG=
R=dmitryas@google.com, kmillikin@google.com

Review-Url: https://codereview.chromium.org/2875023002 .
2017-05-11 13:59:57 +02:00
Zhivka Gucevska eae9c60eb7 Add suport for initializer list execution in constructor invocation
BUG=
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2877733002 .
2017-05-11 12:39:24 +02:00
Zhivka Gucevska 62c0be200e Add support for redirecting constructors and instance field initialization
Instance fields only in immediately enclosing class are initialized.

BUG=
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2870263003 .
2017-05-11 11:45:31 +02:00
Jens Johansen b095347421 [kernel] Add support for cloning Vector nodes and ClosureCreation
This adds support for cloning the following kernel AST nodes.
* ClosureCreation
* VectorCreation
* VectorSet
* VectorGet
* VectorCopy

This will be needed for kernel closure conversion.

BUG=
R=kmillikin@google.com

Review-Url: https://codereview.chromium.org/2874973004 .
2017-05-11 11:33:00 +02:00
Zhivka Gucevska 8ea3c3b3e6 Refactor argument evaluation for static invocation
BUG=
R=dmitryas@google.com, kmillikin@google.com

Review-Url: https://codereview.chromium.org/2871953002 .
2017-05-10 11:11:32 +02:00
Konstantin Shcheglov b7492c31e3 Use Uint32List as the return type of _IntervalListBuilder.buildIntervalList().
R=kmillikin@google.com, paulberry@google.com
BUG=

Review-Url: https://codereview.chromium.org/2869803002 .
2017-05-08 09:04:45 -07:00
Konstantin Shcheglov cc91d04514 Use FileSystem to read files in SourceLoader and TranslateUri.
This is a prerequisite for writing fast unit tests, as I would like
to do while working on the incremental kernel driver.

R=ahe@google.com, paulberry@google.com, sigmund@google.com
BUG=

Review-Url: https://codereview.chromium.org/2865843002 .
2017-05-06 13:09:28 -07:00
P.Y. Laligand 21e9c40b8f Disable analysis on a few packages. (#29571) 2017-05-05 22:06:00 -07:00
Stephen Adams dc8a4f21b8 dart2js allocation tweaks
In compiling a large app:

50% reduction in number of strings allocated.
20% reduction in number of closures allocated.

It is hard to tell if there is a performance improvement because it is in the noise.

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

Review-Url: https://codereview.chromium.org/2864573002 .
2017-05-05 14:40:41 -07:00
Kevin Millikin fbb6c121e6 Add an optional bound to type parameter references
This allows us to represent type parameters with promoted bounds which
are different from the bound at the declaration.  A missing promoted
bound indicates that the type parameter has the original bound at the
declaration.

This is a representation-only change, the optional bound is always
`null`.  Closes #29529.

BUG=https://github.com/dart-lang/sdk/issues/29529
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2866593003 .
2017-05-05 23:33:13 +02:00
Kevin Millikin 04f7ba272a Remove the Kernel setup_builtin_library transformation
This transformation replaces the body of _getMainClosure in
dart:_builtin with `return main` for the script's main if there is one
and removes the body if there is no main.

Without this transformation fasta will compile `return null` and dartk
will compile `return throw new NoSuchMethodError...`.  Both of these
patterns will be patched in the VM when dart:_builtin is compiled from
Kernel.

BUG=
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2861023002 .
2017-05-04 20:29:44 +02:00
Paul Berry 932a749bbc Begin implementing subtype matching for type inference.
R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2856383003 .
2017-05-04 08:40:45 -07:00
Devon Carew af7f15e633 package:kernel version change 0.3.0-dev.1 => 0.3.0-alpha.1.
BUG=
R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2857273002 .
2017-05-03 18:06:50 -07:00
Devon Carew 99d21dd9d0 Prepare package:analyzer 0.30.0.
BUG=
R=kevmoo@google.com

Review-Url: https://codereview.chromium.org/2862713002 .
2017-05-03 14:34:55 -07:00
Paul Berry d842f35bb2 Add a strong mode implementation of LUB to fasta; use it to infer ?:
R=ahe@google.com, leafp@google.com

Review-Url: https://codereview.chromium.org/2849213002 .
2017-05-03 10:36:47 -07:00
Asger Feldthaus 3a162d4241 Add flag to track if a constructor is the synthetic default constructor.
BUG=
R=ahe@google.com

Review-Url: https://codereview.chromium.org/2856123002 .
2017-05-03 12:48:11 +02:00
Zhivka Gucevska 13cb938bc7 Fix issues in interpreter tests
BUG=
R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2850413002 .
2017-05-02 11:43:26 +02:00
Paul Berry 29570728a3 Implement Dart 1.0 LUB algorithm (for interface types) in kernel.
Note: I intend to implement the full LUB algorithm (including strong
mode behaviors) in front_end, however this piece of the algorithm
makes sense to be in kernel so that it can take advantage of
_ClassInfo.

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

Review-Url: https://codereview.chromium.org/2848083002 .
2017-05-01 11:25:47 -07:00
Peter von der Ahé 5d08d5bb6c Update verifier to correctly analyze types of fields.
Fixes #29511.

R=paulberry@google.com

Review-Url: https://codereview.chromium.org/2855603002 .
2017-05-01 17:26:10 +02:00
Zhivka Gucevska 184cc25766 Add initial tests for Kernel interpreter
Add logging in the Interpreter for:
 - StaticInvocationExpression, including calls to print
 - ReturnStatement
 - IfStatement

BUG=
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2841803002 .
2017-05-01 16:12:27 +02:00
Zhivka Gucevska b31e07a29a Fix implicit cast warning
BUG=
R=karlklose@google.com

Review-Url: https://codereview.chromium.org/2855473003 .
2017-05-01 12:41:31 +02:00
Erik Corry aa6353b6da Dart SDK Spelling b, c, and d.
R=kmillikin@google.com
BUG=

Review-Url: https://codereview.chromium.org/2850783002 .
2017-05-01 08:28:10 +02:00
danrubel c8784af933 rename .analysis_options --> analysis_options.yaml
See https://github.com/dart-lang/sdk/issues/28385

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

Review-Url: https://codereview.chromium.org/2839383003 .
2017-04-30 18:33:10 -04:00
Sigmund Cherem 26c2f3e17f Move dartk to the tool folder
"bin" is part of the public API of a package, private tools can go under the
`tool` folder. This allows us to use a dev_dependency on analyzer without
exposing a broken import publicly.

I've only moved `dartk` so far (which I expect will be removed once we have a
better API for front_end.

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

Review-Url: https://codereview.chromium.org/2842643002 .
2017-04-28 15:39:17 -07:00