Commit Graph

4698 Commits

Author SHA1 Message Date
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
Stephen Adams 41263a4c1a [dart2js] Fix for 37502: double ~/ x returns int
http://dartbug.com/37502 shows the type-propagation results of ~/ is double instead of int.

Bug: 37502
Change-Id: Iec7b8a876a20784c7d2858305eaa67e9d02a63dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109889
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2019-07-22 20:54:10 +00:00
Mayank Patke 76f82bd0ec [dart2js] Split up runtime_types.
This is a first pass at breaking up runtime_types.dart.
runtime_types_resolution.dart contains the former parts of runtime_types
that runtime_types_new depends on (namely, RuntimeTypesNeed and
RuntimeTypesSubstitutions), as well as their transitive dependencies.
This leaves just the code responsible for encoding the old type
representation in runtime_types, mirroring what we have in
runtime_types_new. As a result, both runtime_types and runtime_types_new
have runtime_types_resolution as a common dependency, but
runtime_types_resolution does not depend on a particular encoding.

However, runtime_types_resolution is still over 2.5 KLOC and still
depends on the old TypeCheck representation.

Change-Id: I22d932d2695cb573c2a3b4dafe5132d4e424fa77
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109557
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-07-22 20:00:47 +00:00
Johnni Winther 7075ae7026 [cfe+dart2js] Move features to CFE
To share support for annotated tests based on Features.

Change-Id: Ic319442e2e016bf4d1584825ea019d13a74acedb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109560
Reviewed-by: Stephen Adams <sra@google.com>
2019-07-22 16:00:28 +00:00
Stephen Adams 9cd47ac2e6 [dart2js] new-rti: Generate correct $signature functions for closures
Change-Id: I0f75195be4a75b46793b1cd9ec49ecc6e783611d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109723
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-07-19 22:52:51 +00:00
Stephen Adams a089199b93 Fix for issue 37494
A bad 'dummy interceptor' optimization was applied to a super-call to
a method that is used in an intercepted class. This lead to seeing '0'
instead of the List receiver. Fix is to base decision on the target
method when available.

Bug: 37494
Change-Id: I07e5555cbe0083d7dd2510dc5bb0cba99201cd0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109553
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-07-19 17:09:30 +00:00
Stephen Adams d114c96920 [dart2js] new-rti: Use recipes in types table
Change-Id: If4c1624ea7113e102d2a516496cd65a134b9b737
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109522
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-07-19 02:11:16 +00:00
Stephen Adams be36a031c6 [dart2js] Support user-defined 'operator >>>'
Change-Id: Ic2e9392731b01727ec4500aa9a31d535d9c68143
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109000
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-07-18 23:52:35 +00:00
Stephen Adams fcc99f1e06 [dart2js] new-rti: naming of interface type parameters
Change-Id: Id8b2aaac4e7a28f3da39652fa8d00c797407fb7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109462
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-07-17 21:11:35 +00:00
Johnni Winther a66a3e321e [cfe+dart2js] Handle duplicated references in constant nodes.
Change-Id: If21810ea938cd697039e9549c7dbd6ac869eabc8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109260
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2019-07-17 06:26:34 +00:00
Johnni Winther 6d95cb72e2 [dart2js] Test type directives
Change-Id: I4b0459bc097bb5618ab32f479a703ec35303436b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109080
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2019-07-16 14:32:37 +00:00
Johnni Winther b2ed4b3c7b [dart2js] More error tests on pragma annotations
Change-Id: Ic8d27d795f5511ef46d3c7e53a179f766529d0b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108814
Reviewed-by: Stephen Adams <sra@google.com>
2019-07-16 14:32:37 +00:00
Vyacheslav Egorov e82ca2f366 [fasta] Unconditionally enable asserts in const constructors
Based on feedback from the language team (https://github.com/dart-lang/language/issues/447).

Removal of CompilerOptions.enableAsserts is pending cleanup in DDK.

Change-Id: Id515e91da3e31647941ce893b2cffc58894a1b1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108813
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-07-12 15:42:43 +00:00
Johnni Winther e4689c9302 [dart2js] Use new pragma directive syntax.
+ add annotation test.

Change-Id: Ic87e6b5f3f45a7e65de53fb6afacb04fd469e951
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108726
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-07-12 07:27:28 +00:00
Johnni Winther d16c0a127e [cfe] Change supportSetLiterals default value to true
This aligns the NoneTarget with the raw output of the CFE.

Change-Id: Ic3a0a3de46dac389d0ade581192e392fdaba9553
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108721
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-07-11 08:54:19 +00:00
Johnni Winther f743594375 Handle flags at member level
Change-Id: I5fa438789fc1ac52007efeb6ada607f5c51ec037
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108401
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2019-07-10 14:08:33 +00:00
Stephen Adams 774a392aa3 Add '--benchmarking-x' flag
Change-Id: Iae541ae11431ccb86b74ca44b280e5bb6636d5f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108300
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-07-08 01:37:57 +00:00