Commit Graph

4088 Commits

Author SHA1 Message Date
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
Stephen Adams 7cf2607344 Make minified names explicit in printed representation of types.
Supports mixed minified and unminified names (like `List` and `num` below).

Example:
TypeError: Closure 'minified:b3': type '() => minified:o<minified:k<num>>' is not a subtype of type 'List<minified:o<minified:k<num>>>'


Change-Id: I1fc67f189170eb9b9c8614b1e3d33128adc49787
Reviewed-on: https://dart-review.googlesource.com/67303
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-08-06 22:28:11 +00:00
Stephen Adams 315216e2e2 [dart2js] Avoid collision with getInterceptor.
getInterceptor now always goes via HInterceptor, ensuring the back end
knows to generate the unspecialized interceptor. We no longer generate
the unspecialized interceptor as *shadowing* the js_runtime
definition. In small programs where interceptors are not used except
via js_runtime.getInterceptor, the program would fail on the value
returned by the dummy body, since it was not shadowed.

This gets rid of the two definitions of getInterceptor (issue 9180).

Change-Id: Ibfa73f26d7d432273d5e755e2165ab6c2d48ad4f
Reviewed-on: https://dart-review.googlesource.com/68002
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-08-04 00:15:53 +00:00
Sigmund Cherem 09a8660c14 fix typo
TBR=johnniwinther@google.com

Change-Id: I0cda68e63595bb30374bb705341206bc3fffcd2b
Reviewed-on: https://dart-review.googlesource.com/68429
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-08-03 21:48:36 +00:00
Stephen Adams 91caf82497 Do self-interceptor optimization on a per-use basis
The new code guards against updates when the interceptor is data and
not used as an interceptor.

Change-Id: Ibf6c0ca5f7efe859e82646aee6e571de82417bfe
Reviewed-on: https://dart-review.googlesource.com/68424
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2018-08-03 21:35:27 +00:00
Sigmund Cherem e402732eff Improve documentation of the -O flag
TBR=sra@google.com,vsm@google.com

Change-Id: Ib42647ab59313bdfa49df73c25282d0d734d6462
Reviewed-on: https://dart-review.googlesource.com/68140
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-08-02 18:48:21 +00:00
Sigmund Cherem d3df394870 Add -O flag and documentation.
The idea is to provide a flag that can be stable through time, even as we add
and remove certain optimizations.

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

Change-Id: Ic07bf2148308b7530f2a69d7ebecb8fd7bf2d4cc
Reviewed-on: https://dart-review.googlesource.com/67921
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2018-08-02 00:36:53 +00:00
Sigmund Cherem cb7341fceb Initial support for inlining-data in source-maps.
This starts tracking inlining data and records it as an extension
to source-map files so we are able to expand inlined calls when
deobfuscating production stack traces.


Change-Id: I46daf21c2f42305b2bd6ca17fbafb65226355096
Reviewed-on: https://dart-review.googlesource.com/67083
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-07-31 21:41:50 +00:00
Sigmund Cherem 4206131030 Fix tracking of onStep position of arguments to new expression
Change-Id: I359577055555b9372b60fc2485ac1a9354e98427
Reviewed-on: https://dart-review.googlesource.com/67481
Reviewed-by: Stephen Adams <sra@google.com>
2018-07-31 21:41:50 +00:00
Jenny Messerly 058510eeab fix #28233, add hint for missing returns to function expressions
If a function expression is used in a context that expects a return type
other than dynamic/void/Null, issue a hint if that function has a block
body and is missing a `return` statement.

Change-Id: Ia55212abd84f5718343cf7401b87aba2891d6446
Reviewed-on: https://dart-review.googlesource.com/66340
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-07-28 01:50:31 +00:00
Stephen Adams 29b893b124 [dart2js] Evaluate map literal key before value
Change-Id: I41c0c004ddd3f04c0eb48520df7f92ed86d7c8b7
Reviewed-on: https://dart-review.googlesource.com/67206
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2018-07-27 21:55:40 +00:00
Sigmund Cherem 55726c8b3e Do not emit minified names in the deferred source-map files
Change-Id: Ie3ed131248cc5677c3f493fbe7dc2bba0bb5cec3
Reviewed-on: https://dart-review.googlesource.com/67082
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-07-27 02:23:38 +00:00
Sigmund Cherem e3b5bfd854 Store original names in the minified name map
Change-Id: I411125aebe08fee10f1eeee4e6f30623cb0d7854
Reviewed-on: https://dart-review.googlesource.com/65795
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-07-20 23:50:45 +00:00
Sigmund Cherem ca0123ac70 Call KernelImpactBuilder._visitArguments once in visitStaticInvocation
Change-Id: I2602545f116c1de26932c22460a644fe348e20a1
Reviewed-on: https://dart-review.googlesource.com/65789
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-07-20 15:48:09 +00:00
Johnni Winther 555cca2b1a More cleanup in inferrer engine
Change-Id: Ia7f52b46b327c4cef21c775a5f25afc9f4dde452
Reviewed-on: https://dart-review.googlesource.com/65681
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-07-20 12:28:28 +00:00
Johnni Winther 4273bb2e2a Remove TypeUse.mirrorInstantiation
Change-Id: I7a85970a2559489cb8fda5612a300c53562856ed
Reviewed-on: https://dart-review.googlesource.com/65544
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-07-20 12:28:28 +00:00
Sigmund Cherem 35b08dec12 Add minified names to sourcemaps
This change:

* introduces a sourcemap extension to store minified names from the global and
instance namespaces.

* adds a test suite to test that this information is accurate

This is just an initial step: at this time names come from proposed names, which
include extra stuff we don't want. On a later CL I plan to change this to be
able to get the original name instead.

For example, I want to add a test for translating an instance method, right now
we would get "@method@0@" or "method$0" instead of "method".

Change-Id: I411c3bea96446e29e80581750250349799332b9a
Reviewed-on: https://dart-review.googlesource.com/65660
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-07-19 18:50:27 +00:00
Johnni Winther 335f0ab333 Remove EnqueuerStrategy
Change-Id: Id36d4a77d40ca9a70130a4c3ee6e84f68435153d
Reviewed-on: https://dart-review.googlesource.com/65543
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-07-19 08:10:15 +00:00
Johnni Winther 406b6e8866 Flatten inferrer implementation
Change-Id: I0dc59ccc3f02c95c545033ed124f3d475792d72f
Reviewed-on: https://dart-review.googlesource.com/65542
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-07-19 08:10:15 +00:00
Johnni Winther ec733c3b3c Support more type arguments in generic instantiation
The real solution requires more work, so this is to buy us some time.

Change-Id: I033a77d05c0ca7658475d1fe59760ce4e5919f7e
Reviewed-on: https://dart-review.googlesource.com/65541
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-07-19 08:10:15 +00:00
Johnni Winther 70747047b0 Add hint for .runtimeType.toString()
Change-Id: I0a20f1fc42bc475c9acdf40b3d8aae16edbc8ea9
Reviewed-on: https://dart-review.googlesource.com/64845
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-07-19 08:09:15 +00:00
Jenny Messerly 3320d8f677 fix #31237, missing return hint was missing for inferred returns
Change-Id: I3c8c59f31196b220aaa0421f8357a950ff16ba20
Reviewed-on: https://dart-review.googlesource.com/62727
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
2018-07-19 00:19:24 +00:00
Sigmund Cherem 11f3c57e9c Fix deferred type literals and typedefs
Closes https://github.com/dart-lang/sdk/issues/33890

Change-Id: I3a154d4de46747f3ad905de889f14188fdfff50a
Reviewed-on: https://dart-review.googlesource.com/65442
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-07-18 18:28:21 +00:00
Johnni Winther 7c27ebe8e3 Remove unused messages
Change-Id: I3b81dd5dfecf2dee881ec1901d68df71aa703260
Reviewed-on: https://dart-review.googlesource.com/64844
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-07-18 10:28:59 +00:00
Johnni Winther 4a01dc66bc Fix crash in inferrer_engine
Closes #33810

Change-Id: I25ec7ab62dbd6a54331ee0f777644da3ddad1135
Reviewed-on: https://dart-review.googlesource.com/65300
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-07-18 09:46:28 +00:00
Sigmund Cherem a7e511f4dc Fix order of named arguments in nsm-forwarders
Change-Id: I4fa9c3165c61e675be87978441093b9ee664a29d
Reviewed-on: https://dart-review.googlesource.com/65204
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-07-17 16:05:50 +00:00
Johnni Winther 6acee7cdb7 Fix tracking of native classes needed for rti.
Closes #32286
Closes #33690

Change-Id: Ic62c145ca7bb5257d71c0d062b111b183258b7d0
Reviewed-on: https://dart-review.googlesource.com/64343
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-07-16 10:09:06 +00:00
Johnni Winther 117f651f7b Emit classes used in type variable replacements
Change-Id: Iad3bf28790172e364d83a96003fb7ef96f25747e
Reviewed-on: https://dart-review.googlesource.com/64322
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-07-16 10:09:06 +00:00
Johnni Winther 97319b838a Decouple library loader from the K-world
Change-Id: I74cb28960b29a63c225bb259c19b9023424ea74a
Reviewed-on: https://dart-review.googlesource.com/64340
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-07-12 08:07:05 +00:00
Leaf Petersen b5fe750007 Strong mode fixes to kernel and dart2js
Change-Id: Ic51e0bbc31cf993ffb7d2ec6909b96c7ace964ed
Reviewed-on: https://dart-review.googlesource.com/63342
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Leaf Petersen <leafp@google.com>
2018-07-10 19:19:24 +00:00
Johnni Winther 4f1d6a33fc Remove --analyze-* flags
Change-Id: I72f7834ba754bd5affec1a72d1d7be203031aa42
Reviewed-on: https://dart-review.googlesource.com/64041
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-07-10 08:40:59 +00:00
Johnni Winther 1c673b1046 Include bounds in type literals
Change-Id: Ieb3e5b09e88c98f8943a6e7ca9031c8a6ab776e1
Reviewed-on: https://dart-review.googlesource.com/63820
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-07-09 12:24:04 +00:00
Johnni Winther 1717371c99 Move InferredData to GlobalTypeInferenceResults
- and make a pure GlobalTypeInferenceResults interface to prepare for (de)serialization.

Change-Id: I3c2f5f43d686c0d247c611185730134394d86844
Reviewed-on: https://dart-review.googlesource.com/63946
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-07-06 22:02:57 +00:00
Johnni Winther 5dbf6da529 Remove generics where only ir.Node is used
Change-Id: I500b237a871ee21aca1a800806cdc95828713b5c
Reviewed-on: https://dart-review.googlesource.com/63944
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-07-06 22:02:57 +00:00
Johnni Winther da9705b356 Split compileLoadedLibraries
- into computeClosedWorld, performGlobalTypeInference and generateJavaScriptCode
+ pass closed world and inference results directly
+ this prepares for (de)serialization after global inference

Change-Id: I1180de35eea78a107c9e95fc6e904084b63ba0f2
Reviewed-on: https://dart-review.googlesource.com/63943
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-07-06 22:02:57 +00:00
Johnni Winther 04168fa922 Move more methods to ClassHierarchy.
Change-Id: I6f7f0266a77db1e64a40307a4878bfd9b1ca5f07
Reviewed-on: https://dart-review.googlesource.com/61932
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-07-06 22:02:57 +00:00
Sigmund Cherem a4c47afcae Fix global-inference bug.
We incorrectly tracked is checks that are nested within subexpressions of
conditions that do not affect control-flow.

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

Change-Id: If8a9b64273998aed5c4ea8854ea8d717588d5658
Reviewed-on: https://dart-review.googlesource.com/63981
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-07-06 22:01:37 +00:00
Sigmund Cherem 72f3abc239 Fix force-strong flag.
This has a tiny effect in reporting warnings, other than that the flags were
interpreted correctly during compilation.

The force-flag was is used to recognize when the user
explicitly said `--strong` and when it was implicit, so if we see
`--no-preview-dart-2` and we don't see `--strong`, we know we are in legacy mode
and we don't show warnigns about `--checked` and `--trust-type-annotations`.

Change-Id: I532ce4520b49e3aac1ec13898186c74585855d3e
Reviewed-on: https://dart-review.googlesource.com/63980
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-07-06 18:42:56 +00:00
Johnni Winther bb69cc15cb Add ClassHierarchy to share code between J/KClosedWorld (second attempt)
+ improve the commonSubclasses implementation to support the
implementation of FlatTypeMask.intersection and RuntimeEquals.equals
computation. FlatTypeMask.intersection is now ~20% faster.

Change-Id: I0b452afd260ab3b0598ed4d67f07a55ea96d2756
Reviewed-on: https://dart-review.googlesource.com/63560
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-07-04 09:00:28 +00:00
Stephen Adams afaca9f7cf Use field for class hierarchy map
Change-Id: Iabcfd69f3ecbd3d87eb4c7dafd9c80a1be01a016
Reviewed-on: https://dart-review.googlesource.com/63540
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-07-03 19:17:35 +00:00
Johnni Winther 69db5c104a Check local constants
Closes #33707

Change-Id: I8046b45aac8eeef60dca405a47a573724af8bfe8
Reviewed-on: https://dart-review.googlesource.com/63280
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-06-29 22:30:39 +00:00
Stephen Adams 6e108d709c Include native classes needed for RTI
Closes #33627

Change-Id: I9ed6bf9941df6445209a64c29af8986e382b7c51
Reviewed-on: https://dart-review.googlesource.com/62521
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-06-28 23:16:28 +00:00
Sigmund Cherem 64553b68e9 Workaround for bug in nsm-forwarders
This lets dart2js correctly handle nsmForwarders with private names (see
https://github.com/dart-lang/sdk/issues/33665 for details).

Change-Id: Ic34bc8c2dbfd570f35f2f6a4c5a84b3da6ddb1f5
Reviewed-on: https://dart-review.googlesource.com/62711
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-06-28 17:03:50 +00:00
Stephen Adams 50fe42a886 Reduce use of putIfAbsent
Change-Id: I2088d80126bd5af09c0091c768c381b13733aa1e
Reviewed-on: https://dart-review.googlesource.com/62021
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-06-27 02:58:38 +00:00