Commit Graph

367 Commits

Author SHA1 Message Date
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é 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
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
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 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
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
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
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
Asger Feldthaus ac40d0bb8e Add typedef AST node boilerplate.
This adds the Typedef and TypedefType to the kernel AST,
with the relevant boilerplate.

Typedefs are not implemented in frontend or backend.

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

Committed: https://github.com/dart-lang/sdk/commit/d1c3ee4b35227cb6926f03479a34f82774523773
Review-Url: https://codereview.chromium.org/2825053002 .
2017-04-28 13:26:47 +02:00
Asger Feldthaus 3f1aa32183 Revert "Add typedef AST node boilerplate."
This reverts commit d1c3ee4b35.

TBR

BUG=

Review-Url: https://codereview.chromium.org/2849803002 .
2017-04-28 12:54:19 +02:00
Asger Feldthaus d1c3ee4b35 Add typedef AST node boilerplate.
This adds the Typedef and TypedefType to the kernel AST,
with the relevant boilerplate.

Typedefs are not implemented in frontend or backend.

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

Review-Url: https://codereview.chromium.org/2825053002 .
2017-04-28 12:39:21 +02:00
Kevin Millikin 9adfa8a105 Fix a pair of issues in the Dart code for the front end.
- A type needed for an annotation was not visible.
- An iterable was passed instead of a list.

BUG=
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2838983002 .
2017-04-25 21:45:28 +02:00
Kevin Millikin 385f8fb054 Read platform.dill in the VM.
1. A --platform flag is added to dart to give a path to a Kernel
   binary for the platform libraries (as produced by building the
   runtime_kernel target).

2. This binary is used for bootstrapping.  Since it contains libraries
   other then the VM's bootstrap libraries, they are also loaded.

3. The frontend does not send any library with a dart: import URI
   scheme.  Note that it does not (yet) prune the canonical name
   table, which will contain a lot of unnecessary names used for
   internal linkages in the platform libraries.

4. There is a single dependency in the platform libraries on the
   script: _getMainClosure in dart:_builtin.  This is patched after
   the script is loaded.

BUG=
R=ahe@google.com, kustermann@google.com, vegorov@google.com

Review-Url: https://codereview.chromium.org/2786083002 .
2017-04-25 20:04:25 +02:00
Zhivka Gucevska 2860c9cb1b Add support for static invocation with arguments
BUG=
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2832873004 .
2017-04-24 10:14:23 +02:00
Erik Corry 6617737ff5 Replace 'the the' with 'the'
R=kmillikin@google.com
BUG=

Review-Url: https://codereview.chromium.org/2830353002 .
2017-04-24 08:50:37 +02:00
Zhivka Gucevska 4f59c41c5f Remove state for expression evaluation
BUG=
R=dmitryas@google.com, kmillikin@google.com

Review-Url: https://codereview.chromium.org/2833733003 .
2017-04-21 10:11:06 +02:00
Jacob Richman 997b4e62af Run formatter on a few frontend and kernel files that hadn't been formatted.
BUG=
R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2820323005 .
2017-04-20 09:25:13 -07:00
Zhivka Gucevska b00a85231e Parametrize over the additional agrument type for StatementVisitor1 and ExpressionVisitor1
BUG=
R=dmitryas@google.com

Review-Url: https://codereview.chromium.org/2835453002 .
2017-04-20 18:03:15 +02:00
Zhivka Gucevska feb38e4c8b Implement expression evaluation in Coninuation Passing Style
This enables support for Return statements.

BUG=
R=dmitryas@google.com, kmillikin@google.com

Review-Url: https://codereview.chromium.org/2806483003 .
2017-04-20 15:22:33 +02:00
Peter von der Ahé 6b150cb01f Verify rethrow and parents of variables.
R=asgerf@google.com

Review-Url: https://codereview.chromium.org/2800853005 .
2017-04-07 12:59:03 +02:00
Peter von der Ahé ddda182957 Add Source.getTextLine and use it to display source snippets in error messages.
R=asgerf@google.com, johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2788373002 .
2017-04-05 15:02:49 +02:00