Commit Graph

4260 Commits

Author SHA1 Message Date
Mayank Patke 38ca72a3e7 [dart2js] TrivialRuntimeTypesNeed should not say non-generic classes need type arguments.
Change-Id: Idb791d3ec93ba7eedad0d85a3e12eb51318dd48f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113484
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2019-08-20 18:35:30 +00:00
Mayank Patke b52b2c3910 [dart2js] Don't produce '-2' for default type argument values with new RTI.
TBR=sra@google.com

Change-Id: I20ea2b530285090ef8fb4bbb025c632b74be994b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113759
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2019-08-19 23:49:21 +00:00
Stephen Adams 0537c9d326 [dart2js] Fix DartType.subst
DartType.subst would accidentally drop FunctionTypeVariables that had
bounds modified by substitution.

Use a visitor for printing, with changes that make it possible to see the accidentally
free FunctionTypeVariables that were dropped.

Change-Id: Ie6c8d0bb8f2a22b11db6f009067cf64e38ab93c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113600
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-08-19 18:11:42 +00:00
Mayank Patke c179fa106e [dart2js] (New RTI) Handle extractTypeArguments.
Change-Id: I3fcafa879e41f814962457cfb6bf9373b6c17528
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113481
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2019-08-17 01:43:52 +00:00
Mayank Patke 6b531b2ba4 [dart2js] (New RTI) Fix JSInvocationMirror.typeArguments
Change-Id: I198463b7b8b4f15b57133fc5d7481956da2793c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113269
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2019-08-16 22:09:10 +00:00
Mayank Patke 562e4ee216 [dart2js] Fix instantiation stub generation.
If the new RTI is enabled, then to access an Instantiation's type
arguments, we need to index into the _rest property instead of directly
into the Rti.

While we're at it, clean up the impacts/static uses for instantiation.

Change-Id: I34b3e439792410773b1eed6746da83d529c9a58f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113218
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2019-08-15 23:55:52 +00:00
Mayank Patke 326139b729 [dart2js] Add new RTI instantiation entry point.
Change-Id: I6960d8ec2b1b859236542e20935de66259d0d7d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113125
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2019-08-14 23:17:46 +00:00
Stephen Adams d0c24059c6 [dart2js] new-rti: Specialize some cases of instanceType
Depending on the receiver type, HInstanceEnvironment can be a field reference,
or a call to a specialization of instanceType.

Change-Id: Ie895c42a811ca8e71206ecb1e9a5445883d7188d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113048
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2019-08-14 23:10:31 +00:00
Stephen Adams 762f049479 [dart2js] new-rti: fix merge problem
CQ didn't re-run the tests.

TBR=fishythefish@google.com

Change-Id: I6b8a2d51dc806510f241a95e98e2f1000ef3d79c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112820
Reviewed-by: Stephen Adams <sra@google.com>
2019-08-12 22:37:23 +00:00
Stephen Adams 576ef913e4 [dart2js] new-rti: lower field setters
Replace calls to field setters that don't need a check with HFieldSet.

Change-Id: I3408e87fc82686e66cf01d53a4ae10f94279041d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112704
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2019-08-12 21:39:26 +00:00
Stephen Adams bd47ec2f37 [dart2js] new-rti: Simplification and branch-strengthening for 'is'
Change-Id: I49d712b303400fe2f2109b6c9f8fb684917df0ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112701
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-08-12 20:40:06 +00:00
Stephen Adams e29d6d0ecb [dart2js] HValidator - k-limit inputs and usedBy validation
Change-Id: I73207f8bb82e70222ac058ac2fcf9cbb026cbad3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112603
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2019-08-09 23:41:25 +00:00
Mayank Patke 8af17ed9ff [dart2js] Collect named type variables from recipe generator.
Change-Id: Ie056f605f710f7942973c1a8cd219d94c28e74b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112480
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2019-08-09 21:22:06 +00:00
Stephen Adams d8f5970f0f [dart2js] prepare validator for k-limiting
A few tests have huge methods where an instruction is used tens of
thousands of times. We can probably k-limit the validation in
assertion mode to a few thousand and greatly speed up those tests.

When I added k-limiting for an infeasibly large k, the program got
faster for no good reason, so I'm making this change as a baseline for
filing an issue on the VM optimizer.

Change-Id: I708d08be20652820b6ba878919ffcc6947a53b3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112490
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-08-09 19:13:04 +00:00
Johnni Winther 19654f30d0 [cfe+vm+ddc] Return ClassHierarchy and CoreTypes together with Component
Users of the CFE often need the ClassHierarchy and may CoreTypes after
invoking the CFE. This CL extends the result of `kernelForProgram` and
`kernelForComponent` to a `CompilerResult` that includes these objects.

Change-Id: I08491198fe876b6514e49993ad794388d6662c9c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112259
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2019-08-09 13:02:12 +00:00
Johnni Winther 3312fe3d26 [cfe] Fully support expired flags in CFE
This ensures that we can prohibit the disabling of an enabled and
expired flag while still support the use of enum value in
implementation code.

Change-Id: Ib92c506365bb61853d6ff791461c5065acabcd4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99173
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2019-08-09 09:23:01 +00:00
Johnni Winther b614253cdb Test CFE constants in side-effects test
Change-Id: I720a4e1b574a19aebb93dfab17a372f987f2cb71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99153
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-08-09 07:11:52 +00:00
Stephen Adams f7a300fc69 [dart2js] new-rti: signatures for tear-offs with dependent types
Change-Id: I0fd4e1b081500fe9a44897b1489cdd2b6680f409
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112440
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-08-08 23:08:42 +00:00
Stephen Adams 43eb2f74d5 [dart2js] new-rti: Add new-rti type in String.split lowering
Change-Id: I4f02fc023bdfcdf8bd27aed9024f2453f221ded7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112300
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2019-08-08 04:35:28 +00:00
Stephen Adams ccf56d67fe [dart2js] new-rti: store-forward types from instance allocations
Change-Id: I6996c2e8afeb83f36060396be4979c9343e009a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112148
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2019-08-08 04:29:28 +00:00
Stephen Adams 01a679ba73 [dart2js] new-rti: Fix generator header-body merge optimization
Change-Id: Id4f038415990f5379c1a01637b53c398f5325449
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112270
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-08-07 23:14:35 +00:00
Aske Simon Christensen 5121a2e831 [cfe] Read product mode directly from environment in async transform.
When we perform constant evaluation in the CFE, the async transform
runs after constant evaluation. Thus, it can no longer use const
bool.fromEnvironment("dart.vm.product") to query whether the VM is
in product mode.

Instead, it can read the product mode define directly from the
environment defines given to the CFE and generate different code
depending on the value.

Change-Id: I2aabc4a84b50a940d35d5664ff4ebdf0680ed5c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111645
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-08-07 08:28:25 +00:00
Mayank Patke 78c3fc4595 [dart2js] Don't encode types as their own superinterfaces.
Change-Id: I0c478a1d09985394610b6f76224e40b6f12467fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112042
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2019-08-06 22:12:58 +00:00
Mayank Patke f715515531 [dart2js] Encode type variable as index in type rules when the target type declares the type variable.
Change-Id: Ie99ac30c04867336e03d32e9933c6b073d84ea8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112038
Reviewed-by: Stephen Adams <sra@google.com>
2019-08-06 22:12:58 +00:00
Stephen Adams f13978ca9d [dart2js] new-rti: Accelerator for some primitive types.
Change-Id: Icfd479633e6d3dac99ccddb04a6ac67e8859feb9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111940
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-08-06 19:17:49 +00:00
Stephen Adams a94ef646e9 [dart2js] new-rti: register H.Closure when referenced
Change-Id: I20f830dcfca0a8b1c4ae998c500310a883e5c00e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112022
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-08-05 22:42:17 +00:00
Stephen Adams a188b534dc [dart2js] new-rti: as/check used 'is' method
If 'is' is specialized, 'as' will benefit.

Change-Id: Ie95982322bbdd48ac05f0073699547e0b8e7f77c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111986
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-08-05 19:59:45 +00:00
Mayank Patke 8d1f5a5b51 [dart2js] Omit empty objects from new RTI type rules.
Change-Id: I3efbb9d1283606023babbe4940e040b5c5e24d60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111265
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2019-08-05 19:48:08 +00:00
Stephen Adams a3d6b4802f [dart2js] new-rti: Use findType in parameter stubs
This fixes the stubs that default type parameters.
Some benchmarks test this behaviour.

Change-Id: If47d99e5fbf1a2bceeb0e6e930e27cfea6f3eedc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111871
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-08-02 23:59:01 +00:00
Stephen Adams b16d018b29 [dart2js] new-rti: handle passing element type to [a]sync* methods
Change-Id: Iad5522f0a0fc3d34f06881ab2a0b42bc235f40ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111741
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-08-02 20:32:09 +00:00
Stephen Adams 6d13a6df94 [dart2js] new-rti: Lower some checks to a simpler form
HAsCheckSimple is a specialization of HAsCheck that calls a js_runtime
helper to do the check.

This CL specializes bool/double/int/num/String.

is-checks are not included but used by as/type checks, so there is not
much speedup for this CL.

Change-Id: Id65941d789e017350d3f9e181174e4cce768eea5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110422
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2019-08-02 18:00:08 +00:00
Johnni Winther 972d4e9a75 [cfe] Move relativize code from dart2js to cfe
Change-Id: I2e07dcf91adf65965583189972b0c27cc0aee526
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111427
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-08-01 21:07:50 +00:00
Stephen Adams db3028ac5e [dart2js] Enable --benchmarking-x
Change-Id: I9fd19c8bbc1e4dff5606ca59e2a97b005c9015d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111680
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2019-08-01 19:53:13 +00:00
Mayank Patke 440d1f3578 [dart2js] Register TypeUse for HAsCheck SSA nodes.
Change-Id: Ic8a104eb3108d7b1cede86a2e4955c3a5e37586d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111260
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2019-07-30 04:24:22 +00:00
Mayank Patke 928dff2b3e [dart2js] Omit Object from new RTI type rules.
Change-Id: I63a4dbdbbf301128523f93958567735f9e2a19d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111142
Commit-Queue: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Auto-Submit: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2019-07-29 21:10:03 +00:00
Stephen Adams 3d578c7037 [dart2js] new-rti: recognize 'raw' types as precise abstract values
Change-Id: Ie68a36695c8ad93ec4ea280d989cd2001ed5cc78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110755
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-07-29 20:59:03 +00:00
Stephen Adams 73cbfd3826 [dart2js] new-rti: Emit new rti for constants
Change-Id: Ia4b5f55a4836d02d79b8c01cb68b6d23fb3cdc3f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110940
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-07-29 20:17:03 +00:00
Stephen Adams 87626888a4 [cfe, dart2js] Constant hashcode improvements.
CFE and dart2js hashCodes for class instance constants behaved poorly
for certain patterns.

The new tests in https://dart-review.googlesource.com/c/sdk/+/110640
take too long with dart2js (many minutes).

These changes bring dart2js compilation into the normal expected time
(a few seconds) for this size of input.

Change-Id: I67f9be826c2ce7e395379f1ddfff422523631bb1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110660
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-07-28 16:53:50 +00:00
Stephen Adams 614c0cbb52 [dart2js] new-rti: Impacts for _generalXXX methods
Change-Id: I5defeada6b8ffe2f5a59fc1f2c1a2139f0b02ad6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110753
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-07-27 01:47:47 +00:00
Stephen Adams 030ef7b2b3 [dart2js] new-rti: HAsCheck basic optimization
1. Remove HAsCheck when input will always pass.
2. Strengthen output by checked abstract value.

Change-Id: Ibd45cc0e64fb81112559265cdf1d02a9f673e193
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110542
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-07-27 01:30:47 +00:00
Mayank Patke 03e5d910ce [dart2js] Register _Universe.addRules as a global impact.
Change-Id: Ifb39344b5e0fc12a6003193a536fbc3a980c3660
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110820
Commit-Queue: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Auto-Submit: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2019-07-27 00:52:17 +00:00
Mayank Patke 0c8a7b12ab [dart2js] Implement evalTypeVariable in new RTI.
Change-Id: I675dcd5a3a67439dde98c5bcbb72dc7f36ccec38
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110762
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2019-07-26 23:06:45 +00:00
Johnni Winther bcfe26cba0 [cfe] Fail early on unsupported evaluated constants
The many different entrypoints to the CFE have repeatedly shown problems
with targets that do not support unevaluated constants being used
without providing an environment.

Making the targets opt-in to supporting unevaluated constants will
give the users of CFE early notice that CFE is used inconsistently
(as opposed to the backends failing when they happen to see an
UnevaluatedConstant node that they don't support).

Change-Id: I98c80df3a551823598e413e2895f5649f22f7c22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110561
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-07-26 16:57:51 +00:00
Johnni Winther e9220a762b [dart2js] Cache [_ConstantNodeIndexerVisitor] on [_MemberData]
This avoids the recomputation of constant node indices on every
constant reference.

Closes #37611

Change-Id: I376a8cdb55da75e9050c544dc60d20eb7685c0c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110563
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Auto-Submit: Johnni Winther <johnniwinther@google.com>
2019-07-26 16:23:56 +00:00
Mayank Patke 4bec4f043d [dart2js] Emit new RTI type rules.
Change-Id: I9d28a1f0244c8b3af0e9464f1fa55be79d0422a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110380
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2019-07-25 23:46:37 +00:00
Stephen Adams 4cba23496a [dart2js] new-rti: Remove no-op evals.
$T.eval$1("0") --> $T

Change-Id: Ifb544563f963af5ac6005d6719aaeb45d4e393ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110349
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2019-07-25 03:25:23 +00:00
Stephen Adams 9d786640df [dart2js] Use Indexed{Sink/Source} for ConstantValue
This avoids naive tree-expansion of constant DAGs.

Fixes a bug in IndexedSink where multiple nodes in a tree or list can be written
as the same index, so on reading the second node is returned instead of the first.
This affects source information of inlined methods where some frames are dropped.
The .map files are about 10% larger with the frames.

Change-Id: I7e39c72510145a5ee52ea07ad2a3860bd382ee20
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110181
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-07-24 17:12:43 +00:00
Stephen Adams d767363950 [dart2js] Make _ConstantNodeIndexerVisitor DAG-aware
Change-Id: Ie0dc25ef90805fd05e65c738bb010361e7ec9590
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/110186
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-07-24 01:19:32 +00:00
Stephen Adams 06b7329fc9 [dart2js, gardening]: Fix dart2js/inferrence/type_mask2_test
Change-Id: I5b84c5832866931a9ffe6ece95ee621b4aca3593
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109981
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-07-23 09:41:18 +00:00
Stephen Adams 9197c1b021 [dart2js] new-rti: fix TypeEval GVN
Type expression GVN needs to structural equality on TypeRecipe and
TypeEnvironmentStructure.

Change-Id: Iaa4985ec99fff6db29e8bfd63fd0dbacdc10dde6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109942
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-07-22 23:32:00 +00:00