Commit Graph

118 Commits

Author SHA1 Message Date
Stephen Adams 588f168164 [dart2js] Add framework for gathering Task metrics
Adds `--report-metrics` and `--report-all-metrics`.
These options print all the Metrics objects exposed by CompilerTask.

This CL has counts and durations and adds metrics to two tasks to
demonstrate the 'framework'. More task metrics will be implemented
as needed. As we do so, we will experiment to see if it is possible
to make it easier and more efficient collect metrics.

```
$ dart2js ... --report-metrics
Info: Metrics:
  type_inference.time: 1.429s
  deferred_load.time: 0.424s
...

$ dart2js ... --report-all-metrics
Info: Metrics:
  type_inference.time: 1.300s
  type_inference.time.analyze: 0.695s
  type_inference.time.refine1: 0.361s
  type_inference.time.refine2: 0.175s
  type_inference.count.exceededMaxChange: 5
  type_inference.count.overallRefines: 90827
  deferred_load.time: 0.270s
  deferred_load.hunkListElements: 1
```




Change-Id: I2ba66f65af604758b0cbd71a688133cb562e32ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156842
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-08-13 00:18:08 +00:00
Johnni Winther 9c9ab11450 Reland "Handle ir constants in field analysis and impact tests"
Include initial handling of unevaluated constants from environment.

Change-Id: I288801b42a9e25e440baa3eac9ce88263acea0a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97241
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Johnni Winther <johnniwinther@google.com>
2019-03-18 17:57:55 +00:00
Aske Simon Christensen e62391a162 Revert "Handle ir constants in field analysis and impact tests"
This reverts commit 0cd89e5bd1.

Reason for revert: Conflicts with move of constant evaluator.

Original change's description:
> Handle ir constants in field analysis and impact tests
> 
> Include initial handling of unevaluated constants from environment.
> 
> Change-Id: Ibd330a14dfabad1dee95b64ce7015939412374d3
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97112
> Commit-Queue: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Sigmund Cherem <sigmund@google.com>

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

Change-Id: Ie01c7dda6152abbf852cd40a00597f019db49e66
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97116
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2019-03-18 13:01:11 +00:00
Johnni Winther 0cd89e5bd1 Handle ir constants in field analysis and impact tests
Include initial handling of unevaluated constants from environment.

Change-Id: Ibd330a14dfabad1dee95b64ce7015939412374d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97112
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-03-18 10:30:04 +00:00
Nate Bosch 69a4f20347 Add override annotations consistently
This makes it easier to follow class hierarchies and understand where a
class is changing the interface. I hit this when I found a class that
had the annotation on some methods it was overriding, but not all, which
made it confusing.

Prepares for adding the lint rule and enforcing it.

40% of overridden methods were annotated - add annotations to the remaining 60%.

Change-Id: I02472f4b6c5026a820cf9ff1a7ada663a60f1868
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96666
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-03-13 22:36:11 +00:00
Kevin Moore 440f190a34 Cleanup CompilerTask
make a number of fields private

Change-Id: Ib44aa3459e5d286004de7cb08e07039dc115894a
Reviewed-on: https://dart-review.googlesource.com/c/85645
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2018-11-29 22:43:09 +00:00
Sigmund Cherem d9c6bc0316 Improvements to verbose timing data printing.
- format is padded and includes  %
- measure explicitly subtasks of deferred load
- use shorter names for other tasks


Sample output on swarm:

Info: Timings:
    kernel loader:                                 1.407s (17.1%)
    Front end:                                     0.736s  (8.9%)
    Front end > closures:                          0.102s  (1.2%)
    Front end > worldImpact:                       0.586s  (7.1%)
    Type inference:                                1.143s (13.9%)
    Deferred Loading:                              0.002s  (0.0%)
    Deferred Loading > prepare:                    0.002s  (0.0%)
    Enqueue:                                       0.455s  (5.5%)
    self:                                          0.914s (11.1%)
   *self > impl.run:                               0.034s  (0.4%)
    self > run:                                    0.206s  (2.5%)
    self > compileFromKernel:                      0.012s  (0.1%)
    self > computeClosedWorld:                     0.364s  (4.4%)
    self > processQueue:                           0.033s  (0.4%)
    self > emptyQueue:                             0.040s  (0.5%)
    self > applyImpact:                            0.146s  (1.8%)
    self > work.run:                               0.076s  (0.9%)
    SSA builder:                                   1.002s (12.2%)
    SSA optimizer:                                 1.302s (15.8%)
    SSA optimizer > SsaInstructionSimplifier:      0.421s  (5.1%)
    SSA optimizer > SsaTypeconversionInserter:     0.036s  (0.4%)
    SSA optimizer > SsaRedundantPhiEliminator:     0.012s  (0.1%)
    SSA optimizer > SsaDeadPhiEliminator:          0.010s  (0.1%)
    SSA optimizer > SsaTypePropagator:             0.261s  (3.2%)
    SSA optimizer > SsaCheckInserter:              0.030s  (0.4%)
    SSA optimizer > SsaDeadCodeEliminator:         0.067s  (0.8%)
    SSA optimizer > SsaGlobalValueNumberer:        0.071s  (0.9%)
    SSA optimizer > SsaCodeMotion:                 0.024s  (0.3%)
    SSA optimizer > SsaLoadElimination:            0.083s  (1.0%)
    SSA optimizer > SSA value range builder:       0.099s  (1.2%)
    SSA optimizer > SsaSimplifyInterceptors:       0.048s  (0.6%)
    SSA code generator:                            0.623s  (7.6%)
    Code emitter:                                  0.586s  (7.1%)
    Diagnostic handler:                            0.001s  (0.0%)
Change-Id: I4af3ff04954b28ee12354bc79eae517169a3b96e
Reviewed-on: https://dart-review.googlesource.com/c/85550
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-11-29 18:09:20 +00:00
Sigmund Cherem e9e70f0922 Reduce dependency on library spec from dart2js
Change-Id: I0d55b380f135d2e45a0dd112336bd87085e38c76
Reviewed-on: https://dart-review.googlesource.com/c/85471
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-11-28 17:12:11 +00:00
Sigmund Cherem 5a14f9e619 Remove unnecessary setupPackages step.
Since we switched to the CFE we no longer use this, the CFE recomputes the package-configuration internally.

Change-Id: Icdc2a3eeff1aa75e560157ecf0d5320208096d21
Reviewed-on: https://dart-review.googlesource.com/c/84362
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-11-14 19:28:40 +00:00
Sigmund Cherem b484aada21 Remove library-root option - replace it with a libraries-spec option instead
Change-Id: Ie1df52cdaa7ab4381a4c1b94c61a1210f0f31b5f
Reviewed-on: https://dart-review.googlesource.com/c/83641
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-11-09 22:40:28 +00:00
Stephen Adams 9146cea63a Print times in seconds
Change-Id: I4adcb9847d7a1ce4e91f93e7c484a3fd59310f52
Reviewed-on: https://dart-review.googlesource.com/62001
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2018-06-23 00:50:15 +00:00
Emily Fortuna 0e3ca9a668 Fix strong mode runtime error in dart2js.
Change-Id: Ib736576a094388f88183c981f9d04733142c8860
Reviewed-on: https://dart-review.googlesource.com/57480
Commit-Queue: Emily Fortuna <efortuna@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-05-30 20:13:10 +00:00
Emily Fortuna 552680b7f0 First round of changes to dart2js to make it strong mode clean.
Change-Id: Idc3612072c3cf28a4f58bbb890908f67473d8292
Reviewed-on: https://dart-review.googlesource.com/56284
Commit-Queue: Emily Fortuna <efortuna@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-23 21:26:04 +00:00
Johnni Winther d5719cae62 Small cleanup in compiler.dart
Change-Id: I2b3d3ce5925d6c7078250ab3fdadfc3daef90d73
Reviewed-on: https://dart-review.googlesource.com/55462
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-05-17 08:40:03 +00:00
Johnni Winther 944ce140e2 Remove most imports of elements/elements.dart
Change-Id: I4ecd45286fab1171eab1e2d3d443a0441bbdc883
Reviewed-on: https://dart-review.googlesource.com/55180
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-16 09:54:18 +00:00
Johnni Winther df9af04061 Remove CompilerOptions.useKernel
Change-Id: I9ea69addeb18e061280329c233a110fe2d8ca763
Reviewed-on: https://dart-review.googlesource.com/54240
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-09 10:13:32 +00:00
Lasse R.H. Nielsen 973a1a0219 Remove uses of upper-case constants in remaining SDK code.
This includes Fasta, tools and observatory, so the checked-in SDK must
have the lower-case constants.

Change-Id: I8380ad041ad058f7d02ae19caccfecd434d13d75
Reviewed-on: https://dart-review.googlesource.com/50201
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-04-16 16:11:57 +00:00
Sigmund Cherem 823dfda5a5 Delete serialization, except for equivalence and helpers used in other tests.
Move such helpers under the test folders.

Change-Id: Ic8718374741b1e3e46e63ae552fa57e49fc97bb2
Reviewed-on: https://dart-review.googlesource.com/51203
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-04-13 21:31:51 +00:00
Sigmund Cherem f9e12f1116 step 3 of ??: ignore old options from old FE
* preserve-comments: unused, only used for source-mirrors & dartdoc long long ago
* preserve-uris: ignored, mirrors-only flag
* allow-native-extensions: error, was only used for analyze-only with the old FE

Change-Id: Ic93c31edf188cdab3aa658c13018a432baf14742
Reviewed-on: https://dart-review.googlesource.com/48457
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-03-27 20:18:37 +00:00
Sigmund Cherem 751357d630 Make dart.library.isolate false in consts and config imports
Closes #30539

Change-Id: I037ae91d66ad32059d096d3db8890c456230bb96
Reviewed-on: https://dart-review.googlesource.com/48062
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-03-23 20:21:19 +00:00
Sigmund Cherem 09ff1b56f7 Add support for compiling Dart via the FE in dart2js.
This also:
 - replaces --use-kernel with --use-kernel-in-ssa
 - replaces --load-dill with --use-kernel
 - makes --use-kernel support both: compiling from .dill or from .dart
 - change the default of other options that are currently disabled when --use-kernel is on.
 - adds .status lines for all tests in language/corelib/dart2js_extra/dart2js_native

R=efortuna@google.com

 Note: this CL is built on top of another change
 (https://codereview.chromium.org/2981403002/) that adds preview_dart_2 to
 test.dart
Review-Url: https://codereview.chromium.org/2989453002 .
2017-07-24 17:10:11 -07:00
Peter von der Ahé 87700d381c Start making dart2js strong mode clean.
R=efortuna@google.com

Review-Url: https://codereview.chromium.org/2938823002 .
2017-06-14 20:34:07 +02:00
Stephen Adams d5f2138349 Use failedAt in more places
BUG=
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2898403002 .
2017-05-31 03:12:11 -07:00
Johnni Winther ebe69e6060 Support loading binary data in dart2js
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2897903003 .
2017-05-23 10:43:20 +02:00
Emily Fortuna 4156ca6a2b Eliminate multi-callback structure for LibraryLoader.
BUG=
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2760923004 .
2017-03-24 12:20:46 -07:00
Johnni Winther 52efadefc2 Replace Backend with JavaScriptBackend.
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2685573002 .
2017-02-08 10:50:55 +01:00
Sigmund Cherem ac6bf5926f Temporarily allow to import dart:io in client apps.
Disclaimer: I am not in favor of this approach, but it appears to be the least
worst option at the time.

Reach out to kevmoo@ or dgrove@ for details.

R=lrn@google.com, sra@google.com, dgrove@google.com, kevmoo@google.com

Review-Url: https://codereview.chromium.org/2675023002 .
2017-02-07 14:02:04 -08:00
Johnni Winther a78e2e9806 Remove code supporting incremental compilation in dart2js
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2668233002 .
2017-02-02 09:48:19 +01:00
Johnni Winther 3f977cb5d1 Extract ClosedWorldImpl from WorldImpl.
R=sigmund@google.com

Review-Url: https://codereview.chromium.org/2580403002 .
2016-12-21 09:45:57 +01:00
Johnni Winther 33303ffea5 Resolve type arguments to generic methods.
R=eernst@google.com

Review URL: https://codereview.chromium.org/2535373003 .
2016-11-30 12:44:29 +01:00
Lasse R.H. Nielsen bcdf0a1f12 Make dart2js not consider dart:io there if the library is unsupported.
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2321973002 .
2016-09-13 09:21:54 +02:00
Kevin Moore 406d5e0c48 pkg/compiler: fix imports
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2221893003 .
2016-08-08 14:41:50 -07:00
Sigmund Cherem b741e3f0df Make CompilerTask independent of compiler.
Now this base class only has logic for measuring time.

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

Review URL: https://codereview.chromium.org/2000323006 .
2016-05-25 09:11:08 -07:00
Johnni Winther 42435f2643 Support multiple resolution inputs from command line.
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/2004833003 .
2016-05-25 11:02:34 +02:00
Johnni Winther 6571bdb95e Support (de)serialization from command-line
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1975153002 .
2016-05-18 11:52:32 +02:00
Johnni Winther b361d8ce97 Support compilation of Hello World
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1927963002 .
2016-04-29 12:57:45 +02:00
Johnni Winther 4acfa253d3 Add toStructuredText to ConstantExpression and align method names with ConstantValue
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1916053003 .
2016-04-27 12:48:50 +02:00
Peter von der Ahé 33253905e7 Use Zone to correctly measure async operations.
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/1898043004 .
2016-04-26 14:27:41 +02:00
Peter von der Ahé 74144aece4 Make backend and reporter customizable.
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org/1897863007 .
2016-04-25 14:31:09 +02:00
Johnni Winther 09c242e729 Reinsert (and test) handling of exceptions from user code.
Closes issue #26304

R=ahe@google.com

Review URL: https://codereview.chromium.org/1914973002 .
2016-04-25 12:56:10 +02:00
Harry Terkelsen 8f3e4cff01 dart2js: remove references to compiler in ResolvedUriTranslator
BUG=
R=johnniwinther@google.com, sigmund@google.com

Review URL: https://codereview.chromium.org/1884793002 .
2016-04-13 13:49:59 -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
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
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
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
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 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
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
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