Commit Graph

2536 Commits

Author SHA1 Message Date
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 cf0aeb0f50 [kernel] Add delta-blue as a baselined testcase for type propagation.
BUG=
R=kasperl@google.com

Review URL: https://chromereviews.googleplex.com/447237013 .
2016-06-09 11:53:05 +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 9b94420449 [kernel] Add CC dart-kernel group to codereview settings.
BUG=
R=vegorov@google.com

Review URL: https://chromereviews.googleplex.com/439227013 .
2016-06-02 17:27:50 +02:00
Asger Feldthaus c0c21cef23 [kernel] Add a tool for diagnosing where time is spent in the frontend.
BUG=
R=kmillikin@google.com, kustermann@google.com

Review URL: https://chromereviews.googleplex.com/442627013 .
2016-06-01 13:26:12 +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 3c2a76dfb9 [kernel] Bump analyzer version and compiled dart2js version used as test data.
BUG=
R=kustermann@google.com

Review URL: https://chromereviews.googleplex.com/436207013 .
2016-05-30 12:56:49 +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 78fea36888 [kernel] Add codereview.settings 2016-04-29 12:58:45 +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
Asger Feldthaus a117d3f8f7 [kernel] Add 'const' modifier to StaticInvocation.
This is to distinguish constant calls to an external constant factory.

This changes the binary format.
2016-04-28 12:58:42 +02:00
Asger Feldthaus 6f060282f4 [kernel] Support external constant factories such as String.fromEnvironment.
Also fixes a bug in translation of factory calls.
2016-04-28 12:29:40 +02:00
Asger Feldthaus 3bcde6d532 [kernel] Handle redirecting factory constructors.
Redirecting factories are desugared to a factory procedure with a
return and call in the body.

Constant calls to a constant redirecting factory are redirected at the
call-site to the effective target, which must be a constant constructor.
2016-04-28 09:37:22 +02:00
Asger Feldthaus bc46000f4b [kernel] Make test package use ^ and fix a comment 2016-04-27 16:44:25 +02:00
Asger Feldthaus 811a47d430 [kernel] Initial implementation of Dart Kernel.
Contains:
- Command-line tool
- Kernel AST
- Binary serialization
- Printing as text
- Frontend based on analyzer
- Class hierarchy and type algebra
2016-04-26 10:39:15 +02:00
Asger Feldthaus 953adb31fa [kernel] Initial commit. 2016-04-26 10:29:55 +02:00