Change-Id: I558827417c938a22075c5b5357294d27cbd6286a
Reviewed-on: https://dart-review.googlesource.com/76121
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
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>
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>
Fixes#12916.
Change-Id: Icef0f04f1575c8dad5f1cd23a9363f06fa2a2b35
Reviewed-on: https://dart-review.googlesource.com/74161
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
In VM, 'new List' is equivalent to either 'new _GrowableList' or
'new _List' depending on the number of arguments.
This change does the transformation early (on kernel AST), in order
to have specialized representation in TFA and in bytecode.
Change-Id: I46f0db8cc19efb3a53fdbe971ac26bdd2736fbda
Reviewed-on: https://dart-review.googlesource.com/76283
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Teach TFA that small integer literals, which fit into Smi on all
platforms have a concrete class _Smi.
Change-Id: I4aec5389fc0a83f36077c1f1c0c9a5e59ff4b260
Reviewed-on: https://dart-review.googlesource.com/76302
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Depending on a value of a string literal, it is possible to determine
concrete class at compile time (either _OneByteString or _TwoByteString).
Change-Id: Ied696b328021e9a61f1ad14d02b88681a9ed4fed
Reviewed-on: https://dart-review.googlesource.com/76260
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
This simple first step cmdline utility launches and manages an external analysis server process.
Future CLs will add dartfix specific functionality.
Change-Id: Iba32177acd8ca1edd703bad78e55cd1e88edb6bd
Reviewed-on: https://dart-review.googlesource.com/76320
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
This reverts commit 836a1d7a88.
Revert "Don't use ClassElementImpl for now in override checking."
This reverts commit 58e44c1400.
Revert "large_class_declaration_test is slow now."
This reverts commit 56f6c52d58.
Revert "Add regression test for issue 34392."
This reverts commit ef7d144bc7.
Revert "Mixin declarations don't have supertype, fix isMoreSpecificThan()."
This reverts commit 95b8a19a20.
Change-Id: Icda9cf9091ef35acc8fd61ac5dc135b3717eba0a
Reviewed-on: https://dart-review.googlesource.com/76301
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
TBR
I'd like to land this for now, but I probably will reintroduce it a
bit later. The problem is that this again the same problem with
handles, and I don't want to make it into internal build as is.
R=brianwilkerson@google.com
Change-Id: I98c37b2c5dadf2d5450a536471fc002fc5b247d2
Reviewed-on: https://dart-review.googlesource.com/76221
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
If a field is initialized with null (either explicitly or implicitly),
field store can be omitted in bytecode. In such case, bytecode should
still convey the information about this initialization to VM for
field guards to work correctly.
Change-Id: I1fd45b858c3c521b97fa5dbffe0e15b1ea75d92f
Reviewed-on: https://dart-review.googlesource.com/76060
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
This CL starts moving checks from strong-mode specific checker,
and old InheritanceManager into an implementation that is based
on the current spec, and avoids old baggage. It also fixes the issue
we were asked to fix for Dart 2.1.
Bug: https://github.com/dart-lang/sdk/issues/34392
Change-Id: Id5a23c5db7704b2b530bb894ae92628a08eaa70f
Reviewed-on: https://dart-review.googlesource.com/76061
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Fixes regression #34528. Introduces a new test to mitigate future
regressions.
Closes#34528.
Change-Id: Iaf0a8f44db2a8b4a8151c391ddb8dff69910fe3a
Reviewed-on: https://dart-review.googlesource.com/75840
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Change-Id: I2d29c4f08d55d97453cc44344036c54e70e8a155
Reviewed-on: https://dart-review.googlesource.com/75900
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
Report error for negated hex literals > 2^63.
Optimized common case of web int literal exactness check.
Fixes https://github.com/dart-lang/sdk/issues/33311
Change-Id: Ib72b2dbb21e42489ee2d06b17302daf83d560df1
Reviewed-on: https://dart-review.googlesource.com/72802
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
This CL introduces an option - unsafe-package-serialization - where a
caller can select to reuse the serialization of packages. This makes it
unsafe in general, but if never invalidating packages, such as in tests,
it can be used to greatly increase the speed of processing many inputs.
This change - used in flutter - takes the time it takes to run
`flutter test` in `packages/flutter` from ~2 minutes 30 seconds to
~1 minute 15 seconds (on my machine).
A change to how flutter test executes the frontend_server
(to pass the option) is needed for it to take effect though.
Change-Id: Ibe47b43c41286eb08f80c9e7a398e1dc67bf9bc0
Reviewed-on: https://dart-review.googlesource.com/48200
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
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>
No change in functionality; all visit methods already return `null`.
Change-Id: I578fae62522f4b4f79e62e66bed9262cdcf1f33b
Reviewed-on: https://dart-review.googlesource.com/75994
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
It turns out that with the new mixin syntax, we always check for error
MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE first, and if it is found,
we don't even bother checking for MIXIN_INFERENCE_NO_MATCHING_CLASS
(which I think is reasonable). So the expectations on this test need
to be changed.
Change-Id: I2a33ce60a928af63f4fc83b4e3a8309a2660b441
Reviewed-on: https://dart-review.googlesource.com/75990
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This avoids the need to override tests in
CompileTimeErrorCodeTest_Driver to indicate that they pass.
Change-Id: Ieedb75c5d23edb3214b8d2cdb00a138201e3e3a7
Reviewed-on: https://dart-review.googlesource.com/75985
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Since this method is only used to find supertype constraints that are
relevant for mixin inference, it can save its caller from doing extra
work by filtering out mixins that don't take type parameters.
Previously, we were doing that when supporting the old "--supermixin"
feature, but not when using the new mixin syntax.
The method has been renamed to
gatherMixinSupertypeConstraintsForInference so that it's less
surprising that it doesn't return *all* supertype constraints.
Change-Id: I33c5cf20bb4955a19ef0f7dc2425fefc26cf4d39
Reviewed-on: https://dart-review.googlesource.com/75983
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
A few test cases fail. I'll investigate them and follow up with fixes.
Change-Id: I934e82a2ecec68f72ed46fb698b065186ef38aad
Reviewed-on: https://dart-review.googlesource.com/75980
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
In a named mixin application, the superclass doesn't include the last
type appearing in the "with" clause, so that class isn't considered a
superclass constraint.
Fixes some test cases broken by 46e5954b0a.
Change-Id: I2e824d38017fe2c7eaa23e8f185cea07fe2222b7
Reviewed-on: https://dart-review.googlesource.com/75940
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Now that we have an explicit syntax for mixins that is available all
the time, we have to do mixin inference error checking all the time,
not just when the "--supermixin" flag is supplied.
This required fixing several minor bugs:
- ErrorVerifier._checkForMixinSuperInvokedMembers did not properly
handle a mixinElement argument that was a ClassElementHandle.
- ErrorVerifier._checkMixinInference wasn't using the actual
substituted mixin types, causing errors to be wrongly reported when
a class declaration had multiple inferred mixins (this was the root
cause of #34404).
- Type names in "with" clauses in the resolved AST weren't properly
reflecting the mixin type arguments that had been inferred.
Fixes#34404.
Change-Id: Ia773233c66f8d9ab778f207689c73922e9e3a880
Reviewed-on: https://dart-review.googlesource.com/75792
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
So, instead of iterating over all subtypes and checking their supertypes
in string lists, we encode the supertype string id into int once, and
search for it in the denormalized supertype list.
This helps for files with really many classes and subtypes, such as
element.dart and as.dart (both interfaces, not implementations).
Before:
1537403233979 <= Computed implemented in 803 ms.
1537403239426 <= Computed implemented in 2518 ms.
1537403241893 <= Computed implemented in 811 ms.
1537403247675 <= Computed implemented in 2523 ms.
1537403249835 <= Computed implemented in 802 ms.
1537403255796 <= Computed implemented in 2478 ms.
1537403258396 <= Computed implemented in 809 ms.
1537403264560 <= Computed implemented in 2526 ms.
1537403267010 <= Computed implemented in 814 ms.
1537403274513 <= Computed implemented in 2491 ms.
R=brianwilkerson@google.com, paulberry@google.com
After:
1537415241048 <= Computed implemented in 421 ms.
1537415244042 <= Computed implemented in 873 ms.
1537415246189 <= Computed implemented in 402 ms.
1537415249342 <= Computed implemented in 853 ms.
1537415251478 <= Computed implemented in 420 ms.
1537415254756 <= Computed implemented in 877 ms.
1537415257278 <= Computed implemented in 492 ms.
1537415260514 <= Computed implemented in 864 ms.
1537415262864 <= Computed implemented in 421 ms.
1537415266170 <= Computed implemented in 888 ms.
Change-Id: I00e3b8d11ecc7da93816bc5575b7b79b91535d50
Reviewed-on: https://dart-review.googlesource.com/75631
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>