Commit Graph

4835 Commits

Author SHA1 Message Date
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
Asger Feldthaus a1ddf50835 dart2js cps: Use a strictness flag on Branch instead of rewriting.
The unsugar pass no longer inserts `identical(_, true)` around every
branching condition. Insead, the Branch node has a flag isStrictCheck
denoting whether that check should be there.

The `identical(_, true)` check is now inserted by the Tree IR builder.

The identical nodes obstructed reasoning about branching conditions, in
particular in redundant joint elimination and insertion of type
refinement nodes.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1311353008 .
2015-09-01 14:41:58 +02:00
Johnni Winther df3b310e68 Cleanup of function_set.dart
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1303363006.
2015-09-01 13:59:07 +02:00
Johnni Winther ae721be5ae Prepare for computation of NewStructure in Resolution.
BUG=
R=karlklose@google.com

Committed: https://github.com/dart-lang/sdk/commit/1a8f32efc441c4f8603b0d8c83b82d326dbc5d4c

Reverted: https://github.com/dart-lang/sdk/commit/db89bc6574859b93434e98e68bcbe15f0330ab9e

Review URL: https://codereview.chromium.org//1323573002.
2015-09-01 12:39:47 +02:00
Johnni Winther db89bc6574 Revert "Prepare for computation of NewStructure in Resolution."
This reverts commit 1a8f32efc4.

BUG=

Review URL: https://codereview.chromium.org//1308153007.
2015-09-01 10:15:22 +02:00
Johnni Winther 1a8f32efc4 Prepare for computation of NewStructure in Resolution.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1323573002.
2015-09-01 10:11:19 +02:00
Johnni Winther 82e9622969 Extract ReceiverMask interface from TypeMask.
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org//1318383002.
2015-09-01 09:39:19 +02:00
Asger Feldthaus 2650557f0b dart2js cps minor change: Add a comment and rename a parameter.
This was reverted together with the change to use synthetic constants
for the dummy receiver, but the synthetic constants have some deeper
issues.

BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org//1304943003 .
2015-08-31 16:04:41 +02:00
Johnni Winther 838c8d0423 Move isPrivateName and isPublicName to Name.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org//1313893004.
2015-08-31 10:26:51 +02:00
Asger Feldthaus 9ac5099a46 dart2js cps: Interceptor can be null if input is null.
This causes nasty regression but it fixes a correctness issue.

Path-sensitive type propagation recovers some of the regression.

R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1313183007 .
2015-08-28 17:16:46 +02:00
Kevin Millikin d074fa69b7 dart2js: A bit more inlining of static invocations.
Allow is and is! checks, == and !=, parameter references, and literals.

BUG=
R=asgerf@google.com

Review URL: https://codereview.chromium.org//1320143002 .
2015-08-28 16:14:43 +02:00
Asger Feldthaus ade4822108 dart2js cps: Generate interceptors at use-site and share afterwards.
Previously, interceptors were generated at the definition-site to ensure
sharing, and sometimes sunk to its use-site if desirable.

Now they are (again) generated at use-site, then pulled out of loops,
and replaced by dominating calls to getInterceptor.

This means interceptors are only computed if they really are needed,
but on the other hand, they are sometimes computed more than once, when
there are uses that don't have a common dominator.

Interceptor constants are currently not shared/hoisted as it is not
clear when this is beneficial.

R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1313783003 .
2015-08-28 16:02:16 +02:00
Johnni Winther c10a813f16 Move common URIs to common/names.dart
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org//1309743006.
2015-08-28 14:01:57 +02:00
Johnni Winther d8e5194c3b Add support for analyzing individual URIs.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1314973003.
2015-08-28 13:50:40 +02:00
Kevin Millikin 1e4469c144 dart2js CPS: Do not transform unreachable branches.
After type propagation, avoid transforming unreachable branches by
explicitly replacing them with Unreachable.  Also use the abstract boolean
value rather than the concrete constant value for branches, just as was
already done for type tests and casts.

R=asgerf@google.com
BUG=

Review URL: https://codereview.chromium.org//1309813009 .
2015-08-28 13:10:22 +02:00
Johnni Winther 876bad5b80 Add visitor methods specific to ??= to SemanticSendVisitor.
BUG=
R=karlklose@google.com, sigmund@google.com

Review URL: https://codereview.chromium.org//1313323002.
2015-08-28 10:17:24 +02:00
Asger Feldthaus 7624ec59da Revert "dart2js cps: Use dummy constant in dummy receiver optimization."
This reverts commit 4d20c86fd0.

BUG=

Review URL: https://codereview.chromium.org//1314373003 .
2015-08-27 17:08:59 +02:00
Asger Feldthaus 4d20c86fd0 dart2js cps: Use dummy constant in dummy receiver optimization.
Also addresses some other post-commit comments from
https://codereview.chromium.org/1312393002

BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org//1317903002 .
2015-08-27 11:34:00 +02:00
Asger Feldthaus ca9c113313 dart2js cps: Let effective constant expressions propagate further.
Constants would typically fail to propagate into an argument of a method
call in cases where the receiver of the call might be null. Constants
can safely propagate across the unsafe method lookup.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1315333002 .
2015-08-27 11:22:49 +02:00
Asger Feldthaus 82e95e3053 dart2js cps: Use a global counter to generate hash codes.
This gives almost 30x compile-time speedup on ImagingGaussianBlurOnce.

Based on profiling with Observatory, it seems to be a performance bug
in how hash codes are stored on objects. The majority of time is spent
in Object_GetHash, which does not compute a hash, but looks it up in a
weak hash table in the VM.

R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1311673009 .
2015-08-26 16:47:13 +02:00
Asger Feldthaus 0216e21efc dart2js cps: Use 'this' instead of receiver-arg when possible.
This fixes a bug in how intercepted super calls were handled,
and enables the redundant receiver optimization.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1312393002 .
2015-08-26 16:06:41 +02:00
Kevin Millikin e99fb4fc26 dart2js: Use the NoInline annotation on getInterceptor in the JS runtime.
This also requires fixing NoInline to work for the JS runtime.
Previously it was ignored.

R=karlklose@google.com
BUG=

Review URL: https://codereview.chromium.org//1315083002 .
2015-08-26 10:56:14 +02:00
Harry Terkelsen bc0deb66d7 dart2js: fetch http Resources
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org//1308143002 .
2015-08-25 10:46:27 -07:00
Kevin Millikin 90039f64ae dart2js CPS: simple inlining of static invocations.
Inline static functions whose bodies are a single Dart expression that
just calls a foreign (native) function.  This eliminates a lot of
overhead from the code in the JavaScript runtime library.

R=asgerf@google.com
BUG=

Review URL: https://codereview.chromium.org//1318453003 .
2015-08-25 13:31:46 +02:00