Commit graph

81386 commits

Author SHA1 Message Date
pq
c22a170429 linter 1.9.0
Change-Id: Id833d90a90caefe7578451f6086828fd33002529
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209765
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2021-08-11 23:05:13 +00:00
asiva
e3058884b0 [VM/Runtime] - Remove API Dart_GlobalTimelineSetRecordedStreams which is
not used anywhere

Enabling of the timeline streams is done using command line flags
during initialization and no embedder uses this API function
(It was added when Mojo was supported).

TEST=ci

Change-Id: Ide9205b9ecd703e2ccdab7a85e8a79c48d98f180
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209850
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2021-08-11 22:33:43 +00:00
Paul Berry
9ed173fcad Stop tracking scopes in ResolverVisitor
With this change, the analyzer logic for performing scope lookups is
now fully separated from the logic for doing type analysis and flow
analysis (ResolverVisitor now only does the latter; the former is done
by ScopeResolverVisitor and ResolutionVisitor).  The analyzer now has
a similar separation of concerns between scope lookups and type/flow
analysis as the CFE does; this should help pave the way for sharing
resolution logic between the analyzer and the CFE in the future.

Change-Id: Ie006dfe1b5943bb361dc0aec4525e21572e21e5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209381
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-08-11 17:39:40 +00:00
Paul Berry
b278964664 Move scope lookup of simple identifiers into ScopeResolverVisitor.
This is another step toward removing scope tracking from ResolverVisitor.

Change-Id: I76c45601b8cf7a3fa30f6f6ca43b044e5aaf6dc6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209721
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-08-11 17:39:40 +00:00
Paul Berry
143f39b683 Create a new base class for resolution visitors.
The new class, ResolverBase, will eventually take the place of
ScopedVisitor as the common base class between ResolverVisitor and
ScopeResolverVisitor.  Unlike ScopedVisitor, it won't maintain any
scope information (since we are migrating all scope handling out of
ResolverVisitor); all it needs to do is keep track of some information
that is needed by all resolution stages, such as the library element,
the type provider, and the error reporter.

Change-Id: I00f80457d368489d6df9736713fd3caddd5f917f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209720
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2021-08-11 17:39:40 +00:00
David Benjamin
e8e0a39464 Estimate the overhead of an X509 object without sizeof
To unblock optimizations in hopes of reducing the overhead, we're
planning to make X509 opaque in BoringSSL. This aligns with upstream
OpenSSL, which has made most of these structs opaque.

Instead, use an estimate. The sizeof-based estimate was undercounting
the overhead anyway because there are many structures underneath X509,
some of which are already opaque. I just rounded sizeof(X509) +
sizeof(X509_CINF) up.

(Even this is likely still undercounting it because X509 objects are
very malloc-heavy and duplicate large chunks of the certificate. They're
not a very efficient representation and can't be made efficient without
first hiding the structs. In Chrome, we stopped using them altogether
and just retain the byte string, parsing as needed.)

TEST=ci

Change-Id: Icdc729ceba7eadf002bec5e080fc3e0adf7c4b56
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209920
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
2021-08-11 16:41:41 +00:00
Erik Ernst
cc84bb3e28 Adjust type_parameter_test to expect caller-side check on tearoff
language/covariant/type_parameter_test.dart performed a tearoff which
should incur a run-time error (because the dynamic type of the
tearoff is not a subtype of the static type, so it would be a
soundness violation to pass that value on to the next step of
evaluation).

Change-Id: Ia4ec813606e711cab0bdcc68d24bbac3c9a2d8c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209910
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2021-08-11 16:37:51 +00:00
Alexander Markov
15e5ec1762 [vm] Faster floor/ceil/truncate on JIT/x64
This change enables use of roundsd instruction on x64 if SSE4.1 is
detected (in JIT mode).

Also, XMM register is cleared before roundsd to avoid false dependency
due to partial register access in roundsd.

Microbenchmark results on JIT/x64:
Before: BenchFloor(RunTime): 303.81512987999395 us.
After:  BenchFloor(RunTime): 135.00067499156262 us.

Custom floor implementation in Dart:
BenchFastFloor(RunTime): 147.609889298893 us.

TEST=ci

Issue: https://github.com/dart-lang/sdk/issues/46650
Change-Id: I13502f5d40edf32916edec14cfab027758a22457
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209764
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2021-08-11 16:32:17 +00:00
Johnni Winther
3befe682e9 [cfe] Fix message offset on unresolved prefix access
Bug: b/195806584
Change-Id: I0d607ceef8d17433df00f5a71cc5b37d6f5c899f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209907
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-08-11 16:12:01 +00:00
Erik Ernst
ef1f4c78db Remove expectation that instantiated local function tearoffs are notEqual
This CL changes the test
language/generic_methods/explicit_instantiated_tearoff_test.dart
such that it no longer expects a generic instantiation of a local
function tearoff to be notEqual to another function object which is
the same local function, same enclosing invocation, same type
arguments.

The rationale is that we should not preclude an optimization whereby
these function objects are canonicalized (at run time, or if they
can be lifted to the top level even possibly at compile time).

Change-Id: I5845a19ce9ccf931c4d3abe4ab619f3ed2a2fbc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209860
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2021-08-11 16:07:51 +00:00
Alexander Thomas
ef850dbdec [co19] Skip flawed tests on latest co19 roll
The top_level_main tests starts themselves via
Platform.resolvedExecutable which causes them to turn into a fork bombs
on AOT. On web, dart:io is not supported.

https://github.com/dart-lang/co19/issues/1137

findProxy tests are timing out on all relevant platforms.

https://github.com/dart-lang/co19/issues/1129

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-win-release-x64-try
Change-Id: If1e4d0c26d5d40cd60e5e8a8dd4600b85668da5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209706
Reviewed-by: William Hesse <whesse@google.com>
2021-08-11 13:29:59 +00:00
Alexander Thomas
f9a65636e5 [co19] Roll co19 to aff1a334d7875e465c2f43e1b38774512fbb4ba4
2021-08-09 sgrekhov@unipro.ru 1126. Different roll failures fixed
2021-08-09 sgrekhov@unipro.ru 1100. Fix Link.watch() test to avoid flakiness
2021-08-09 sgrekhov@unipro.ru Fixes 1128. Remove check for '!identical(v1, v2)'
2021-08-06 sgrekhov@unipro.ru 1126. Some of the roll failures fixed or issue numbers added
2021-08-06 sgrekhov@unipro.ru 1127. Expect compile-time errors in CFE for cyclic redirecting factories participating in a loop
2021-08-06 sgrekhov@unipro.ru 1126. Some of the roll failures fixed
2021-08-04 irina.arkhipets@gmail.com Useless libraries removed.
2021-08-04 sgrekhov@unipro.ru 993. PointerPointer tests added
2021-08-03 sgrekhov@unipro.ru 993. IntPtrPointer tests added
2021-08-03 sgrekhov@unipro.ru 993. Work with memory fixed in FFI tests
2021-08-02 sgrekhov@unipro.ru 993. Int64Pointer tests added for FFI library
2021-07-30 sgrekhov@unipro.ru Fixes 993. IntXXPointer tests added for FFI library
2021-07-30 sgrekhov@unipro.ru 1087. More tests for tearing-off constructor of an abstract class
2021-07-29 sgrekhov@unipro.ru Fixes 993. DoublePointer tests added for FFI library
2021-07-29 sgrekhov@unipro.ru Fixes 993. More Union tests for FFI library added
2021-07-28 sgrekhov@unipro.ru Fixes 1125. Test for cascades contained explicitly instantiated tearoffs added
2021-07-28 sgrekhov@unipro.ru 1087. Header comment style fixes
2021-07-27 sgrekhov@unipro.ru 1087. Add tests for tearing-off constructor of an abstract class
2021-07-27 sgrekhov@unipro.ru Fixes 1124. Constructor tear-off tests fixed
2021-07-26 sgrekhov@unipro.ru 1124. Numerous errors and typos in Constructor tear-off tests fixed
2021-07-21 irina.arkhipets@gmail.com Issue 1119: test corrected.
2021-07-20 irina.arkhipets@gmail.com Issue 1109: Libraries_and_Scripts test updated, new tests added.
2021-07-20 sgrekhov@unipro.ru 1123. Constructor tear-off tests fixed to expect syntax errors
2021-07-20 sgrekhov@unipro.ru 1123. Expect syntax errors in tests which check syntax
2021-07-19 sgrekhov@unipro.ru Missed checks added to Language/Generics/syntax_t31 test
2021-07-19 sgrekhov@unipro.ru 1123. Expect syntax errors in tests which check syntax
2021-07-19 sgrekhov@unipro.ru 1123. Syntax error fixed in unnamed constructor tear-off tests
2021-07-19 sgrekhov@unipro.ru 1122. nonfunction-type-aliases tests moved out of type-aliases directory
2021-07-16 sgrekhov@unipro.ru 1122. nonfunction-type-aliases experimental flag removed
2021-07-16 sgrekhov@unipro.ru 1122. nonfunction-type-aliases experimental flag removed
2021-07-15 sgrekhov@unipro.ru Fixes 1121. Update Symbol tests according to the changed specification
2021-07-14 sgrekhov@unipro.ru 932. Issue number added
2021-07-14 irina.arkhipets@gmail.com Fixes 1109: test expectations corrected according to  dart-lang/sdk44161, dart-lang/sdk44163 evaluations.
2021-07-14 sgrekhov@unipro.ru 1120. Added test which uses type aliases
2021-07-13 sgrekhov@unipro.ru 993. NativeFunction test added
2021-07-12 sgrekhov@unipro.ru Fixes 1107. Replace multitests by static errors tests
2021-07-12 sgrekhov@unipro.ru 1120. Tests for mixin static members added
2021-07-09 sgrekhov@unipro.ru Fixes 1120. Tests for function object canonicalization added
2021-07-08 sgrekhov@unipro.ru Fixes 1087. More constructor tear-offs tests added
2021-07-07 sgrekhov@unipro.ru 1087. More constructor tear-offs tests added
2021-07-06 sgrekhov@unipro.ru 1087. Added tests that checks factory constructor tear-offs and use of tear-offs in a factory constructors
2021-07-06 sgrekhov@unipro.ru Fixes 1118. Expect an error for Union/Struct subclasses created by generative constructor
2021-07-05 sgrekhov@unipro.ru Fixes 1111. Expect an error for zero-sized arrays
2021-07-05 sgrekhov@unipro.ru Fixes 1116. Expect a compile error for empty setOrMapLiteral for Iterable<Object> context type
2021-07-05 sgrekhov@unipro.ru Fixes 1112. Expect a compile error if mixin is derived from a class other than Object
2021-07-05 sgrekhov@unipro.ru Fixes 1105. Function tear-offs tests fixed
2021-07-05 sgrekhov@unipro.ru Fixes 1106. Use runtime check 'is int' VS 'is String' to check that runtime type is 'int', not 'dynamic'
2021-07-01 irina.arkhipets@gmail.com Fixes 1113: Method signature corrected.
2021-07-01 irina.arkhipets@gmail.com Fixed Issue 1115: test expectation corrected.
2021-07-01 irina.arkhipets@gmail.com Fixes Issue 1117: test corrected.
2021-06-29 irina.arkhipets@gmail.com Issue 1094: Merge changes from pre-nnbd branch.
2021-06-25 sgrekhov@unipro.ru 1087. Added tests for static invocations and type object member ambiguity
2021-06-25 sgrekhov@unipro.ru 1104. Fix type used in onError
2021-06-24 sgrekhov@unipro.ru 1087. Added more tests for resolving ambiguities
2021-06-23 sgrekhov@unipro.ru 1087. Added more tests for resolving ambiguities
2021-06-22 sgrekhov@unipro.ru 1087. Added more tests for resolving ambiguities
2021-06-22 sgrekhov@unipro.ru Fixes 1103. Change expected error range for analyzer according to the changed behaviour
2021-06-22 sgrekhov@unipro.ru Fixes 1102. Change test expected results according to the changed behavior
2021-06-21 sgrekhov@unipro.ru 1087. Added more tests for resolving ambiguities
2021-06-21 sgrekhov@unipro.ru Issue number added to the failing test
2021-06-21 sgrekhov@unipro.ru Fixes 1101. Expect less compile errors
2021-06-18 sgrekhov@unipro.ru 1087. Resolving ambiguities tests added
2021-06-17 sgrekhov@unipro.ru 1087. Resolving ambiguities tests added
2021-06-17 sgrekhov@unipro.ru 1087. Call-method tests added
2021-06-15 sgrekhov@unipro.ru Fixes 1100. Expect file system event not on link itself but on directory it points to
2021-06-15 sgrekhov@unipro.ru 1099. Fixed co19 roll failures

Cq-Include-Trybots: dart/try:analyzer-nnbd-linux-release-try,dart2js-nnbd-linux-x64-chrome-try,ddc-nnbd-linux-release-chrome-try,front-end-nnbd-linux-release-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-nnbd-linux-release-simarm64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-nnbd-mac-release-arm64-try,vm-kernel-nnbd-win-release-x64-try,vm-kernel-precomp-nnbd-linux-release-simarm64-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-win-release-x64-try
Change-Id: Ib18e48d31771b2b70e607951577b9ac90d0b40a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209547
Reviewed-by: William Hesse <whesse@google.com>
2021-08-11 13:29:59 +00:00
Tess Strickland
8239fecf1a [gardening] Fix build errors on GCC bot.
TEST=Build succeeds on GCC trybot.

Cq-Include-Trybots: luci.dart.try:vm-kernel-gcc-linux-try
Change-Id: I986137795edd28f7ad5bd42dcfe83af4576641f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209903
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2021-08-11 11:54:01 +00:00
Alexander Thomas
df4f40e4ef [infra] Fix pkg/dart2js_info package-config.json exclusion on Windows
This is a follow-up to https://dart-review.googlesource.com/c/sdk/+/209900

Cq-Include-Trybots: luci.dart.try:pkg-linux-release-try,pkg-mac-release-try,pkg-win-release-try
Change-Id: Ic03c6d830727b377477b7780ab9dbf242c16d368
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209906
Reviewed-by: William Hesse <whesse@google.com>
2021-08-11 11:07:32 +00:00
Tess Strickland
45e6b6970e [gardening] Restrict ReloadTestScript to non-PRODUCT mode.
Fixes linking error on vm-kernel-win-product-x64.

TEST=Build succeeds on Windows PRODUCT trybot.

Cq-Include-Trybots: luci.dart.try:vm-kernel-win-product-x64-try
Change-Id: I6b433441ce0b1a112a03c9e8fb61d1bb59a2322c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209904
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2021-08-11 10:32:30 +00:00
Dmitry Stefantsov
6393841036 [cfe] Account for InvalidType at nestedness level in UP and DOWN
Closes #46863.

Bug: https://github.com/dart-lang/sdk/issues/46863
Change-Id: I0cc60251f80406baa955131978cd6cbd029b228e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209700
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-08-11 09:40:31 +00:00
Alexander Thomas
c04a71e455 [infra] Temporarily remove package_deps.dart from the test matrix
It currently fails because pkg/dart2js_info isn't wired up, yet.

Change-Id: I10a2d43385fe3d900a62fa7438ed37b9e366dffb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209902
Reviewed-by: William Hesse <whesse@google.com>
2021-08-11 09:10:06 +00:00
Alexander Thomas
cf411dc539 Add 'pkg/dart2js_info/' from commit '86ccc7749bd01278473d1d3843c442b5046b36fa'
git-subtree-dir: pkg/dart2js_info
git-subtree-mainline: 7fe597bd8e
git-subtree-split: 86ccc7749b
2021-08-11 10:17:15 +02:00
Alexander Thomas
86ccc7749b
Fix misplaced whitespace in info.proto (#91)
These cause warning when this is checked into the SDK which has formatting checks for proto files.
2021-08-11 10:15:32 +02:00
Alexander Thomas
7fe597bd8e [infra] Exclude pkg/dart2js_info from package_config.json
pkg/dart2js_info will soon contain a checked-in version of dart2js_info
that will eventually replace third_party/pkg/dart2js_info. Until that
happens, pkg/dart2js_info should be ignored.

Change-Id: I337d69b6ee58b1ec0f436a199c81828dfd391ec8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209900
Auto-Submit: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Commit-Queue: William Hesse <whesse@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2021-08-11 07:32:40 +00:00
Sam Rawlins
26bfbd4cf1 analyzer tests: Remove the WithNullSafety mixin
Two remaining test files are modified to use the TestCases structure.
In each case, the tests are unchanged, but the classes are renamed.

Additionally, each file had a *WtihNonFunctionTypes variant. Each of
these classes just specified more test cases that include some form of
"typeAlias" in the name, and can be safely merged with the null safety
test cases.

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

Bug: https://github.com/dart-lang/sdk/issues/44666
Change-Id: Id7db1038e64f8bbc12764cb558670b23427a5a86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209763
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-08-11 06:41:51 +00:00
Konstantin Shcheglov
79181abb70 Issue 46839. Stop using UNCHECKED_USE_OF_NULLABLE_VALUE.
Bug: https://github.com/dart-lang/sdk/issues/46839
Change-Id: Ia6a71438c265e54e83b148689e68e1e409d34cee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209500
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-08-11 02:56:32 +00:00
Konstantin Shcheglov
3a2e4d92a2 Remove ExperimentStatus.latestWithNullSafety
Change-Id: I0a813ce1a64f1d6201005280cf7a116deaf8da1a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209581
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-08-11 02:37:44 +00:00
Paul Berry
f66037acce Migration: add support for Angular's @ViewChild() and @ContentChild() annotations.
Bug: https://github.com/dart-lang/sdk/issues/45661
Change-Id: Ie77d720677fb032585e17fe13358afe597e702bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209820
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-08-11 01:55:41 +00:00
Kaushik Iska
650dfa19ff Allow deprecated copy on fuchsia
Looks like fidlgen generated the copy constructor
but not the assignment operator which is resulting
in build failures for the SDK roll.

Bug: https://github.com/flutter/flutter/issues/88004
Change-Id: I1b919eb318d9afb6952af4905db7f183c84e8a7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209800
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2021-08-11 01:14:22 +00:00
Sam Rawlins
3393591b3f Rewrite AST w/ Constructor reference w/ explicit type args
This should handle all cases of constructor reference w/ explicit type
args; there aren't too many cases:

* named and unnamed constructors
* referencing class and referencing type alias
* prefixed class names and not-prefixed
* null-aware access (weird)
* bound on type parameter of class, and on type parameter of alias

error cases:

* cascade
* wrong number of type arguments

Bug: https://github.com/dart-lang/sdk/issues/46020
Change-Id: If257eb561a9ad854709b6e9a7d81faa9d084d6ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209622
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-08-10 23:54:49 +00:00
Sigmund Cherem
d6cecab694 [dart2js]: Improve deferred loading documentation
This moves the algorithm comment to be more visible at the top of the library,
and expands it with more details about how the algorithm works.

Change-Id: I74eeec52e71c55ba77df8d7d35473570c9d1f6e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209441
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2021-08-10 23:53:11 +00:00
Ben Konyi
2831d8af85 [ VM / Profiler ] Fix case where EnterSampleReaderLock could set the lock count using an uninitialized variable
TEST=Ran all service tests in parallel, was no longer able to reproduce
assertion failure

Change-Id: I884f160ce267ca2b7c4684ace901caa88ce19924
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209762
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-08-10 22:38:51 +00:00
Paul Berry
4d0dc2ea8a Migration: add support for Angular's @Optional() annotation.
Bug: https://github.com/dart-lang/sdk/issues/45661
Change-Id: I6c8c87c2a0d26dc8053ef66961a96e03cf5a2582
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209780
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-08-10 21:32:51 +00:00
Ryan Macnak
ae0880a5c0 [vm] Globally intercept new (zone) DoesNotExtendZoneAllocated().
Cf. 479430235c

TEST=ci
Change-Id: Ice55e5083096591b1c7e1243a12ea4aa160efb0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209740
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2021-08-10 21:10:01 +00:00
asiva
f21c9d54ea [VM/Runtime] - Remove TimelineEventBlockIterator which is dead code.
Dead since ff2fd8fe54.

TEST=Deleted code, no new functionality added. Regular CI runs.
Change-Id: I95716abfe9807eba48dbbc7fa3efc7f58cd1b11d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209760
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-08-10 19:53:41 +00:00
Danny Tuppeny
5447c3981e [dds] Add support for conditional breakpoints in DAP
Change-Id: I5f28337b0371f4efb52b2ba169bf27e1d61425c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209702
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-08-10 19:33:20 +00:00
Sam Rawlins
19fa4519bd Analyzer: Refactor and rename test classes in 18 files to use TestCases model
The diffs may look large, but only due to sorting. No tests were added,
removed, or altered.

Change-Id: Id126e9a08056f6d3f99bad32d7060d65b07e4e90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209722
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-08-10 18:48:50 +00:00
Nicholas Shahan
7ff8c6c6be [tests] Remove not-identical expectation for Type values
The instantiation at runtime implies non-constant type expressions
but canonicalization is unspecified so backends should be allowed
to optimize by canonicalizing types.

Change-Id: I2f1cab6ac68a1ce156b15af0b99e02d03b7b3dca
Issue: https://github.com/dart-lang/sdk/issues/46837
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209663
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2021-08-10 18:47:31 +00:00
Sam Rawlins
2c32ff9331 Report error on function tearoff w/ type args on dynamic
From the spec:

> We do not allow dynamic explicit instantiation. If an
expression _e_ has type `dynamic` (or `Never`), then
`e.foo<int>` is a compile-time error for any name `foo`.

Bug: https://github.com/dart-lang/sdk/issues/46020
Change-Id: I041c3fcac77fe8edf64633a8d23dbaa89cf42f77
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209623
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-08-10 18:36:11 +00:00
Gabriel Castro
799b39ad42 dart:html static extension members generation
Initial changes to add functionality to the dart:html generation
script to generate classes with the JSInterop static extension pattern

Change-Id: I9dca21db7500ab25ac96b16eda11fe605f915abe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208461
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Gabriel Castro <gabrielmcastro@google.com>
2021-08-10 18:15:30 +00:00
Martin Kustermann
049921b45f [vm/concurrency] Add optimizations to avoid O(N) cost to find ICData in certain switchable call miss handler cases
This fixes a huge performance regression (introduced in [0]) of a
synthetic microbenchmark - MicroClosureCreateTearoffClassSecondTime -
that happens to have a gigantic function with a large number of call
sites in them.

All of those call sites stay monomorphic but all of them will have to
go to runtime for miss handler because the target code was disabled (the
unoptimized code got disabled, since optimized target code was
installed). The particular target function in question is
`_GrowableArray.add()`.

The cause for the regression is that the miss handler will lookup the
ICData based on linearly walking PcDescriptors to find deopt-id which it
uses to get ICData from function's ic-data array.

Interestingly enough it only regresses ia32 but not x64 (the only two
architectures this benchmark is run on). The reason for that is that
x64 uses exactness tracking and therefore doesn't switch to
monomorphic calls.

This CL:

If a monomorphic call site had a miss because the cached old target
was disabled, we go to runtime to find the real target. Another thread
may have transitioned the call site already from monomorphic to
polymorphic.

When resolving the target function we take advantage of a back reference
from the `ICData::entries()` back to the `ICData` to avoid the O(N)
lookups.

[0] https://dart-review.googlesource.com/c/sdk/+/206373

TEST=Existing test suite.

Change-Id: Ia066a846f5f50e5a575f0734c9453d2368f80780
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207133
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-08-10 18:03:21 +00:00
Tess Strickland
2c89455557 [vm/compiler] Create optimized TTS for plain Function type.
This does not handle more specific function types (those represented
using FunctionType objects), but just Type::DartFunctionType().

TEST=vm/cc/TTS_Function

Change-Id: I42ddd8818da5331eed748784b051cd2c78547b5b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209703
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2021-08-10 17:54:42 +00:00
Vyacheslav Egorov
493fe772d0 [vm] Rewrite Double.~/ in pure Dart
Avoid going into runtime for every operation.

https://github.com/dart-lang/sdk/issues/46855

TEST=ci

Change-Id: I5ab1d224f895342c8dd7fb9b8a7a98cfb0359db0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209705
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2021-08-10 17:54:40 +00:00
Danny Tuppeny
215efd6642 [dds] Mark not-debuggable frames as deemphasized in DAP
This allows user code to stand out better in the stack trace when debugging SDK/External packages is disabled.

Change-Id: I1740001f2aa085e3bc2069d788e1c53e71386866
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209641
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2021-08-10 16:54:23 +00:00
Paul Berry
b266aeebc3 Move some logic from ScopedVisitor to ResolverVisitor.
Of the two classes that inherit from ScopedVisitor (ResolverVisitor
and ScopeResolverVisitor), only ResolverVisitor needs to know about
the currently enclosing class, extension, and function.  So we move
this tracking logic to the ResolverVisitor itself.  This will help
pave the way for a cleaner separation between the ResolverVisitor and
ScopeResolverVisitor.

(The ScopeResolverVisitor *does* need to know the currently enclosing
closure, so that it can detect improper break/continue statements and
so that it can detect when a local variable is mutated in a closure,
but the tracking logic needed for this is much simpler than what the
ResolverVisitor needs for the "enclosing function".  So a new
_enclosingClosure member has been added to ScopeResolverVisitor to
track this.)

Change-Id: I768c15ff4ffcabf564388f5471a6e8f88e677148
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209665
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2021-08-10 15:11:27 +00:00
Paul Berry
98f0e78e3c Make ScopeResolverVisitor responsible for setting break/continue targets.
This is part of a long term arc of work to consolidate all scope
lookup into a single analyzer visitor.

Change-Id: Ifc483a94173e05672b659348a3f37dd1c5b4468e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208662
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2021-08-10 15:11:27 +00:00
Paul Berry
8cf79c9703 Rename VariableResolverVisitor.
This is the beginning of an arc of work to move the responsibility of
all the analyzer's scope-based resolution into a single class.
VariableResolverVisitor will become that class, so accordingly it's
being renamed to ScopeResolverVisitor.

In the long term, this shift of responsibility will bring the analyzer
and the CFE into better alignment by removing scope resolution logic
from the type analysis phase (the CFE performs all scope resolution
during parsing, and then has a single visit pass to do type analysis).
This should allow analyzer and CFE logic to be more readily shared.
Also, it should improve the performance of the analyzer by allowing
Scope objects to be built up in just a single visitor pass rather than
in multiple visitor passes.

Change-Id: I037346d28de6485cac783e2bc65e0de9d3a2ada6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208661
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-08-10 15:11:27 +00:00
Paul Berry
b53ea6cb8e Refactor scope lookup logic in preparation for consolidating scope analysis to a single visitor.
This CL refactors the scope lookup logic for simple identifiers so
that it happens in three phases:

- The actual lookup, handled by Scope.lookup

- Choosing which element is being referred to, handled by the
  LexicalLookup class

- If lexical lookup failed, falling back on implicit `this` lookup,
  handled by the ThisLookup class

In a future CL, this will allow us to consolidate the first phase,
along with all other scope-related operations, into a single visitor
so that the ResolverVisitor no longer needs to maintain scopes.  This
should simplify the analyzer's scoping logic and help prepare for
sharing more code with the CFE (since it will make the analyzer's
visitors more closely parallel the analysis phases of the CFE).

Change-Id: I0c8a2aa60bfc5a935b6060adf64e5a4504bc268f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209664
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2021-08-10 15:11:27 +00:00
Lasse R.H. Nielsen
020f21261a Add documentation to .fromEnvironment-like constructors.
Document that only `const` invocations are guaranteed to work.
(But leave open the door that some platforms might allow `new`.)

Thanks to @irvine5k for the initial work (see #46846).

Change-Id: I16ad26186e91898cf1dc2922a492ce4eb0dac207
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209543
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-08-10 14:37:37 +00:00
Tess Strickland
51649b702d [vm] Allow optimized type testing stubs to be partial.
Previously, the code in the TypeCheck runtime entry assumed that if a
lazily specialized type testing stub (TTS) returned a false negative in
JIT mode, that it should always be regenerated and that regeneration
would always result in different code. In AOT mode, false negatives
instead always cause the stub to go to runtime, even if that false
negative had been seen before, because the assumption is that false
negatives shouldn't happen when the whole class hierarchy is known at
compile time.

However, even in the current implementation of optimized TTSes, there
are cases where this assumption is false. For example, the code
generated by BuildOptimizedSubclassRangeCheckWithTypeArguments allows
for provided type arguments to be type parameters. When this happens,
the type parameter is instantiated at runtime using the instantiator or
function type arguments, and the instantiated type parameter must be
identical to the result retrieved from the type arguments of the
instance. That means that if the instantiated type parameter is not the
same type, but a supertype, of the result, then a false negative is
generated.

This CL changes TypeCheck's handling of false negatives from lazily
specialized TTSes as follows: in JIT, if the regenerated stub is the
same as the old stub, or in AOT, a false negative causes the same fall
back to SubtypeTestCaches as unoptimized stubs.  This way, further
checks with the same false negative will be caught via the STC before
going to runtime, assuming the STC hasn't already filled up with false
negatives.

Currently, we only generate false negatives for reasons that will not
change when respecialization occurs due to additions to the hierarchy,
so we do not need to clear affected STCs during respecialization.
However, the previous approach to resetting STCs on reload (in
CallSiteResetter::ResetCaches) is insufficient, since there may be
caches containing reloaded types in non-reloaded code (like the TTS
invoker stub created by the TTS testing framework). Instead, clear
all caches on reload using the same ObjectVisitor as deoptimizing type
testing stubs.

Since we now have to check instruction equality to determine whether
to add to the STC, we now only replace the existing stub if the
instructions are different. This makes it easier to test whether a
TTS invocation on a false positive caused respecialization or not.

This CL also reworks the testing framework for type testing stubs,
1) creating a test case object that stores the particulars of a given
invocation, including expectations, and 2) moving most checks and
access to appropriate data structures into a state object that handles
setup and performing invocations given test cases.

TEST=vm/cc/TTS_Partial

Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-tsan-linux-release-x64-try,vm-kernel-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try
Change-Id: I139608c5a0f2442a85a1cf39d1c04104db7a5593
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208653
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-08-10 13:56:33 +00:00
Alexander Thomas
c040c050d6 [release] Bump language version to 2.15
TEST=Standard CQ.
Change-Id: Ib50b4d23f25ea4bd074904a87068a4a8774932aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209561
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-08-10 13:06:53 +00:00
Konstantin Shcheglov
7ad9feb2d6 Issue 46472. Don't resolve to static Object members via dynamic.
For instance members we do this because this is the best that we
know about the result, and any successful override will be more
specific. But static members never can be invoked this way. So, we
don't do recovery for recovery.

Bug: https://github.com/dart-lang/sdk/issues/46472
Change-Id: Ifbd274011e159c3c8ae35d343603c02bb7599d8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209420
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2021-08-10 12:53:23 +00:00
Sigurd Meldgaard
88b4b4d08a Update package_config
Bump pub

```
> git log --format="%C(auto) %h %s" 70b1a4f9229a36bac6340ec7eae2b2068baac96c..9f2ddc02f066c68fb638ff65fbb73761ece23267
 9f2ddc02 Use uris for paths in git source descriptions (#3063)
 97a0033e Update README.md (#3069)
 2ef10adf Roll setup-dart (#3054)
 4b5450d3 Updated repository specification. (#3050)
 0f3055db Add executables to allErrors (#3048)
```

Change-Id: Iaa42df2339b6f62aeb63e0f2e7eaf062da84e7c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209681
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2021-08-10 12:47:33 +00:00
niku
005e496e1e Fix isAfter method code example on DateTime class
The code example looks similar as [isBefore method](b8d040e523/sdk/lib/core/date_time.dart (L405-L417)) except in this change.

Closes https://github.com/dart-lang/sdk/pull/46847
https://github.com/dart-lang/sdk/pull/46847

GitOrigin-RevId: 4087032bcbd64e8aaf58dab81babb971d4642c86
Change-Id: I0b01d82ce4fad9ae076c4a1d46ee03cbc3b08d25
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209460
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2021-08-10 11:58:34 +00:00