Commit Graph

3816 Commits

Author SHA1 Message Date
Stephen Adams ded73cdd08 Revert "[dart2js] Simplify noInline / tryInline annotations"
This reverts commit 8bae3a1cfd.

There are versioning issues that need to be addressed.

TBR=kevmoo@google.com

Change-Id: Ia82e94f127523db650e4df03af1179ef94463bee
Reviewed-on: https://dart-review.googlesource.com/76564
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2018-09-25 22:11:42 +00:00
Stephen Adams 8bae3a1cfd [dart2js] Simplify noInline / tryInline annotations
Use @pragma for dart2js.noInline / dart2js.tryInline

Change-Id: Id7932ad7f85b91e4c1e427bb88e782ede81d5926
Reviewed-on: https://dart-review.googlesource.com/76341
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2018-09-25 19:08:14 +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 b4341f02db Remove unneeded method rti need
We don't need to mark generic methods (not local functions) as needing
rti if subtypes of Functions need support for .runtimeType.

Unlike local functions, generic methods only have function type when
they are torn off. The tear-off itself doesn't add the need for type
arguments: either the function is instantiated, in which case the
instantiation carries the type arguments, or it is uninstantiated, in
which case the function type is still generic.
Change-Id: I5fc849aad443f49c4b0b26b18d6eccc409e43fb9
Reviewed-on: https://dart-review.googlesource.com/76000
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-09-25 09:16:41 +00:00
Johnni Winther 4b312b2b8c Support multiple superclasses in the mixin on clause.
Change-Id: I23c613170be8fdf3c4a7ace560d71161b3e7320f
Reviewed-on: https://dart-review.googlesource.com/75881
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-09-25 08:26:38 +00:00
Johnni Winther 0d588bf50c Add --omit-as-casts option
Change-Id: I0e5b122c28aefb6badc95882e95a97bdd4b8edd3
Reviewed-on: https://dart-review.googlesource.com/56801
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-09-24 07:22:28 +00:00
Stephen Adams 1e5b80918a [dart2js] hashCode stability to improve repeatability
The default Object.hashCode is different on every run, so avoid using it for MemberEntity.hashCode.

Using a consistent (if arbitrary) hashCode appears to fix issue 34527
and also makes the *.js.map files consistent.
We also sort instructions in SsaCodeMotion to make order less sensitive to unrelated changes.

We might still want to impose a canonical ordering for map files, e.g. minified map file entries might be sorted by name.

Change-Id: I94ad6c1e18ac808b92e62e76b48558a7e2fbd7b7
Reviewed-on: https://dart-review.googlesource.com/75982
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2018-09-21 23:47:50 +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 1681241062 Remove _ClassEnsurer
This is no longer needed since we eagerly register all classes with the
ClassHierarchyBuilder

Change-Id: Ifaa27017bac6a7b0a659de83af415f2bd25ea005
Reviewed-on: https://dart-review.googlesource.com/75260
Reviewed-by: Stephen Adams <sra@google.com>
2018-09-20 07:37:32 +00:00
Stephen Adams 96a190020e Remove dart2js non-strong platforms
Since dart2js is now strong-mode-only and ignores the --strong flag, I don't see the point in having 'strong' in the platform name.

Removed:
  dart2js_platform
  dart2js_server_platform
renamed:
  dart2js_platform_strong --> dart2js_platform
  dart2js_server_platform_strong --> dart2js_server_platform

Change-Id: If74ef31a17acc15a23a5338e5f53e820fc66b0dd
Reviewed-on: https://dart-review.googlesource.com/71425
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2018-09-18 16:33:19 +00:00
Johnni Winther 5dff98f960 Use inferred map type arguments in element map fields
+ split method creation from lookup in kernel element map.

Change-Id: If375d8ffdb12cde9180476828a9324e372d5738f
Reviewed-on: https://dart-review.googlesource.com/74721
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-09-18 06:51:15 +00:00
Johnni Winther 2da165a62d Stop compilation early on CFE compile-time errors
Change-Id: Ie93af5880bbd0b9f0c72aa6c1832550bf9025595
Reviewed-on: https://dart-review.googlesource.com/75160
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-09-18 06:50:55 +00:00
Johnni Winther 2cb2ac401c Optimize ClassHierarchyBuilder.isInheritedInSubtypeOf.
This fixes the compile-time regression introduced by
https://dart-review.googlesource.com/c/sdk/+/72643

Change-Id: I55d441592cd710daeca980a3eb902284751575dc
Reviewed-on: https://dart-review.googlesource.com/75001
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-09-17 08:06:15 +00:00
Stephen Adams 3e9f4e6792 dart2js: generate simple '==' in more cases
Change-Id: I9f8d674f8346b6c3ecf5232c369b3953053d261f
Reviewed-on: https://dart-review.googlesource.com/74964
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-09-14 17:11:23 +00:00
Johnni Winther bb56d4592f Fix receiver type for js-interop access
This includes the unknown potential targets of access to js-interop
members. Since we don't know actual classes implementing the js-interop
classes we just assume it could be any of them.

Change-Id: I4d91ab673fa8221eb701b34e9c32fd16e5a1c381
Reviewed-on: https://dart-review.googlesource.com/74980
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-09-14 16:56:44 +00:00
Johnni Winther 8dea9aa45e Share inlining cache between members
Change-Id: I7dde30abcd585016efad664d65911101a213288f
Reviewed-on: https://dart-review.googlesource.com/75060
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-09-14 16:55:45 +00:00
Johnni Winther 625d679c8b Remove ElementCreatorMixin from JsKernelToElementMap
Change-Id: I2ff9014305177a1f0060626062fadf8276b74979
Reviewed-on: https://dart-review.googlesource.com/74400
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-09-13 07:32:15 +00:00
Stephen Adams bd660a5707 Better inlining in execute-once paths
Calls that return constants and calls that forward to calls of the
same or smaller size should be inlined in static initializers.

Change-Id: I55284b7455bc70e34607c0a218a5bf6ca31fc6b4
Reviewed-on: https://dart-review.googlesource.com/74020
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-09-11 20:43:11 +00:00
Johnni Winther 5ab5c00ea4 Compute annotations in the K-World
This ensures that entities only used in metadata is part of the K-world
and doesn't have to be created late in (only) the J-world.

Change-Id: If9a264c51fba99093a196538fb655b1d5fafd47a
Reviewed-on: https://dart-review.googlesource.com/73880
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-09-11 11:10:37 +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 f8633aeae7 Move KernelToElementMapForBuilding and friends to js_model/element_map*
- this is part of splitting element map classes between K/J worlds

Change-Id: I82e4373f0849b12cb0d1586b77bfa411f55d26a7
Reviewed-on: https://dart-review.googlesource.com/72822
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-09-10 14:44:02 +00:00
Johnni Winther 88bff737f9 Inline element map mixins that are only applied once
Change-Id: Ibfadf6ee6aaf5ec184b4b7b71cb8767cd968a237
Reviewed-on: https://dart-review.googlesource.com/72820
Reviewed-by: Stephen Adams <sra@google.com>
2018-09-10 14:44:02 +00:00
Johnni Winther 8c03bff4bb Step towards splitting element maps in K/J versions
* Refactor ClassData, remove ensureCallType
* Make kernel/types.dart its own library

Change-Id: I280f7de0b78f9a14551f0ae0548452693a6d0d05
Reviewed-on: https://dart-review.googlesource.com/72761
Reviewed-by: Stephen Adams <sra@google.com>
2018-09-10 14:44:02 +00:00
Johnni Winther c4bfa601d1 Add first step of an in-memory serialization test
Change-Id: If6d3d0c3f0bc4ce931a76087d7efb75c727595f9
Reviewed-on: https://dart-review.googlesource.com/72760
Reviewed-by: Stephen Adams <sra@google.com>
2018-09-10 14:44:02 +00:00
Johnni Winther e311e12bc4 Move all data for collection for testing behind one flag
- to ensure that we don't retain unneeded data in production

Change-Id: I2f702e040ed99cb8540a5b60efcf88a2c6b33af0
Reviewed-on: https://dart-review.googlesource.com/72720
Reviewed-by: Stephen Adams <sra@google.com>
2018-09-10 14:44:02 +00:00
Johnni Winther f3036f4e17 Support supermixins in dart2js
The tests use the old syntax which CFE currently (wrongfully) allows for dart2js.

Change-Id: Ia4dde9e6e1444d8ec22905c36209049bd4161faa
Reviewed-on: https://dart-review.googlesource.com/72443
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-09-10 08:16:57 +00:00
Johnni Winther 5e263044e8 Enable StrongModeWorldStrategy
This makes closed world computation take the static type of the receiver
into account and removes non-live members from the J-world.

Change-Id: I5547aaae4685c6417a94916df0bc4e621296ce8d
Reviewed-on: https://dart-review.googlesource.com/72643
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-09-10 07:09:07 +00:00
Johnni Winther 134bb884de Handle generic types in native behavior
Previous implementation didn't include subtypes of the specified type.
For instance `JS('Rectangle', ...)` should have triggered the inclusion
of `_DomRect` but the use of this-type in the subtype test,
`_DomRect <: Rectangle<T>`, prohibited this.

This fix is to use the raw type instead of the this-type. The subtype test
will therefore be `_DomRect <: Rectangle<dynamic>` which correctly
includes `_DomRect`.

The change has the effect that `JS('List', ...)` now actually includes subtypes of
`List`. For this reason uses of `List` have been updated to use `JSArray` or
explicitly use `returns:...` to avoid unintended inclusion of native lists such
as the native typed arrays.

Change-Id: I06ab55d9bf694829596875d9c3a0a6c954d396b7
Reviewed-on: https://dart-review.googlesource.com/73903
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-09-07 22:28:37 +00:00
Johnni Winther c715e8125d Refactor global inference data to prepare for serialization
Change-Id: If88b948ca80b1a7915d87a49ba4e1d05de669282
Reviewed-on: https://dart-review.googlesource.com/72401
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-09-06 07:11:44 +00:00
Johnni Winther f9bb407eba Delete analyze_dart_test
- this tested Dart 1 semantics of the dart2js implementation

Change-Id: Ib80b3a056f552e9826b5c97a88dab9df3e15570e
Reviewed-on: https://dart-review.googlesource.com/72821
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-09-06 07:10:04 +00:00
Peter von der Ahé fa14dbcdfc Format constants and remove dart2jsCode
Change-Id: Ia04066782292f0c49a56689056c69b0481f3aacb
Reviewed-on: https://dart-review.googlesource.com/72021
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2018-08-30 08:05:31 +00:00
Johnni Winther 263931bd33 Small cleanups to avoid warnings in IntelliJ
Change-Id: I02214d21a910def67184e49765af3020848389d9
Reviewed-on: https://dart-review.googlesource.com/71941
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-08-30 06:47:38 +00:00
Johnni Winther 185eec12a6 Avoid crash on falsely enqueued .call methods.
Change-Id: Ib58b02eecfc697f70e74cbb9f5e5816fb936a31b
Reviewed-on: https://dart-review.googlesource.com/71400
Reviewed-by: Stephen Adams <sra@google.com>
2018-08-29 07:29:38 +00:00
Stephen Adams ecfc03c3d1 dart2js: fix crash on setter with FutureOr type.
TBR=johnniwinther@google.com

Change-Id: Idc82430ccbee697201401ed7ebcb11c34cb3d8ce
Reviewed-on: https://dart-review.googlesource.com/71429
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2018-08-24 22:42:21 +00:00
Stephen Adams e1df47b15e Add closure signature to dependencies
Adds these missing dependencies to the deferred loading partition:

1. Signature of a local function / closure.
2. Bounds of type variables.

TBR=johnniwinther@google.com

Change-Id: I201d08cf874381e58e161d2f910b60d83932968c
Reviewed-on: https://dart-review.googlesource.com/71120
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2018-08-22 22:04:54 +00:00
Johnni Winther 75943282e5 Delete Flags.strongMode and references to it
Change-Id: Ia1af10f04224f172afb7dac1e88338d20467364b
Reviewed-on: https://dart-review.googlesource.com/70646
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-08-22 07:03:24 +00:00
Johnni Winther d456532124 Disallow non-js interop external members
Change-Id: Ic73a3e2b16bdf77a2cd94fdcfaffe7989a798909
Reviewed-on: https://dart-review.googlesource.com/70513
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-08-22 06:59:46 +00:00
Stephen Adams ceace12724 dart2js: Work-around for imprecise calledOnce info
Change-Id: Id1118a394a2be5c8a1844ce40ce33512239bf650
Reviewed-on: https://dart-review.googlesource.com/70843
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2018-08-21 17:02:13 +00:00
Johnni Winther 244c9bebec Remove STRONG_MODE flag
Change-Id: I260be375925dde43703f64e83e09ed924e44e669
Reviewed-on: https://dart-review.googlesource.com/70641
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-08-21 08:21:02 +00:00
Johnni Winther 814738b273 Remove CompilerOptions.strongMode/enableTypeAssertions/trustTypeAnnotations
Change-Id: I4a51b081f42d76f12c70c140286c28375fcbd5ce
Reviewed-on: https://dart-review.googlesource.com/70515
Reviewed-by: Stephen Adams <sra@google.com>
2018-08-21 08:21:02 +00:00
Johnni Winther d7c71862da Check setters in Dart 2
Change-Id: I3a0bb90f34072cb4ef47f2712c43e4779b92fbdd
Reviewed-on: https://dart-review.googlesource.com/70514
Reviewed-by: Stephen Adams <sra@google.com>
2018-08-21 08:21:02 +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
Stephen Adams e02ec040cb @dart2js.tryInline should not inline methods that can't be inlined
Change-Id: I1efc13b64d7740dbe904364e44fa6e6b9be0fd81
Reviewed-on: https://dart-review.googlesource.com/70440
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-08-17 22:14:03 +00:00
Johnni Winther 2c3e093208 Register implicit .call invocations.
Change-Id: I3dbfbe8d974474aaf8488a4432eeb988bc380be6
Reviewed-on: https://dart-review.googlesource.com/69966
Reviewed-by: Stephen Adams <sra@google.com>
2018-08-17 12:05:48 +00:00
Johnni Winther 1285506aec Register need for constructors used in instanceof checks
Change-Id: Ibc84f859a10517e4b34317a1feea0563633ee2fa
Reviewed-on: https://dart-review.googlesource.com/70262
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2018-08-16 20:50:36 +00:00
Vyacheslav Egorov aa8145a03d [vm/kernel] Add a transformation that annotates invocations with receiver type.
Currently we only annotate those call-sites that would result
in generic covariant checks performed on the callee side.

Bug: https://github.com/dart-lang/sdk/issues/31798
Change-Id: Ifcf60032036575f615015d716276484a7c1236b3
Reviewed-on: https://dart-review.googlesource.com/69580
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-08-16 12:30:56 +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
Sigmund Cherem 8a05c944cd Remove JsInvocationMirror._invokeOn
I believe this was code only used via dart:mirrors

Soon we might want to rename JSInvocationMirror to just JsInvocation (so it's
clear that it is only used for nsm)

Change-Id: I0e0f836b18e6f290311c7173cfafedfcccab5c6f
Reviewed-on: https://dart-review.googlesource.com/69246
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-08-13 18:09:14 +00:00
Harry Terkelsen 5d4e85ba3d Allow x == null to be a constant value whenever x is const.
This is the fix for #33408 for dart2js

Change-Id: Ifddeacb68884da308d279ce6d5cbbb6adc5385ca
Reviewed-on: https://dart-review.googlesource.com/69020
Commit-Queue: Harry Terkelsen <het@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-08-09 23:48:21 +00:00
Stephen Adams 4d156f9fb0 [dart2js] Fix function_type GVN bug
Fixes #30476

Change-Id: Ie1e536c197b137ccddeeaa45d337f1bd16a2ff78
Reviewed-on: https://dart-review.googlesource.com/68848
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-08-08 00:05:14 +00:00