Commit Graph

1555 Commits

Author SHA1 Message Date
Martin Kustermann 43116be5c5 [kernel] Implement binary format implementation for BlockExpression
R=vegorov@google.com

Review URL: https://chromereviews.googleplex.com/462427014 .
2016-08-02 12:14:50 +02:00
Vyacheslav Egorov 6fc00fe8cf [kernel] Add the first version of async transformer.
This transformer is responsible for lifting subexpression into temporary variables preserved across yield points.

To maintain AST validity I introduced an expression that can contain a block of statements inside called BlockExpression.

BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/458577014 .
2016-08-02 12:14:50 +02:00
Asger Feldthaus f5093e39b7 [kernel] Include labels in the textual representation.
BUG=
R=kmillikin@google.com

Review URL: https://chromereviews.googleplex.com/475297014 .
2016-07-25 15:18:53 +02:00
Asger Feldthaus c97036648a [kernel] Correctly translate PropertyAccess of a static class member.
This handles the case of null-aware static member access `C?.foo`, as
well as fully qualified static member access `h.C.foo`.

BUG=
R=kmillikin@google.com

Review URL: https://chromereviews.googleplex.com/476957013 .
2016-07-25 15:18:21 +02:00
Asger Feldthaus 2432655e48 [kernel] Add support for batch mode in dartk.
Also forwards errors reported by the analyzer for use
in testing.

BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/476727013 .
2016-07-22 17:42:32 +02:00
Asger Feldthaus 0228e8c29e [kernel] Fix deserialization of labels in nested functions.
BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/472867013 .
2016-07-20 14:12:07 +02:00
Asger Feldthaus 241a79e11b [kernel] Preserve leading BOMs during deserialization.
BUG=#21
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/467567013 .
2016-07-20 14:10:22 +02:00
Asger Feldthaus 10d54d7a61 [kernel] Change the default binary file extension to .dill
BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/475637013 .
2016-07-19 17:52:33 +02:00
Martin Kustermann 1d0f534832 [kernel] Revert "Implement binary format implementation for BlockExpression"
This accidentally landed on master branch.
2016-07-08 09:22:36 +02:00
Martin Kustermann 4acb4446fd [kernel] Implement binary format implementation for BlockExpression
R=vegorov@google.com

Review URL: https://chromereviews.googleplex.com/462427014 .
2016-07-08 09:18:01 +02:00
Martin Kustermann 77001a5494 [kernel] Fix moving super initializer to the end
R=vegorov@google.com

Review URL: https://chromereviews.googleplex.com/462167013 .
2016-07-05 11:53:03 +02:00
Peter von der Ahé 7eef2bb9a2 [kernel] Null aware assignment is when lvalue is null.
R=asgerf@google.com

Review URL: https://chromereviews.googleplex.com/462137013 .
2016-07-01 13:21:45 +02:00
Asger Feldthaus 1d86616fd5 [kernel] Enable Accessor subclasses to provide error handling.
BUG=
R=ahe@google.com

Review URL: https://chromereviews.googleplex.com/462807013 .
2016-07-01 11:39:21 +02:00
Asger Feldthaus f13be3e4bc [kernel] Add LocalInitializer and move super calls last in initializer lists.
LocalInitializer lets us to bind temporaries to variables in the
initializer list.  We use it to ensure the arguments to super() are
evaluated at the right time.

accessors.dart and the new file super_calls.dart have been moved into
a folder "frontend" for frontend helpers that operate on Kernel IR.

BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/457457013 .
2016-06-28 14:27:01 +02:00
Peter von der Ahé 72e5a0281b [kernel] ConstructorInvocation extends InvocationExpression.
R=asgerf@google.com

Review URL: https://chromereviews.googleplex.com/456367013 .
2016-06-28 13:11:25 +02:00
Asger Feldthaus d61e67d85a [kernel] Fix a broken parent pointer and add option in dartk to check them.
BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/460807013 .
2016-06-28 11:15:48 +02:00
Asger Feldthaus 4a40d3f244 [kernel] Insert default super constructor calls.
BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/457997013 .
2016-06-28 10:59:54 +02:00
Asger Feldthaus 37d46de6a5 [kernel] Fix labeled variable declarations.
BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/453477013 .
2016-06-27 12:23:02 +02:00
Peter von der Ahé 0e36559dd4 [kernel] Reduce dependencies on analyzer.
R=asgerf@google.com

Review URL: https://chromereviews.googleplex.com/445507013 .
2016-06-17 11:41:26 +02:00
Peter von der Ahé 3f1162ea96 [kernel] Rename ReadOnlyAccessor.finish to _finish.
This way ReadOnlyAccessor overrides Accessor._finish as intended which solves problem where reads would contain free temporary variables.

R=asgerf@google.com

Review URL: https://chromereviews.googleplex.com/455597013 .
2016-06-16 10:26:42 +02:00
Asger Feldthaus ab59e37155 [kernel] Canonicalize loads and stores in type propagation.
BUG=
R=kasperl@google.com

Review URL: https://chromereviews.googleplex.com/444557013 .
2016-06-14 17:35:01 +02:00
Asger Feldthaus d78bab065e [kernel] Preserve all annotations on graph nodes.
The text annotator needs all annotations to be present,
and previously only one per member would be preserved.

BUG=
R=kasperl@google.com

Review URL: https://chromereviews.googleplex.com/444547013 .
2016-06-14 12:47:57 +02:00
Asger Feldthaus 41f9505d88 [kernel] Improve graph visualization of type inference constraints.
Constraints are now annotated as well as variables, making it easier
to determine which edges should be included in the graph for a given
member.

BUG=
R=kasperl@google.com

Review URL: https://chromereviews.googleplex.com/445297013 .
2016-06-14 12:23:37 +02:00
Asger Feldthaus d1f8edf534 [kernel] Fix handling of static setter invocation in type propagation builder.
BUG=
R=kasperl@google.com

Review URL: https://chromereviews.googleplex.com/449907013 .
2016-06-13 16:04:38 +02:00
Asger Feldthaus 69ed34a87d [kernel] Fix inferred return value in closures.
The return value of a closure would previously be merged
with the return value of its enclosing function.

Also rename returnValue => returnVariable for consistency
in the builder.

BUG=
R=kasperl@google.com

Review URL: https://chromereviews.googleplex.com/448917013 .
2016-06-13 12:53:01 +02:00
Asger Feldthaus 76b439cf15 [kernel] Track instance fields in type propagation.
R=kasperl@google.com

Review URL: https://chromereviews.googleplex.com/441497013 .
2016-06-10 09:59:18 +02:00
Asger Feldthaus 04e65980b7 [kernel] Properly output the type of fields in type propagation.
BUG=
R=kasperl@google.com

Review URL: https://chromereviews.googleplex.com/447997013 .
2016-06-09 14:19:24 +02:00
Asger Feldthaus d96b840b11 [kernel] Support constructor initializers in type propagation.
BUG=
R=kasperl@google.com

Review URL: https://chromereviews.googleplex.com/444207013 .
2016-06-09 13:56:49 +02:00
Asger Feldthaus 8186f220fc [kernel] Add type-based modeling of externals in type propagation.
BUG=
R=kasperl@google.com

Review URL: https://chromereviews.googleplex.com/444827013 .
2016-06-09 12:13:36 +02:00
Asger Feldthaus bd76a94541 [kernel] Test type propagation by comparing the output against a gold file.
This should help reviewers see how a change in type propagation affects
the current output.

There are currently only 3 tests with gold files.  We can add more tests
ongoing as more features are implemented.

The expected outputs contains a lot of wrong types because the backing
type propagation is not complete.

BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/440487013 .
2016-06-08 13:06:17 +02:00
Asger Feldthaus 638b4bfaff [kernel] Normalize DartTypes to 'dynamic' instead of 'null' when omitted.
For constructor bodies, we arbitrarily set the return type to 'void'.

Although there is hardly any legitimate use for the "return type" of
a constructor, this doesn't have any overhead and it simplifies the
restriction on FunctionNode.

BUG=
R=kmillikin@google.com

Review URL: https://chromereviews.googleplex.com/446827013 .
2016-06-06 15:01:51 +02:00
Asger Feldthaus a4656a204b [kernel] Incomplete global type propagation.
To make this more digestible, a lot of things are intentionally left
out from the implementation:
 - Some AST nodes, like super calls and await
 - Handling of externals
 - Avoidance of redundant variables in the constraint system

The solver is currently field-based, which is also something I plan to
change.

Suggested reading order:
- constraints.dart
- solver.dart
- canonicalizer.dart
- builder.dart
- visualizer.dart

R=kasperl@google.com

Review URL: https://chromereviews.googleplex.com/442937013 .
2016-06-03 16:22:36 +02:00
Asger Feldthaus 311c893fa3 [kernel] Avoid redundant allocations in the frontend.
Doesn't make much of a difference, but we might as well land it now.
At least it rules them out as a bottleneck.

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

Review URL: https://chromereviews.googleplex.com/439987013 .
2016-05-30 14:21:50 +02:00
Asger Feldthaus e42ad3d3f9 [kernel] Fix name of unary- method and regenerate dart2js binary used for testing
BUG=

Review URL: https://chromereviews.googleplex.com/434157013 .
2016-05-27 11:46:18 +02:00
Asger Feldthaus 49746d5092 [kernel] Remove ProcudureKind.IndexGetter and IndexSetter.
They are now ProcedureKind.Operator.

BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/433267013 .
2016-05-27 11:27:19 +02:00
Asger Feldthaus b61129ee84 [kernel] Support interface member resolution in class hierarchy.
This is useful for handling of externals in tree shaking and type
propagation.

BUG=
R=ahe@google.com

Review URL: https://chromereviews.googleplex.com/435947013 .
2016-05-27 11:25:00 +02:00
Asger Feldthaus c5649381a8 [kernel] Document that variable declaration statement must be in a Block.
BUG=
R=kmillikin@google.com

Review URL: https://chromereviews.googleplex.com/437797013 .
2016-05-25 16:49:39 +02:00
Asger Feldthaus 9e4e37a4ae [kernel] Add more convenience methods and tweak the behavior of toString().
Also contains a bugfix for a missing visitor call.

BUG=
R=ahe@google.com

Review URL: https://chromereviews.googleplex.com/438627013 .
2016-05-25 13:56:43 +02:00
Asger Feldthaus e340a3b0ac [kernel] Implement DartType.hashCode and add some tests.
BUG=
R=ahe@google.com

Review URL: https://chromereviews.googleplex.com/437757013 .
2016-05-25 13:09:59 +02:00
Asger Feldthaus c3bb92a04f [kernel] Support redirecting factory constructors.
BUG=
R=ahe@google.com

Review URL: https://chromereviews.googleplex.com/434877013 .
2016-05-25 12:56:25 +02:00
Asger Feldthaus c4d30e587f [kernel] Ensure dart:core is always loaded when loading whole programs.
BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/422447013 .
2016-05-24 17:27:40 +02:00
Peter von der Ahé 94342127fe [kernel] Suppress dart2js hint about hashCode.
R=asgerf@google.com

Review URL: https://chromereviews.googleplex.com/433597013 .
2016-05-19 13:40:48 +02:00
Peter von der Ahé 32c66ac737 [kernel] Update name in comment.
R=asgerf@google.com

Review URL: https://chromereviews.googleplex.com/432727013 .
2016-05-19 13:32:00 +02:00
Peter von der Ahé 2fc2b9c1cb [kernel] Fix typo in IndexAccessors.indexAccess
R=asgerf@google.com

Review URL: https://chromereviews.googleplex.com/428207013 .
2016-05-19 13:20:33 +02:00
Asger Feldthaus c7606c752c [kernel] Flag external static procedures as external.
BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/426927013 .
2016-05-13 13:46:43 +02:00
Asger Feldthaus 77d0b4b244 [kernel] Support member resolution in class hierarchy.
Review URL: https://chromereviews.googleplex.com/417107013 .
2016-05-09 14:12:40 +02:00
Asger Feldthaus c808dd897c [kernel] Allow variable declarations that are not direct children of a block.
For example:

  if (foo) var x = 5, y = foo(x);

Becomes:

  if (foo) {
    var x = 5;
    var y = foo(x);
  }

BUG=
R=kmillikin@google.com

Review URL: https://chromereviews.googleplex.com/419297013 .
2016-05-04 13:38:04 +02:00
Asger Feldthaus c1e99a7b9e [kernel] Avoid using empty strings as library names.
Previously, anonymous libraries would have an empty name when loaded
from Dart, but a null name when loaded from binary.

The textual printer will use synthetic names for null, but not for empty
names, so we should prefer null.

BUG=
R=kmillikin@google.com

Review URL: https://chromereviews.googleplex.com/419187013 .
2016-05-03 12:59:16 +02:00
Asger Feldthaus afd71681e9 [kernel] Do not use the return value from calls to '[]='.
If an index assignment occurs where its result is used, we bind
the value in a 'let' to reuse the value.

For example:
  return x[y] = z

would become:
  return let #x = x
      in let #y = y
      in #x.[]=(#y, z)

but now becomes:
  return let #x = x
      in let #y = y
      in let #z = z
      in let #dummy = #x.[]=(#y, #z)
      in #z

It clearly looks worse, but it makes the semantics of MethodInvocation
node a lot more uniform when there is no special case for invoking a
method named '[]='.
2016-04-29 10:03:57 +02:00
Asger Feldthaus 272a9e51c6 [kernel] Avoid creating a 'let' binding for 'this' in property and index access.
Some analyses can perform special treatment of 'this' accesses, so we
should preserve them when desugaring.

For example:
  this.foo += 1

would become:
  let #1 = this in #1.foo = #1.foo.+(1)

but now instead becomes:
  this.foo = this.foo.+(1)
2016-04-29 08:43:13 +02:00