Commit Graph

4698 Commits

Author SHA1 Message Date
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
Stephen Adams 0bd5cc5f70 dart2js: fix for https://github.com/dart-lang/sdk/issues/24412
The regression on some benchmarks was caused by
UnknownJavaScriptObject becoming alive.  Changing the test to 'is' reverts the regression.

Also make the cps_ir register UnknownJavaScriptObject when generating try-catch as that might snag a JavaScript error.

BUG= https://github.com/dart-lang/sdk/issues/24412
R=asgerf@google.com

Review URL: https://codereview.chromium.org//1366673003 .
2015-09-23 17:27:16 -07:00
Stephen Adams 8852bf9e14 dart2js: fix nondeterministic output of type metadata.
Use consistent hashcode for deferred index into metadata.
Slightly nicer names for type constants in non-minified mode.

C.Type_k8F -->  C.Type_String_k8F

BUG= http://dartbug.com/24391
R=het@google.com

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

Review URL: https://codereview.chromium.org//1358363002 .
2015-09-23 17:08:27 -07:00
Stephen Adams db811d2e20 Revert "dart2js: fix nondeterministic output of type metadata."
BUG=

Review URL: https://codereview.chromium.org//1367723005 .
2015-09-23 16:09:43 -07:00
Stephen Adams 4cb72d2baf dart2js: fix nondeterministic output of type metadata.
Use consistent hashcode for deferred index into metadata.
Slightly nicer names for type constants in non-minified mode.

C.Type_k8F -->  C.Type_String_k8F

BUG= http://dartbug.com/24391
R=het@google.com

Review URL: https://codereview.chromium.org//1358363002 .
2015-09-23 15:52:55 -07:00
Sigurd 1c3dd67408 Avoid warning when using return; from sync* and async* functions.
Fixes https://github.com/dart-lang/sdk/issues/24406

R=johnniwinther@google.com

Committed: https://github.com/dart-lang/sdk/commit/75f80a204b98ebd65a5da1f2c1db6c6388d67887
Reverted: https://github.com/dart-lang/sdk/commit/8163c4a14199314b6fad626de61d031a35b4d2c1

Review URL: https://codereview.chromium.org//1367433002 .
2015-09-23 13:50:56 +02:00
Sigurd 8163c4a141 Revert "Avoid warning when using return; from sync* and async* functions."
This reverts commit 75f80a204b.

BUG=

Review URL: https://codereview.chromium.org//1361813003 .
2015-09-23 12:21:52 +02:00
Florian Loitsch f36b8aa4e4 dart2js: Make sure that super classes have their inheritance chain set up correctly.
This bug was only happening for the --fast-startup.
For most browsers we simply change the '__proto__' and the order wouldn't be important. However, for the other browsers we have to do it in order.

R=sigmund@google.com

Review URL: https://codereview.chromium.org//1347423003 .
2015-09-23 11:48:18 +02:00
Sigurd 75f80a204b Avoid warning when using return; from sync* and async* functions.
Fixes https://github.com/dart-lang/sdk/issues/24406

R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//1367433002 .
2015-09-23 11:07:31 +02:00
Karl Klose e28e578731 dart2js cps: Support sync* and yield.
R=asgerf@google.com, kmillikin@google.com

Review URL: https://codereview.chromium.org//1353843002 .
2015-09-23 11:01:34 +02:00
Florian Loitsch 5461f0f5cd dart2js: Don't return null from void functions.
R=sigmund@google.com

Review URL: https://codereview.chromium.org//1348573004 .
2015-09-22 11:10:33 +02:00
Asger Feldthaus e97d32be50 Revert "dart2js cps: Change type tests to null tests when applicable."
This reverts commit 29dedfa97e.

This triggers an assertion failure.

BUG=

Review URL: https://codereview.chromium.org//1358843002 .
2015-09-21 14:17:54 +02:00
Asger Feldthaus 29dedfa97e dart2js cps: Change type tests to null tests when applicable.
When null is the only value that might fail a type test we can
rewrite it to just compare against null.

R=kmillikin@google.com, sra@google.com

Review URL: https://codereview.chromium.org//1306773005 .
2015-09-21 13:33:16 +02:00
Asger Feldthaus 8c6b990305 dart2js cps: Set receiver-nullability in analysis pass.
Setting receiverIsNotNull, objectIsNotNull in the analysis pass
simplifies the transformation pass since predicates like
'isSafeForElimination' depend on them.

This would prevent constant folding of array lengths since
GetLength was not marked as safe for elimination at the
time it was considered for constant folding.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1348233002 .
2015-09-21 12:43:26 +02:00
Asger Feldthaus ccb3af54ab dart2js cps: Set result of 'await' to dynamic instead of empty.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1349723002 .
2015-09-21 11:37:39 +02:00
Stephen Adams 19f2296576 Nicer error for JS() form with mismatched arguments.
R=sigmund@google.com

Review URL: https://codereview.chromium.org//1353243002 .
2015-09-18 18:51:47 -07:00
Stephen Adams d0c00d2b61 Throw Error on unreachable code rather than throwing a String.
Still under a 'flag'.
Enable with:

  DART_VM_OPTIONS=-Dunreachable-throw=true  <compile>

These tests fail with an [empty] input to createRuntimeType.

DART_VM_OPTIONS=-Dunreachable-throw=true  tools/test.py -mrelease -cdart2js -rd8 dart2js_extra/deferred/deferred_mirrors1_test
DART_VM_OPTIONS=-Dunreachable-throw=true  tools/test.py -mrelease -cdart2js -rd8 dart2js_extra/mirrors_used_warning2_test
R=sigmund@google.com

Review URL: https://codereview.chromium.org//1355873003 .
2015-09-18 16:54:50 -07:00
Kevin Millikin 454278872a dart2js CPS: Fix a bug in the generic Tree transformer.
When I was experimenting with inlining, I triggered a violation of the Tree
integrity checker after variable merging, because variable uses in the
typeInformation were not rewritten.

R=asgerf@google.com
BUG=

Review URL: https://codereview.chromium.org//1356903002 .
2015-09-18 16:59:33 +02:00
Kevin Millikin 19d7f93dad dart2js CPS: Small cleanup of the compilation pipeline.
Apply all the optimization passes uniformly.  Rename CpsIR to CpsIr
and TreeIR to TreeIr.

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

Review URL: https://codereview.chromium.org//1344173005 .
2015-09-18 14:13:18 +02:00
Kevin Millikin b97a6bc0c9 dart2js CPS: Clean up the S-Expression builder.
* Type annotations were not correct anymore, since we refactored type
  propagation.

* Continuations were not decorated.  This meant that they weren't marked
  with '**' when they caused an integrity violation.

* There was a bug in the arity of calls to _currentIsolate that manifested
  when trying to build the argument list string.

* Formatting needed some small cleanups.

R=karlklose@google.com
BUG=

Review URL: https://codereview.chromium.org//1345983007 .
2015-09-18 11:31:35 +02:00
Stephan Herhut 75b48722bc Abandon type inference on closures that (potentially) flow into Function.apply.
Type inference uses the closure tracer to decide whether it has sufficient global
information to compute an actual type on a closure. If tracing fails, it will
abandon type inference for that closure. However, we no longer fail tracing just
because a closure flows into Function.apply, as this still means that we have
seen all use sites. Unfortunately, type inference does not understand that
Function.apply is actually a call site (and we lack other information to make
this knowledge worthwhile). So it concludes that the closure is never called.
With this fix, it now correctly abandons inference again.

The second issue was that we only take default values into account when looking
at a call site (so that we only use them if they are actually used). This can be
decided statically unless we loose track or there is a call to Function.apply.
I have added an extra edge to the use-graph so that there now always is a use
edge from a default to the parameter. While this is conservative, it will only
affect tracing and thus only the types of traced entities that are used as
default should be impacted.

BUG= http://dartbug.com/24297
R=sigmund@google.com, sra@google.com

Review URL: https://codereview.chromium.org//1355563002 .
2015-09-18 10:13:34 +02:00
Stephen Adams a2239c2dee dart2js ssa: Inlining heuristics ignore assert() statement size.
assert() Ast nodes are not counted towards inlinee size in production mode.

R=sigmund@google.com

Review URL: https://codereview.chromium.org//1345413002 .
2015-09-17 09:44:32 -07:00
Johnni Winther b1ecbf10d4 Revert "Enqueue superclasses instead of supertypes."
This reverts commit a118955a2b.

BUG=

Review URL: https://codereview.chromium.org//1354603002.
2015-09-17 14:02:46 +02:00
Johnni Winther a118955a2b Enqueue superclasses instead of supertypes.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1352533002.
2015-09-17 13:28:31 +02:00
Johnni Winther ecb1e33a7f Report hint on unmatched show and hide combinators.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1346133002.
2015-09-17 12:33:17 +02:00
Johnni Winther 573c1c68e4 Rename ReceiverMask and ReceiverMaskSet and update comments.
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org//1342933006.
2015-09-17 10:41:04 +02:00
Stephen Adams 0b9e80edbf 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

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

Review URL: https://codereview.chromium.org//1342213003 .
2015-09-16 16:47:40 -07:00
Stephen Adams 37be70525b Revert "Add optional message to assert in Dart2js - continued"
To be re-applied with .status changes.

TBR=sigmund@google.com

Review URL: https://codereview.chromium.org//1346093003 .
2015-09-16 16:37:10 -07:00