This should resolve an outstanding issue with unreachable code being
transformed. A subterm in the unreachable code would get specialized
and then reanalyzed while some of the definitions in scope have no type.
This changes a lot of test case results. Some test results
have changed in very surprising ways, but I would argue
these are separate bugs that we should hunt down.
BUG=
R=kmillikin@google.com
Review URL: https://codereview.chromium.org//1335273003 .
This should make it easier to use type information in other passes.
Some passes have been adapted to update the type field, even though it
is still only used in type propagation.
Refinement nodes are still removed pretty early since most passes are
not prepared to deal with them.
BUG=
R=kmillikin@google.com
Review URL: https://codereview.chromium.org//1305863010 .
This change removes one traversal in the backend and it is one step in the direction of recording more inforamtion in resolution; the compuation of DartCapturedVariables, for example, could also be done during resolution and stored in the TreeElements.
The disadvantage is that resolution may look at more code than TypePropagation, but in this specific case I do not think that we are realisticly able to eliminate try statements in functions that are small enough to be inlined.
R=kmillikin@google.com
Review URL: https://codereview.chromium.org//1311403003 .
Interceptor sharing/hoisting now takes places much later.
ShareInterceptors is now responsible for replacing interceptor calls
with constants, although determining if it CAN be replaced with a
constant is determined during type propagation where precise types are
available.
LetSinking has been removed; it was a leftover from when interceptors
were generated at definition-site.
As a follow-up on deleting LetSinking, creation expressions are now
considered effectively constant during assignment propagation. This is
safe because such expressions are not propagated into loops (this was
not always the case).
BUG=
R=kmillikin@google.com
Review URL: https://codereview.chromium.org//1322403002 .
Functions are unreachable if their parameters have an empty type. We would generate bogus code for the function due to the empty type so we might as well generate a throw. This can prevent spurious inclusion of more code referenced only in the unreachable code.
It is usually a bug if we generate unreachable methods but it can happen for legitimate reasons. One is that type inference is sometimes more precise than type propagation in the optimizer. Another is that we call a function that has an uninstantiated parameter type. This usually happens due the infeasibility of the path being hidden by a correlation between the type and some variable's value.
There is a tail of bugs that need to be flushed out before we can enable this by default.
Enable with:
DART_VM_OPTIONS=-Dunreachable-throw=true <compile>
language/cyclic_default_values_test fails, with foo and foo2 falsely unreachable:
DART_VM_OPTIONS=-Dunreachable-throw=true tools/test.py -mrelease -cdart2js -rd8 language/cyclic_default_values_test
I have added a test for the cause - a type inference bug with default argument values.
DART_VM_OPTIONS=-Dunreachable-throw=true tools/test.py -mrelease dart2js/simple_inferrer_const_closure_default_test
R=sigmund@google.com
Review URL: https://codereview.chromium.org//1320673004 .
Refinement nodes are inserted after an InvokeMethod, refining the type
of the receiver to those that can respond to the selector.
Refinements are also inserted in the arms of a branch with a condition
of form 'x is T' or 'x == null'.
R=kmillikin@google.com
Review URL: https://codereview.chromium.org//1330503003 .
The plan:
Move ElementListener from listener.dart to element_listener.dart
Move NodeListener from listener.dart to node_listener.dart
Move MemberListener from class_element_parser.dart to member_listener.dart
Move PartialElement, PartialFunctionElement etc from listener.dart and class_element_parser.dart to partial_elements.dart
Move PrecedenceInfo from token.dart to precedence.dart
Move *_INFO constants from token.dart to precendence_constants.dart
Move *_TOKEN constants from token.dart to token_constants.dart
BUG=
R=karlklose@google.com
Review URL: https://codereview.chromium.org//1325053003.
Aggregates which do not escape can be replaced with local variables.
This applies to regular objects, closures and boxes. Closures need
their body inlined first.
Fields that are written are replaced with a MutableVariable. Fields
that are only initialized have the reads replaced with references to
the initial value.
R=asgerf@google.com
Review URL: https://codereview.chromium.org//1319303002 .
Updated js_backend_cps_ir_closures_test.dart
Made two variants of tests that were changed by inlining:
1. Same source, showing inlined code.
2. Source with escaping closure to avoid inlining.
Review URL: https://codereview.chromium.org//1310483004 .