Runs either `dart pub get` or `gclient sync`, based on project type.
For the SDK, copies the .gclient and .gclient_entries files as well
into the parent dir.
Also adds a `--timeout` argument, controls how long to wait for analyzer messages.
Change-Id: Id2c28e6d0251e94914bb0650be104c1f90a66651
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468620
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Use a (mutable) global rather than a function to get the externref to
the appropriate module for exported function wrappers. This way we don't
have to make a slow JS interop call to get the module.
Recovers regression in golem "FunctionToJs.Convert.*.*" benchmarks seen
from introducing these functions.
Change-Id: Ie05d803a3d9992dce3dda89e6ae5af83d3f34383
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468220
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This stops completion from suggesting `final` outisde a primary
constructor's parameter list when the feature is enabled. When the
feature is not enabled, it won't be suggested anywhere. I did that
because in the same release this CL is for we'll produce a warning if
`final` is used, and it seems unhelpful to suggest adding code that will
have a diagnostic associated with it.
Change-Id: I2f8ad2d92ea0641e2212c89d01aa23921b39b3e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468401
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This CL makes it possible for the Dart VM to start or stop `perf` while
doing GC, which gives a significantly more stable output.
Example usage:
Bash script that creates the correct file handles and calls dart under
`perf stat` based on the arguments given to the script:
```
DART=$1
shift
AOTSNAPSHOT=$1
shift
ctl_dir=/tmp/
ctl_fifo=${ctl_dir}perf_ctl.fifo
test -p ${ctl_fifo} && unlink ${ctl_fifo}
mkfifo ${ctl_fifo}
exec {ctl_fd}<>${ctl_fifo}
ctl_ack_fifo=${ctl_dir}perf_ctl_ack.fifo
test -p ${ctl_ack_fifo} && unlink ${ctl_ack_fifo}
mkfifo ${ctl_ack_fifo}
exec {ctl_fd_ack}<>${ctl_ack_fifo}
perf_ctl_fd=$ctl_fd perf_ctl_fd_ack=$ctl_fd_ack perf stat --delay=-1 --control fd:${ctl_fd},${ctl_fd_ack} -B -e "task-clock:u,context-switches:u,cpu-migrations:u,page-faults:u,cycles:u,instructions:u,branch-misses:u" $DART --perf_ctl_fd=${ctl_fd} --perf_ctl_fd_ack=${ctl_fd_ack} --perf_ctl_usage=1 --deterministic $AOTSNAPSHOT $@
exec {ctl_fd_ack}>&-
unlink ${ctl_ack_fifo}
exec {ctl_fd}>&-
unlink ${ctl_fifo}
```
This will start `perf stat` paused (which would require the run dart
aot-compiled script to start it when it wants to) and where the VM
pauses `perf` while doing GC.
In practise, looking at instruction counts reported by `perf stat`, I've
seen the difference between runs go from 2+ mio (and in some instances
23+ mio) to around 30,000 (!) on runs of the analyzer (tool
"stable_analysis").
TEST=manually
Change-Id: Iab955a5dd35e47f22c4f693ae50effc8ee633897
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468260
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
This reduces main wasm module a bit (<1%) as it avoids the main module
from having to define and export simple accessor (e.g. field accessor)
functions.
There's two scenarios to consider:
Deferred module calls function from main module
=> No issues
Main module calls function from deferred module
=> This call must have been preceded by a CheckLibraryIsLoaded
=> The wasm modules of the deferred import must have been loaded
=> No issues.
We also change the inlining to be a little more conservative on static
field getters, as a static field may need to do a lazy initialized check
and call initializer function.
We also give the initializer function a better name.
Change-Id: I5d9b138c9fcb41f8580602fd1ba9ec5aa4af5341
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467820
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
There was a bug in `CallTarget.signature` which triggers if there's only
one entry that's statically dispatched against, which causes us to
inline the polymorphic dispatcher, which relies on this (previously
incorrect) signature.
The CL also changes the dispatch table building logic to not allocate
table entries for the statically dispatched regions (as they would
never be used).
Change-Id: Ic2d0c387e8863e89ef811e1892642fe81df9189a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468000
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
We don't have a strict rule set for naming test methods, but the general
idea of grouping terms with underscores (and breaking an otherwise
rather universal rule of using camelCase) is to help to group like
test cases (aided by our alphabetical sorting enforcement).
There were examples in this file that really broke the grouping
mechanism by not using consistent grouping. Here are the broad strokes
of what I changed; no test bodies were changed, _only names_, but the
CL is hard to review because of sorting.
* `test_classGetterSetter_...` and `test_classSetter_...` were renamed
to use `class` as a group (`test_class_getterSetter_...` and
`test_setter_...`) consistently.
* `test_factoryConstructor_...` were renamed to use `constructor` as
the group base (`test_constructorFactory...`).
* `test_optionalParameter_...` were renamed to use `parameter` as the
group base (`test_paramter_...`). This is the bulk of the change.
There were previously dozens of tests starting with
`test_optionalParameter_` _and_ dozens of tests starting with
`test_parameter_`. However, `unused_element` only concerns itself
with optional parameters, so that can be the default meaning of
`test_parameter_`. (Similar to classes; we don't report any public
classes as unused, but we don't need to write `private` in every
test case.)
* In the parameter tests, there was an inconsistent placement of the
group `isUsed` or `notUsed`. It seems like the bulk of tests place
the `isUsed` or `notUsed` grouping earlier rather than at the end of
the test name, so I went with that for this consistency CL.
Change-Id: I54be6591615d015ae9cf87ee4c9726ed7cfee209
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468180
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Change the `verify_docs` package's use of `DiagnosticCode.name` to
`DiagnosticCode.lowerCaseName`. There is no functional change since
all diagnostic codes generated by the analyzer are already in lower
case.
This helps pave the way for eventually deprecating and removing
`DiagnosticCode.name`, which will help ensure that analyzer clients
treat diagnostic codes in a case-insensitive fashion.
Change-Id: I6a6a69645300e89b1bed342804d5e89ae9cf556b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468141
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This adds completion support in the class header. Support for completion
in the body will be added in a separate CL.
Please look carefully at the tests to ensure that there aren't holes in
the coverage.
Change-Id: I189f25fbb90f43b4d8993622d5eb025d3160bef1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467920
Reviewed-by: Kallen Tu <kallentu@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Converts the code that reports diagnostic codes
`bodyMightCompleteNormally` and `bodyMightCompleteNormallyNullable` to
use the literate diagnostic reporting API.
This was not a straightforward conversion because the code for
reporting these diagnostics
(`ResolverVisitor.checkForBodyMayCompleteNormally`) made use of the
`DiagnosticReporter.atConstructorDeclaration` method, which doesn't
have a direct analogue in the literate diagnostic API. The equivalent
formulation in the literate diagnostic API is to call
`ConstructorDeclarationExtension.errorRange` to compute the offset and
length for the constructor name, and then pass the result to
`LocatableDiagnostic.at`.
Note that the previous version of
`ResolverVisitor.checkForBodyMayCompleteNormally` used an `if`/`else`
chain to handle three possible types for `errorNode`:
`ConstructorDeclaration`, `Token`, or `BlockFunctionBody`. But the
call sites might pass in any sort of `FunctionBody`. So it appeared
that the diagnostic would be accidentally dropped in the case where
`errorNode` was some other type of `FunctionBody`. However, it turns
out that there was a tricky reason why the diagnostic was never
accidentally dropped: the call site that passes in a `FunctionBody`
also passes the same `FunctionBody` for the `body` parameter, and
`ResolverVisitor.checkForBodyMayCompleteNormally` only checks for
`bodyMightCompleteNormally...` errors if `body` is of type
`BlockFunctionBody`.
In the new code, a `switch` expression is used to compute the range
over which the diagnostic should be reported, so it is manifestly
clear that the diagnostic is never accidentally dropped.
Change-Id: I6a6a69647a8fd1928d935ec8b5cb0c733ad2412f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467540
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Fixes https://github.com/dart-lang/sdk/issues/62214
Danny describes the problem at a high level in https://github.com/dart-lang/sdk/issues/62214.
At a lower level, the issue is that we add the new `PluginIsolate` to
the `_pluginMap` as soon as we instantiate it! Before we've even made
the request to start it up. The `_pluginMap` is how PluginManager sends
out various requests, like watch events, priority files, and update
content.
The fix is easy enough: we wait to add the PluginIsolate to the `_pluginMap` until after we've awaited `PluginIsolate.start`.
Change-Id: I05e6314fde10fbaf4cf25b38b526c5cf96bd65ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467923
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This response header entry prevents DevTools from being embedded in
iframes, which is needed to embed the DevTools inspector within the
Flutter widget preview environment.
TEST=Manually verified with `flutter widget-preview start`
Change-Id: Ic4ec3cf0e23509a6c0cbc94ab636a18c6abf733f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468020
Auto-Submit: Ben Konyi <bkonyi@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
This will allow diagnostic reporting code in the analyzer to be more
easily converted to the new literate diagnostic reporting API, because
it will make it possible to use `SourceRange` as the common
denominator for situations where the location where a diagnostic needs
to be reported might come from either a `SyntacticEntity` or a
`SourceRange`.
Change-Id: I6a6a6964f3ec2ea33e8900d93b5abe714c9e1dcc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467682
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
`builder.current` at the time of creating the labelGraph is the block
after the body. So setting that as the end node of the subGraph was
including all the code after loop into the body of the labeled
statement.
Instead we use the `bodyBlock` as the end of the labelGraph as this is
the last block in the body of the loop. If no such body exists, we use
the `conditionEndBlock` which is the block right before the body (and
still includes the logic to exit the loop).
Also changes codegen to not emit a labelStatement if it has no body.
AFAICT we don't do DCE on flow blocks so codegen is the best time to
avoid emitting this code.
Bug: https://github.com/dart-lang/sdk/issues/62185
Change-Id: Ia80cc7d3b44782c6193a67e8adbbc66f00b8f133
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468060
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Thread::OffsetFromThread from runtime_api.cc assumed that all fields
between leaf and non-leaf runtime entries in Thread have word size,
so the delta between runtime entries can be translated from host to
target by multiplying by the ratio between target and host word size.
Since leaf and non-leaf runtime entries are not co-located in Thread,
this assumption is incorrect. It is now fixed by using separate
bases when calculating offsets of leaf and non-leaf runtime entries.
Also, add FatalError runtime entry which is useful for
bootstrapping of the new compiler.
TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Iea4762b21285aa6423876b34328c863227ee1434
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467900
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Change the `dart2wasm` package's use of `DiagnosticCode.name` to
`DiagnosticCode.lowerCaseName`. There is no functional change since
all diagnostic codes generated by the analyzer are already in lower
case.
This helps pave the way for eventually deprecating and removing
`DiagnosticCode.name`, which will help ensure that analyzer clients
treat diagnostic codes in a case-insensitive fashion.
Change-Id: I6a6a696490fe3ecf945d1c1544ea7eb20c12e995
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/468120
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This reduces essentials main module by 8.3% (-730 KB)
The dispatch table contains displaced selector rows. Each selector row
contains an entry for each class that provides the selector.
This can lead to very large dispatch tables with repeated elements:
Especially common is a base class with selectors that get inherited
by many subclasses where few subclasses override the selector.
This is common e.g. for `Object.{hashCode,operator==,noSuchMethod}` but
also for user defined base classes that have many subclasses.
This led to the element section being very large: It often contains
large consecutive sub-ranges which refer to the same target function.
To shrink the element size we instead move the initialization of those
large regions homogenious regions to the module init function: We can
utilize the `table.fill` instruction which can initialize a large range
of the table with the same value.
Change-Id: I9fc308969264f4855a514e7d36c761891bb0cb52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467843
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Changes the logic for accessing the maps `customizedCorrections` and
`customizedMessages` so that it looks up messages by
`lowerCaseUniqueName` rather than `uniqueName`.
These maps are used by the google3 import of the analyzer, so that
error messages can be customized for internal use without having to
patch analyzer sources. This change is a no-op because all diagnostic
codes currently have lower case names.
This paves the way for deprecating (and eventually removing) the
`DiagnosticCode.uniqueName` getter.
Change-Id: I6a6a69646e7e131976ef3ac708f83b1e82b47ead
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/466128
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Don't call native methods on a socket which is closed
or in process of being closed. On some OSes this will
crash the VM because underlying FD is actually a malloc
allocated handle object which will be destroyed by
the event handler once it receives and processes close
request.
BUG=b/335437875
TEST=standalone/io/abrupt_close_test
Change-Id: I557d725a6cce020a6a1e3df0bd3e2c836a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467841
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Work towards https://github.com/dart-lang/sdk/issues/59514
We introduced a new Warning called NON_NULLABLE_EQUALS_PARAMETER a few releases ago. It warns when the parameter of an `operator ==` override has a nullable type:
> The parameter type of '==' operators should be non-nullable.
I didn't realize it at the time, but that new warning, plus null safety, basically replace the `avoid_null_checks_in_equality_operators` lint rule. This rule reports doing any null-check work on a nullable parameter of an `operator ==` override.
Change-Id: Ibd8139cd5804a9ccb6cc07d2187c9305a336c7cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467922
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
This saves around 730 KB (-7.7%) on essentials main module.
The existing fine grained partitioning of code into wasm modules
operates on static elements. That means as soon as a constructor is
called, all instance methods of a class are included as well.
This CL improves upon this using the insight that some instance methods
are always accessed via direct calls (i.e. all call sites to the
instance member are devirtualized).
For those methods that are never called indirectly, the partitioning
algorithm can avoid enquing those instance methods when the class is
enqueued and instead enqueue them when the devirtualized call site is
hit.
An example where this can happen is e.g. main module allocates a proto
class but doesn't access field X. Currently when hitting the constructor
we'll enqueue all instance members. Now we don't enqueue X (as all uses
of X are direct calls to the X getter). That means if X is only used in
a deferred module, then we can move the X getter to that deferred
module.
Change-Id: Ib45edb6e658a62aaeb15ed7c40745733ec619ff0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467700
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Converts the code that reports the diagnostic codes
`classInstantiationAccessToStaticMember` and
`classInstantiationAccessToInstanceMember` to use the literate
diagnostic reporting API.
Change-Id: I6a6a6964690435bde5e4c39bc6a95c2a3d01104f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467741
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
For all the diagnostic messages used by `shared_type_analyzer.dart`,
replaces the placeholder parameter names `p0`, `p1`, `p2`, etc. with
descriptive parameter names, and updates the call sites that use those
diagnostic messages to use the new literate diagnostic reporting API.
The changes to `dart` code had to be done manually, since the types
substituted into the diagnostic messages needed to be converted from
`SharedTypeView` to `TypeImpl` by calling
`.unwrapTypeView<TypeImpl>()`.
Change-Id: I6a6a6964147dbb304cb21b3fed427ab0d5ed1e6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467740
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Fixes errors of the sort
```
mosum@mosum2:~/projects/i18n/pkgs/intl4x/example$ dart --enable-experiment=record-use build cli example.dart
There are multiple possible targets in the `bin/` directory, and the 'target' argument wasn't specified.mosum@mosum2
```
Change-Id: I7ed6dbd21838506c1fe60b6d69d6066406d3b7c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467842
Auto-Submit: Moritz Sümmermann <mosum@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>