Commit Graph

1634 Commits

Author SHA1 Message Date
Stephen Adams dc95698672 Type inference cleanup
- No longer attribute queries to type inference. Queries are attributed to client.

- Remove vestigial CPA code

- Don't compare target sets for additions and deletions if they are
  the same (most of the time we revisit the dynamic call site due to
  a change in a returned result).

R=sigmund@google.com

Review URL: https://codereview.chromium.org/1777393003 .
2016-03-10 17:25:22 -08:00
Johnni Winther b31a2566d4 Use specific messages for const constructor with body.
BUG=
R=floitsch@google.com

Review URL: https://codereview.chromium.org/1768143003 .
2016-03-10 10:09:17 +01:00
Stephen Adams ae13804e09 dart2js: Destroy some type inference graph edges after type inference.
Removing the `_assignments` and `users` collections from TypeInformation
nodes causes interior nodes (e.g. Phi, Narrow) to become unreachable and
available for GC. This seems to trim 1%-5% off the final heap of an SSA
compile.

R=sigmund@google.com

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

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

Review URL: https://codereview.chromium.org/1776533002 .
2016-03-09 16:45:19 -08:00
Stephen Adams 9292d1bc2b Revert "dart2js: Destroy some type inference graph edges after type inference."
BUG=

Review URL: https://codereview.chromium.org/1775253004 .
2016-03-09 14:07:48 -08:00
Stephen Adams 42070892a4 Create map for dump_info on demand.
Saves about 1% of heap for non --dump-info compile.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/1777823002 .
2016-03-09 13:15:05 -08:00
Stephen Adams e85ac19134 dart2js: Destroy some type inference graph edges after type inference.
Removing the `_assignments` and `users` collections from TypeInformation
nodes causes interior nodes (e.g. Phi, Narrow) to become unreachable and
available for GC. This seems to trim 1%-5% off the final heap of an SSA
compile.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/1776533002 .
2016-03-09 12:47:10 -08:00
Asger Feldthaus 40f6c6934c dart2js cps: Do field calls directly instead going through the adapter.
E.g. obj.foo$1(x) becomes obj.foo.call$1(x).

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1776473006 .
2016-03-09 15:59:49 +01:00
Asger Feldthaus cb46f224f6 dart2js cps: Inline constructor bodies that are only called once.
ConstructorBodyElements do not exist in the type inference graph, so
we can't rely on it to tell us if such a method has a single call site.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1779723002 .
2016-03-09 14:00:25 +01:00
Johnni Winther 7b7cfb66ab Add source information to variable declarations in CPS.
This adds a source mapping to variable declarations in the beginning of a JS function, that points to the start of the corresponding Dart method:

foo: function() {
  var a, b;
  ^

maps to

foo() {
      ^

R=sigmund@google.com

Review URL: https://codereview.chromium.org/1772703002 .
2016-03-09 10:02:16 +01:00
Stephen Adams d367741ead Recognize identical() ConstantValues as equal.
This fast path is not used when interning ConstantValues but is
beneficial when the ConstantValue is the key of a HashMap.

BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1777483006 .
2016-03-08 17:18:27 -08:00
Stephen Adams ea480cdf0f Fix typo in TypeInformationSystem.joinTypeMasks
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1771253002 .
2016-03-08 10:55:15 -08:00
Asger Feldthaus 7772152fa1 dart2js cps: Keep interceptors in a separate field.
Previously, the "receiver" of an InvokeMethod would be either be the
"Dart receiver" or an interceptor, depending on the calling convention.
Likewise, the argument list was possibly prefixed by the Dart receiver.

Now, the receiver is always the Dart receiver, and the arguments are
the Dart arguments and the interceptor is in a field specific for the
interceptor.

The old way was very inconvenient in the CPS, it has led to several
bugs already, and it's just unintuitive that "receiver" can mean two
very different things.

FunctionDefinition no longer has a thisParameter, but
instead a receiverParameter and an interceptorParameter.  These are
named to correspond exactly with the names used in InvokeMethod.

The concept of 'this' has been removed from the CPS IR to hopefully
avoid confusion between 'Dart this' and 'JS this'.  There is now only
receiver and interceptor, and which one corresponds to the JS 'this'
is irrelevant.

The Tree IR has not changed.  The Tree IR builder is thus responsible
for translating the calling convention into the JS receiver and
argument list.  The Tree needs to know the order in which the operands
are evaluated, so it makes sense to keep this form in the Tree.

R=sra@google.com

Review URL: https://codereview.chromium.org/1761903002 .
2016-03-08 13:43:20 +01:00
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