Commit Graph

43 Commits

Author SHA1 Message Date
Sigmund Cherem 7c7160f022 Move isRedirectingFactory to CFE and add unit test for it.
Eventually it should be handled by Procedure.isRedirectingFactoryConstructor, but that is
currently broken for patch files.

It appears the VM has no patches of that kind, but dart2js does.

Change-Id: I0b64379f16089ad0d98ecd4df1ed9282ed6bc0e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98523
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2019-06-11 22:00:10 +00:00
Régis Crelier 21b74fdf79 [dart2js] Update expectation file after BigInt fix in core lib.
Change-Id: I3a68b24357104b75f85a6a5c46852e2924437727
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103722
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
Auto-Submit: Régis Crelier <regis@google.com>
2019-05-26 01:01:33 +00:00
Johnni Winther 5ce8402b0d Handle let variable like normal variables in static type computation
Change-Id: Ie6eb1eafd5677207163e22c2f428487b4e55b090
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101522
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-05-08 12:12:40 +00:00
Johnni Winther 87c553bf3c Ascribe constants to the member world impacts
Change-Id: I978a6453196b47dd4ed5f51dde1d81feaa4f2008
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97502
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-03-22 12:58:40 +00:00
Stephen Adams 7a90563ee3 [js_runtime] Try to avoid String.prototype.replace with replacement patterns
Change-Id: I4b063fe77592bbb0ad9f6ffb628c3bdd6323b20c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96220
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-03-15 21:51:15 +00:00
Nate Bosch f2579a8ede Add override annotations in dart2js tests
In preparation of enforcing these in the analysis options.

Change-Id: I316f2efea510ecc8ff1b975e96d166a5f8c0286c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96834
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-03-14 00:15:46 +00:00
Johnni Winther b8069cbeca Refactor computation of modular data
Add ModularStrategy as a step towards loading modular data from disk.

Change-Id: I9d0baebef8899794742164be4350bedbd3da5b68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95650
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-03-08 08:36:07 +00:00
Johnni Winther 889d5d9240 Fix type error in node_tracer
From https://dart-review.googlesource.com/c/sdk/+/94749
This is triggered by set literal testing.

Change-Id: I151f9154410790820e1f4d6301b0ccde52a72767
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95441
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-03-08 08:21:47 +00:00
Mayank Patke 6bdd38ae84 Reland "Move the JavaScript constant system into constants/constant_system.dart in preparation to merge it with the base constant system and flatten the constant system hierarchy."
This is a reland of 1702b986c8

Original change's description:
> Move the JavaScript constant system into constants/constant_system.dart
> in preparation to merge it with the base constant system and flatten the
> constant system hierarchy.
>
> Change-Id: I6ef27b210515140d4516336fea015f74c8a0cd6a
> Reviewed-on: https://dart-review.googlesource.com/c/93840
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>

Change-Id: I20ef9755886a6b54135aa7169c9d7de08e8cbe93
Reviewed-on: https://dart-review.googlesource.com/c/94105
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-02-23 00:06:31 +00:00
Mayank Patke 960b08a969 Reland "Remove the Dart constant system and move all required classes into the JavaScript constant system."
This is a reland of 5af8de8954

Original change's description:
> Remove the Dart constant system and move all required classes into the
> JavaScript constant system.
>
> Change-Id: I2a31ea743270459284c42b615b0dffd1c7aa2584
> Reviewed-on: https://dart-review.googlesource.com/c/93746
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>

Change-Id: I8c8399e94dd80c1f543a54454efc9cf59ef6ac7b
Reviewed-on: https://dart-review.googlesource.com/c/94104
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-02-23 00:06:31 +00:00
Mayank Patke e1992e0178 Revert "Remove the Dart constant system and move all required classes into the"
This reverts commit 5af8de8954.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Remove the Dart constant system and move all required classes into the
> JavaScript constant system.
> 
> Change-Id: I2a31ea743270459284c42b615b0dffd1c7aa2584
> Reviewed-on: https://dart-review.googlesource.com/c/93746
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>

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

Change-Id: Ic28807774502d11a53572095616510a642cf75b3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/94081
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2019-02-22 21:54:57 +00:00
Mayank Patke 05d9c60a22 Revert "Move the JavaScript constant system into constants/constant_system.dart"
This reverts commit 1702b986c8.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Move the JavaScript constant system into constants/constant_system.dart
> in preparation to merge it with the base constant system and flatten the
> constant system hierarchy.
> 
> Change-Id: I6ef27b210515140d4516336fea015f74c8a0cd6a
> Reviewed-on: https://dart-review.googlesource.com/c/93840
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>

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

Change-Id: If1b6291508c9792a6135a2ad5333b4bb3b800f69
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/94103
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2019-02-22 21:50:57 +00:00
Mayank Patke 1702b986c8 Move the JavaScript constant system into constants/constant_system.dart
in preparation to merge it with the base constant system and flatten the
constant system hierarchy.

Change-Id: I6ef27b210515140d4516336fea015f74c8a0cd6a
Reviewed-on: https://dart-review.googlesource.com/c/93840
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-02-22 21:34:47 +00:00
Mayank Patke 5af8de8954 Remove the Dart constant system and move all required classes into the
JavaScript constant system.

Change-Id: I2a31ea743270459284c42b615b0dffd1c7aa2584
Reviewed-on: https://dart-review.googlesource.com/c/93746
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-02-22 21:34:47 +00:00
Sigmund Cherem e3b8065625 Add support for --dump-info=binary
We continue to accept `--dump-info`, but now also accept `--dump-info=binary` so
we can use the new cheaper encoding.

Change-Id: I971cb9a3634ae1a333cfee14b2927c0e25000a01
Reviewed-on: https://dart-review.googlesource.com/c/93823
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2019-02-21 17:54:39 +00:00
Mayank Patke 99a5057bca Add set tracing.
Change-Id: I889c5ac8d6207c9a25721d939b0f01b4e945a940
Reviewed-on: https://dart-review.googlesource.com/c/92149
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-02-15 20:44:46 +00:00
Mayank Patke e53cd30112 Add SetTypeMask.
Change-Id: I9f202506c364cc1387efa8cea4cca6038f350470
Reviewed-on: https://dart-review.googlesource.com/c/92146
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-02-15 20:44:46 +00:00
Stephen Adams 4ef8de99ac Remove full emitter
Change-Id: Iaabca4423570a851bf7d8969d1829c81c94850a8
Reviewed-on: https://dart-review.googlesource.com/c/88882
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-01-10 17:38:34 +00:00
Johnni Winther 2bc015b03a Remove dependency on TypeEnvironment.hierarchy
Change-Id: Ibc675aa37bf1d5f90640b41471d094025ae3da86
Reviewed-on: https://dart-review.googlesource.com/c/88805
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2019-01-09 11:21:36 +00:00
Johnni Winther e14472c46b Use getters/setters found through the static types.
This uses the information from the static types now used in inference which
can improve the precision in particular for generic classes. Since type
masks lose the type argument information, we cannot expect locating members
based on the type mask to be more precise than what has been found through
the static types.

This CL also expands the unit test framework to support unit test of
optimizations and the emission model, including tests of the improved
field access handling.

Closes #35433

Change-Id: Ia5de15efaf8b60c8723943bb34de6eec7d380798
Reviewed-on: https://dart-review.googlesource.com/c/88440
Reviewed-by: Stephen Adams <sra@google.com>
2019-01-07 15:01:10 +00:00
Peter von der Ahé e45e334548 Rename strong mode to legacy mode in package:kernel
Change-Id: Ia4a8a9cac7817a8db5771ec82541b556c705f7c8
Reviewed-on: https://dart-review.googlesource.com/c/86353
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-12-20 18:06:34 +00:00
Johnni Winther ec1dfa8716 Add @pragma('dart2js:disableFinal')
Change-Id: I9b3f878803f946d08979144028d08b1a4dc4612f
Reviewed-on: https://dart-review.googlesource.com/c/86924
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-12-13 09:35:13 +00:00
Johnni Winther be532c0fc5 Use AbstractBool in AbstractValueDomain and add TrivialAbstractValueDomain
Change-Id: I01c8ca95d48b89c47748e91ba7e4709c3e6f2e78
Reviewed-on: https://dart-review.googlesource.com/c/86700
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-12-10 09:39:21 +00:00
Johnni Winther c18225d98c Implement guarded type promotion in dart2js
Change-Id: Ic284990c73ff5cb4b201ed4bbcc57ec0d7b0b66f
Reviewed-on: https://dart-review.googlesource.com/c/85923
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-12-05 11:52:26 +00:00
Kevin Moore be5d0cca5c Remove sha1 impl from dart2js
pkg:crypto has a fine implementation
Change-Id: Ibefd6c294259c58cd4eb3ac8f5718a078894a39b
Reviewed-on: https://dart-review.googlesource.com/c/85415
Auto-Submit: Kevin Moore <kevmoo@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-11-29 04:28:02 +00:00
Johnni Winther 82f9884289 Support exact class and this expression relations in StrongModeConstraint
Change-Id: I32e6e5b6f55d4ef4240b6ba87eb26dfc2a699130
Reviewed-on: https://dart-review.googlesource.com/c/85166
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-11-27 13:50:04 +00:00
Sigmund Cherem 02f6395606 Cleanup library-loader: rename as kernel producer, remove some dependencies
Once we remove the frontend strategy object, we might want to remove some additional dependencies on KernelResult

Change-Id: I27ef1fbb12e671748b59a87d2dd249100501e02a
Reviewed-on: https://dart-review.googlesource.com/c/85060
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-11-21 17:59:18 +00:00
Johnni Winther b943fa897c Move closure scope classes to ir/
Change-Id: Ib14696e9ab8572e30343e0880c1d028cfc26b377
Reviewed-on: https://dart-review.googlesource.com/c/84621
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-11-20 14:02:39 +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
Johnni Winther a9e2af657f Refactor static type computation
This decouples the computation of static types from the kernel impact
visitor and prepares for flow sensitive static types (i.e. guarded type
promotion).

Change-Id: Ic8b6283bd64d535ff49b1d6fee2e5ae38d48a2d9
Reviewed-on: https://dart-review.googlesource.com/c/83381
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-11-08 13:16:42 +00:00
Lasse R.H. Nielsen 5226b5c307 Remove some unnecessary dynamic invocations in the platform libraries.
Change-Id: Ia72033e37c4d8292eabd95aeff97e4cb29e81823
Reviewed-on: https://dart-review.googlesource.com/c/82204
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-11-02 11:32:03 +00:00
Johnni Winther 2bb05234a8 Support command-line dynamic invocation analysis though analyze_helper
Change-Id: I75da7e8d47d6096c29d0980e3ff12d932e60427c
Reviewed-on: https://dart-review.googlesource.com/c/81761
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-11-01 09:44:17 +00:00
Jens Johansen 69f04aac12 Remove unused _ConstantHelper
This was an idea that never manifested.
This has thus been unused code for more than a year.

Change-Id: Ib7c373a988a220e515d873d7a9e815cecfab178c
Reviewed-on: https://dart-review.googlesource.com/c/82225
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-11-01 08:44:36 +00:00
Lasse Reichstein Holst Nielsen 26121608a1 Make DateTime not assume arguments are instances of the same class.
The current DateTime class takes DateTime objects as arguments,
and then tries to access private members.
That does not work if someone else implements the DateTime interface.

Fixes #34962

BUG= http://dartbug.com/34962

Change-Id: I7191fe42f5b6efc1c7da5ed8e22b892b18f872f7
Reviewed-on: https://dart-review.googlesource.com/c/81828
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2018-10-31 07:29:48 +00:00
Johnni Winther 8b6f8969a6 Support post-inference serialization/deserialization
Currently handling Swarm in-memory serialization/deserialization.

Change-Id: I4b01f70d1e42d7462ed079ece227d6c2ed4de597
Reviewed-on: https://dart-review.googlesource.com/c/80445
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Auto-Submit: Johnni Winther <johnniwinther@google.com>
2018-10-22 14:37:04 +00:00
Johnni Winther 843b4c9c23 Refactoring to prepare for serialization
- pipes GlobalLocalsMap, ClosureData and OutputUnitData through JClosedWorld

Change-Id: Id1d8353a9c75217aab7e06a276bfb503f50a5811
Reviewed-on: https://dart-review.googlesource.com/c/79683
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-10-17 12:05:05 +00:00
Stephen Adams bd223d0ec4 Add consistent_type_error_test
Change-Id: Ic48765468dcdd19371291a32514b9b04012a762a
Reviewed-on: https://dart-review.googlesource.com/c/79146
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-10-12 00:52:25 +00:00
Peter von der Ahé 248954117a Consolidate dart2js front-end dependencies
Also, convert dart2js to use onDiagnostic.

Change-Id: Ifdf89349eaf2ebe8cfcd1994712b3d1be2dd4197
Reviewed-on: https://dart-review.googlesource.com/77400
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-10-02 12:34:28 +00:00
Johnni Winther 225b8d5075 Specialize Object properties in static type computation
This normalizes all accesses of Object properties on dynamic receivers
to target the corresponding Object members.

CFE already set the interface target on for instance `a == b` where `a`
has static type `dynamic` but didn't for the implicit call to `==` in
for instance `a?.b`.

Change-Id: I4f714766ac33a431f5ef645df7ee1bbb254c06ce
Reviewed-on: https://dart-review.googlesource.com/76123
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-09-27 09:51:01 +00:00
Johnni Winther 1652850381 Compute static types during impact computation
This speeds up the computation of static type by avoiding repeated
visits of subtrees. The change also paves the way for improving
static type computation beyond what is specified. For instance by
handling negative type promotions.

Change-Id: Ifa3ea0f9760251f43cbbcc97b684004741a97b11
Reviewed-on: https://dart-review.googlesource.com/76020
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-09-25 09:58:19 +00:00
Johnni Winther 762a14e139 Update dart2js_dynamic_test to exclude CFE code.
Change-Id: I849611da80a2d2bc86c267664508af30dc56b382
Reviewed-on: https://dart-review.googlesource.com/75841
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-09-21 10:42:01 +00:00
Johnni Winther a5b71813ab Use json expectation files in dynamic tests
+ add support for generating said expectation files.

Change-Id: I24ead63bf56542a58b36c35e7849fd80d86c4454
Reviewed-on: https://dart-review.googlesource.com/75140
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-09-20 07:27:33 +00:00
Johnni Winther 1befc25f28 Add tests for dynamic access in platform and dart2js code.
This is a step towards making our own code use Dart 2 rather that
Dart 1 semantics.

For instance, the js-runtime libraries often use `dynamic` to avoid
extra type checking in Dart 1 checked mode, which has the consequence
that we have _more_ checking in Dart 2 (or just worse inference
baselines).

The VM is now optimizing for the typed paths and we should therefore
avoid unneeded dynamic accesses in dart2js code itself.

Change-Id: I793ef6c478c4c1b8caa1513990baafc598c462d8
Reviewed-on: https://dart-review.googlesource.com/74380
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-09-13 13:53:17 +00:00