Commit Graph

4698 Commits

Author SHA1 Message Date
Harry Terkelsen 666964b3fc dart2js cps: specialize isEmpty and isNotEmpty
BUG=
R=asgerf@google.com

Review URL: https://codereview.chromium.org/1583663003 .
2016-01-12 15:55:50 -08:00
Asger Feldthaus c85916dedc dart2js cps: Hoist unsafe expressions from loop entry.
Primitives that potentially throw cannot normally be hoisted, but we can
sometimes hoist them anyway if they are at the loop entry.

We now hoist GetLength, GetField, GetIndex, NullCheck, and BoundsCheck.

BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1578963002 .
2016-01-12 15:18:31 -08:00
Asger Feldthaus e6cc028c6f dart2js cps: Preserve parameter hints during eta and beta reductions.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1582643002 .
2016-01-12 15:12:51 -08:00
Harry Terkelsen 32dc120668 dart2js: fix type annotation
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1580593006 .
2016-01-12 10:57:48 -08:00
Kevin Millikin 1791fb62de dart2js: Remove rethrow from the Tree IR.
BUG=
R=asgerf@google.com

Review URL: https://codereview.chromium.org/1580613002 .
2016-01-12 10:49:25 -08:00
Harry Terkelsen c08bcf530d dart2js: lazily load fields in their own deferred parts
Fixes #24356

BUG=
R=floitsch@google.com

Review URL: https://codereview.chromium.org/1575603002 .
2016-01-12 10:40:41 -08:00
Kevin Millikin 5180cef547 dart2js: Simplification of the IrBuilderVisitor.
Remove more simple helpers by inlining them and simplify.

BUG=
R=asgerf@google.com

Review URL: https://codereview.chromium.org/1570603006 .
2016-01-12 09:15:24 -08:00
Florian Loitsch b80994d6ad Revert "Add support for 'dart.library.X' environment variables in dart2js."
This reverts commit 369899c8ff.

Review URL: https://codereview.chromium.org/1573243004 .
2016-01-12 14:41:00 +01:00
Florian Loitsch 369899c8ff Add support for 'dart.library.X' environment variables in dart2js.
R=johnniwinther@google.com, sigurdm@google.com

Review URL: https://codereview.chromium.org/1404183002 .
2016-01-12 13:58:46 +01:00
Lasse R.H. Nielsen fd59c87146 Make ?? a compile-time constant operator.
Update specification, change analyzer, VM and dart2js.

Fixes issue #25054.
BUG= http://dartbug.com/25054
R=floitsch@google.com, gbracha@google.com

Review URL: https://codereview.chromium.org/1493693002 .
2016-01-12 12:30:07 +01:00
Stephen Adams 133493c5c9 Fix BoundsCheck copying.
The length may be null for a lower-only check.

Review URL: https://codereview.chromium.org/1579073002 .
2016-01-11 19:59:55 -08:00
Asger Feldthaus d432ec78c0 dart2js cps: Remove inlining from TypePropagator.
It seems wasteful to do inlining in two places.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1575103003 .
2016-01-11 17:50:49 -08:00
Harry Terkelsen 41dde543fe dart2js: remove resolved TODO
The answer to the question in the TODO ("does this cover all cases?") is yes.
In Dart, the LHS of a for-in loop must be an identifier. It cannot be a super
access or a static variable access (unless that variable is in scope).

BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org/1580493003 .
2016-01-11 15:41:21 -08:00
Stephen Adams 7f724c151d Null check remover understands JS fragments.
This is an SSA-parity item.

R=asgerf@google.com

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

Reverted.

Review URL: https://codereview.chromium.org/1567103006 .
2016-01-11 14:33:17 -08:00
Sigmund Cherem 714bf980e1 cpsir: fix co19 test - use process* instead of visit* (we unadvertly removed code that recursed into the arguments)
BUG=
R=asgerf@google.com

Review URL: https://codereview.chromium.org/1572423002 .
2016-01-11 14:19:20 -08:00
Stephen Adams 62c30c6c21 Revert "Null check remover understands JS fragments."
BUG=

Review URL: https://codereview.chromium.org/1577993005 .
2016-01-11 14:11:19 -08:00
Stephen Adams 1576feeb23 Null check remover understands JS fragments.
This is an SSA-parity item.

R=asgerf@google.com

Review URL: https://codereview.chromium.org/1567103006 .
2016-01-11 13:42:17 -08:00
Asger Feldthaus 4f1d09e208 dart2js cps: Fix a comment.
BUG=

Review URL: https://codereview.chromium.org/1579713002 .
2016-01-11 11:08:10 -08:00
Sigmund Cherem 0f626270ad cps_ir: add refinement on "success" arguments for a set of whitelisted methods
and operators.

R=asgerf@google.com

Review URL: https://codereview.chromium.org/1571953002 .
2016-01-11 10:48:14 -08:00
Asger Feldthaus 41412aaa70 dart2js cps: Hoist loop-invariant branches from loop entry.
Performs the following optimization:

  b = COND
  while (true) {
    if (b)
      BRANCH (contains no continue to loop)
    else
      LOOP
  }

==>

  b = COND
  if (b)
    BRANCH
  else
    while (true)
      LOOP

BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org/1573693002 .
2016-01-11 10:06:40 -08:00
Asger Feldthaus 4e0a152f63 dart2js cps: Do not count refinement nodes when measuring size.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1570353002 .
2016-01-11 09:15:59 -08:00
Asger Feldthaus e3a9b74b56 dart2js cps: Do not remove unused refinements.
Unused refinements may become used after GVN.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1572043002 .
2016-01-11 09:13:03 -08:00
Johnni Winther 2ddf46bb85 Add EnumSet.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1568213003.
2016-01-11 11:29:44 +01:00
Kevin Millikin aa21250b7a dart2js: Fix build.
When moving code, I forgot to change a parameter type.  This triggered a
warning.

TBR=asgerf@google.com

Review URL: https://codereview.chromium.org/1572673005 .
2016-01-08 17:38:31 -08:00
Kevin Millikin ad0b2701bb dart2js: Start creating IR nodes in the IrBuilderVisitor class.
BUG=
R=asgerf@google.com

Review URL: https://codereview.chromium.org/1574543003 .
2016-01-08 16:13:10 -08:00
Asger Feldthaus 7127119f6d dart2js cps: Do GVN for all primitives except fast constants.
Previously, trivial primitives such as "x+1" would not be hoisted.
Only fast constants are considered trivial now.

This is mainly to enable other optimizations.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1573473003 .
2016-01-08 15:38:13 -08:00
Asger Feldthaus afd7a91da4 dart2js cps: Name labels uniquely within each method, not globally.
Apart from a slight code size benefit, this should also make the diff
more stable.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1575593002 .
2016-01-08 14:15:37 -08:00
Kevin Millikin 5aedac787a dart2js: Eliminate the JsIrBuilderVisitor.
Since there is only one subclass of IrBuilderVisitor, make IrBuilderVisitor
non-abstract and move all the subclass methods to it.

BUG=
R=asgerf@google.com

Review URL: https://codereview.chromium.org/1567403004 .
2016-01-08 13:07:16 -08:00
Asger Feldthaus 8eb030b419 dart2js cps: Fix for tear-off of noSuchMethod or toString on null.
Some optimizations would assume that null.toString and null.noSuchMethod
would throw because these selectors were not whitelisted as non-throwing.

BUG=

Review URL: https://codereview.chromium.org/1570813003 .
2016-01-08 12:49:59 -08:00
Stephen Adams aa85691ddd Specializations of instance methods have non-null receiver.
A null check is inserted before the inlined code.
This occasionally removes a few null checks at inlining sites within the inlinee.

R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1568103003 .
2016-01-08 11:59:19 -08:00
Stephen Adams 1c1a0196f3 Copy all fields of NullCheck
Failing to copy the condition and selector lead to an inlined check that should have been

   if (typeof v0 !== "number") return v0.$add;

becoming

   v0.toString;

R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1564423002 .
2016-01-08 11:14:10 -08:00
Asger Feldthaus 11c7ad4d6f dart2js cps: Compute intercepted classes in optimize_interceptors.
There was previously an optimization in type propagation that replaced
getInterceptor(x) with x, but this depends on the set of intercepted
classes (since null may or may not need interception).

That optimization is now handled at the use-site of the interceptor,
since each use knows if it needs null to be intercepted.

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

Review URL: https://codereview.chromium.org/1571433002 .
2016-01-08 10:06:09 -08:00
Asger Feldthaus c59ef7d792 dart2js cps: Copy calling convention for InvokeMethodDirectly.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1562253003 .
2016-01-07 12:06:31 -08:00
Stephen Adams 0ed95c7737 Use propagated type of receiver to determine return type, not type-inference type.
The type-inference result is missing for some calls and might be less precise since type propagation happens after some simplification.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1566653004 .
2016-01-07 10:59:08 -08:00
Stephen Adams ac0d8dbd81 Fix null receiver guard on uncached path.
We has two copies of the inlining preparation code, so I put it in a local function.

This fixes some of the errant .toString guards but not all.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1561953005 .
2016-01-07 10:22:40 -08:00
Johnni Winther c6f0d75d81 Specialize message for parts as entry point
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1564803002.
2016-01-07 09:50:49 +01:00
Asger Feldthaus 33b1d52057 Improve null-check elimination and change backward traversal strategy.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1569593002 .
2016-01-06 17:25:39 -08:00
Asger Feldthaus d2a6980c1c dart2js cps: Generate increment and compound operators.
Expressions like `i = i + E` now become `i += E` or `++i` if E=1.

The same applies for field and index access.

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

Review URL: https://codereview.chromium.org/1562893002 .
2016-01-06 16:56:33 -08:00
Asger Feldthaus eadb59e4c1 dart2js cps: Eliminate unary string concatenation.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1563983002 .
2016-01-06 16:18:00 -08:00
Kevin Millikin 97b88e4ee7 dart2js: Do not inline when try is seen.
Do not inline in functions containing try, do not inline functions
containing try.  V8 does not optimize functions containing try, so
inlining in such functions or inlining such functions will make
potentially optimizable code become unoptimizable.

This repairs a large performance regression on the Angular 2 change
detection benchmarks.

R=sra@google.com
BUG=

Review URL: https://codereview.chromium.org/1554083002 .
2016-01-06 23:24:19 +01:00
Stephen Adams 55e8ae0e10 Copier should copy InvokeMethod calling convention
R=asgerf@google.com

Review URL: https://codereview.chromium.org/1564713002 .
2016-01-06 13:07:11 -08:00
Sigmund Cherem e2623f1aea cpsir: add support for deferred code
R=asgerf@google.com

Review URL: https://codereview.chromium.org/1558353002 .
2016-01-06 10:24:52 -08:00
Asger Feldthaus 8d7c326979 dart2js cps: Disable RHS propagation in operands to builtin operators.
Previously we would get code like `x == (y = null)`, which confuses
the JS engine.  It is better to have `y = null` and `x == null` separate.

BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org/1563693002 .
2016-01-06 07:44:05 -08:00
Johnni Winther 306537be79 Add test of unittests.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1562023002.
2016-01-06 13:19:41 +01:00
Johnni Winther 812527f5b3 Make NamedMixinApplicationElementX and EnumClassElementX implement DeclarationSite.
BUG=
R=ahe@google.com

Review URL: https://codereview.chromium.org/1504763003.
2016-01-06 11:54:20 +01:00
Asger Feldthaus e9f211962a dart2js cps: Fix some analyzer hints in the CPS backend.
BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org/1560433003 .
2016-01-05 13:41:39 -08:00
Stephen Adams 731b9894b2 dart2js: minify 'static:' tag
(For now, only in frequency based renamer)

R=sigmund@google.com

Review URL: https://codereview.chromium.org/1540973005 .
2015-12-28 16:12:06 -08:00
Stephen Adams 712574058a Better NullCheck for null-or-number
R=het@google.com

Review URL: https://codereview.chromium.org/1550463002 .
2015-12-28 12:06:15 -08:00
Kevin Millikin 044b283a3c dart2js: Initial implementation of inlining.
Perform a depth-first postorder traversal of the call graph of known
functions.  Make an inlining decision based on the vector of argument
types at the call site, and cache inlining decisions.  For positive
inlining decisions, cache the optimized function body specialized to
the receiver and argument types at the call site.

Future work:
  * Real inlining heuristics.
  * Propagate result types of inlined calls.
  * Specialized for constant arguments when it makes sense.
  * Performance improvements.

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

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

Review URL: https://codereview.chromium.org/1537663002 .
2015-12-23 10:12:19 +01:00
Stephen Adams db2d6b798f dart2js: format 'static' sections better.
Unminified: each property goes on a new line.
minified: ignore the isOneLiner directive until a function is seen.

This makes unminified static functions easier to read, and makes minified swarm 0.3% smaller (but almost no different after gzip).

R=sigmund@google.com

Review URL: https://codereview.chromium.org/1548793002 .
2015-12-22 14:45:23 -08:00