Commit Graph

4835 Commits

Author SHA1 Message Date
Johnni Winther 7cbfcd69ca Updates from comments.
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1683063002 .
2016-03-08 10:36:58 +01:00
Johnni Winther 583fd470d8 Add source location to function declarations.
Temporarily adds source location to function declarations in the new source info system.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/1773553002 .
2016-03-08 10:30:13 +01:00
Florian Loitsch d41bce8cda Don't assume that we always have a HowToFix and remove failing test.
Also fix a typo.

Review URL: https://codereview.chromium.org/1769043002 .
2016-03-07 17:36:34 +01:00
Florian Loitsch dd326beee1 Move more messages.
Migrates some of the 'undefined' messages to the shared file.

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

Review URL: https://codereview.chromium.org/1750143005 .
2016-03-07 16:39:12 +01:00
Florian Loitsch 65b4256b9e Support multiple categories per message.
Also move more messages to use this feature.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org/1763373002 .
2016-03-07 16:37:57 +01:00
Sigmund Cherem cf78d296d7 Replace TypeMask.isEmpty by isEmptyOrNull, use isEmpty when it's really empty.
R=asgerf@google.com, sra@google.com

Review URL: https://codereview.chromium.org/1755823003 .
2016-03-03 15:04:32 -08:00
Asger Feldthaus 8c1475f186 dart2js cps: Bugfix in insert refinement pass.
The insert refinements pass would refine the interceptor instead of the
Dart receiver, when the interceptor is the "this" parameter.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1754253002 .
2016-03-03 13:49:16 +01:00
Johnni Winther 0a3de942ee Add --use-new-source-info option
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1750393002 .
2016-03-02 10:19:04 +01:00
Asger Feldthaus 396bf9ac15 dart2js cps: Reorder class definitions and run dartfmt.
Subclasses of Primitive and Expression have been grouped into separate
sections of cps_ir_nodes.dart.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1748413002 .
2016-03-01 15:34:19 +01:00
Asger Feldthaus dbaf47de5e dart2js cps: Remove receiverIsNotNull from CPS nodes.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1747213002 .
2016-03-01 14:56:45 +01:00
Asger Feldthaus e54c4c7003 dart2js cps: Use definitions by default, not references.
Example of new client code:
  x.object => x.objectRef
  x.object.definition => x.object
  x.arguments[n].definition => x.argument(n)

BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1743283002 .
2016-03-01 13:25:31 +01:00
Asger Feldthaus 6f3b69d365 dart2js cps: Refactor tracking of side effects.
Primitives now getter for its side effects, as a bitmask.

This avoids a lot of code duplication between GVN, BoundsChecker, and
LoopSideEffects.

There are more flags than those in the SideEffects class (which is used
by the SSA backend, foreign code annotations, and type inference).

We are going to need these extra flags in general, but I want to use
them in the CPS first to see how they work out.

Upcoming changes which are "loose ends" in this CL to keep it manageable:
- Simplify GvnVectorBuilder using dependency flags.
- Stop the overuse of isSafeForElimination.
- Add the extra flags to the rest of the compiler.

BUG=
R=sigmund@google.com

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

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

Review URL: https://codereview.chromium.org/1645053002 .
2016-02-29 15:41:02 +01:00
Asger Feldthaus a7fe3b140c Revert "dart2js cps: Refactor tracking of side effects."
This reverts commit 7f6c587de6.

BUG=

Review URL: https://codereview.chromium.org/1750583002 .
2016-02-29 15:29:31 +01:00
Asger Feldthaus 7f6c587de6 dart2js cps: Refactor tracking of side effects.
Primitives now getter for its side effects, as a bitmask.

This avoids a lot of code duplication between GVN, BoundsChecker, and
LoopSideEffects.

There are more flags than those in the SideEffects class (which is used
by the SSA backend, foreign code annotations, and type inference).

We are going to need these extra flags in general, but I want to use
them in the CPS first to see how they work out.

Upcoming changes which are "loose ends" in this CL to keep it manageable:
- Simplify GvnVectorBuilder using dependency flags.
- Stop the overuse of isSafeForElimination.
- Add the extra flags to the rest of the compiler.

BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1645053002 .
2016-02-29 15:10:07 +01:00
Asger Feldthaus a3804f6fc8 dart2js cps: Add SetLength instruction.
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1713983002 .
2016-02-29 12:42:16 +01:00
Kevin Moore 1c051f6c0f some analyzer fixes for compiler
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1724053002 .
2016-02-24 07:40:36 -08:00
Florian Loitsch 3df7b0c072 Remove triple-shift from dart2js.
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1719193002 .
2016-02-23 11:21:10 +01:00
Florian Loitsch b42775689f Fix too generic type for 'implementsFunction'.
Review URL: https://codereview.chromium.org/1723653002 .
2016-02-22 19:27:58 +01:00
Florian Loitsch 7db06aedc4 More shared messages.
R=brianwilkerson@google.com, sigmund@google.com

Review URL: https://codereview.chromium.org/1716463002 .
2016-02-18 22:13:15 +01:00
Florian Loitsch 4d26e4ec13 More shared messages.
R=brianwilkerson@google.com, sigmund@google.com

Review URL: https://codereview.chromium.org/1706033002 .
2016-02-18 17:21:04 +01:00
Asger Feldthaus 71fdc6687f dart2js cps: Rename duplicate_branch.dart to match the new pass name.
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1709623002 .
2016-02-18 10:44:28 +01:00
Florian Loitsch 3301bc7786 Use shared error for constructor's with return type.
Dart2js reports constructor's with return type, as long as the class is used.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/1704173002 .
2016-02-17 23:50:41 +01:00
Florian Loitsch 830ac68d05 Share const-error messages.
R=brianwilkerson@google.com, sigmund@google.com

Review URL: https://codereview.chromium.org/1700243002 .
2016-02-17 20:10:30 +01:00
Asger Feldthaus 95d4f72bba dart2js cps: Specialize shift-right calls.
Call _shrBothPositive, _shrReceiverPositive, or _shrOtherPositive if
the receiver and/or argument is known to be a UInt.

This matches what the SSA backend does.

BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1699833002 .
2016-02-17 13:58:27 +01:00
Asger Feldthaus e839697d70 dart2js cps: Constant folding for "uint < 0" etc.
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1701733002 .
2016-02-17 13:20:37 +01:00
Asger Feldthaus e19ab63840 dart2js cps: Count size of JS expressions in inliner.
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1696163002 .
2016-02-17 12:39:29 +01:00
Asger Feldthaus 1c698c183b dart2js cps: Fix inlining of stringify.
The rewrite Stringify(x) -> x.toString() is only safe when the toString
method is known to return a string.

BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1697373002 .
2016-02-17 10:57:58 +01:00
Asger Feldthaus e12baf9394 dart2js cps: Combine integer type check with bounds check.
The lower bounds check can be combined with the argument check using a
uint32 check:

  if (i >>> 0 !== i || i >= array.length)
      return H.ioore(array, i);

BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1699033003 .
2016-02-17 10:14:28 +01:00
Asger Feldthaus 64fa2ef505 dart2js cps: Do not inline string interpolation helper.
Inlining H.S(x) can lead to code like:
  x === 0 ? 1 / x < 0 ? "-0.0" : "" + x : "" + x

It does not help much to inline this and it can block more useful
inlinings because the extra code brings the caller over the inlining
threshold.

H.S(x) is replaced with x.toString$0(0) if x is a self-interceptor, and
the inliner is then allowed to continue inlining on that.

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

Review URL: https://codereview.chromium.org/1689933002 .
2016-02-15 10:58:01 +01:00
Sigmund Cherem 48b0df5fa1 cpsir: insert guard and force specialization for [] and []=
R=asgerf@google.com

Review URL: https://codereview.chromium.org/1685893002 .
2016-02-12 09:21:52 -08:00
Sigmund Cherem 648be1a299 fix warnings/test failures due to analyzer warnings, update stauts to include
analyzer missing error.

TBR=jacobr@google.com

Review URL: https://codereview.chromium.org/1687283003 .
2016-02-11 13:49:58 -08:00
Sigmund Cherem a0c438a972 cpsir: implementation of jsinterop in cps ir
R=jacobr@google.com

Review URL: https://codereview.chromium.org/1688433006 .
2016-02-11 13:21:52 -08:00
Florian Loitsch d8467b7e2d Don't allow to iterate over strings.
BUG= https://github.com/dart-lang/dart-pad/issues/716
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1689783002 .
2016-02-10 23:21:56 +01:00
Kevin Millikin 35839c7840 Dart2js CPS: Implement 'await for'.
The implementation strategy is in terms of a loop over a StreamIterator,
similar to what is done in the dart2js SSA backend and in the Dart VM.

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

Review URL: https://codereview.chromium.org/1686973002 .
2016-02-10 15:28:03 +01:00
Asger Feldthaus aeb36c9314 dart2js cps: Set the return type on adapters.
The return type of an adapter function was not set, preventing
further inlining of methods whose receiver depends on the return value.

CLOSES #25725.

BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1685643002 .
2016-02-10 11:47:35 +01:00
Asger Feldthaus 3f8fdc2434 dart2js cps: Update status files.
BUG=

Review URL: https://codereview.chromium.org/1686733003 .
2016-02-10 11:21:11 +01:00
Johnni Winther fcad7b6b5b Introduce getPrefixEndToken to avoid too big context in messages.
R=ahe@google.com

Review URL: https://codereview.chromium.org/1661853005.
2016-02-10 09:27:30 +01:00
Asger Feldthaus 00ad00c98c dart2js cps: Do not count no-check bounds checks in size visitor.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1681953002 .
2016-02-09 17:56:47 +01:00
Asger Feldthaus 35b6203b9d dart2js cps: Remove interceptors in cases where type propagation fails.
After calling a non-intercepted method on an object, that object is
known to be self-interceptor:

  x.foo$1()
  getInterceptor(x).$eq(x, y)
    ==>
  x.foo$1()
  x.$eq(0, y)

Type propagation would handle this if TypeMasks could represent a
type containing all self-intercepting classes (see issue #25646).

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1655183002 .
2016-02-09 17:52:09 +01:00
Johnni Winther 059f44aa3b Fix super noSuchMethod handling.
Closes #25680

- This CL fixes the handling of inapplicable noSuchMethod methods on superclasses (see issue 25671) for both SSA and CPS.
- The CPS implementation for normal noSuchMethod calls on super was wrong is fixed with this CL, including the addition the missing visitUnresolvedSuperSet method  on the SemanticSendVisitor.
- An error (presumably in type inference) affecting SSA was found with the added tests (Issue 25716 filed)

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

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

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

Review URL: https://codereview.chromium.org/1678053002.
2016-02-09 15:19:19 +01:00
Asger Feldthaus bbca76a5e2 dart2js cps: More aggressive operator specialization.
Inline more unsafe operator calls, and insert more checks accordingly.

When "num" is the only receiver that does not respond with NSM, insert
a check and use the builtin operator.  Previously we only did this when
the receiver was a number or null. For example:

  if (typeof x !== "number") return x.$lt();
  result = x < 4;

When the argument might have the wrong type, insert an argument check
and use the builtin operator.  Previously we never did this if the
argument might have the wrong type. For example:

  if (typeof x !== "number") return H.iae(x);
  result = 4 < x;

If both receiver and argument need checks, we join the two checks and
use a one-shot interceptor to throw the error:

  if (typeof x !== "number" || typeof y !== "number")
    return J.$lt(x, y);
  result = x < y;

NullCheck has been generalized to a ReceiverCheck instruction to
support "x.$lt()" above, that throws even if x is a non-null value.

BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1668913002 .
2016-02-09 13:34:37 +01:00
Johnni Winther a0d7b64fde Revert "Fix super noSuchMethod handling."
This reverts commit 756d95a372.

BUG=

Review URL: https://codereview.chromium.org/1677423002.
2016-02-09 13:02:31 +01:00
Asger Feldthaus 86f286a3eb dart2js cps: Pull SetFields into field initializer arguments.
For example:

    foo = new D.Foo(null, null);
    foo.x = 'a';
    foo.y = 'b';

becomes:

    foo = new D.Foo('a', 'b');

BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1671073002 .
2016-02-09 12:33:18 +01:00
Johnni Winther 756d95a372 Fix super noSuchMethod handling.
Closes #25680

- This CL fixes the handling of inapplicable noSuchMethod methods on superclasses (see issue 25671) for both SSA and CPS.
- The CPS implementation for normal noSuchMethod calls on super was wrong is fixed with this CL, including the addition the missing visitUnresolvedSuperSet method  on the SemanticSendVisitor.
- An error (presumably in type inference) affecting SSA was found with the added tests (Issue 25716 filed)

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

Review URL: https://codereview.chromium.org/1678053002.
2016-02-09 11:39:37 +01:00
Johnni Winther 1a4ba676ad Add Dart code to diff_view
+ update annotations to make nodes without information more visible
+ add annotation for unused source information
+ use source information from subnodes in variable declarations, assignments and expression statements (a fix triggered by showing unused information)
+ support source information for initial variable declarations
+ new source info is now comparable to the old; need to check source locations before  switch to the new

R=sigmund@google.com

Review URL: https://codereview.chromium.org/1678043003.
2016-02-09 11:25:26 +01:00
Johnni Winther d97da6f225 Report error on JS-interop operator [] and []= methods.
R=floitsch@google.com, jacobr@google.com, sigmund@google.com

Review URL: https://codereview.chromium.org/1651933002.
2016-02-08 12:57:15 +01:00
Florian Loitsch a9b8efcd0d Don't expose private libraries with dart.library.X.
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/1674613002 .
2016-02-05 17:36:14 +01:00
Asger Feldthaus 703a7fcc6d dart2js cps: More type rules in type propagation.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1657613004 .
2016-02-05 12:10:23 +01:00
Florian Loitsch 6468ba5022 Share the first error messages.
R=brianwilkerson@google.com, johnniwinther@google.com

Review URL: https://codereview.chromium.org/1660703002 .
2016-02-04 12:52:39 +01:00
Florian Loitsch 2232803eae Don't use "var" to introduce the deferred_initializer.
R=het@google.com

Review URL: https://codereview.chromium.org/1653453002 .
2016-01-29 21:52:52 +01:00