Commit Graph

4835 Commits

Author SHA1 Message Date
Harry Terkelsen c38de336c7 Throw an error early when dump info is used with the startup emitter.
The compiler will crash at the very end of the compilation with a cryptic
error message if dump info is used with the fast startup emitter.

BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1866403002 .
2016-04-07 12:38:48 -07:00
Harry Terkelsen 29cf477139 dartfmt pkg/compiler
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1859343004 .
2016-04-07 10:00:53 -07:00
Johnni Winther 450116f9d8 Add Visitor1<R, A>
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1863403002 .
2016-04-07 11:16:21 +02:00
Johnni Winther ee2fc29142 Test closed world model after deserialization.
We still need better tracking of native/foreign elements.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/1856953003 .
2016-04-06 11:30:20 +02:00
Stephen Adams 551546622b Avoid Object.hashCode on a few objects
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/1861563002 .
2016-04-05 09:13:28 -07:00
Erik Ernst 586c43ac7e Repeats and fixes the changes landed & reverted as CL 1789553003.
When landed, CL 1789553003 turned out to cause bot failures because
some libraries outside the compiler are importing compiler libraries
which have been updated. For instance, the tests in 'compiler/dart2js'
depend on several internal elements of the 'dart2js' compiler.

This CL updates these external dependents to work with the modified
library structure and class APIs of the compiler. A small adjustment
was applied to 'dart2js_incremental' as well.

No further dependents are believed to exist: Grepping in sdk for
relevant imports does not reveal any further imports of any of the
libraries in the compiler where the "interface" has changed, and
external clients are not supported (that is, imports in arbitrary
github repositories may or may not break if they use the compiler
internals, but we do not support this type of dependency so we won't
do anything to protect them against that type of breakage).

R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/1864433004 .
2016-04-05 17:26:07 +02:00
Johnni Winther e914716bb7 Test ResolutionImpact equivalence.
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1856713002 .
2016-04-05 09:36:05 +02:00
Erik Ernst 355888457a Revert "Introduces ParserOptions."
This reverts commit d4c9a499d5.

Review URL: https://codereview.chromium.org/1859543002 .
2016-04-04 15:16:13 +02:00
Erik Ernst d4c9a499d5 Introduces ParserOptions.
In preparation for support for generic methods (with an associated
command line option), this CL introduces a `ParserOptions` class and
uses that to pass the existing option `enableConditionalDirectives` to
all parsers. With that, the addition of an `enableGenericMethodSyntax`
option will be concise and well localized.

It is necessary to keep a `ParserOptions` object in `Parsing`, because
that's the only convenient channel for providing the options to the new
`Parser` and `ClassElementParser` created from the top-level function
`parse` in 'partial_elements.dart', and a from
`PartialClassElement.parseNode`, respectively.

The `ParserOptions` class is located in 'parser.dart'; from the current
import structure the most natural choice might be to put it in
'element_listener.dart', but considering the nature of that file it
seems less natural: What does `ParserOptions` have to do with element
listeners? So I put it in 'parser.dart', even though this causes a few
additional import statements.

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

Review URL: https://codereview.chromium.org/1789553003 .
2016-04-04 14:45:20 +02:00
Kevin Millikin 78998a518c dart2js: Do not use the async rewriter on nested functions.
Nested functions in JS can be introduced by foreign code in our own
libraries.  They are always plain synchronous non-generator JS functions so
it is unnecessary to rewrite them.  Trying to do so will crash, because the
pre-translation analysis does not analyze them.  The translation wouldn't
do the right thing anyway.

Closes https://github.com/dart-lang/sdk/issues/25396

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

Review URL: https://codereview.chromium.org/1848283002 .
2016-04-04 09:33:29 +02:00
Johnni Winther 46beb25f43 Add *IndexSetIfNull methods to SemanticSendVisitor.
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1842033004 .
2016-04-01 09:46:42 +02:00
Johnni Winther 27b2c36ec1 Serialize ResolutionImpact instead of WorldImpact.
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1839243003 .
2016-03-31 09:55:03 +02:00
Johnni Winther 4b4718a53c Support per-library serialization.
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1811173003 .
2016-03-29 11:27:44 +02:00
Johnni Winther ff31372564 Fix exit_code_test after refactoring.
The test was broken by https://codereview.chromium.org/1819053002

Review URL: https://codereview.chromium.org/1836033003 .
2016-03-29 11:18:01 +02:00
Johnni Winther b4b67c3d2a Don't serialize unnamed mixin applications.
This change is needed to allow for per-library serialization.

These elements should not be part of the element model, anyway.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/1815693002 .
2016-03-29 10:26:27 +02:00
Sigmund Cherem f2700cc0ab Fix warning after loader refactor discovered by a red bot.
TBR=het@google.com

Review URL: https://codereview.chromium.org/1830863002 .
2016-03-23 18:17:05 -07:00
Sigmund Cherem bada3cac9d Split loader from the rest of the compiler. This adds several abstractions to
make the decoupling easier. Some of the new abstractions should be revisited,
but it's a step forward :).

R=het@google.com

Review URL: https://codereview.chromium.org/1819053002 .
2016-03-23 16:02:33 -07:00
Kevin Millikin 6efe664788 Use exact instruction names in the SSA tracer.
Before the mapping from HInstruction names to printed representations
used by the tracer was arbitrary.  Change it to use the HInstruction
name with a colon separating the arguments from the instruction name.
The first colon on the line is recognized by the tool as delimiting
the opcode.

Seeing the precise structure of the IR is more important than
having human-writable surface syntax.

BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org/1819833002 .
2016-03-21 13:25:20 +01:00
Johnni Winther 5d97c6176f Support serialization of WorldImpact
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1809533004 .
2016-03-18 09:05:27 +01:00
Johnni Winther 37ad6d2d14 Use JS backend in serialization_analysis_test
BUG=
R=sigmund@google.com

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

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

Review URL: https://codereview.chromium.org/1802883002 .
2016-03-18 07:57:30 +01:00
Greg Littlefield bc68abe486 Fix typo that causes generation of duplicate parameters 2016-03-17 17:33:41 -07:00
Sigmund Cherem 4f3a7cb86e Move all flags to CompilerOptions (first step to stop passing the compiler to
just get the options in the future).

BUG=
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/1803303002 .
2016-03-17 16:42:02 -07:00
Johnni Winther 408f4edee3 Revert "Use JS backend in serialization_analysis_test"
This reverts commit cc8aa23c16.

BUG=

Review URL: https://codereview.chromium.org/1808133002 .
2016-03-17 10:03:18 +01:00
Johnni Winther cc8aa23c16 Use JS backend in serialization_analysis_test
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1802883002 .
2016-03-17 09:23:29 +01:00
Harry Terkelsen 5286e1390b Fix warnings about unimplemented methods in serialized element model.
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1806003002 .
2016-03-16 10:30:39 -07:00
Sigmund Cherem fa35ff3837 Revert "Delete support for source mirrors"
This reverts commit 6586b3696e.
Bots broke because of some references I didn't notice before.

BUG=

Review URL: https://codereview.chromium.org/1805563002 .
2016-03-15 09:13:52 -07:00
Sigmund Cherem 6586b3696e Delete support for source mirrors
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/1799283002 .
2016-03-15 09:09:41 -07:00
Harry Terkelsen 983569525f dart2js: Adds support for custom elements in CPS.
BUG=
R=sigmund@google.com, sra@google.com

Review URL: https://codereview.chromium.org/1798303002 .
2016-03-14 16:57:46 -07:00
Sigmund Cherem 0f979d529d Cleanup 1: split parts into their own libraries for: tree, helpers, ssa, native.
In the case of ssa, I also removed references to AST nodes in ssa nodes that were unused, so now only the builder imports the AST.

I also got rid of unused imports from everywhere else in the code.

R=sra@google.com

Review URL: https://codereview.chromium.org/1762723002 .
2016-03-14 14:03:35 -07:00
Asger Feldthaus 35a984ac7f Tool for visualizing type inference graph.
BUG=
R=sigmund@google.com

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

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

Review URL: https://codereview.chromium.org/1759653003 .
2016-03-14 15:15:23 +01:00
Asger Feldthaus dce808a448 Revert "Tool for visualizing type inference graph."
We're not allowed to import dart:io.

This reverts commit 408e38e82f.

BUG=

Review URL: https://codereview.chromium.org/1798913004 .
2016-03-14 14:22:42 +01:00
Asger Feldthaus 408e38e82f Tool for visualizing type inference graph.
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1759653003 .
2016-03-14 13:57:53 +01:00
Asger Feldthaus 68c2ea495e Fix type annotation for TypeInformation.contextMember.
BUG=

Review URL: https://codereview.chromium.org/1790343003 .
2016-03-14 13:50:57 +01:00
Johnni Winther e6746a98f2 Fix selector in visitSuperSetterGet
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1787743002 .
2016-03-14 09:23:25 +01:00
Stephen Adams 56d0f6aeee Fix all for-in warnings in dart2js
NodeList mixes in IterableMixin<Node>. This makes the object bigger,
costing ~3% extra size for the Dart AST. (10MB out of 350MB)
One idea would be to revert this change and make all the for-in sites use
the .nodes member.

Link<T> now implements Iterable<T>, with missing methods added.
IterableMixin could not be used since Link has a const constructor.

I would like to see Link<T> replaced with fixed length lists or
unmodifiable lists.

A couple of other classes were modified to return an Iterable.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/1783053005 .
2016-03-11 17:19:36 -08:00
Johnni Winther 4dd2360452 Make source information on conditions mandatory in CPS
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1779153002 .
2016-03-11 15:08:15 +01:00
Johnni Winther 8738704223 Make source information mandatory for building send-like node in CPS
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1785633002 .
2016-03-11 14:56:18 +01:00
Asger Feldthaus fafed299ca dart2js cps: A few extra RTI optimizations.
There is no need to set the runtime type on an object whose
type arguments are all 'dynamic'.

Also use a more precise precondition for eliminating a
ReadTypeVariable access.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1784263002 .
2016-03-11 13:53:53 +01:00
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