Commit Graph

4698 Commits

Author SHA1 Message Date
Stephen Adams d5b2b393f3 Add optional message to assert in Dart2js - continued
This CL takes https://chromiumcodereview.appspot.com/1325843003/ and makes some changes:

 - distinguish enableUserAssertions from enableTypeAssertions
 - better type inference for disabled assertions

R=lrn@google.com

Review URL: https://codereview.chromium.org//1342213003 .
2015-09-16 15:16:02 -07:00
Johnni Winther 7ef93ef03a Make the universe parts into small libraries.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1348063002.
2015-09-16 15:09:14 +02:00
Asger Feldthaus 4055f6fca3 dart2js cps: Use more precise type inference for direct index access.
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1340093002 .
2015-09-16 11:00:51 +02:00
Asger Feldthaus 19cb08fa05 dart2js cps: Remove code after calls that cannot return.
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 .
2015-09-15 17:46:48 +02:00
Karl Klose 4ce8a23f0a dart2js: Register helpers for updating send to type variable.
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//1344733003 .
2015-09-15 15:31:52 +02:00
Johnni Winther 06ad66481c Move Selector and CallStructure into parts.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1346593002.
2015-09-15 14:21:05 +02:00
Johnni Winther b0e941ac98 Prepare for moving Selector and CallStructure into their own libraries.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1342503004.
2015-09-15 14:14:30 +02:00
Asger Feldthaus 79c0cb039f dart2js cps: Store the TypeMask for each primitive in a field.
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 .
2015-09-15 13:05:35 +02:00
Asger Feldthaus e48d774006 dart2js cps: Set a flag on InvokeMethod when the receiver is intercepted
This should make it clear where the "actual receiver" of a method call
can be found after dummy receiver optimization.

BUG=
R=karlklose@google.com, sra@google.com

Review URL: https://codereview.chromium.org//1335933004 .
2015-09-15 12:13:06 +02:00
Johnni Winther 14336baa3a Handle deferred import without prefix.
BUG=

Review URL: https://codereview.chromium.org//1332223005.
2015-09-15 11:34:05 +02:00
Johnni Winther b98cd40055 Add ImportElement and ExportElement
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1335983004.
2015-09-15 10:06:10 +02:00
Stephen Adams f9459ad4ac dart2js ssa: Avoid tracking too much in load elimination
R=floitsch@google.com

Review URL: https://codereview.chromium.org//1343783002 .
2015-09-14 12:49:57 -07:00
Sigurd dc6b09a6d7 Makes the $ variable local to the deferred enclosing function.
This fixes https://github.com/dart-lang/sdk/issues/24328
BUG=
R=floitsch@google.com

Review URL: https://codereview.chromium.org//1337923006 .
2015-09-14 15:35:52 +02:00
Johnni Winther afc7f9acae Avoid creating ConstructedConstantExpression for deferred constant.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org//1336303002.
2015-09-14 15:28:26 +02:00
Johnni Winther bae758fa61 Show import chains for unsupported dart:* library imports.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org//1338783002.
2015-09-14 15:19:06 +02:00
Johnni Winther 83b2c7f68a Type check await for.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org//1338803002.
2015-09-14 11:37:33 +02:00
Johnni Winther bda5146f40 Compute Compiler.proxyConstant on demand.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1334203002.
2015-09-11 14:47:49 +02:00
Johnni Winther 7407a72115 Add related types check to analyze_dart2js_test
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org//1338683002.
2015-09-11 14:38:04 +02:00
Johnni Winther 8bcbccc067 Use memory compiler in compiler_helper.dart.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org//1322973007.
2015-09-11 12:49:34 +02:00
Johnni Winther d655374736 Add warnings and hints to for-in.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org//1334673002.
2015-09-11 12:38:34 +02:00
Stephen Adams 1aa97c36b5 dart2js ssa: Open coding of removeLast should use -1 as index
This makes the error consistent between unoptimized and optimizer code.

R=sigmund@google.com

Review URL: https://codereview.chromium.org//1315523012 .
2015-09-10 15:38:49 -07:00
Asger Feldthaus 7d7d70a0e4 dart2js cps: Check strictness flag in redundant join eliminator.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1316163004 .
2015-09-10 09:54:43 +02:00
Johnni Winther 0dc96c4c2c Wrap Import uses in deferred_load.dart
This prepares for the addition of ImportElement for imports.

BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org//1313753004.
2015-09-10 09:53:49 +02:00
Johnni Winther 234f09fa7e Shared commandline flags.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org//1314833003.
2015-09-09 15:53:32 +02:00
Sigurd 18bb772cdd Fix crash when deferred loading would encounter an unresolved super setter.
BUG=
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//1327123003 .
2015-09-09 14:56:11 +02:00
Johnni Winther 8855bc8161 Support metadata on patches.
Closes #24291

R=karlklose@google.com

Review URL: https://codereview.chromium.org//1302333006.
2015-09-09 13:04:51 +02:00
Sigmund Cherem d78be6beb0 Fix typo in lookup map, use pub_semver to check version constraints in dart2js
R=sra@google.com

Review URL: https://codereview.chromium.org//1301373009 .
2015-09-08 14:51:23 -07:00
Asger Feldthaus a7cba674f5 dart2js cps: Insert bounds check for removeLast() -> pop() optimization.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1328093004 .
2015-09-08 16:21:18 +02:00
Asger Feldthaus 249a2affaa dart2js cps: Use TypeMaskSystem when inserting refinement nodes.
This also fixes a precision bug where checks like 'x is String'
would refine to [subtype=String] instead of [exact=JSString].

R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1316673006 .
2015-09-08 16:17:02 +02:00
Johnni Winther 7d4751dae8 Add ClassSet to support ClassWorld.strictSubtypesOf
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1304083008.
2015-09-08 15:02:42 +02:00
Karl Klose 4f8047af3b dart2js cps: Track existence of try statements in resolution instead of traversing AST/IR nodes to check for it.
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 .
2015-09-08 11:08:20 +02:00
Asger Feldthaus e5fc507c78 dart2js cps: Change interceptor pipeline.
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 .
2015-09-07 19:08:18 +02:00
Sigmund Cherem 711dee7433 green bots: fix analyzer warning in lookupmap
TBR=sra@google.com

Review URL: https://codereview.chromium.org//1325383002 .
2015-09-04 15:43:40 -07:00
Stephen Adams cbaae993a1 Make functions that appear to be unreachable throw.
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 .
2015-09-04 15:11:08 -07:00
Sigmund Cherem f348b8b01c Add version validation for LookupMap, also add unittest directly in LookupMap (take 2)
BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org//1308993008 .
2015-09-04 14:24:26 -07:00
Sigmund Cherem 9b8c06d225 Revert "Add version validation for LookupMap, also add unittest directly in LookupMap."
This reverts commit fc582d7a3d due to lots of redness

TBR=sra@google.com

Review URL: https://codereview.chromium.org//1318003006 .
2015-09-04 14:05:41 -07:00
Sigmund Cherem fc582d7a3d Add version validation for LookupMap, also add unittest directly in LookupMap.
R=sra@google.com

Review URL: https://codereview.chromium.org//1312943007 .
2015-09-04 13:59:50 -07:00
Karl Klose 42e374d41d dart2js cps: Remove some uses of giveup.
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1321013006 .
2015-09-04 10:20:22 +02:00
Asger Feldthaus c4546e8bb6 dart2js cps: Insert refinements for identical(x, null) in condition.
The unsugaring pass inserts an `identical(x, null)` check in the
beginning of each implementation of ==. We should refine the type
of `x` after that check.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1326913003 .
2015-09-03 18:42:34 +02:00
Sigmund Cherem dc9bcce778 Generalize lookup-maps to support other const keys
R=herhut@google.com

Review URL: https://codereview.chromium.org//1310183014 .
2015-09-03 08:41:09 -07:00
Asger Feldthaus 998be61175 dart2js cps: Add path-sensitive types by inserting refinement IR nodes.
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 .
2015-09-03 16:41:48 +02:00
Sigmund Cherem 2c660aa2f0 dart2js: add initial support for lookup-maps
R=herhut@google.com, sra@google.com

Review URL: https://codereview.chromium.org//1320503003 .
2015-09-02 17:51:59 -07:00
Johnni Winther d6db26f912 Split parser/listener.dart, parser/class_element_listener.dart and tokens/token.dart into smaller libraries
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1311783012.
2015-09-02 15:55:19 +02:00
Johnni Winther 3fbe395529 Copy libraries to prepare for move
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.
2015-09-02 12:40:48 +02:00
Johnni Winther ee54b9e3cd Move parser and token related libraries into their own subfolder.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1313073007.
2015-09-02 12:07:00 +02:00
Stephen Adams 383f809030 dart2js cps: Scalar replacement of aggregates
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 .
2015-09-01 22:25:04 -07:00
Stephen Adams 68f1ea3f84 Redo "Inline single-use local closures."
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 .
2015-09-01 19:50:38 -07:00
Stephen Adams 96e102bf1a Revert "Inline single-use local closures."
Need to update some tests.

TBR=asgerf@google.com

Review URL: https://codereview.chromium.org//1303213005 .
2015-09-01 18:23:34 -07:00
Stephen Adams 0dafa33f82 Inline single-use local closures.
Inlining is restricted to cases that generate opportunities for scalar replacement of aggregates.

R=asgerf@google.com

Review URL: https://codereview.chromium.org//1307303004 .
2015-09-01 17:28:43 -07:00
Johnni Winther f5a7be0c17 Split scannerlib.dart into several libraries.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1315483006.
2015-09-01 15:39:31 +02:00