Commit Graph

4835 Commits

Author SHA1 Message Date
Johnni Winther d13bf49870 Check type-variable bounds on generic methods
Closes #32711

Change-Id: I86c123f5a8b9eda393b276248cdd27d1b109354b
Reviewed-on: https://dart-review.googlesource.com/53201
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-03 09:36:58 +00:00
Johnni Winther 2a8c3515b2 Avoid strong+checked mode: strong mode supersedes checked mode
Change-Id: Ic68f429ec06d583a9e60b6ace1ec88ee83a4be5f
Reviewed-on: https://dart-review.googlesource.com/53202
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-02 08:33:28 +00:00
Harry Terkelsen f8bea2a7e6 dart2js: Register inlined native methods for dump info
Change-Id: I362b56c70bff7a0afcec3374882c973ff879d48e
Reviewed-on: https://dart-review.googlesource.com/53061
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Harry Terkelsen <het@google.com>
2018-05-01 18:22:25 +00:00
Kevin Moore 7fe8659613 dump-info: Use relative paths for library canonicalUri...
...if they are within the working directory

Makes output from dump-info more stable, especially with pkg:build

Change-Id: I3e6c444a0aa7df55c10e1bdff4b59ef035d2acc3
Reviewed-on: https://dart-review.googlesource.com/53168
Reviewed-by: Harry Terkelsen <het@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2018-05-01 16:47:26 +00:00
Johnni Winther 8351dd4928 Support constant instantiation
Closes #32774

Change-Id: I88090246d3fb39e3d3a1f9c3fdcc3b6fd6e0fa4f
Reviewed-on: https://dart-review.googlesource.com/53022
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-01 12:59:18 +00:00
Johnni Winther d85c175a22 Register deferredLoadlibrary as backend impact
Closes #32998

Change-Id: If2a0a948f1209652925be360f7f145ebfdb3d60d
Reviewed-on: https://dart-review.googlesource.com/53008
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-01 11:05:31 +00:00
Johnni Winther 54b8ebd992 Support js-interop classes that implement generic types in Dart 2
This adds a special RTI representation for a type argument of a
(supertype of a) js-interop class, which effectively is the Dart 1
`dynamic` type.

Closes #32969

Change-Id: Ifd92b3fc6779d96d354ad929bd7c07a349299ae6
Reviewed-on: https://dart-review.googlesource.com/53002
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-01 08:37:11 +00:00
Johnni Winther 20c7725954 Handle deferred constant instantiations
Closes #32997

Change-Id: I31661bb223ca9d9bdee2e7cabe4e62bf18e87509
Reviewed-on: https://dart-review.googlesource.com/53007
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-01 08:31:01 +00:00
Stephen Adams d6a3b85ed2 Use factory methods for async/sync*/async* transforms
The static methods allow type parameters to be registered,
but this means that the type parameters will be dropped unless in strong mode.

Change-Id: I91c1977c287c14742df7d59b988e64ddc46f794d
Reviewed-on: https://dart-review.googlesource.com/52870
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-30 22:32:56 +00:00
Sigmund Cherem 3c9d0858b0 dart2js: turn on sync-async by default
Closes https://github.com/dart-lang/sdk/issues/32869

Change-Id: I79b2d02d13adccdfbbd3a78158805244aceff7de
Reviewed-on: https://dart-review.googlesource.com/52061
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-04-27 19:48:46 +00:00
Johnni Winther 93511d523c Track RTI for noSuchMethod
Change-Id: I1fd66c48061556f8950bad471744eab4e2f40eb7
Reviewed-on: https://dart-review.googlesource.com/52560
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-04-26 08:07:02 +00:00
Johnni Winther 5e72411c5c Add InstantiationConstantExpression/Value
Change-Id: I2f471560a076e79f944fa70000de4be50385ae18
Reviewed-on: https://dart-review.googlesource.com/52443
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-25 09:37:29 +00:00
Stephen Adams 405dd275e9 Add --benchmarking-production flag
Adding the flag to dart2js means we can change the 'best' set of flags
without updating the benchmarking insfrastructure.

Change-Id: I7b4015819fab8c79ae5736c76c3cb5eda94b57f5
Reviewed-on: https://dart-review.googlesource.com/52523
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2018-04-24 22:13:08 +00:00
Johnni Winther e5a2fe6435 Update jump, side effect and inlining tests to test strong mode
Change-Id: I0c8073f5bc72fae63b012033dc23b15c1913fec7
Reviewed-on: https://dart-review.googlesource.com/52223
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-04-24 08:37:24 +00:00
Stephen Adams bcc5e6ed42 dart2js: Fix Iterable<T> type check
Bug: https://github.com/dart-lang/sdk/issues/32810
Change-Id: I0d34185725bd9cbd627a5da66d3ef5eea5b7e4dd
Reviewed-on: https://dart-review.googlesource.com/52402
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-24 04:51:54 +00:00
Johnni Winther 9c9a3544ec Skip abstract methods in super access.
Closes #32928

Change-Id: I2834a9e34e4b8f4241e01f776be0bb22e375b30a
Reviewed-on: https://dart-review.googlesource.com/52222
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-23 08:28:59 +00:00
Johnni Winther f74ee52c70 Optimize signature need computation.
Change-Id: Ied6dfbfe71a9d323e189dbcacdb5ae2985c3fbb8
Reviewed-on: https://dart-review.googlesource.com/52221
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-23 08:00:02 +00:00
Johnni Winther 7afa0812ee Implement strong mode open world strategy.
Implements a new strategy for closed world computation that takes
the static type of the receiver into account when processing dynamic
calls.

For this to work, the J-model needs to only contain live members,
meaning queries can no longer assume that a J-model member exists for
instance for JSString.split because it might not be live.

This is the initial implementation which only uses
ir.MethodInvocation.invocationTarget. Later we will use the static
type of the expression on ir.MethodInvocation, ir.PropertyGet, and
ir.PropertySet.



Change-Id: I2dcc5a9148f27127d4e89c414a7d24f90f9cf2a4
Reviewed-on: https://dart-review.googlesource.com/48480
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-23 07:58:12 +00:00
Stephen Adams 81d779c41b Redo "Pass type argument into rewritten marked function"
TBR=sigmund@google.com

Change-Id: I0999ab52f76da185c601ce7105e4a8491c5e4edf
Reviewed-on: https://dart-review.googlesource.com/52262
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2018-04-21 01:14:49 +00:00
Stephen Adams a5ea3c5e33 Revert "Pass type argument into rewritten marked function"
This reverts commit 25b3dbb7b3.

TBR=sigmund@google.com

Change-Id: If0e37738e1516efcb144bffbaf57cfc7d3028d13
Reviewed-on: https://dart-review.googlesource.com/52261
Reviewed-by: Stephen Adams <sra@google.com>
2018-04-20 19:30:14 +00:00
Johnni Winther 395c96153b Fix subtype/equals for function types with type variable return types.
Change-Id: I645f73cabc74c4a427eb100220b3ddcf7232b0a4
Reviewed-on: https://dart-review.googlesource.com/52101
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-04-20 19:21:59 +00:00
Stephen Adams 25b3dbb7b3 Pass type argument into rewritten marked function
The values returned from calling sync*, async and async* are now parameterised.
Simple cases where the type has no type parameters are handled.

The next step is to introduce a signature-like j-model entity to compute the type in more complex cases.


Change-Id: I2e43088cc6383a70e3a3d3067ec7542694ee2d0a
Reviewed-on: https://dart-review.googlesource.com/51421
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-20 18:41:59 +00:00
danrubel 10b441b16b Improve conditional import expression recovery
This improves recovery when parsing conditional import expressions
by repositioning the synthetic closing ')' that was inserted by the
scanner in a less than optimal location.

This approach relies on the beforeSynthetic field being set correctly.
While the scanner still sets the 'next' and 'beforeSynthetic' fields
directly for efficiency, most other functions which update an existing
token stream have been revised to call 'setNext()' rather than setting
the 'next' field directly. This ensures that the 'beforeSynthetic' field
will be correctly updated.

Change-Id: Id631fd600c64d1feaf00593acb74a7070e354f07
Reviewed-on: https://dart-review.googlesource.com/52120
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-20 13:58:50 +00:00
Harry Terkelsen ffc1f607a1 dart2js: Emit fields in dump-info in more cases.
Previously we would omit a field if it was never the element
in a codegen WorkItem. However, almost all fields fail this test
because field getters are inlined in the optimizer.

Change-Id: I34de218dadb5937885d77dd429237584d1a8be2c
Reviewed-on: https://dart-review.googlesource.com/51581
Commit-Queue: Harry Terkelsen <het@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-04-19 22:14:18 +00:00
Stephen Adams 32df3387f2 Fix the output type of HNegate.
TBR=sigmund@google.com

Change-Id: If5875aac80f111bb95852ad4d9f568dadf4f9d65
Reviewed-on: https://dart-review.googlesource.com/51980
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2018-04-19 20:18:38 +00:00
Stephen Adams 2f9f8088b5 Don't lower to HIndexAssign when the value should be checked
'--checked' and '--strong' accidentally lowered []= to HIndexAssign,
in effect removing the check on the parametric covariant argument.

This makes --checked slower for some array-update-intensive
benchmarks.

Change-Id: I8c36e1db15ac6a98e1ec9ca01b2ebdd3effafc1b
Reviewed-on: https://dart-review.googlesource.com/51802
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-19 20:15:48 +00:00
Johnni Winther 6a8cad4877 Optimize RTI capture
Change-Id: I1b1b363de442e118ccb1e2018748a2ba7c5fe9e6
Reviewed-on: https://dart-review.googlesource.com/51642
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-19 16:00:28 +00:00
Sigmund Cherem a5e5b7cd80 Minor changes to make dart2js strong-mode clean again
See https://github.com/dart-lang/sdk/issues/31623#issuecomment-381766327

Change-Id: I6aaa939d09ba6f69220f07d56b9fa864f3cb3b64
Reviewed-on: https://dart-review.googlesource.com/51700
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-04-18 23:57:51 +00:00
Dan Rubel 8e812ddaa5 Pass modifiers in beginFormalParameters event
This CL updates the beginFormalParameters event to include
the covariant and const/final/var modifiers, and cleans up
a number of unused classes and methods including:

* the original implementation of ModifierContext/Recovery
* handleModifier and handleModifiers events

Change-Id: Ie89a202d17872fba85cd1a477091472a8d2d223b
Reviewed-on: https://dart-review.googlesource.com/51380
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-04-17 20:27:37 +00:00
Lasse R.H. Nielsen 973a1a0219 Remove uses of upper-case constants in remaining SDK code.
This includes Fasta, tools and observatory, so the checked-in SDK must
have the lower-case constants.

Change-Id: I8380ad041ad058f7d02ae19caccfecd434d13d75
Reviewed-on: https://dart-review.googlesource.com/50201
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-04-16 16:11:57 +00:00
Johnni Winther b1bc4ed2b5 Handle as in nested const constructors
Change-Id: I8ee105594022b7c64a3f1dd0228501b06f48cebe
Reviewed-on: https://dart-review.googlesource.com/51126
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-13 22:02:35 +00:00
Sigmund Cherem 823dfda5a5 Delete serialization, except for equivalence and helpers used in other tests.
Move such helpers under the test folders.

Change-Id: Ic8718374741b1e3e46e63ae552fa57e49fc97bb2
Reviewed-on: https://dart-review.googlesource.com/51203
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-04-13 21:31:51 +00:00
Stephen Adams 7383cd46e0 Fix for issue 32872
Don't insert receiver-conditioning checks for JSArray.+

Change-Id: I77a300f3eecaec54f2f75f0d32c3d99db5eeb1ef
Reviewed-on: https://dart-review.googlesource.com/51202
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-13 21:28:51 +00:00
Johnni Winther c5f69dff2d Include call on Closure in inference
Closes #32835

Change-Id: Ief2096544e01f74e6cc52abd6131a24a10ffe75f
Reviewed-on: https://dart-review.googlesource.com/50680
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-13 08:46:26 +00:00
Johnni Winther 826928e2ab Use _trust to test inference of --omit-implicit-checks
+ update the comment in ParameterTypeInformation.potentiallyNarrowType to
match the current expectations.

Change-Id: Ic98025f8314e8ac9eee6225c8c77e407a9fdabb9
Reviewed-on: https://dart-review.googlesource.com/50481
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-13 08:42:56 +00:00
Johnni Winther b7cc1e7ce7 Fix stack overflow in RTI computation
Closes #32853

Change-Id: Ic759780799830dde655fafc7839c7d5387eb75d6
Reviewed-on: https://dart-review.googlesource.com/50943
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-04-12 17:45:39 +00:00
Stephen Adams cbdf102d0c Use interceptor for reading type arguments
Type arguments that require a subsitution need the interceptor to
access the substitution function.

- Add an interceptor input to HTypeInfoReadVariable
- Add an entry point getRuntimeTypeArgumentIntercepted that takes the interceptor.
- Optimize uses that do not need the interceptor.

The interceptor is cheap to get from the context in the common case
that the type variable access is directly in an instance method.

A typical use (broken)

    var t1 = H.getRuntimeTypeArgument(receiver, "ListMixin", 0);

becomes

    var t1 = H.getRuntimeTypeArgumentIntercepted(this, receiver, "ListMixin", 0);

Change-Id: I2abe6a2b6e8d2cdb0ede1b7248dd8337830f8a0c
Reviewed-on: https://dart-review.googlesource.com/50640
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-11 21:25:26 +00:00
Johnni Winther b00ae2ec5d Fix dynamic call arguments computation
Closes #32828

Change-Id: Ic6307746d4d3c48b312cab74b383705d5892b408
Reviewed-on: https://dart-review.googlesource.com/50480
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-11 07:54:01 +00:00
Stephen Adams f3cec061eb Capture type variables in global NSM stubs
- Add a type argument count to JSInvocationMirror.
- Change stubs to pass the argument count.

Change-Id: I448dbee9a2aa0be17c24ae79eae0c89e7574fa7c
Reviewed-on: https://dart-review.googlesource.com/49820
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-10 21:32:11 +00:00
Johnni Winther f555ae505a Trust type annotations in strong mode
Change-Id: I59019ec56e432a71c52637307fa4dd346fa27c1f
Reviewed-on: https://dart-review.googlesource.com/50240
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-10 09:16:46 +00:00
Johnni Winther 91bbc798fa Skip abstract forwarding stubs
Change-Id: If0c0967e55038d330fef48d97bc96a92b0f4b506
Reviewed-on: https://dart-review.googlesource.com/49860
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-10 07:48:39 +00:00
Sigmund Cherem f71d204185 Fix expected type in substByContext
Note: the crash in language_2.status was added as a result of
https://dart-review.googlesource.com/c/sdk/+/49835.
Change-Id: I0dbd69a7cf80c6c432938f9bfd9df60703d5b367
Reviewed-on: https://dart-review.googlesource.com/50361
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-04-10 00:05:01 +00:00
Stephen Adams 899dbe4dae Forward type arguments in one-shot interceptors.
The status change is unrelated.

TBR=sigmund@google.com

Change-Id: Ic611ec7e9fa6b8e5dae9de7fc106fd839dd35bb6
Reviewed-on: https://dart-review.googlesource.com/50322
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-09 22:29:15 +00:00
Harry Terkelsen 1fd3011f47 dart2js: Add more whole-program information to dump-info
Change-Id: I39c8778aae26ebb2b7d39db092e043d101bc63c5
Reviewed-on: https://dart-review.googlesource.com/50321
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Harry Terkelsen <het@google.com>
2018-04-09 21:40:47 +00:00
Sigmund Cherem b430570364 dart2js: handle constant casts with type variable substitutions
Closes https://github.com/dart-lang/sdk/issues/32811

Change-Id: Ibf108405a3a36092a42902e5be806310a34c067c
Reviewed-on: https://dart-review.googlesource.com/49835
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-04-09 18:31:46 +00:00
Sigmund Cherem 09f7d2aee5 dart2js: naive support for instantiations in constants - ignore the actual
instantiation

Change-Id: Ic214ac3688fe7639ce98daf0eb1ab7ba4705b81c
Reviewed-on: https://dart-review.googlesource.com/50023
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-04-09 18:09:16 +00:00
Johnni Winther 969c0de335 Avoid crash on EOF error in file with Windows line encoding
+ start using spans from CFE (now that they're available)

Change-Id: I4fe82070d32948a64fb0fab527bd4cc857eebeb4
Reviewed-on: https://dart-review.googlesource.com/49841
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-09 12:16:20 +00:00
Johnni Winther 3d8524be3f Propagate freeVariablesForRti through nested closures
Closes #32770

Change-Id: Id7a24d5a7ea98c786a27f2e952f6b37e8607778e
Reviewed-on: https://dart-review.googlesource.com/49960
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-04-06 19:22:02 +00:00
Dan Rubel fd87a11ad0 Update fasta parser to generate error when "throw" missing expression
Change-Id: I6610400204e111a3a6cc7971159bfdd6c2e58794
Reviewed-on: https://dart-review.googlesource.com/49880
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-04-06 16:10:12 +00:00
Sigmund Cherem 0284fdab6b dart2js: allow as expressions in constants
The CFE doesn't allow them explicitly yet, but implicit casts do show up by the
time we see them in dart2js.

Closes https://github.com/dart-lang/sdk/issues/32773

Change-Id: Idb566625ce7c8edc74a4eea0109491bd72357051
Reviewed-on: https://dart-review.googlesource.com/49801
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-04-06 00:46:30 +00:00