Commit Graph

116 Commits

Author SHA1 Message Date
Stephen Adams f96362ccfd [dart2js] Smaller code by caching values
- Move more that one assignment into var-list
- Move 'this' to a local variable
- Move repeated large 'fast' constants to local variable

Currently under flag --experiment-code-1


Change-Id: I091cab47f498b4ec3759b9ed358bcc0f2e73fdb1
Reviewed-on: https://dart-review.googlesource.com/c/77025
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-10-08 17:40:19 +00:00
Johnni Winther cf5cdea808 Add J/K versions CommonElements and ElementEnvironment
This is a step towards separating the element map implementations.

Change-Id: Iaf8cee48bd0c127a981b1661773d9036b419fecf
Reviewed-on: https://dart-review.googlesource.com/75300
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-09-20 07:37:32 +00:00
Johnni Winther db1570bdcd Split element maps for J/K further
* The J model is in the /js_model/ folder and KernelToElementMapForBuilding is renamed
  to JsToElementMap.
* The K model is in the /kernel/ folder and KernelToElementMapForImpact is renamed
  to KernelToElementMap.
* Code shared between JsToElementMap and KernelToElementMap is in the /ir/ folder using
  the interface IrToElementMap internally.
* KernelToElementMap and JsToElementMap do _not_ implement IrToElementMap so all code
  that is not part of the implementation must explicitly use one or the other.
* Both KernelToElementMap and JsToElementMap extend KernelToElementMapBase
  but this will be changed in a follow-up.

Change-Id: Id6b762984d25354477cb099dc2f8301b83a7ba07
Reviewed-on: https://dart-review.googlesource.com/73382
Reviewed-by: Stephen Adams <sra@google.com>
2018-09-11 11:10:37 +00:00
Johnni Winther 6616ddeb88 Move dart2js unittests to subfolders
* All helpers in /helpers/
* Tests of user-facing behavior in /end_to_end/
* Tests of internal models and unittests of internal classes in /model/

Change-Id: Ic7a7e58aa01f92f8572514ae81230804f36af67e
Reviewed-on: https://dart-review.googlesource.com/72644
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-09-10 08:22:53 +00:00
Johnni Winther 3af2f793ac Remove --no-preview-dart-2 from dart2js
Change-Id: I17a18ebe905fa60ba2a1b41af2f444cfe58a38a2
Reviewed-on: https://dart-review.googlesource.com/70512
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-08-20 09:18:02 +00:00
Johnni Winther e4bd67028f Make minified test work on Windows
Change-Id: If484387147aa7b60915238f9fff4f11973ac941e
Reviewed-on: https://dart-review.googlesource.com/69940
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-08-16 14:46:57 +00:00
Keerti Parthasarathy b99e41ac6f Revert "fix #28233, add hint for missing returns to function expressions"
This reverts commit 058510eeab.

This causes a lot of missing_return failures internally and requires time to fix.

Change-Id: I2c7a79c6e838bbd9f101f53919b1db2c0d4a2594
Reviewed-on: https://dart-review.googlesource.com/70024
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2018-08-14 21:10:27 +00:00
Stephen Adams 4196c0e2f5 Fix dart2js/sourcemaps/minified_names_test
TBR=sigmund@google.com

Change-Id: Ie48333f2bfa9352c7ff787acc00dc12aa5c97cd5
Reviewed-on: https://dart-review.googlesource.com/68846
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-08-08 00:01:57 +00:00
Sigmund Cherem cb7341fceb Initial support for inlining-data in source-maps.
This starts tracking inlining data and records it as an extension
to source-map files so we are able to expand inlined calls when
deobfuscating production stack traces.


Change-Id: I46daf21c2f42305b2bd6ca17fbafb65226355096
Reviewed-on: https://dart-review.googlesource.com/67083
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-07-31 21:41:50 +00:00
Jenny Messerly 058510eeab fix #28233, add hint for missing returns to function expressions
If a function expression is used in a context that expects a return type
other than dynamic/void/Null, issue a hint if that function has a block
body and is missing a `return` statement.

Change-Id: Ia55212abd84f5718343cf7401b87aba2891d6446
Reviewed-on: https://dart-review.googlesource.com/66340
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-07-28 01:50:31 +00:00
Sigmund Cherem 1566b0dbc1 Add tests for nsm errors
Change-Id: Ib215299c4229641d0b62edc099f5834c5d894d99
Reviewed-on: https://dart-review.googlesource.com/66080
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-07-23 17:10:49 +00:00
Sigmund Cherem e3b5bfd854 Store original names in the minified name map
Change-Id: I411125aebe08fee10f1eeee4e6f30623cb0d7854
Reviewed-on: https://dart-review.googlesource.com/65795
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-07-20 23:50:45 +00:00
Sigmund Cherem 35b08dec12 Add minified names to sourcemaps
This change:

* introduces a sourcemap extension to store minified names from the global and
instance namespaces.

* adds a test suite to test that this information is accurate

This is just an initial step: at this time names come from proposed names, which
include extra stuff we don't want. On a later CL I plan to change this to be
able to get the original name instead.

For example, I want to add a test for translating an instance method, right now
we would get "@method@0@" or "method$0" instead of "method".

Change-Id: I411c3bea96446e29e80581750250349799332b9a
Reviewed-on: https://dart-review.googlesource.com/65660
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-07-19 18:50:27 +00:00
Peter von der Ahé 389b8997b3 Update dart2js extra test wrt. void rules
Change-Id: Ic83252a27fc90dd2d19b799d09c0bc4b111a1caf
Reviewed-on: https://dart-review.googlesource.com/65501
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-07-18 09:48:19 +00:00
Mike Fairhurst 21258299d7 Reland "Fix #32227 export dynamic from dart:core in analyzer."
This reverts commit d3b4ba3a0b.

Reason for revert: Previous breakage was related to overly strict tests.

Original change's description:
> Revert "Fix #32227 export dynamic from dart:core in analyzer."
> 
> This CL caused a breakage in angular code generation.
> 
> This reverts commit 6f965a94e2.
> 
> Change-Id: Id066661930b9531cdd32a0d38e71f70fe73ece75
> Reviewed-on: https://dart-review.googlesource.com/63680
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
> Commit-Queue: Paul Berry <paulberry@google.com>

TBR=paulberry@google.com,scheglov@google.com,brianwilkerson@google.com,mfairhurst@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: If0a03148db5e88724f3498a1fa2d46a9c42d7f1f
Reviewed-on: https://dart-review.googlesource.com/64120
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2018-07-09 22:30:49 +00:00
Johnni Winther 5dbf6da529 Remove generics where only ir.Node is used
Change-Id: I500b237a871ee21aca1a800806cdc95828713b5c
Reviewed-on: https://dart-review.googlesource.com/63944
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-07-06 22:02:57 +00:00
Johnni Winther da9705b356 Split compileLoadedLibraries
- into computeClosedWorld, performGlobalTypeInference and generateJavaScriptCode
+ pass closed world and inference results directly
+ this prepares for (de)serialization after global inference

Change-Id: I1180de35eea78a107c9e95fc6e904084b63ba0f2
Reviewed-on: https://dart-review.googlesource.com/63943
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-07-06 22:02:57 +00:00
Paul Berry d3b4ba3a0b Revert "Fix #32227 export dynamic from dart:core in analyzer."
This CL caused a breakage in angular code generation.

This reverts commit 6f965a94e2.

Change-Id: Id066661930b9531cdd32a0d38e71f70fe73ece75
Reviewed-on: https://dart-review.googlesource.com/63680
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-07-03 19:50:26 +00:00
Mike Fairhurst 6f965a94e2 Fix #32227 export dynamic from dart:core in analyzer.
Assign dynamic to dart:core in NamespaceBuilder & LibraryScope

This seems to be the best two places to hit up all cases. We need two to
handle the case of where code imports dart:core, vs code that is itself
the definition of dart:core.

Includes a member sort of compile_time_error_code_kernel_test, so that
pollutes the diff a bit, but not importantly so and its good to get that
sorted.

Bug: 32227
Change-Id: Ibe620f4b66a35d088355f36da042a5d82380772c
Reviewed-on: https://dart-review.googlesource.com/62730
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-06-29 19:24:41 +00:00
Johnni Winther 7c6211b1d8 Make unittests work with Dart 2
Change-Id: Ic2c105747dfba067464fc15e158f58417c8636a8
Reviewed-on: https://dart-review.googlesource.com/61922
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-06-22 20:25:05 +00:00
Stephen Adams 5ccc497678 Inline constructor bodies that are called once
Change-Id: I74b2518fed543a78f1531b54510f4dcbe3a57192
Reviewed-on: https://dart-review.googlesource.com/60324
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-06-20 22:12:02 +00:00
Sigmund Cherem c96f23243b Enable Dart2 in dart2js by default
Change-Id: Id197fc734bcb45f0805e49e89c0d03419384bb0b
Reviewed-on: https://dart-review.googlesource.com/60448
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-06-19 19:20:36 +00:00
Sigmund Cherem 0cf860f361 Remove pub_build_validity test
Now that `pub-build` is gone, this is no longer needed.

Change-Id: Ie3b7e6c3e2e50fc43bcf6601387e9e839d3b6ff8
Reviewed-on: https://dart-review.googlesource.com/60321
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-06-14 22:57:35 +00:00
Stephen Adams 2c8c05f877 [dart2js] merge generator body into empty entry function
Change-Id: I99a5f16f9a22d3c3cbb4989151a8d3c7bfda16ef
Reviewed-on: https://dart-review.googlesource.com/56037
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-22 21:17:44 +00:00
Johnni Winther 54331b1c4b Delete elements.dart and resolution_types.dart
Change-Id: Ib50dabdbeec72ebf443e85b51b818d9ed0602b4f
Reviewed-on: https://dart-review.googlesource.com/55221
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-16 09:54:18 +00:00
Johnni Winther 47a67b2b8f Delete AST nodes
Change-Id: Iab9396b3a21cd9502c455fb73633216faed777ef
Reviewed-on: https://dart-review.googlesource.com/55126
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-16 09:54:18 +00:00
Sigmund Cherem c25a9fd46b Remove support for dart:isolate in dart2js.
Change-Id: I1216a0ac91d8a1d13b441809596e1a8b5e51bb34
Reviewed-on: https://dart-review.googlesource.com/54526
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-05-10 01:20:17 +00:00
Stephen Adams 6efd3b3654 Refactor output code for generators
sync*/async/async* generators have two parts: an entry, which does
checks and computes the element type of the result, and a body, which
is transformed after lowering to JavaScript.

The split ensures that the code for checks is done at function call
time, rather than e.g. in the moveNext method of a sync* iterator.

A following CL with optimize the split to generate one function when
there are no checks and the type argument is simple enough for textual
substitution.

Change-Id: I5414109ca851f9267871aa113a2e29b16236986d
Reviewed-on: https://dart-review.googlesource.com/54308
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-05-09 18:22:07 +00:00
Johnni Winther 4c7926107e Remove support for --use-old-frontend option
Change-Id: Ia6e7ded5e312cce4841ded8170fc01a51f07b098
Reviewed-on: https://dart-review.googlesource.com/54229
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-09 09:11:01 +00:00
Johnni Winther 17e22dfcd3 Remove unneeded kernel tests and sourcemap old-frontend tests
Change-Id: Iaf9533a812df5c872f223bce17ec7127f0b46318
Reviewed-on: https://dart-review.googlesource.com/54200
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-09 07:55:08 +00:00
Johnni Winther 831a6ba598 Remove useOldFrontend testing from various tests
Change-Id: Iff97dd60756ae18cb0a3203cffd87c8da9e53757
Reviewed-on: https://dart-review.googlesource.com/53944
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-05-08 08:31:43 +00:00
Johnni Winther 235b81d045 Remove MockCompiler
Change-Id: I476cb39f8fed068d7c47a15486419783f599a285
Reviewed-on: https://dart-review.googlesource.com/53806
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-07 10:07:40 +00:00
Johnni Winther 794fe1e14f Add stacktrace tests for synchronous async
Change-Id: Iafd66528f9ea3d7a301dc4845118ca16517e235f
Reviewed-on: https://dart-review.googlesource.com/53206
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-03 08:09:33 +00:00
Sigmund Cherem 3c9d0858b0 dart2js: turn on sync-async by default
Closes https://github.com/dart-lang/sdk/issues/32869

Change-Id: I79b2d02d13adccdfbbd3a78158805244aceff7de
Reviewed-on: https://dart-review.googlesource.com/52061
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-04-27 19:48:46 +00:00
Janice Collins 1afe71c08a Enable preview-dart-2 as default for analyzer.
Based on https://dart-review.googlesource.com/c/sdk/+/52340, but adds
the necessary plumbing through the test system to pass through
negations to strong and preview-dart-2.  Also adds support for those
negations to the analyzer.

Change-Id: I9793ff28bb593d25bbb0a2ed8736b5b53e0a62d8
Reviewed-on: https://dart-review.googlesource.com/52461
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-26 17:01:12 +00:00
Johnni Winther 8eb749e032 Fix sourcemaps/name_test for kernel
Change-Id: I77e60ae236cf8a17edc3854496fc900d67915bd0
Reviewed-on: https://dart-review.googlesource.com/47040
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-03-20 11:35:49 +00:00
Sigmund Cherem c438f8b3f4 Dart2js defaults to the new common front-end
Change-Id: Id0f69d258b010a746b56e259335185bcca7dafec
Reviewed-on: https://dart-review.googlesource.com/45143
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-03-13 19:25:59 +00:00
Johnni Winther d539c78af1 Add source information to parameter stubs.
Change-Id: If942cc13203752361c3104c89190d75979073498
Reviewed-on: https://dart-review.googlesource.com/34440
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-01-12 21:23:40 +00:00
Johnni Winther 399f0326c9 Move unittests, part #10 of ?
Change-Id: Ia346ac44c75b349b61c35e2e9816a7f3d92f04b4
Reviewed-on: https://dart-review.googlesource.com/31481
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-12-29 12:15:06 +00:00
Johnni Winther 410c3c4a69 Move unittests, part #9 of ?
Change-Id: Ief32bb619da08133a4247b2e4f80cad592f18d77
Reviewed-on: https://dart-review.googlesource.com/31423
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-12-29 11:40:45 +00:00
Johnni Winther d5447c848a Reuse cached kernel platform libraries in runCompiler in memory_compiler.dart
Change-Id: Ic545371803263add622ddf8af08eddf484d6ca10
Reviewed-on: https://dart-review.googlesource.com/31343
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-12-29 10:19:08 +00:00
Johnni Winther c9fc2e7e40 Use a temporary dir for stepping_test
Change-Id: I474552f4c77e4c8a28c545710e823c203c6a51d5
Reviewed-on: https://dart-review.googlesource.com/31340
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2017-12-22 13:30:27 +00:00
Johnni Winther a521c7f255 First step debugging tests.
Change-Id: I8a947999778f851ed38c1a9fb518af00664f19ec
Reviewed-on: https://dart-review.googlesource.com/30740
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-12-21 14:03:51 +00:00
Johnni Winther 289671e38e Port unittests, part #3 of ?
Change-Id: If5174e76187d2e045cb14b11df932acdee9e42dd
Reviewed-on: https://dart-review.googlesource.com/30761
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-12-21 09:35:06 +00:00
Sigmund Cherem 414bad86df Directly create dart2js platform files using its patch files
Change-Id: I1c7d59968bfafeeb5a8b5252fa2d47e3c05b893e
Reviewed-on: https://dart-review.googlesource.com/27404
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Emily Fortuna <efortuna@google.com>
2017-12-19 20:31:57 +00:00
Sam Rawlins b50319ca9f Fix RETURN_OF_INVALID_TYPE for anonymous closures
The displayName of an anonymous closure is a blank String, resulting in messages like:

    [error] The return type 'String' is not a 'int', as defined by the method ''.

After this change, an error might instead look like:

$ xcodebuild/ReleaseX64/dart-sdk/bin/dartanalyzer --strong 26056.dart
Analyzing 26056.dart...
  error • The return type 'String' isn't a 'int', as defined by anonymouse closure at 26056.dart:6:28 • return_of_invalid_type
  1 error found.

Bug: https://github.com/dart-lang/sdk/issues/26056
Change-Id: I4003eea22cb23e0b06479482c06d5ce8a936c756
Reviewed-on: https://dart-review.googlesource.com/28382
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2017-12-18 15:33:06 +00:00
Johnni Winther dbadf204aa Add source information to break, continue, == and constructor body calls
Change-Id: I3ca3dc1e1ed55b636808685bff5d017d422678e7
Reviewed-on: https://dart-review.googlesource.com/24923
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-12-05 11:40:41 +00:00
Johnni Winther 5a238b215a More source information
+ on super calls
+ null tests
+ logical and

Change-Id: I136500544d14afa5cbaf431ec12dfb1516c38d29
Reviewed-on: https://dart-review.googlesource.com/24480
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-11-30 08:45:39 +00:00
Johnni Winther 93d03da1db Add source information to yield* and async*
Change-Id: I4e3f09f60527c0ea501b266abca6b70dc01d1a64
Reviewed-on: https://dart-review.googlesource.com/23668
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-11-28 10:16:54 +00:00
Johnni Winther 9bfef29e21 Add source information to throw/try/await in async and yield in sync*
Change-Id: I8559aaf40c3cb12892113b7373608dc0eed3cb45
Reviewed-on: https://dart-review.googlesource.com/23680
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-11-28 09:56:09 +00:00