Commit Graph

1716 Commits

Author SHA1 Message Date
Jens Johansen 6971cddaed [CFE] Fix crash with experimental invalidation and factory with same name as procedure
A factory is saved as a procedure in kernel, and was thus also indexed
as a procedure for the purpose of experimental invalidation.
This caused trouble when having a "real" procedure and a factory with
the same name.
That is fixed by this CL by indexing factories ad constructors.

Fixes https://github.com/flutter/flutter/issues/74180

Change-Id: Ieef0421c29a61e26f2a7ee4bb4f196672afd8445
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180148
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-01-20 13:56:05 +00:00
Johnni Winther fabf3efda4 [cfe] Refactor ClassHierarchyBuilder to use Tuple for computation
Change-Id: I8055552313786814bde6f66214a013a8bedb2078
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177500
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-01-19 19:52:13 +00:00
Johnni Winther 34fb48bb8a [kernel,front_end] Migrate first wave of pkg/kernel and pkg/front_end
Migrates libraries dependent only on already migrated libraries.

Change-Id: I0e85ee8dbc2afce031b92e0009e71c206a55af28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179502
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-01-18 15:40:21 +00:00
Dmitry Stefantsov 0de9b16e7a [cfe] Give a hint on erroneous super-bounded types
Change-Id: Ifb4caaf8995f9f139fd24b4ae6e9c071a83459ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178240
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-01-14 16:25:23 +00:00
Jens Johansen 4ea0bae02a [kernel] Tools and fixes wrt lazy loading and reachability
Change-Id: I191d338097b09ff2211d6d14c6013632190de629
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178980
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-01-13 14:20:28 +00:00
Dmitry Stefantsov cf8887bd7e [cfe] Update the conversion algorithm for checking super-bounded types
The update is specified in the following:
https://github.com/dart-lang/language/pull/1133

Change-Id: I2850b1acf7c94b8174c21cf899c9b926a03d9cc8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175726
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-01-08 11:58:32 +00:00
Jens Johansen 5fac8d3d71 [CFE] Reproduction and fix of duplicate string-named 'abstract member-signature'
Before this CL, the map we use to "reuse" references when doing
experimental invalidation mapped from String to Reference.
In bug #44523 two abstract member-signatures have the same textual
(String) name meaning that via the lookup one would get the correct
one, one would get the wrong one, they would get the same one
which eventually causes a crash when trying to serialize.

This CL fixes the issue by mapping via the Name instead, which
basically - for private names - wraps the name and the library
which disambiguates it.

This CL also includes the reproduction of #44523.

Fixes #44523.

TEST=Mostly relying on existing test coverage.

Change-Id: Ib62ebca0b7f5092f0b8410d3c458663c3032eca1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177704
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-01-07 13:11:18 +00:00
Johnni Winther b4d4316de0 [cfe] Rename stub kinds
ForwardingStub -> AbstractForwardingStub
ForwardingSuperStub -> ConcreteForwardingStub
MixinStub -> AbstractMixinStub
MixinSuperStub -> ConcreteMixinStub

TEST=refactoring

Change-Id: Ice76a41ce8e1071f553ed8fd3ecbb29c97377161
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177129
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-12-29 16:54:55 +00:00
Johnni Winther 42f09a71ba [vm] Re-resolve stub targets on mixin deduplication
This ensures that stub targets are re-resolved when performing
mixin deduplication. In particular member signatures, whose stub
target point the member signature origin, need to be re-resolved
since the origin is serialized together with the interface target
in PropertyGet, PropertySet and MethodInvocation, and if not
re-resolved, might point to removed members.

TEST=pkg/vm/test/modular_kernel_plus_ast_test.dart

Closes #44560

Change-Id: Ib2dd923fbf736a9defe2df38bbc71d442f80b7bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177127
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-12-29 15:01:35 +00:00
Johnni Winther 5ed4e5becd [cfe] Pass references instead of fields/procedures
TEST=refactoring

Change-Id: I6e2d46af9bd58673bda847ea5cf981616e1118b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176667
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-12-29 11:46:15 +00:00
Dmitry Stefantsov 0642e7a245 [cfe] Deem all intersection types syntactically not nullable
Closes #44362.

Bug: https://github.com/dart-lang/sdk/issues/44362
Change-Id: Id54de1848e6af1108956476e241bab5c0ed96a4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177124
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-12-29 09:58:35 +00:00
Johnni Winther 60702d4158 [cfe] Make field assignability immutable
Changes fields to be either mutable or immutable by construction.
This ensure that we don't create setter references for fields that
cannot be assigned to and is a prerequisite for replacing @fields/
@fields= canonical names with @getters/@setters.

TEST=existing expectation tests and verification

Change-Id: I70b9a504ee6f221b7c334ac02620feb0d5f7ae01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176665
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-12-28 16:11:14 +00:00
Johnni Winther 52db62dd65 [cfe] Use MixinSuperStub
This CL adds stub for each concrete mixed in member into mixin
applications. The body of the stub calls the original member via
a super call.

This addition means that resolution of super access now use the
stub and not the original declaration as the target, which means
that it will be correct even when mixed in members are cloned. For
this reason, dart2js no longer needs to perform its own super
member resolution.

When a super call targets a mixin super stub (after cloning) it
can be optimized away by redirecting the call to the `stubTarget`
of the call. This optimization is performed in dart2js.

Since dart2js now uses the correct super target, its runtime
mixin application needs to avoid overriding members already
declared in the mixin application. These members are the
forwarding super stubs which ensure that correct runtime types
when members with covariant parameters are implemented.


Change-Id: Iab71ffcc400aa6a683987bc20b9553a263ebc8e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176526
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-12-25 23:32:17 +00:00
Sigmund Cherem f376642572 [cfe]: include path to .dill file on version mismatch error messages
Change-Id: I8862abd55c111de2c81c5000539fb69268dcac06
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176921
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2020-12-23 16:31:51 +00:00
Johnni Winther 76dcd9e37d [cfe] Ensure implicit-as and typedef reference are legacy erased
TEST=existing expectation tests

Change-Id: I48571347ef95b709a0804d284902ac6af7115afd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176083
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-12-15 15:34:40 +00:00
Johnni Winther 5dbb6e245b [kernel,cfe,ddc] Add new method invocation node to package:kernel
This adds
* InstanceInvocation, DynamicInvocation, FunctionInvocation, and
   LocalFunctionInvocation, EqualsCall, and EqualsNull as a future
   replacement for MethodInvocation.
* InstanceGet, DynamicGet, InstanceTearOff, and FunctionTearOff as a
   future replacement for PropertyGet
* InstanceSet and DynamicSet as a future replacement of PropertySet
* StaticTearOff as an addition to StaticGet

TEST=pkg/front_end/test/binary_md_vm_tags_and_version_test.dart

This CL combines
* https://dart-review.googlesource.com/c/sdk/+/171729
* https://dart-review.googlesource.com/c/sdk/+/172649
* https://dart-review.googlesource.com/c/sdk/+/172650
* https://dart-review.googlesource.com/c/sdk/+/172651

using the initial encoding fo EqualsCall and EqualsNull

Change-Id: I98e020b5f2b405a812663bdcd2c05aba8efa74c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175480
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-12-14 10:55:48 +00:00
Jens Johansen 739393b290 [kernel] Fix and test readComponentSource
This was broken after constant coverage was recorded in dill because
reading the source then needed to have the link table too (which it
doesn't have when using readComponentSource).

Fixes https://github.com/flutter/flutter/issues/71851.

Change-Id: I90b6a185abd133c7d08fd335f69faf634684738b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175724
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-12-11 11:57:58 +00:00
Johnni Winther 3d19493f2d [cfe] Add flag to identify lowered locals
+ add predicate helpers to identify these and extract their
original names.

TEST=pkg/front_end/test/predicates/predicate_test.dart

Change-Id: I4d94c575d010b6b01c985eaf5392b9e0e979d044
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175250
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-12-08 14:53:14 +00:00
Johnni Winther c19225224b [cfe] Handle lowered Map/Set/List constants in constant evaluation
Change-Id: Ib3b3a39478fe0927fc0168a9916684fd9ac09f77
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175247
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-12-08 10:42:43 +00:00
Lasse R.H. Nielsen 6e29700e16 Update List constructor documentation, deprecate constructor.
Emphasize that the operation is going away,
and mark constructor as deprecated.

TEST= Refactoring+deprecation only, covered by existing tests.

Change-Id: I82aa044cd2cf7bf347b624371399f44bda8f4a07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173261
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2020-12-07 16:20:28 +00:00
Dmitry Stefantsov 26fb376bce [cfe] Use type parser in type schema environment test
Bug: https://github.com/dart-lang/sdk/issues/44354
Change-Id: I046ab5856668d3e5c3a69fc6b3bca961d980a8b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174927
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-12-07 15:23:57 +00:00
Johnni Winther 74be6670c9 [kernel] Remove CoreTypes from legacyErasure
Change-Id: I9692c01ed3bf9982834144dd9eb477a97db5536f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175041
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-12-04 10:03:40 +00:00
Johnni Winther a3236f6622 [cfe] Disable verification of opt-in/opt-out types
In response to https://dart-review.googlesource.com/c/sdk/+/174860

Change-Id: I8d037bcd833990d242c0822adecbd0c4086e604f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174925
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-12-03 17:08:43 +00:00
Johnni Winther 87ef15787a [cfe] Handle write during late local initialization
In response to issue #44372

Change-Id: I6ad0730e662f7fcd8987a745cbab72dbb91c2045
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174923
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-12-03 16:41:53 +00:00
Devon Carew 8cba879f46 Add additional validations to the pkg/ package pubspecs.
TEST=these are additional validations that we run on the bots

Redux of https://dart-review.googlesource.com/c/sdk/+/161040

Change-Id: Ia32ced5d48fbfeafacfa9e51dc4774d2e9425091
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174601
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2020-12-02 17:27:18 +00:00
Johnni Winther d51ab9b62a [cfe] Add ProcedureStubKind
The enum `ProcedureStubKind` together with the flag `isSynthetic`
replaces the flags `isForwardingStub`, `isForwardingSemiStub`,
`isNoSuchMethodForwarder` and `isMemberSignature`.

The semantics of the existing properties on `Procedure` is unchanged.

The new MixinStub and MixinSuperStub stub kinds are not used yet and
the stub target for NoSuchMethodForwarder is not set yet.

TEST=refactoring


Change-Id: I6e81970dbb4baf0229f43c2a0bf0d5e575e65043
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174462
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-12-02 16:35:58 +00:00
Jens Johansen 27ed7912af [kernel] Constant coverage recorded in dill
This adds the recorded constant coverage to the dill file.

runtimes for constant evaluation:
dart2js: No difference proven at 95.0% confidence
flutter gallery: No difference proven at 95.0% confidence
big internal app: No difference proven at 95.0% confidence

sdk sizes:
vm: ~0.0182%
dart2js: ~0.0137%
flutter: ~0.0197%

compile sizes:
dart2js: ~0.0179%
flutter gallery: ~0.0162%
big internal app: ~0.0414%

TEST=test was fixed.

Change-Id: I347751e4d96d4d62140d26ebe37960f46a0dfbfa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171948
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-12-01 12:30:14 +00:00
Clement Skau 2d36c85ff8 [vm] Removes support for --causal-async-stacks
All existing embedders have been opted into --lazy-async-stacks, the
VM also uses it as it's default in all configurations.

After this CL, any user of --causal-async-stacks will get an error
message when trying to use it.
=> In any such case, please simply remove the flag.

TEST=Exhaustive CQ.

Bug: https://github.com/dart-lang/sdk/issues/37668
Change-Id: Ia440afcf2dba464aa8b8cf381b93bbac8eb9f8dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172564
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-12-01 07:27:14 +00:00
Johnni Winther 7a130ccc49 [cfe] Rename isNullableByDefault annotation to isLegacy
TEST=Existing tests

Change-Id: I0aad4deea062ba2016a8be47489ffaa970bfc03e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174260
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-11-27 13:36:29 +00:00
Johnni Winther 79f36c9d49 [kernel] Rename readUInt to readUInt30 to match corresponding write-method.
TEST=Refactoring

Change-Id: I455c498065785909fb175a0b5fa82bd9d5b38f1f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173524
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-11-24 08:50:38 +00:00
Sam Rawlins 1cfe7dd6f6 Remove unused import of dart:async
Change-Id: I999e316293c995d831376afb71c340529b9de09c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173460
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-11-23 19:36:07 +00:00
Jens Johansen d89bc9fd9b [kernel] Update WidgetCreatorTracker to provide setterReference
This should fix the breaked reported at
https://github.com/flutter/flutter/pull/70884

Change-Id: If0de90da6e8dbe5425d2c45bc49943fa85590779
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173265
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-11-20 15:06:16 +00:00
Johnni Winther 887ab360e5 Revert "[kernel] Ensure that visitors don't implicitly returns null"
This reverts commit 4a3f121341.

The changes broke flutter/engine

TEST=It's a revert!

Change-Id: I1e65e6cfab03795a21a64a96fe3ed72e6ba8ecd9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172760
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-11-18 14:51:30 +00:00
Johnni Winther 4a3f121341 [kernel] Ensure that visitors don't implicitly returns null
This is in preparation to migrate package:kernel to null safety.
For the visitor interfaces to support non-nullable return types, the
implementations must avoid using `null` as return value in its base case.

TEST=Refactoring

Change-Id: I9f9b318982148d844be9826a5f8c88374a9fc402
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172180
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-11-18 11:54:30 +00:00
Jens Johansen 0576d64a67 [CFE][kernel] Set parents on typedef children
Change-Id: Iccdd2b0c4c0062abc4e0cf50a2feadc4487941b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172563
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-11-17 17:52:18 +00:00
Jens Johansen 4a9a0fa949 [kernel] Test for reading all platforms
This test would have cought the need for
https://dart-review.googlesource.com/c/sdk/+/171727
sooner (or, rather it wouldn't have been needed at all because we would
have found out before landing the original :)).

Change-Id: If9e3216b1b8733d0463006fb253e1dbb484291eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171883
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-11-16 08:36:21 +00:00
Johnni Winther c4622003a2 [kernel] Remove dynamic access from text_serializer
Change-Id: Ic1012992472f8798c384af8795db8b1f42f8ccb1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171945
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-11-16 08:16:39 +00:00
Johnni Winther a39ea25627 [cfe] Add test for dynamic access in CFE/kernel code
Change-Id: I9cd5aec2bd9b455a099503ca3c55f61659145869
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171726
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-11-15 12:04:47 +00:00
Dmitry Stefantsov b4dbbe220c [cfe] Use type parser in type constraint gatherer tests
Closes #44096.

Bug: https://github.com/dart-lang/sdk/issues/44096
Change-Id: Id977e1ef70a1c17b30aedf072be7e6d2ea812d8c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171587
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-11-12 17:25:27 +00:00
Dmitry Stefantsov ffc5ea67a1 [cfe] Read Null in a supertype position as an InterfaceType
Change-Id: I64927f996eee9e6928ee3a4303b39be4328ee0b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171727
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-11-12 16:51:07 +00:00
Johnni Winther 7b89827956 [cfe] Support bit mask for enabling specific late lowerings
TEST=pkg/front_end/testcases/late_lowering/late_lowering_bitmasks.dart

Closes #43993

Change-Id: I47d238dd7cf0ea22983a38bed86e415330070596
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171580
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-11-11 14:06:30 +00:00
Johnni Winther 13dfd58ac2 [kernel] Remove unification code
Change-Id: I1e5d8196839c3e0b54c7ad9aca1cdb41ca3aecbe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171582
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-11-11 12:51:28 +00:00
Johnni Winther b38821f39d [kernel] Enforce lints in pkg/kernel
Change-Id: I954f7632f22b552febed2a3140f81245277cb050
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171581
Reviewed-by: Jens Johansen <jensj@google.com>
2020-11-11 12:51:28 +00:00
Stephen Adams 8c13fa841e [dart2js] Kernel transformer expansion for List.generate
Simple calls to `List.generate` are expanded into a list allocation
and a loop. This generates better code for several reasons:

 - There is no overhead for the function argument (closure allocation,
   closure type, closure class)

 - Global type inference is more precise since each List.generate list
   is tracked separately, and the assignments in the loop give better
   inference to the collection's element type.

To get precise element type inference, there are two new JSArray
constructors. Global type inference starts with the element type being
bottom for these elements, avoiding spurious nulls in the inferred
type.

Change-Id: I5efb90651ae3f9eb2e81af556704960cdf0b75c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168770
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-11-11 04:27:22 +00:00
Johnni Winther 267a061c2b [kernel] Clone Block.fileEndOffset
+ remove redundant clone of fileOffset.

Change-Id: Ie13e35a710e8496da4e93b858ee18b54dd0d551f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170960
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-11-09 20:59:14 +00:00
Dmitry Stefantsov 783d83950b [cfe] Use type parser in type schema elimination tests
Closes: #44095.

Bug: https://github.com/dart-lang/sdk/issues/44095
Change-Id: Iff15b0686557388c4e701075a4f6e4fc16dfa5fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170901
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-11-09 16:54:39 +00:00
Johnni Winther 1930c07cd7 [cfe] Add flags to MethodInvocation and fileEndOffset to Block
The CL add a 'flags' to MethodInvocation with the properties isInvariant
and isBoundsSafe. The former is used for to marks safe calls in unified
collection encoding. Both can be used further by backends.

The CL also adds a 'fileEndOffset' to Block. This is current set for
block declared in used code.

In response to https://github.com/dart-lang/sdk/issues/43994
and https://github.com/dart-lang/sdk/issues/43965

Change-Id: I579fc2928331465dfc2c152ccfd21297b12cfdd3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170695
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-11-09 07:36:44 +00:00
Dmitry Stefantsov d54e2bb568 [cfe,ddc,dart2js,vm] Add NullType
This CL is the sum of the following 5 CLs:
* https://dart-review.googlesource.com/c/sdk/+/170342/
* https://dart-review.googlesource.com/c/sdk/+/170344/
* https://dart-review.googlesource.com/c/sdk/+/170345/
* https://dart-review.googlesource.com/c/sdk/+/170346/
* https://dart-review.googlesource.com/c/sdk/+/170347/

The reason for landing the 5 CLs as one CL is to prevent potential
troubles with bisecting over the branch because the change is fully
functional only with all 5 CLs.

Closes #40122.

TEST=Verified by changes in .expect files in pkg/vm/.
Bug: https://github.com/dart-lang/sdk/issues/40122
Change-Id: Ib8197802fdc69694387ae47ac990c58b3aaab7a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170689
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-11-06 12:43:52 +00:00
Clement Skau 27ca552ddb [SDK] Replaces async's _AsyncAwaitCompleter with _Future.
Run time (less is better) impact:
dart:
- Calls.AwaitAsyncCall  -43.95% ~ -55.50%
- Calls.AwaitAsyncCallClosureTargetPolymorphic  -40.33% ~ -53.58%
- Calls.AwaitAsyncCallInstanceTargetPolymorphic  -42.69% ~ -55.65%
- Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits  -42.05% ~ -56.14%
- Calls.Await...  0% ~ -13%
dart-aot:
- Calls.AwaitAsyncCall  -9.748% ~ -11.13%
- Calls.AwaitAsyncCallClosureTargetPolymorphic  -8.673% ~ -13.19%
- Calls.AwaitAsyncCallInstanceTargetPolymorphic  -9.799% ~ -11.74%
- Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits  -5.412% ~ -13.43%

Code size impact:
- flutter_gallery_app_so_brotli_size  -0.1237% ~ -0.2410%
- flutter_gallery_readonlydata_size  0.1693% ~ 0.2041%
- flutter_gallery_instructions_size  0.1157% ~ 0.1779%
- flutter_gallery_total_size  0.1021% ~ 0.1413%

Bug: https://github.com/dart-lang/sdk/issues/39119
Change-Id: I64d28a8bea078277946d7be43737e265920c8f16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/126322
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-11-05 09:51:13 +00:00
Jens Johansen 7b75bd8ece [CFE] Special case StrongModeNNBDPackageOptOut message in IncrementalCompiler
This CL fixes the wrong message, so - when in the process of fixing
the package nnbd settings - one gets the correct message, mentioning the
right packages and no longer mentioning the fixed ones.

Change-Id: Ied26094055e56b44dfdd2e942b98eb9e1e7968fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170423
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-11-05 09:43:23 +00:00