Commit Graph

4698 Commits

Author SHA1 Message Date
Florian Loitsch 5cb3da473b Update messages, and fix typing in test.
Review URL: https://codereview.chromium.org/1625213003 .
2016-01-25 13:41:03 +01:00
Florian Loitsch c849a62744 Generate dart2js and analyzer files for shared messages.
R=brianwilkerson@google.com, sigmund@google.com

Review URL: https://codereview.chromium.org/1582903003 .
2016-01-25 13:08:40 +01:00
Kevin Millikin cabf28ce87 dart2js: Turn the CPS inlining cache into a general compilation cache.
Cache function definition terms just before specializing them for their
arguments.  Use these cached terms for subsequent specializations and for
generic (non-specialized) compilation.

BUG=
R=asgerf@google.com

Review URL: https://codereview.chromium.org/1608953002 .
2016-01-25 12:02:53 +01:00
Kevin Millikin b1c627be70 dart2js: Flatten the code generation visitor a little bit.
Do not call visitStatement in tail position, do not call
List.generate (which calls its argument).

BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1608483004 .
2016-01-25 12:01:12 +01:00
Johnni Winther e333e631f3 Base JavaScript code position computation on JavaScript tracer.
Trace computation added in position_information.dart
Diff view tool added in diff_view.dart that utilizes the new computation and show coverage stats.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/1617083002.
2016-01-25 11:17:24 +01:00
Asger Feldthaus cc1111e23b dart2js cps: Tolerate refinements in more cases.
Useless branch elimination looks past dead refinements in the branches.

Redundant phi elimination ignores refinements, but is followed by an
UpdateRefinements pass to restore refinements again.

This is a step towards being able to land:
https://codereview.chromium.org/1576063003/

FIXES #25448

BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org/1620873003 .
2016-01-22 16:44:16 -08:00
Sigmund Cherem 7778f54141 Add missing parent pointers in CopyingVisitor
R=asgerf@google.com

Review URL: https://codereview.chromium.org/1626603002 .
2016-01-22 13:40:54 -08:00
Asger Feldthaus 762c41f9e4 dart2js cps: More rewritings for compound assignments.
Compound assignments are now generated for:

- SetStatic, previously only supported for SetField, SetIndex, and
  variable uses.

- SetField and SetIndex when the receiver is 'this', previously only
  supported for variable uses.

- String concatenation with >2 arguments, previously only supported
  with exactly 2 arguments.

BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org/1613853003 .
2016-01-22 11:22:03 -08:00
Stephen Adams 33ac12a5a4 Lower map literals to constructor or function calls in builder
Remove LiteralMap from cps_ir and tree_ir.

R=asgerf@google.com

Review URL: https://codereview.chromium.org/1616143003 .
2016-01-21 19:32:13 -08:00
Sigmund Cherem f466f30fdb dart2js: improve performance of TypeMask.intersection
R=asgerf@google.com

Review URL: https://codereview.chromium.org/1611783003 .
2016-01-21 11:12:12 -08:00
Stephen Adams ffa96cdeac Avoid using wrong 'adaptor' for native methods.
The Dart arity adaptor was adding default arguments to the call instead of calling with the given number of arguments.
The best way to fix this is to implement Issue 25548.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/1612773002 .
2016-01-21 08:44:22 -08:00
Sigmund Cherem e17d3d39ab Implement TypeMask.isDisjoint instead of using intersection.
R=sra@google.com

Review URL: https://codereview.chromium.org/1604333002 .
2016-01-20 14:18:16 -08:00
Stephen Adams d43365998d dart2js: switching isolate is not 'PURE'
R=asgerf@google.com

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

Reverted.

Review URL: https://codereview.chromium.org/1607373002 .
2016-01-20 12:59:24 -08:00
Stephen Adams ccd383309d Revert "dart2js: switching isolate is not 'PURE'"
TBR=asgerf@google.com
BUG=

Review URL: https://codereview.chromium.org/1607413002 .
2016-01-20 12:38:26 -08:00
Stephen Adams bbd105f106 dart2js: switching isolate is not 'PURE'
R=asgerf@google.com

Review URL: https://codereview.chromium.org/1607373002 .
2016-01-20 12:34:08 -08:00
Stephen Adams 94c08cfc27 Mark ForeignCode as isSafeForElimination when it has no effects or exceptions.
R=asgerf@google.com

Review URL: https://codereview.chromium.org/1609993002 .
2016-01-20 07:40:43 -08:00
Stephen Adams 905a1c862c Re-flow comment to force rebuild
TBR=sigmund@google.com

Review URL: https://codereview.chromium.org/1608773003 .
2016-01-19 18:35:53 -08:00
Stephen Adams 68c7404c4a Remove useless branches in shrinking_reductions.
R=asgerf@google.com

Review URL: https://codereview.chromium.org/1601863005 .
2016-01-19 17:41:02 -08:00
Asger Feldthaus aba2e1ea99 dart2js cps: Fix bug in pulling of assignments into a var.
BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org/1609943002 .
2016-01-19 16:55:45 -08:00
Asger Feldthaus b36e28171e dart2js cps: Update null checks when updating refinements.
Also run UpdateRefinements before second type propagation.

This cleans up a lot of redundant null checks in the output.

BUG=
R=sigmund@google.com

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

Review URL: https://codereview.chromium.org/1583263007 .
2016-01-19 14:56:58 -08:00
Asger Feldthaus 75f17171ce Revert "dart2js cps: Update null checks when updating refinements."
This reverts commit e5498d1500.

BUG=

Review URL: https://codereview.chromium.org/1605203002 .
2016-01-19 14:48:16 -08:00
Asger Feldthaus 07f43b5480 dart2js cps: Handle unsafe .length calls in bounds check elimination.
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1600973003 .
2016-01-19 14:37:31 -08:00
Asger Feldthaus 0b157e2963 dart2js cps: Fix codegen for instanceof checks.
With certain optimizations disabled the codegen would sometimes register
an unresolved class as being instantiated.

BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1595783002 .
2016-01-19 14:17:41 -08:00
Asger Feldthaus 4d93612ca7 dart2js cps: Fix return type for native functions.
Native functions would be translated into a ForeignCode instruction,
but the type mask was not set, so its return type was assumed to be
dynamic.

BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1607993002 .
2016-01-19 13:56:58 -08:00
Asger Feldthaus e5498d1500 dart2js cps: Update null checks when updating refinements.
Also run UpdateRefinements before second type propagation.

This cleans up a lot of redundant null checks in the output.

BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1583263007 .
2016-01-19 13:44:24 -08:00
Asger Feldthaus eab396d82b dart2js cps: Eliminate duplicate branches.
BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org/1585923010 .
2016-01-15 16:43:26 -08:00
Stephen Adams d7237c5275 Don't inline methods that only throw.
R=sigmund@google.com

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

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

Review URL: https://codereview.chromium.org/1587053003 .
2016-01-15 11:35:46 -08:00
Asger Feldthaus f123fa568d dart2js: Default to an empty set instead of null
The set of interceptor classes that can respond to a given selector
depends on which classes are considered instantiated by resolution.
It can therefore be empty even for intercepted selectors.
Do not surprise the caller by returning null.

BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1588733008 .
2016-01-15 09:29:12 -08:00
Asger Feldthaus 8226a28185 dart2js cps: Remove default call to visit return continuation.
There seems to be no use case for visiting the return continuation
automatically, and it's often causing problems.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1585073004 .
2016-01-15 09:26:50 -08:00
Stephen Adams 890e900c31 Don't inline methods that only throw.
R=sigmund@google.com

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

Reverted.

Review URL: https://codereview.chromium.org/1587053003 .
2016-01-14 21:20:24 -08:00
Stephen Adams 033d78c579 Don't inline methods that only throw.
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1587053003 .
2016-01-14 14:54:23 -08:00
Asger Feldthaus fb0330df46 dart2js cps: Improve constant folding of equality operators.
Previously we would only fold comparisons between primitive constants, missing out on e.g. the list sentinel comparisons.

BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org/1583993005 .
2016-01-14 14:01:20 -08:00
Asger Feldthaus 1b9a7e0be5 dart2js cps: Avoid comparing boolean values to boolean constants.
E.g. (x === true) can be replaced with x if x is a boolean.

Box2D has some code where this happens.

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

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

Review URL: https://codereview.chromium.org/1588813002 .
2016-01-14 13:01:31 -08:00
Asger Feldthaus 2680d9ab04 Revert "dart2js cps: Avoid comparing boolean values to boolean constants."
This reverts commit dd8ba75909.

BUG=

Review URL: https://codereview.chromium.org/1590523004 .
2016-01-14 12:55:42 -08:00
Asger Feldthaus dd8ba75909 dart2js cps: Avoid comparing boolean values to boolean constants.
E.g. (x === true) can be replaced with x if x is a boolean.

Box2D has some code where this happens.

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

Review URL: https://codereview.chromium.org/1588813002 .
2016-01-14 12:28:16 -08:00
Asger Feldthaus 2dd2a0d3f7 dart2js cps: Remove redundant traversal from variable merger pass.
This was a leftover from when we had nested functions in the IR.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1582033002 .
2016-01-14 10:52:58 -08:00
Asger Feldthaus 2bd0de209c dart2js cps: Use dartArgumentsLength instead of arguments.length
BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org/1589643004 .
2016-01-14 10:51:24 -08:00
Asger Feldthaus 27e2977dc7 dart2js cps: Fix traversal order in statement rewriter.
The statement rewriter uses a backward traversal, but the visitor for
yield and logical operator did not follow this order.

Fixes #25460

BUG=
R=het@google.com

Review URL: https://codereview.chromium.org/1584253003 .
2016-01-14 10:49:41 -08:00
Stephen Adams 1aab83e6dd Add cleanup ShrinkingReducer pass after second TypePropagation pass.
The need for cleanup shows up in
co19/LibTest/collection/DoubleLinkedQueue/forEachEntry_A01_t02

The compiler crashed: Internal Error: Unreachable continuations must be removed before computing loop side effects.

TBR=asgerf@google.com

Review URL: https://codereview.chromium.org/1586943002 .
2016-01-13 22:10:42 -08:00
Stephen Adams a56036b0a3 Do TypePropagation again after inlining
R=asgerf@google.com

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

Reverted.

Review URL: https://codereview.chromium.org/1560963002 .
2016-01-13 20:03:47 -08:00
Stephen Adams bec587aaf3 Revert "Do TypePropagation again after inlining"
Tests need to be updated.

TBR=asgerf@google.com

Review URL: https://codereview.chromium.org/1588723003 .
2016-01-13 15:45:33 -08:00
Stephen Adams 9392a2ece9 Do TypePropagation again after inlining
R=asgerf@google.com

Review URL: https://codereview.chromium.org/1560963002 .
2016-01-13 15:32:13 -08:00
Asger Feldthaus add29e3cba dart2js cps: Do redundant join elimination after inlining.
Redundant join elimination can enable optimizations in GVN and BCE, and
redundant joins can occur after inlining a method used in a condition,
such as isEmpty or isNotEmpty.

BUG=
R=het@google.com

Review URL: https://codereview.chromium.org/1581593004 .
2016-01-13 14:17:48 -08:00
Stephen Adams 9db58343b3 dart2js cps: for(;;) is shorter than while(true)
R=asgerf@google.com

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

Reverted.

Review URL: https://codereview.chromium.org/1584693003 .
2016-01-13 12:57:13 -08:00
Stephen Adams 33056a1ab8 Revert "dart2js cps: for(;;) is shorter than while(true)"
There are some tests I should have updated.

TBR=asgerf@google.com

Review URL: https://codereview.chromium.org/1582103002 .
2016-01-13 12:35:00 -08:00
Kevin Millikin 5c2125c9af dart2js: Flatten the printed representation of the CPS IR.
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1588543003 .
2016-01-13 20:59:57 +01:00
Stephen Adams dbb96bac32 dart2js cps: for(;;) is shorter than while(true)
R=asgerf@google.com

Review URL: https://codereview.chromium.org/1584693003 .
2016-01-13 10:25:41 -08:00
Florian Loitsch 45f4d82cde Revert shared dart2js messages.
This partially reverts commit e802e26d7b.
This reverts commit 6ecea2f559.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/1589493002 .
2016-01-13 18:32:55 +01:00
Florian Loitsch e775fa0932 Add support for 'dart.library.X' environment variables in dart2js.
R=johnniwinther@google.com, sigurdm@google.com

Committed: https://github.com/dart-lang/sdk/commit/369899c8ffca28f28a1af3cc323d1111c1a4a48a
Reverted: https://github.com/dart-lang/sdk/commit/b80994d6ad63ac30b400590cf51815e862c0e8a1

Review URL: https://codereview.chromium.org/1404183002 .
2016-01-13 16:34:46 +01:00
Asger Feldthaus a3cf74fdda dart2js cps: Copy allocation site type when cloning.
Currently makes no difference because type propagation is not run after
inlining, but it will be needed.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1581853002 .
2016-01-12 16:38:49 -08:00