Commit Graph

4835 Commits

Author SHA1 Message Date
Stephen Adams 5ac49b5f29 dart2js cps_ir: BuiltinOperation improvements
Type propagation:

Added better type_propagation rules for various operators to detect more uint31/uint32/non-negative cases.
Moved the rules to per-operator code so the rules can be shared by invokes (e.g. '<') and the builtin operations they are lowered to (NumLt).
In the case of NumLt, this removes lower bounds checks from injected bounds checks (i.e. NumLt(index, 0)) for constant indexes by simple constant folding.

Bit operations:

The '>>> 0' coercion is often not needed.

If we can tell the result is in the uint31 range then the result
generated by JavaScript's bit operations will not have become
negative.

Added a tree analysis to codegen to tell if the result fits in uint31.
This works quite well and removes about as many coercions as SSA.
It misses some coercions due to lack of type information in tree_ir.

Added missing operators:

NumShr aka '>>>', valid on limited inputs.
NumDiv (Seems like a simple omission, boost some math code)
NumTruncatingDivideToSigned32

R=asgerf@google.com

Review URL: https://codereview.chromium.org/1393763004 .
2015-10-12 12:29:09 -07:00
Harry Terkelsen e067a52e44 dart2js: set effective target for patched constructors
Closes #24461

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

Review URL: https://codereview.chromium.org/1382313002 .
2015-10-12 11:19:00 -07:00
Asger Feldthaus 77eb3fb60f Revert "dart2js cps: Maintain parent pointers instead of recomputing them."
This reverts commit 6cc9b43535.

BUG=

Review URL: https://codereview.chromium.org/1386343003 .
2015-10-12 16:50:37 +02:00
Asger Feldthaus 6cc9b43535 dart2js cps: Maintain parent pointers instead of recomputing them.
All passes must now preserve valid parent pointers. Several passes
already did this (or tried to do it).

The IR integrity checker can now check that parent pointers are valid.
This has caught a number of missing parent pointers assignments in
passes that otherwise tried to preserve them.

All node constructors now set parent pointers. This is very convenient
for simple transformations, but also a bit of a trap since updating a
field on an existing node does not update the parent pointer.

This is a pretty heavy-handed change. The main rationale for it are:

- The helpers methods require parent pointers, so they are more useful
  when parent pointers are always set.

- The integrity checker can catch bogus parent pointers after passes
  that have to maintain them anyway.

- The integrity checker is super slow, but this can finally be fixed
  if it can assume parent pointers are valid (not part of this CL).

The IR visitors have been changed a bit to support a generic parent
visitor that does not have to implement every visit method.

The 'parent index' fields have been removed.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1375213003 .
2015-10-12 16:26:32 +02:00
Sigurd Meldgaard a763c71d92 Introduce the "Embedded" category.
It is not visible from the dart2js command line.

BUG=
R=brianwilkerson@google.com, johnniwinther@google.com

Committed: https://github.com/dart-lang/sdk/commit/0aef0efb6a38a65fa676fa9e8daa85a972521745
Reverted: https://codereview.chromium.org/1401513002

Review URL: https://codereview.chromium.org/1395863002 .
2015-10-12 12:15:48 +02:00
Johnni Winther ab5225a353 Introduce DartType.unaliased to avoid use of Resolution in the backend.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1397053002.
2015-10-12 11:28:56 +02:00
Johnni Winther 1414d9b27e Use common.dart to re-export commonly used entities.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1394063004.
2015-10-12 09:34:02 +02:00
Johnni Winther ec41c5f141 Introduce BackendImpact to separate enqueueing from data.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1397043002.
2015-10-09 15:00:54 +02:00
Sigurd Meldgaard 01d6977030 Revert "Introduce the "Embedded" category."
This reverts commit 0aef0efb6a.

BUG=

Review URL: https://codereview.chromium.org/1401513002 .
2015-10-09 13:29:53 +02:00
Sigurd Meldgaard 0aef0efb6a Introduce the "Embedded" category.
It is not visible from the dart2js command line.

BUG=
R=brianwilkerson@google.com, johnniwinther@google.com

Review URL: https://codereview.chromium.org/1395863002 .
2015-10-09 13:08:26 +02:00
Johnni Winther da0a18de44 Split RuntimesTypes into RuntimeTypes and RuntimeTypesEncoder
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org/1394213002.
2015-10-08 13:59:16 +02:00
Stephen Adams 5265eeebaa Use interceptors for is-checks (version 2).
Use the $isXXX properties for type tests on raw (non-parameterized) types.

Use special builtin operations for the weird JSArray type hierarchy.

Still TODO:

If the only use of an interceptor is a single 'getInterceptor(value).$isXXX', and XXX is not a supertype of a native type, replace with 'value instanceof XXX'.

R=kmillikin@google.com

Committed: https://github.com/dart-lang/sdk/commit/3b4e12f00bbdf2f5c16ca99c28300ebb63f794a9

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

Review URL: https://codereview.chromium.org/1385423002 .
2015-10-07 17:06:57 -07:00
Stephen Adams 89b6d8e749 Revert "Use interceptors for is-checks (version 2)."
Need to fix some analyzer warnings.

TBR=kmillikin@google.com

Review URL: https://codereview.chromium.org/1396663002 .
2015-10-07 16:29:11 -07:00
Stephen Adams 3b4e12f00b Use interceptors for is-checks (version 2).
Use the $isXXX properties for type tests on raw (non-parameterized) types.

Use special builtin operations for the weird JSArray type hierarchy.

Still TODO:

If the only use of an interceptor is a single 'getInterceptor(value).$isXXX', and XXX is not a supertype of a native type, replace with 'value instanceof XXX'.

R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1385423002 .
2015-10-07 15:47:25 -07:00
John McCutchan 98638457ce Remove final users of dart:profiler library
BUG=
R=turnidge@google.com

Review URL: https://codereview.chromium.org/1394533002 .
2015-10-07 09:27:22 -07:00
Stephan Herhut 80aa2a4cc0 Do not emit type metadata for classes that are only emitted for rti.
Classes only emitted for rti are empty shells and, even if they are
marked as reflectable, are not otherwise referenced from the program. So
we should not try to emit type metatdata because it is neither needed
for is it always complete (as most of the class, including its type
variables, is missing).

Fixes #24493.

BUG= http://dartbug.com/24493
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1394483002 .
2015-10-07 17:38:50 +02:00
Johnni Winther b3b7dc94ac Make computeSignature private to modelx.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1391193002.
2015-10-07 14:15:30 +02:00
Johnni Winther 5a68d6fa0e Avoid eager enqueueing from resolution
BUG=
R=sigurdm@google.com

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

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

Review URL: https://codereview.chromium.org/1376863004.
2015-10-07 10:41:23 +02:00
Johnni Winther e49a3e7d44 Limit hints on empty hide on package imports.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1382143005.
2015-10-06 15:13:13 +02:00
Johnni Winther a0ca16a773 Revert "Avoid eager enqueueing from resolution"
This reverts commit dda38dfe47.

BUG=

Review URL: https://codereview.chromium.org/1385183002.
2015-10-06 14:36:23 +02:00
Johnni Winther dda38dfe47 Avoid eager enqueueing from resolution
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1376863004.
2015-10-06 13:53:15 +02:00
Johnni Winther 76b7203c19 Extract DiagnosticReporter implementation from Compiler.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1383483006.
2015-10-06 10:24:44 +02:00
Sigmund Cherem 66db8a7f0e add tool to track memory watermark
R=sra@google.com

Review URL: https://codereview.chromium.org/1384833002 .
2015-10-05 10:20:36 -07:00
Florian Loitsch c2aa04db8b dart2js: Don't use "void" as field.
Although legal now, some engines don't like `void` as property name.

R=sra@google.com

Review URL: https://codereview.chromium.org/1377523007 .
2015-10-05 12:50:21 +02:00
Sigmund Cherem f2d97d17c5 dart2js: rename folder (stats -> info)
R=het@google.com

Review URL: https://codereview.chromium.org/1385443003 .
2015-10-02 11:31:32 -07:00
Sigmund Cherem 16ef5ef93b dart2js: fix analyzer warning
TBR=het@google.com

Review URL: https://codereview.chromium.org/1377293003 .
2015-10-02 11:30:24 -07:00
Sigmund Cherem 93f61f383e dart2js send stats, includes:
- initial visitor to collecting data about sends (incomplete)
- logic to emit data in a json summary file.
- logic to print summary information on the command-line
- logic to display some of the data in a web UI.

BUG=
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//1220043005 .
2015-10-02 11:10:41 -07:00
Asger Feldthaus f1a40e23c1 dart2js cps: Status updates and minor fixes for host checked mode.
CPS should now run the test suite cleanly in host-checked mode. Let's keep it that way.

BUG=
R=floitsch@google.com

Review URL: https://codereview.chromium.org/1377323003 .
2015-10-02 15:36:21 +02:00
Johnni Winther 9645292c03 Refactor resolution of foreign calls.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org//1384523003.
2015-10-02 10:45:35 +02:00
Harry Terkelsen 28a803d343 dart2js: improve ssa utilization of bool value types
BUG=
R=sra@google.com

Committed: https://github.com/dart-lang/sdk/commit/0b6ad019446096b7ecd6f0bdb80af9fb5cf16bc7

Review URL: https://codereview.chromium.org/1376603003 .
2015-10-01 14:08:18 -07:00
Johnni Winther d25224c212 Add Resolution and Parsing interfaces for computeType, ensureResolved and parseNode.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org//1383503002.
2015-10-01 11:39:38 +02:00
Stephen Adams 98531917c6 dart2js: Remove ConcreteTypeInference
R=sigmund@google.com

Review URL: https://codereview.chromium.org//1376113002 .
2015-09-30 15:21:58 -07:00
Harry Terkelsen 392544f717 Revert "dart2js: improve ssa utilization of bool value types"
This reverts commit 0b6ad01944.

BUG=

Review URL: https://codereview.chromium.org//1381793002 .
2015-09-30 12:54:22 -07:00
Harry Terkelsen 0b6ad01944 dart2js: improve ssa utilization of bool value types
BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org//1376603003 .
2015-09-30 11:37:44 -07:00
Florian Loitsch 773cb94c98 dart2js: provide a better error-message, when a backend doesn't support mirrors.
R=sigmund@google.com

Review URL: https://codereview.chromium.org//1382603002 .
2015-09-30 19:52:22 +02:00
Johnni Winther 86c76de237 Remove Registry arguments from Enqueuer.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org//1374243002.
2015-09-30 10:06:46 +02:00
Stephen Adams d978e7d45b dart2js cps_ir: Seed type_propagation with constant bools from inference.
Global type inference discovers interprocedural constants. Use this information at parameters and invocation return values.

R=asgerf@google.com

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

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

Review URL: https://codereview.chromium.org//1367353003 .
2015-09-29 15:24:12 -07:00
Stephen Adams 45caa197dd Revert "dart2js cps_ir: Seed type_propagation with constant bools from inference."
This reverts commit e04ff2f4f0.

Some tests need to be updated.

TBR=asgerf@google.com

Review URL: https://codereview.chromium.org//1381493003 .
2015-09-29 13:44:31 -07:00
Stephen Adams e04ff2f4f0 dart2js cps_ir: Seed type_propagation with constant bools from inference.
Global type inference discovers interprocedural constants. Use this information at parameters and invocation return values.

R=asgerf@google.com

Review URL: https://codereview.chromium.org//1367353003 .
2015-09-29 10:08:32 -07:00
Asger Feldthaus 808f5e2228 dart2js cps: Add helpers for common IR manipulation.
This adds four helpers:
- InteriorExpression: remove, insertAbove, and insertBelow.
- Primitive: destroy.

As discussed elsewhere, using such helpers is a double-edged sword.
They make the code easier to read and write, but it's easy to end up
with helpers that look like they work for a particular purpose, but
actually don't because of slight variations in different use-cases.

These methods have a couple of pitfalls, like forgetting to unlink
references after a call to `remove`, or accidentally using the body
of an orphaned node. But these are generally caught quickly in
checked-mode so, it seems like it will be worth it.

BUG=
R=kmillikin@google.com

Committed: https://github.com/dart-lang/sdk/commit/85f25787834ec7b5c09ceb7f9d5a27196c0ad11b

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

Review URL: https://codereview.chromium.org//1375513002 .
2015-09-29 13:09:00 +02:00
Asger Feldthaus e4536dd274 Revert "dart2js cps: Add helpers for common IR manipulation."
This reverts commit 85f2578783.

TBR=kmillikin@google.com

BUG=

Review URL: https://codereview.chromium.org//1380513002 .
2015-09-29 12:15:50 +02:00
Asger Feldthaus 85f2578783 dart2js cps: Add helpers for common IR manipulation.
This adds four helpers:
- InteriorExpression: remove, insertAbove, and insertBelow.
- Primitive: destroy.

As discussed elsewhere, using such helpers is a double-edged sword.
They make the code easier to read and write, but it's easy to end up
with helpers that look like they work for a particular purpose, but
actually don't because of slight variations in different use-cases.

These methods have a couple of pitfalls, like forgetting to unlink
references after a call to `remove`, or accidentally using the body
of an orphaned node. But these are generally caught quickly in
checked-mode so, it seems like it will be worth it.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1375513002 .
2015-09-29 11:26:19 +02:00
Harry Terkelsen 0132043db4 dart2js: add bool value types
Also optimize if-statements which have a condition with an inferred value

BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org//1371193004 .
2015-09-28 17:44:24 -07:00
Asger Feldthaus 3fa9c1f80a dart2js cps: LICM, GVN, and constify for interceptors in one pass.
Neither of these optimizations can "obviously" be placed before any of
the others without missing out on an optimization:

Constifying an interceptor makes it LICM'able because its dependency on
the input disappears. This suggests we should constify before LICM.

Interceptors in disjoint scopes might become sharable after LICM.
This suggests we LICM before sharing.

Constifying an interceptor can prevent sharing, because we "forget"
which input it came from. This suggests we share before constifying.

The last point could also be resolved by performing a stronger analysis
to determine which interceptors in scope are a valid substitute for a
given interceptor. But having everything in one pass isn't too bad.

BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org//1364703004 .
2015-09-28 13:55:22 +02:00
Asger Feldthaus 3cd331cbb6 dart2js cps: Logical rewriter should treat Throw as a terminator.
Because of this bug, the tree IR had a tendency to put throw
statements at the bottom of a method, even if it meant inserting
an explicit negation in a branch.

BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org//1368963002 .
2015-09-28 11:14:28 +02:00
Asger Feldthaus 75da9e4907 dart2js: Measure time of individual optimization passes.
Passing the -v flag to dart2js now prints the time spent in individual
optimization passes.

It should also be easier to throw in ad-hoc timing of specific
procedures for some quick-and-dirty timing measurements.

BUG=
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//1362953002 .
2015-09-25 12:49:52 +02:00
Johnni Winther 1590970ccc Report info messages together with their error, warning, or hint.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org//1363993004.
2015-09-24 15:08:29 +02:00
Johnni Winther f794df713b Enqueue superclasses instead of supertypes.
BUG=
R=herhut@google.com, karlklose@google.com

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

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

Review URL: https://codereview.chromium.org//1352533002.
2015-09-24 11:20:23 +02:00
Johnni Winther d6ea60bdfc Normalize constructor lookup.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org//1360153005.
2015-09-24 10:07:08 +02:00
Stephen Adams bb1998a825 Revert "dart2js: fix for https://github.com/dart-lang/sdk/issues/24412"
TBR=asgerf@google.com
BUG=

Review URL: https://codereview.chromium.org//1367783003 .
2015-09-23 18:07:23 -07:00