Commit Graph

789 Commits

Author SHA1 Message Date
Johnni Winther 639cff0ec0 [dart2js] Detect non-trivial substitution between type and this-type in optimization
Closes #37267

Change-Id: I317c2b8e5fb3f1df10691bdaf9c10f20b8042b8c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106347
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-06-21 17:07:57 +00:00
Johnni Winther 77668f4e58 [CFE] Preserve errors in unevaluated and unused arguments and locals
Change-Id: If8c23ac2f374ee863fd8df4c241195c0a115e69d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104980
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-06-21 13:53:17 +00:00
Mayank Patke 089a435344 [dart2js] Add subtyping for identical interface names without explicit type rule.
Change-Id: I0db1ff88e6fcb6a5e3f7615aa588afb473a77a16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106820
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2019-06-20 21:24:27 +00:00
Mayank Patke f4903989bb [dart2js] Refactor RTI type rules and streamline test harness.
Change-Id: I8c32ec329d26babcfccc3e06f4d3a7ead9257201
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106780
Reviewed-by: Stephen Adams <sra@google.com>
2019-06-20 21:24:27 +00:00
Robert Nystrom 1734133f2c Migrate tests off the ancient multitest marker syntax.
Change-Id: Iae025d9c544831e24debf0a670202ced8f252a97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106201
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2019-06-19 21:15:30 +00:00
Mayank Patke 0fae370538 [dart2js] Add subtyping rules to new RTI.
Change-Id: I9b70e2ccfc2dbac768fdccf4449b0f551a4fb5cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106486
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2019-06-19 20:01:16 +00:00
Stephen Adams 68dadda21c Add other terminal Rtis
Change-Id: If70dc283a5fb06fa0d037fb0d30e4ba19352f8d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105736
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2019-06-13 00:22:28 +00:00
Stephen Adams b981798e3a Add environment.bind operation.
Change-Id: I2fd5d4b87e7fdd1fe75f064ec82c43a8334c2138
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105722
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-06-12 21:15:22 +00:00
Stephen Adams 701a2fed01 Parse binding recipes
Indexing scheme changed.

Change-Id: I44f7592b65d615827ea3b78f46117c71f3e50b31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105660
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-06-11 23:52:59 +00:00
Stephen Adams 7ecd81b0b8 Start on parser
Change-Id: Ibcc1dcb04735bcefd43f4239dcac28329f519c95
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105470
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2019-06-11 03:17:35 +00:00
Stephen Adams d10dffbfbf Add simple test to create dynamic
- Add testing entry points to create Universe
- Add creation of 'dynamic'

Change-Id: I54dd27b9a2f6c93a382c4927e6a306b11bcea96c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105345
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-06-07 19:40:12 +00:00
Kevin Millikin 64b0ce5b58 Remove UI as code experimental flags from our tests
The features control-flow-collections and spread-collections have been
shipped and it is no longer necessary for tests to explicitly opt into
them.

Change-Id: I074b91d12e4e485ee4a64147947bb1113899ecdc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104780
Auto-Submit: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
2019-06-06 13:17:49 +00:00
Stephen Adams 237d3ca398 dart2js: Add skeleton dart:_rti libary
- Skeleton Rti type
- Skeleton test
- Add dependency on command-line flag to get dart:_rti into platform dill

Change-Id: Idf383269c66c9951e23fd70a45ce65c54a973586
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104921
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2019-06-06 01:02:20 +00:00
Nicholas Shahan 86c7165969 [tests] Avoid use of $strong because it is always true now
* Remove all `&&  $strong` clauses.
* Delete all sections that include a `&& !$strong` clause.

Change-Id: Idd32cf5623793e3f98e3e998025bac079d88e2f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102223
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2019-05-16 17:41:27 +00:00
Sigmund Cherem 9ac7bd7855 Ensure we have a scope for variables when visiting fields
Fixes https://github.com/dart-lang/sdk/issues/36864

Change-Id: I66d70cc30b26bd069d4ab5e2b98f0f5954f3ef59
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101460
Auto-Submit: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2019-05-06 21:43:42 +00:00
Johnni Winther 5fc8029587 Remove StaticMemberUsage and cleanup codegen world builder
Change-Id: I4fdc6148af671010d1aca55c05d08e55e9c1e9fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100245
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-04-25 08:45:20 +00:00
Mayank Patke ab66a3808b Add more JS subtyping semantics to CFE constant evaluator.
If we're targeting a JS backend, `isSubtype` considers every int to be a
double. We need to additionally allow any integer-valued double to be an
int. This mainly allows us to handle signed zeroes correctly.

Fixes https://github.com/dart-lang/sdk/issues/36562.

Change-Id: I00d1e693bb3f1268ac100a76c9bec8fcc612b182
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99101
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-04-10 21:09:03 +00:00
Mayank Patke 919461badd Ensure boolified SSA nodes are non-null first.
Fixes https://github.com/dart-lang/sdk/issues/34147.

The Dart language specification says we should ensure booleans are
non-null in the following (non-exhaustive) situations:
* (ternary) conditional expressions - this includes the `!` operator
since `!x` is equivalent to `x ? false : true`
* arguments to logical boolean expressions (`||` and `&&`), modulo
short-circuiting
* `if` conditions
* `for` loop conditions
* `while` conditions
* `do`/`while` conditions

With control-flow-collections enabled, this CL will also cover
conditions in `if` elements and `for` elements. Tests for these already
exist in
language_2/control_flow_collections/{if,for}_null_condition_test.dart.

Change-Id: I2ce9a30adeb16a0a68411f358f69aeca08656dab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98780
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-04-10 00:28:10 +00:00
Mayank Patke 2f77af1c6f Fold identical(double.nan, double.nan) => false in dart2js.
Change-Id: Idc6b064e330af71bbc8525a48874d332d84f404a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98607
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2019-04-03 21:14:31 +00:00
Johnni Winther 93d0e8279a Include liveness of type arguments in supertypes in RTI needed checks computation
Including supertypes (and not just superclasses) this time.

Change-Id: Ib398f6f2fab0ae502dd754727b482641793dd225
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98569
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-04-03 15:03:46 +00:00
Johnni Winther 78fca5b2fa Include liveness of type argument in supertypes in RTI needed checks computation
Change-Id: Ifdde3e8694f8d39ccf10cac0d5dc2cb3cb9225bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98560
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-04-03 10:23:53 +00:00
Mayank Patke 335a854696 Implement JavaScript semantics for frontend constant folding.
Change-Id: I8232d0f5875d8471d8110582c44fc9d9b8a735f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98240
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-04-02 22:37:46 +00:00
Sigmund Cherem c26f1c6bf7 Do not assume stack trace is not null
Change-Id: Ib795cfdbcf9599f7e4bc2688b9a965f50c0b7c3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98421
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2019-04-02 00:02:53 +00:00
Johnni Winther 1a3e8dda3b Handle nested unevaluated constants in constant evaluator
The constant evaluator assumed that any ConstantExpression met during evaluation of a sub expression was not an unevaluated constant. This do occur, for instance when a field is initialized to an unevaluated constant. With the change, unevaluated constants met during evaluation are themselves evaluated.

This change also fixed handling of assert initializers in unevaluated constants.

Change-Id: Id9e676f40bc829c4d234f34a74ef0ca5c4c6ec48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98348
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2019-04-01 14:29:32 +00:00
Johnni Winther eb6f1b6abd Handle effectively constant fields in class stub generator
Closes #36222

Change-Id: Ic8b7a3963e1364903b4b2d7871ff0b12cb134572
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97082
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-03-15 20:15:25 +00:00
Johnni Winther 3e794ec16a Add tests for rti emission on function types
Change-Id: Iee612110afbb83947a7869df3c49138a9ba34832
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96906
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-03-15 09:40:14 +00:00
Mayank Patke 4339fe9b51 Add constant evaluation tests for IfNull.
Change-Id: I68229e831cea9e1c9aac548d9da8434bcacdaaff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96710
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2019-03-13 21:36:51 +00:00
Mayank Patke 8adcab9fec Add constant evaluation tests for Identity.
Change-Id: I9ce93147f7cdb96ce659551499a64958a77d1711
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96709
Reviewed-by: Stephen Adams <sra@google.com>
2019-03-13 21:36:51 +00:00
Mayank Patke 3552dbb429 Add constant evaluation tests for Equals.
Change-Id: I20be37af485f8841ec549f33c16e5680e0170444
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96708
Reviewed-by: Stephen Adams <sra@google.com>
2019-03-13 21:36:51 +00:00
Mayank Patke 27328840f9 Add constant evaluation tests for GreaterEqual.
Change-Id: I2e2a3b656710cd130882dd2f7480f9d532a1ba61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96707
Reviewed-by: Stephen Adams <sra@google.com>
2019-03-13 21:36:51 +00:00
Mayank Patke 9f680cd0bd Add constant evaluation tests for Greater.
Change-Id: I356b805ff69307a697e073ea4499217e11541cc5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96706
Reviewed-by: Stephen Adams <sra@google.com>
2019-03-13 21:36:51 +00:00
Mayank Patke 0950d473ad Add constant evaluation tests for LessEqual.
Change-Id: If98b28bfbb32b14e1d53546642fae613aa937519
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96705
Reviewed-by: Stephen Adams <sra@google.com>
2019-03-13 21:36:51 +00:00
Mayank Patke 7ff70237d4 Add constant evaluation tests for Less.
Change-Id: I024905e6e90f40301d092de2e4e0e45e379b143b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96704
Reviewed-by: Stephen Adams <sra@google.com>
2019-03-13 21:36:51 +00:00
Mayank Patke ce9a1bb24e Add constant evaluation tests for Add.
Change-Id: I21b5fd03bfaee3c32573c56d8f529c933f315d14
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96703
Reviewed-by: Stephen Adams <sra@google.com>
2019-03-13 21:36:51 +00:00
Mayank Patke 2fa96dd653 Add constant evaluation tests for Divide.
Change-Id: Ic361816bd0cfa5a6822cb96322bb29fcf7749778
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96405
Reviewed-by: Stephen Adams <sra@google.com>
2019-03-13 21:36:51 +00:00
Mayank Patke 952421a68d Add constant evaluation tests for TruncatingDivide.
Change-Id: I144967283f76570ec6312750995ca219d3a4ad09
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96404
Reviewed-by: Stephen Adams <sra@google.com>
2019-03-13 21:36:51 +00:00
Mayank Patke 9fd0ec2560 Add constant evaluation tests for Modulo.
Change-Id: Ia8d7fd2faee166ea71aaca5e1fc797d5d658d8c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96403
Reviewed-by: Stephen Adams <sra@google.com>
2019-03-13 21:36:51 +00:00
Mayank Patke 9262d111fd Add constant evaluation tests for Multiply.
Change-Id: I05e7c3e6b6cb4a137a03f4917b8ab7125a1e19b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96402
Reviewed-by: Stephen Adams <sra@google.com>
2019-03-13 21:36:51 +00:00
Mayank Patke aba9392f0e Add constant evaluation tests for Subtract.
Change-Id: Id818fc9c2f246b8858fb747d8955604b44348a4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96401
Reviewed-by: Stephen Adams <sra@google.com>
2019-03-13 21:36:51 +00:00
Mayank Patke 3a38f0bb89 Add constant evaluation tests for BooleanOr.
Change-Id: Ib9f7b409845ff13ecaa49fd1d949ea1bf474281d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/94465
Reviewed-by: Stephen Adams <sra@google.com>
2019-03-13 21:36:51 +00:00
Mayank Patke 052d6d235c Add constant evaluation tests for BooleanAnd.
Change-Id: Icead29835e72027f6f9cd82f799781983843fc89
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/94464
Reviewed-by: Stephen Adams <sra@google.com>
2019-03-13 21:36:51 +00:00
Mayank Patke be5332c0a5 Add constant evaluation tests for ShiftRight.
Change-Id: I327d98fa496543db885549e3654844da5f9f6a16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/94463
Reviewed-by: Stephen Adams <sra@google.com>
2019-03-13 21:36:51 +00:00
Mayank Patke 4f34218ce1 Add constant evaluation tests for ShiftLeft.
Change-Id: Ie669c127be1f76a64dbb7a96b81b3ce7d1621733
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/94462
Reviewed-by: Stephen Adams <sra@google.com>
2019-03-13 21:36:51 +00:00
Mayank Patke 3df5334137 Add constant evaluation tests for BitXor.
Change-Id: If5b72f5743ebde2304058ba57e50c7dee5173561
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/94344
Reviewed-by: Stephen Adams <sra@google.com>
2019-03-13 21:36:51 +00:00
Mayank Patke 84d8d6b513 Add constant evaluation tests for BitOr.
Change-Id: I93d172601c8c3e83e3a17d4eeb90d06f2fe2fd45
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/94343
Reviewed-by: Stephen Adams <sra@google.com>
2019-03-13 21:36:51 +00:00
Mayank Patke f7972480bd Add constant evaluation tests for BitAnd.
Change-Id: I162aed0534530efb04e7e743d1f29ef041f888fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/94342
Reviewed-by: Stephen Adams <sra@google.com>
2019-03-13 21:36:51 +00:00
Mayank Patke 432c6c8c39 Add constant evaluation tests for Not.
Change-Id: I1afa07efb7f3def69f13719ee3f57cd4d8c00f2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/94341
Reviewed-by: Stephen Adams <sra@google.com>
2019-03-13 21:36:51 +00:00
Mayank Patke 2e1c78db7b Add constant evaluation tests for Negate.
Change-Id: I9e23fc47538324fcd64c8e2e90e75cf12e8b0491
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/94340
Reviewed-by: Stephen Adams <sra@google.com>
2019-03-13 21:36:51 +00:00
Mayank Patke 5853f129b2 Add constant evaluation tests for BitNot.
Change-Id: I1bc82d76073006a18109eedfc62bd53a70f1685f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/94320
Reviewed-by: Stephen Adams <sra@google.com>
2019-03-13 21:36:51 +00:00
Mayank Patke aa4a2df5a2 Add structure of constant folding tests.
This test suite is not comprehensive by any means. The goal is to
establish the right structure for the tests (so that we get the right
inlining and constant folding behavior). Broader semantic tests will be
added later.

Change-Id: Ib028ec05f063b98046f5946272cfbfe986244d3f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/94040
Reviewed-by: Stephen Adams <sra@google.com>
2019-03-13 21:36:51 +00:00