benchmark_harness's `measureFor` returns in microseconds, but we
currently show the numbers with the unit "ns".
Convert the microseconds reported by benchmark_harness to nanoseconds
when reporting.
We could also report in microseconds, but the numbers would be very
small, with a few zeros before fractional digits. So keep reporting in
nanoseconds.
Change-Id: I189190b2139c8e2d39b8bef84159585ab0967980
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436904
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This CL organizes the commands in the Dart CLI to categories. It
mirrors the categories used in `flutter --help`: `SDK`, `Project`, and
`Tools`. The available command section will now look as follows in
verbose mode:
```
Available commands:
Project
build Build a Dart application including native assets.
compile Compile Dart to various formats.
create Create a new Dart project.
pub Work with packages.
run Run a Dart program.
test Run tests for a project.
Source code
analyze Analyze Dart code in a directory.
doc Generate API documentation for Dart projects.
fix Apply automated fixes to Dart source code.
format Idiomatically format Dart source code.
Tools
compilation-server Control resident frontend compilers.
development-service Start Dart's development service.
devtools Open DevTools (optionally connecting to an existing application).
info Show diagnostic information about the installed tooling.
language-server Start Dart's analysis server.
tooling-daemon Start Dart's tooling daemon.
```
Bug: https://github.com/dart-lang/sdk/issues/60980
Change-Id: Ic9da297fcdd0f8e85d619632ba8ec30fd2c32666
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-arm64-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436382
Reviewed-by: Michael Thomsen <mit@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Various changes to the stanalone/io/socket_local_port_test:
* Make server ports ephemeral: The test is testing client-side
binding of address & port, the server part can use ephemeral ports.
=> This eliminates the issue of another process using the
hard-coded port
* Close sockets normally instead of using `Socket.destroy()`
* Make dead code alive: There were test in the tests that were
not invoked by `main()`.
* Align the individual test helper functions.
* ...
Then we change the dart:io implementation of `Socket::CreateBindConnect`
to set the `SO_REUSEADDR` socket option. We do this already for the
server side in `Socket::CreateBindListen`, now we do it also for the
client side.
=> This will ensure that one can bind the client side socket to
specific address/source despite there being an old closed
socket that's now in `TIME_WAIT` state.
=> This is the same reason we also do it in `Socket::CreateBindListen`.
Fuchsia doesn't implement `Socket::CreateBindConnect` and on Windows
the socket option seemingly has different semantics (we also don't use
`SO_REUSEADDR` on windows for the server socket, but another option).
Issue https://github.com/dart-lang/sdk/issues/51477
TEST=standalone/io/socket_local_port_test
Change-Id: I7d07becad0cd98c3a9b973ef2f9037730d3f8b19
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436902
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
The test was writing a dart script and then invoking a
subprocess to run that script.
=> The write of the script was asynchronous but not awaited
=> The subprocess can start running before the script is written
We also cleanup the test, it seemingly has some copy&pasted code
from another test that isn't relevant (it doesn't write
anything to the subprocess's `stdin` channel, ...)
Closes https://github.com/dart-lang/sdk/issues/60904
Change-Id: Iaa1094056cf444a976b2edc373227e54868fae94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436900
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
Update the last known good component after a recompile reject back to
the expected state before the recompile.
Adds tests for expression compilation after recompile accept and
recompile reject cases with `--target=dartdevc`. Similar to existing
tests for the VM.
Removes calls to `_generator.accept()` and
`component.computeCanonicalNames()` from `compileExpressionToJs()`.
These were added very early in the prototype implementation and it is no
longer clear why they would be needed.
Added some additional test cases for expression compilation involving
import resolution because the change that originally added the
`component.computeCanonicalNames()` call implies it was needed for that
reason. See: https://dart-review.googlesource.com/c/sdk/+/138010
TEST=pkg/frontend_server/test/frontend_server_test.dart,pkg/dev_compiler/test/expression_compiler/expression_compiler_test.dart
Change-Id: I9c04bd46e56b33dc654d00fb330de29c3c643a5b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/434522
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Use ConstructorElementMixin2 as its type.
All resolution is always base on element, so here we stop using fragments, and stop storing this information in fragments.
Change-Id: Ide073eb3f5efd3fa1afaac855beb092c114e304f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436162
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This changes the implementation of addSyntheticImport from mimicking
syntactical imports to directly providing the data needed. This avoids
the reliance on CanonicalName and Uri.toString and instead directly
uses the importUri already available.
Change-Id: I62447ab3c7c9f54597101704be3bdad0a4d2557c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436622
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
We should not blindly use `--all-features` as that will tell
binaryen that it may use any features in the resulting wasm file
(even features not even finalized yet).
The default dart2wasm (without extra opt-in by the user into more
wasm features) should only enable wasm features that we require
and are available in browsers at the point when they shipped
WasmGC.
Change-Id: Ifdcc31d938e29048b50be3fd5692693dc80ecbd3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436604
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
This document was created during the early stages of the NNBD
development. The goal was to aid the migration to the new model. The
document has served its purpose and is not maintained for some time
now, so it can be deleted.
Change-Id: I398331cc41a0070e28cf3d1f94da958dd2d3ecfa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436602
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
When dynamic modules are enabled, standalone VM can now run bytecode
binaries directly. Also, if --interpreter flag is specified, Dart
source is compiled to bytecode and interpreter is used to run it.
This will allow us to test VM service capabilities including
debugging and hot reload against the interpreter.
TEST=manual
Change-Id: Ibb5a67f4844485c4ed90b8a7568dc42fa552fcac
Cq-Include-Trybots: luci.dart.try:vm-aot-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try,vm-dyn-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436421
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
In dart2wasm applications are by default deployed in `-O2` mode which
implies `--minify`.
Given this is the default configuration for customers, we want good
testing of this configuration and not large numbers of approved failures.
=> Rewrite various tests to not depend on `<obj>.runtimeType.toString()`
Change-Id: I1108b28c63b8bec6ad94df0d7b878b3339776df9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436281
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
The "add late" assist was broadened in
https://dart-review.googlesource.com/c/sdk/+/176900 with a link to
https://github.com/dart-lang/sdk/issues/44440 where the example is
adding `late` to a field in the same class the user is currently editing
the constructor for.
That makes sense.
The code could also add the `late` keyword to other files which is - I
think - bad for at least two reasons:
1) It's confusing being given the option to "add late" to something,
then when trying it nothing seemingly happen, except something does
happen: another - possibly not open - file has changed.
2) It requests the resolved unit for another - possibly not open -
file, which is slow. This means that, at least in VSCode, just
moving the cursor over something can send requests that takes a
long time. In practise I've experienced up to ~1.5 seconds, and in
benchmarks I can make this arbitrarily large by increasing the
size of the file. Shown below, having 16,000 small classes takes
around 4 seconds (vs less than 10 ms with this CL).
This CL restricts this to the same file, adds a few tests and updates
a few existing tests.
Note that the existing tests that verified the behavior of adding `late`
to other files was added in
https://dart-review.googlesource.com/c/sdk/+/180087 with a link to
https://github.com/dart-lang/sdk/issues/44534
where the issue discusses a bug where it is applied in the wrong file
and says that it should either be applied to the right file or be
disallowed. The option of allowing it was picked in that instance,
but now at least there's data to show that it comes at a cost.
For an ad-hoc test where I programmatically asks for assists at every
position in `pkg/front_end/lib/src/kernel/body_builder.dart` I go from
1875 positions that takes >= 100 ms to answer to 0 such positions.
For the added benchmark I get this data:
Before this CL:
```
size 1000:
Initial analysis: 0.188291
Action call on 4:11 : 0.308514
Action call on 4:12 : 0.319540
Action call on 4:13 : 0.274678
peak virtual memory size: 2363 MB
total program size (virtual): 2292 MB
peak resident set size ("high water mark"): 258 MB
size of memory portions (rss): 244 MB
size 2000:
Initial analysis: 0.387643
Action call on 4:11 : 0.649877
Action call on 4:12 : 0.550778
Action call on 4:13 : 0.474030
peak virtual memory size: 2325 MB
total program size (virtual): 2325 MB
peak resident set size ("high water mark"): 279 MB
size of memory portions (rss): 277 MB
size 4000:
Initial analysis: 0.753913
Action call on 4:11 : 1.086648
Action call on 4:12 : 1.015921
Action call on 4:13 : 0.915511
peak virtual memory size: 2335 MB
total program size (virtual): 2304 MB
peak resident set size ("high water mark"): 363 MB
size of memory portions (rss): 334 MB
size 8000:
Initial analysis: 1.235531
Action call on 4:11 : 1.880335
Action call on 4:12 : 1.824658
Action call on 4:13 : 1.771081
peak virtual memory size: 2414 MB
total program size (virtual): 2386 MB
peak resident set size ("high water mark"): 436 MB
size of memory portions (rss): 411 MB
size 16000:
Initial analysis: 2.618666
Action call on 4:11 : 3.991542
Action call on 4:12 : 3.775863
Action call on 4:13 : 4.094692
peak virtual memory size: 2576 MB
total program size (virtual): 2516 MB
peak resident set size ("high water mark"): 667 MB
size of memory portions (rss): 611 MB
```
With this CL:
```
size 1000:
Initial analysis: 0.202665
Action call on 4:11 : 0.005730
Action call on 4:12 : 0.003086
Action call on 4:13 : 0.002743
peak virtual memory size: 2174 MB
total program size (virtual): 2170 MB
peak resident set size ("high water mark"): 256 MB
size of memory portions (rss): 247 MB
size 2000:
Initial analysis: 0.433420
Action call on 4:11 : 0.005353
Action call on 4:12 : 0.002116
Action call on 4:13 : 0.002156
peak virtual memory size: 2226 MB
total program size (virtual): 2226 MB
peak resident set size ("high water mark"): 290 MB
size of memory portions (rss): 240 MB
size 4000:
Initial analysis: 0.674376
Action call on 4:11 : 0.004219
Action call on 4:12 : 0.002138
Action call on 4:13 : 0.001625
peak virtual memory size: 2392 MB
total program size (virtual): 2328 MB
peak resident set size ("high water mark"): 306 MB
size of memory portions (rss): 286 MB
size 8000:
Initial analysis: 1.244688
Action call on 4:11 : 0.005225
Action call on 4:12 : 0.002104
Action call on 4:13 : 0.002729
peak virtual memory size: 2349 MB
total program size (virtual): 2338 MB
peak resident set size ("high water mark"): 385 MB
size of memory portions (rss): 366 MB
size 16000:
Initial analysis: 2.776680
Action call on 4:11 : 0.008848
Action call on 4:12 : 0.002854
Action call on 4:13 : 0.002327
peak virtual memory size: 2423 MB
total program size (virtual): 2405 MB
peak resident set size ("high water mark"): 505 MB
size of memory portions (rss): 489 MB
```
It's interesting how the action calls for sizes >= 4000 was slower than
the initial analysis, but I haven't looked into it.
Change-Id: Icefe02073cdf1ad442a37de2030fd7e53f5013b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436280
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
This removes the use of Fragment from _Declaration. Constructors and
properties are fully handled through their *Declaration objects. The
remaining declarations uses _StandardDeclaration which still uses
Fragment.
This is a step towards normalize builder creating between user
declarations and synthetic declarations.
Change-Id: Icb95ea42213248702f25a99e8c6f6b562d839bfa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435821
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Existing Monitor is not reentrable, doesn't support acquiring it if it is already acquired by this thread.
TEST=ReentrantMonitorAllowsReentrance
Change-Id: Id74479388a99ca907bca6e379c3a7e08191e841b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436542
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Turns out that dart compile exe --depfile produces
depfile which does not work with ninja because
it uses absolute path to the output file
instead of using relative path.
So we can't use it directly and need to fix
depfile.
TEST=manually
Change-Id: I1aadfd5079cc38d392933f9afe333f63407bb295
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435680
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
It is getter / setter elements that know that they form a
PropertyInducingElement, and the other way around,
PropertyInducingElement that has getter and setter. Fragments OTOH, just
dangle from the elements.
Change-Id: Ide8ece5cb318c75093b0173c661b01f564d1a55a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435746
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
While exploring this code, I saw some easy wins:
* A number of local variables of the form `String? x = a.b.c;` can be
made non-nullable as `.c` now returns `String`; no tooling will warn
the developer of this.
* A number of methods of the form `String? m() {...}` can be made non-
nullable, as they only return non-null values; no tooling will warn
the developer of this.
* A number of methods of the form `m(String? p) {...}` can instead
accept non-nullable Strings, as all of the call sites pass non-null
Strings.
* `_coerceRefType` accepted a `String?` parameter but immediately null-
checked it's value. We can use the type system to enforce that this
function requires non-null values.
* StreamCategory's `_name` and `_events` fields can be made non-nullable
by using a little factory constructor; this enhancement reveals that
the fields can be made final (analyzer reports this). Then we have
unnecessary public getters that expose these final fields; the fields
can instead be made public, and the getters removed.
* `Api.types` can be made a `List<Type>`.
* Some fields can be made final: `MemberType.types`, `TypeRef.name`,
`TypeRef.nullable`, `MethodArg.type`, and `MethodArg.name`.
* Some fields can be made non-nullable: `TypeRef.name`,
`MethodArg.name`, and `EnumValue.name`.
Change-Id: Ia36c1edc4686c6a14d76fd053d70da60b7b4aac6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436420
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
In case of compile-time errors kernel service has been serializing kernel AST anyway and has been passing kernel bytes to the VM.
VM does not use those kernel bytes except a few unit tests.
This change removes the unnecessary kernel serialization and freeing
of kernel bytes and cleans up unit tests.
TEST=ci
Change-Id: Ic2464e50f56227bc998df53dd2b594c1abcf9468
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/436360
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>