Asger Feldthaus
1abc2c897c
[kernel] Fix some broken tests and benchmarks.
...
The tests and benchmarks did not use AnalyzerRepository and the test
expectations for type propagation were not updated after a change to
the frontend.
BUG=
R=ahe@google.com
Review URL: https://chromereviews.googleplex.com/462127013 .
2016-07-01 13:10:00 +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
b18ed0d0ec
[kernel] Reorganize some files in the test folder.
...
Moves type_propagation_dump.dart => type_propagation/dump.dart
Also renames baseline_test_clean to clean_baseline to avoid obstructing
tab completion of baseline_test.
BUG=
R=kasperl@google.com
Review URL: https://chromereviews.googleplex.com/449897013 .
2016-06-13 13:04:52 +02:00
Asger Feldthaus
ed8b41704f
[kernel] Add option to only print type inference graph for some members.
...
BUG=
R=kasperl@google.com
Review URL: https://chromereviews.googleplex.com/442527013 .
2016-06-13 12:53:47 +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
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