Commit Graph

18413 Commits

Author SHA1 Message Date
Ryan Macnak acbd51c08d [vm] Serialize strings compactly, instead of as heap images.
Avoids the space overhead for the class, hash and alignment padding.

Flutter Gallery ARM64 release
Total(CodeSize): 8537094 -> 8088430 (-5.25%)

Change-Id: I73bc984f157042824c29efc42d45547914bd3c1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160183
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2020-09-15 18:36:41 +00:00
Alexander Aprelev 083ecee7f6 [vm/fieldtable] Fix retaining paths for static fields.
This is a follow-up to https://dart.googlesource.com/sdk/+/e2aadc7a075da3b52957c93dc39d3b7fc86a5d1b which regressed retaining path reporting for static field values.

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

Change-Id: Iee9f289652e41fafd075a9e93b225099aac8e01c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162900
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-09-15 18:32:31 +00:00
Chris Bracken f8cbabeeae Add forward-declaration of Intrinsifier
This fixes the following compile warning on Windows:

    ../../third_party/dart/runtime\vm/compiler/asm_intrinsifier.h(37,16):
    warning: unqualified friend declaration referring to type outside of
    the nearest enclosing namespace is a Microsoft extension; add a
    nested name specifier [-Wmicrosoft-unqualified-friend]

    friend class Intrinsifier;
    ^
    ::dart::

Change-Id: I2b1f8b961a32e47c7ec6244616f68989356f55e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162901
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2020-09-15 17:33:41 +00:00
Andrei Constantinescu e72adbc6ca [util] Allow USE() template to be used with Dart heap objects
Currently, Dart heap objects are non-copyable. For this reason, code such as

> const Function& f = ...
> USE(f);

would not compile. Doing this can be useful when doing initial testing runs of one's code. Of course, the problem generalises to other kinds of objects.

This CL fixes the issue by changing the template function to use a universal reference.
The other beneficial aspect of this change is that when a copyable class is passed to USE, it will no longer be copied.

Tested: all trybots, see results.

Change-Id: Ic1497067e2228b1b59806ddad8df9e85d87f4c27
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162502
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Andrei Constantinescu <andreicostin@google.com>
2020-09-15 09:50:02 +00:00
Dan Field b62fc7c43a Allow for named lookup when the caller knows the private key of the class but not the function
Change-Id: I5374b25140ada7af157f0f5fbcfb26141d5072d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162460
Commit-Queue: Dan Field <dnfield@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-09-15 00:38:08 +00:00
Nicholas Shahan cdd1260ef0 [tests] Move regression test to run on all backends
This same error recently surfaced on a flutter web target.

Change-Id: If4c093cde85887105e93ab46469b1c3b2ea55d03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162243
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-09-14 21:13:37 +00:00
Regis Crelier 27235bf480 [VM/runtime] Fix finalization of recursive types.
Super type's type arguments that are still unfinalized after instantiation during finalization are not necessarily `TypeRef`, but can be (recursive) `Type`.
Add regression test.

This fixes flutter issue https://github.com/flutter/flutter/issues/65278

Change-Id: I07f842d798d24ebff9d1462d7e47278e901c0128
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162583
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2020-09-14 18:52:43 +00:00
Tess Strickland 781094f2ce [vm/bytecode] Add parameter flags to FunctionDeclaration.
We create the parameter names array when loading the
FunctionDeclaration, but the required parameter flags are only set later
when we load the Code declaration. If there's an intermediate use of the
Function object that copies the required parameter flags, like creating
an ImplicitClosureFunction when loading a tearoff stored in the object
pool, there will be no set flags at that point.

Add a copy of the parameter flags to the FunctionDeclaration so the
required flags can be set at the same time as the parameter name and
type to avoid this scenario.

To avoid adding unneeded flags to the kernel bytecode, we only serialize
the parameter flags needed for each declaration, so FunctionDeclaration
and ClosureDeclaration only contain the required flag, and Code contains
all flags _but_ the required flag.

There are no trybots for strong mode + bytecode, but manually checked
by running the following on the main branch (cherry-picking the
test_matrix.json changes) and this branch:

python tools/test.py \
    -n dartkb-mixed-strong-linux-release-x64,dartkb-interpret-strong-linux-release-x64 \
    tests/language/nnbd/required_named_parameters/missing_required_argument_dynamic_test.dart

Cq-Include-Trybots: luci.dart.try:vm-dartkb-linux-release-simarm64-try,vm-dartkb-linux-release-x64-try
Change-Id: Ic75b831d5ceed08154e2c61b8f64461705558653
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162501
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2020-09-14 15:28:20 +00:00
Tess Strickland 02f5faa288 [vm/compiler] Prepare InstantiateTypeArguments for dynamic type args.
Current users of InstantiateTypeArguments have the uninstantiated type
arguments available at compile time. After upcoming work on #40813,
there are cases where the generated code needs to instantiate type
arguments that are only available at runtime.

This work changes the uninstantiated type arguments for the
InstantiateTypeArguments instruction to a runtime Value pointer instead
of a compile time TypeArguments reference. The changes beyond that are
limited to only what is needed to get current uses working, with ASSERTs
checking that current invariants still hold. The rest of the changes
needed for dynamic uninstantiated type arguments will come later.

Bug: https://github.com/dart-lang/sdk/issues/40813
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try
Change-Id: Iafe836cfd8744d3e835e60112a4f099e631f4782
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162183
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2020-09-14 15:28:19 +00:00
张梦 371476bf84 Fix dartvm re-init Flag check crash
Fix dartvm re-init Flag check crash,if dartvm first init set FLAG_causal_async_stacks and FLAG_lazy_async_stacks both true, when we re-init dart vm we will get a crash,it's better to read flag before flag check.

I got this crash when we modified flutter engine [common/settings.h](https://github.com/flutter/engine/blob/master/common/settings.h), because we want to destory dartvm to release memory,but when we recreate the Flutter engine ,we got crash below
```dart
 [VERBOSE-3:dart_vm.cc(421)] Error while initializing the Dart VM: To use --lazy-async-stacks, please disable --causal-async-stacks!
```
So I changed the code order, First to initialize flag from snopshot,then we check the Flag  is legal or not

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

GitOrigin-RevId: d8b05f613751a3516c864a526d5976f570d589d5
Change-Id: I4cb73df93000333963bd68da3d5dae96e382a2e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161720
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-09-11 16:29:52 +00:00
Vyacheslav Egorov 62354c1540 [vm/arm64] Refactor leaf runtime call sequence.
Leaf runtime calls a silently clobbering R23 and R25 registers, which
causes bugs when these calls happen from write barriers (which are not
expected to clobber anything outside of R25).

We introduce a special helper class to handle saving and restoring
necessary registers.

The bug originally reported by Joe Lin <zuojian.lzj@alibaba-inc.com>
who proposed a fix[1]. This CL builds on top of that fix and tries to
make it more safe by forcing users to use a more strict API.

[1] https://dart-review.googlesource.com/c/sdk/+/162300

TEST=vm/dart/write_barrier_register_clobber_test

Change-Id: I93e0a13a3c4c38ad28210b35750a66e615e3e44a
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162191
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2020-09-11 07:37:51 +00:00
Alexander Aprelev a9ed5d1d1e [dart/sendandexit] Fix validation of the sendAndExit messages and the test.
The validation was not actually traversing the message and the test was not actually testing sendAndExit, rather standard message passing.

Brought error messages reported by sendAndExit in line with regular message passing error messages.

Bug: https://github.com/dart-lang/sdk/issues/43382

Change-Id: Iceb26ab9027a39e9eb3847b42a64ce991521578e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162249
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-09-10 18:33:37 +00:00
Ben Konyi 19875e9ab4 [ VM / Service ] Fix issue where dart:* sources were not available via
the service

As part of the dartdev refactoring, 'dfe.Init()' was only called when
an explicit script URI was found during option parsing. However, with
--observe provided, 'script_uri' is always null as dartdev is
responsible for determining which script to run. This change ensures
that vm_platform_strong.dill is always loaded by the DFE.

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

Change-Id: I118b83390efba48e3e8d5b793444d189ba3c5ae2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162060
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-09-10 17:53:19 +00:00
Martin Kustermann 3ab9008fbd [vm] Ensure class is type finalized before looking members in it up
Fixes https://github.com/dart-lang/sdk/issues/43369

Change-Id: I6f181e0a544faf723db86c07649843e895e6ad58
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162189
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-09-10 10:04:05 +00:00
Tess Strickland 3d77741666 [vm/compiler] Unify name checking in dynamic closure call dispatchers.
Instead of possibly looping over the closure function parameter names
array multiple times, just do it once. Check each entry against the
provided argument names. If none match, check the required bit (if in
null-safe mode). Also keep a count of matched names to check that all
provided names matched after the iteration.

Now that optional name checking is part of the fragment built by
BuildClosureCallArgumentsValidCheck, that method builds checks for
exactly the same things as its namesake in Function.

Also refactor the variables used by the checker into read/write ones
that need to be allocated in the parsed function and read-only ones
that can just be temporaries since no Phi nodes are needed.

Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try
Bug: https://github.com/dart-lang/sdk/issues/40813
Change-Id: I3cb421dd538629d7f5499f3bbf0653d34b850dce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160725
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2020-09-10 07:12:14 +00:00
Ben Konyi e3fcee331d [ VM / Service ] Roll back major revision, update to 3.39
The major revision bump is causing Intellij users to be unable to debug
as the Dart and Flutter plugins both bail out if the VM service major
revision is not 3. This change will allow for these plugins to keep
working.

This is technically breaking the semver contract as the following RPCs
and objects have been removed:

- getClientName
- getWebSocketTarget
- setClientName
- requireResumeApproval
- ClientName
- WebSocketTarget

However, these RPCs were never used by first party tooling and it's
highly unlikely that they were used externally, so removing these RPCs
is unlikely to break anyone.

Change-Id: Ie8e2705545682e96c3dab4c0787a1e88cd8a19d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162240
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-09-09 17:46:09 +00:00
Martin Kustermann f6906f856e [vm/compiler] Add type testing stubs to allow TypeParameter types to be called indirectly
Right now AssertAssignable will not call the TTS of a TypeParameter but
instead load the value for the type parameter inline and then call it's
TTS.

To prepare for future changes where we want to call TTS of an arbitrary
type object, we need to be able to install a functioning TTS on
TypeParameter, which this CL does.

Issue https://github.com/dart-lang/sdk/issues/40813

Change-Id: I0792cc1a796fe8afb2167b7665580b3f1385005b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162007
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2020-09-09 17:33:09 +00:00
Martin Kustermann 1c7731db60 [vm/compiler] Always use type testing stubs for AssertAssignable
As a preparation for being able to dynamically call TTS on any type object we ensure that
also in the non-dynamic AssertAssignables we always use TTS.

Issue https://github.com/dart-lang/sdk/issues/40813

Change-Id: Ia7a2aa98eff940e4ead28f6158f13c084ecb3818
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162008
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2020-09-09 16:57:19 +00:00
Clement Skau c273f9ae15 [API] Changes Dart_GCEvent to mirror Service Protocol closer.
Turns out, even thought Heap constructs an elaborate event
object, and attaches it to the ServiceEvent, the service
does its own event construction (again).
As a result the ServiceEvent has quite a different layout
and no concept of before/after.

This CL changes Dart_GCEvent to more closely follow the
JSON event emitted by Service.

Bug: https://github.com/dart-lang/sdk/issues/43106
Change-Id: I34f33f23065ea7a92142ee7df23ab05ca91f161e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161176
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-09-09 07:25:44 +00:00
Zichang Guo f8fbefd951 Revert "Enable long path on Windows"
This reverts commit 08662f0575.

Reason for revert: failure on pkg-win-release, https://dart-ci.appspot.com/log/pkg-win-release/unittest-asserts-release-win/12878/pkg/dartdev/test/commands/test_test

Original change's description:
> Enable long path on Windows
> 
> File APIs on Windows can now handle files and directories identified by
> long paths (greater than 260 characters). For directory, the limit is
> 248.
> 
> Some restrictions from Windows:
> 1. The size limit for long path is 32,767 characters.
> 2. Each component separated by backslashes should not be more than 255
> characters.
> 
> Reference: https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation.
> 
> Note that `Directory.current` does not work with long path.
> 
> Bug: https://github.com/dart-lang/sdk/issues/42416
> Change-Id: Ia1b4608d393fb36f1d843858c6f076f3c825dc83
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152736
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Commit-Queue: Zichang Guo <zichangguo@google.com>

TBR=aam@google.com,zra@google.com,zichangguo@google.com

Change-Id: If6701c887e616cd62f20faac43f601cfb53ed349
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/42416
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162104
Reviewed-by: Zichang Guo <zichangguo@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2020-09-08 22:34:50 +00:00
Zichang Guo 08662f0575 Enable long path on Windows
File APIs on Windows can now handle files and directories identified by
long paths (greater than 260 characters). For directory, the limit is
248.

Some restrictions from Windows:
1. The size limit for long path is 32,767 characters.
2. Each component separated by backslashes should not be more than 255
characters.

Reference: https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation.

Note that `Directory.current` does not work with long path.

Bug: https://github.com/dart-lang/sdk/issues/42416
Change-Id: Ia1b4608d393fb36f1d843858c6f076f3c825dc83
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152736
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2020-09-08 20:12:05 +00:00
Michal Terepeta 4237fda6a5 Check for IN_MODIFY in file_system_watcher_linux.cc
This allows to detect changes to a file due to `write` or `truncate`
syscalls.

Change-Id: I095d842367a56121cd87c2176dde0a4feb5e3d7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161177
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
Auto-Submit: Michal Terepeta <michalt@google.com>
2020-09-08 17:57:45 +00:00
Alexander Aprelev 3e0243fb16 [vm/locks] Allow SafepointRwLocks reentrance, nesting read lock in write lock.
Change-Id: I9ab7b0b16c814116d15892c23f594d520f8a0e71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161823
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-09-08 16:26:43 +00:00
Tess Strickland 6349882b7a [vm/compiler] Add missing truncate calls for parameter names.
Also replace any null flag entries left in the parameter names array to
zero Smi values, so that after truncation, no null checks are needed for
retrieved flag entries.

Now that all appropriate places truncate the parameter names array after
setting any required bits, dynamic closure call dispatchers can simply
check for any post-name flag entries to detect missing required named
parameters if no named arguments were passed.

Without the added truncate calls, then
vm/dart/minimal_kernel_bytecode_test fails when dynamic closure call
dispatchers use that shortcut as seen on patchset 1 of CL 160725.

Bug: https://github.com/dart-lang/sdk/issues/40813
Change-Id: I25abd23ad3ce42b03ec5ca29b4e067c162826066
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160860
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-09-08 13:16:24 +00:00
Vyacheslav Egorov 4d182203ca [vm] Include static call references into V8 profile
Code objects might be connected by static calls and these references
were not included into the profile. This lead to some objects being
unreachable from the root.

This CL also adds a test which computes dominators for all nodes
in the snapshot (this in turn verifies that there are no
unreachable nodes).

Cq-Include-Trybots: luci.dart.try:pkg-linux-release-try,pkg-win-release-try,pkg-mac-release-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try
Change-Id: I2af4107fdb7f875624192e892ce1cec78cbf0dd0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161709
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-09-08 12:11:34 +00:00
Tess Strickland ee8690563d [vm/compiler] Fix early return value from SerializeGraph.
The bodies provided to COMPILER_PASS macro uses are put into
a DoBody method of a generated class that has the following signature:

virtual bool DoBody(CompilerPassState* state);

CompilerState::Run uses this return value to decide whether to repeat a
given pass.

Previously, if no precompiler was provided in the compiler state, the
SerializeGraph compiler pass returned the compiler state. Since the
compiler state itself was not nullptr, it would implicitly convert to
true, meaning that CompilerState::Run would always run SerializeGraph
twice in this case. Since SerializeGraph was marked as an AOT pass,
though, this case never happened as the precompiler is always provided
for AOT passes.

In the meantime, others have used it as a basis for new compiler passes
with early returns that _could_ happen and then were confused by seeing
the pass happen twice in those cases. Fix the return value so it avoids
such confusion in the future.

Change-Id: I3a91e84abe2fbcc8437c64ce1b5b91f3d4808c65
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161784
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2020-09-07 11:44:13 +00:00
Tess Strickland e969fd995a [vm/compiler] Optimize prologue IL for invocation dispatchers.
Arguments descriptors for invocation dispatchers are loaded as
constants.  However, we only optimize type argument length field loads
from constant argument descriptors, so the prologue code is less
efficient than it could be in these cases.

Add the appropriate cases for pulling out the count, positional count,
and size as constants from constant argument descriptors in
LoadFieldInstr::TryEvaluateLoad, which is enough to let the optimizing
compiler tune this code appropriately.

Also remove the code for handling dynamic closure call dispatchers
specially within the prologue builder and instead explicitly generate
any checks that use the runtime closure value in the dynamic closure
call fragment builders after the prologue.

Bug: https://github.com/dart-lang/sdk/issues/40813
Change-Id: Ie9bd4c01c3b604f282e9b2a72327b7fc81dc4eaf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159905
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-09-07 11:35:47 +00:00
Ben Konyi e498ca00dc [VM] Temporarily disable DDS for 2.10 branch
Change-Id: I32916b8e816e109d4e659e9b05326cd0fffb85d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161764
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2020-09-04 02:25:35 +00:00
Ben Konyi 9de8be2792 [ VM ] Fix failing assert when requesting system isolates immediately
after startup

It's possible for VM service clients to request information about
isolates before they've been marked as runnable. Updated the assert to
allow for the kNone service event to handle this case.

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

Change-Id: If03d9f6659714408381d5d2e9f9b1d75a83e82a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161761
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-09-03 21:40:35 +00:00
Ben Konyi f0d88cc96d Reland "[ Service / DDS ] Advertise DDS as the VM service, bump version to 4.0"
This reverts commit ed120c3c80.

Change-Id: I445f4bb2dafaad3ce2daa3ae42efe1723f9b1abe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160660
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-09-03 15:20:14 +00:00
Vyacheslav Egorov 80504c8ffe [vm_snapshot_analysis] Fix issues with artificial nodes
This CL addresses two problems, which only reveal themselves when
analysing snapshots produced when function dropping is enabled.
When tests for snapshot analysis were written functions were dropped
in PRODUCT build by default - by currently this functionality needs
to be enabled separately or is automatically enabled when DWARF stack
traces are enabled. This CL changes test suite to enable DWARF stack
traces.

* When constructing ProgramInfo from V8 snapshot profile we should
not assume that Function nodes have any fields outside of owner_,
because Function node might be artificial and thus have no real
fields except for owner link.
* When writing V8 snapshot profile we should take care not to call
CreateArtificalNodeIfNeeded inside TraceStartWritingObject scope,
because CreateArtificalNodeIfNeeded might itself call
TraceStartWritingObject and these calls don't nest, the second one
overwrites the first one.

R=sstrickl@google.com

Bug: b/167601345
Change-Id: I40879ee087c38992388776af58b81bbefd147631
Cq-Include-Trybots: luci.dart.try:pkg-linux-release-try,pkg-win-release-try,pkg-mac-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161703
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2020-09-03 13:31:14 +00:00
Vyacheslav Egorov 566fd8af36 [vm] Tweak version.cc generation
Actuallly generate null SDK hash in version.cc when verify_sdk_hash
is set to false. Previously it also required setting dart_version_git_info
to false.

R=cskau@google.com

Change-Id: Ib81757c898507029c499c7c3fa17a86b3375d25b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161701
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2020-09-03 10:00:24 +00:00
Zichang Guo 0c5f2a3532 [vm/file] Ensure that appropriate type is reported for links to files vs directories
Bug: https://github.com/dart-lang/sdk/issues/30410
Change-Id: I96c9ca8a5aff4a4337022047ea0b844335efdfcf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161260
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2020-09-03 01:17:52 +00:00
Alexander Aprelev 8793e5aa01 Reland "[vm/io] Fix FileSystemWatcher enum name typo."
This reverts commit 34f636ce1d with the fix for the typo in patchset 2.

Change-Id: I419528f866f6edb707ca586f21a2a8c7f09323d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161620
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-09-02 20:41:32 +00:00
Alexander Markov 34f636ce1d Revert "[vm/io] Fix FileSystemWatcher enum name typo."
This reverts commit 0a036db596.

Reason for revert: build fails on android.

Original change's description:
> [vm/io] Fix FileSystemWatcher enum name typo.
> 
> Change-Id: Ie9f2e10847caf794ddc79229ce7bd35a3909896d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161600
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Alexander Aprelev <aam@google.com>

TBR=aam@google.com,rmacnak@google.com

Change-Id: Ibffe96077dacd6f7f9c8b383703d77b416a0cf20
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161605
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-09-02 19:05:35 +00:00
Liam Appelbe 7a02118a41 [vm/fuchsia]: Safely shutdown the async message loop.
Shut down the message loop before destroying it, and also clear the
default dispatcher.

Bug: https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=59293
Change-Id: I77ba07f4139309e70f812cd4f921e6af4bdc4957
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161462
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2020-09-02 18:36:02 +00:00
Alexander Aprelev 0a036db596 [vm/io] Fix FileSystemWatcher enum name typo.
Change-Id: Ie9f2e10847caf794ddc79229ce7bd35a3909896d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161600
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-09-02 17:21:47 +00:00
Tess Strickland 33e4a6bc2a Revert "[vm] Have Read/WriteStream use (S)LEB128 for variable-length encoding."
This reverts commit cfc8e6de3f.

Reason for revert: b/167520550

Original change's description:
> [vm] Have Read/WriteStream use (S)LEB128 for variable-length encoding.
>
> Previously, the non-fixed read and write methods of ReadStream and
> WriteStream used a similar but slightly different encoding to LEB128 for
> unsigned values and SLEB128 for signed values. The only difference was
> the high continuation marker bit, which was unset in non-final parts and
> set in final parts in the previous encoding, but is set for non-final
> parts and unset in final parts in (S)LEB128.
>
> This CL changes it so that they instead use the standard LEB128 and
> SLEB128 encodings. Among other things, this means that one-byte
> encodings of values in snapshots will be the value itself, not the value
> with the high bit set. This also means that when outputting specific
> formats that use (S)LEB128, like DWARF, the format writers can just use
> WriteStream::Write(Unsigned) directly instead of needing to write a
> separate encoder.
>
> Cq-Include-Trybots: luci.dart.try:vm-kernel-ubsan-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try
> Change-Id: I409a22e7da9e4672011dfaccd3790c122ec3e522
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150526
> Commit-Queue: Tess Strickland <sstrickl@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

TBR=kustermann@google.com,rmacnak@google.com,sstrickl@google.com

Change-Id: Ie5b9e595e4dbe9bbed5f0dd5bdc6f78bd1233f5d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161540
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
2020-09-02 14:17:53 +00:00
Tess Strickland cfc8e6de3f [vm] Have Read/WriteStream use (S)LEB128 for variable-length encoding.
Previously, the non-fixed read and write methods of ReadStream and
WriteStream used a similar but slightly different encoding to LEB128 for
unsigned values and SLEB128 for signed values. The only difference was
the high continuation marker bit, which was unset in non-final parts and
set in final parts in the previous encoding, but is set for non-final
parts and unset in final parts in (S)LEB128.

This CL changes it so that they instead use the standard LEB128 and
SLEB128 encodings. Among other things, this means that one-byte
encodings of values in snapshots will be the value itself, not the value
with the high bit set. This also means that when outputting specific
formats that use (S)LEB128, like DWARF, the format writers can just use
WriteStream::Write(Unsigned) directly instead of needing to write a
separate encoder.

Cq-Include-Trybots: luci.dart.try:vm-kernel-ubsan-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-simarm_x64-try
Change-Id: I409a22e7da9e4672011dfaccd3790c122ec3e522
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150526
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-09-02 01:16:21 +00:00
Zichang Guo d27556656f Fix Directory.list from aborting on Linux
Directory.list will throw fatal error if a symbolic link points to an
unexpected file type with follow_link being set. This cl will make
list() issuing the link itself regardless of whether follow_link is set.

Closes: https://github.com/dart-lang/sdk/issues/43176
Change-Id: I16f0e9a0ec68c9d48e60f1fbe58820ebe4b066eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160705
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-09-01 22:44:01 +00:00
Ryan Macnak d511a85126 [vm] Fix missing initialization in --print_instructions_sizes_to.
Bug: https://github.com/dart-lang/sdk/issues/43246
Change-Id: Ib477e0289974d9de9f3c66952184bcf5fe69756e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161240
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-09-01 16:50:29 +00:00
Ryan Macnak c1bb9a520c [vm] Don't write LibraryPrefix::importer_ in AOT snapshots.
This field won't be used at runtime and is not accounted for during tree-shaking.

Bug: https://github.com/dart-lang/sdk/issues/41974
Bug: https://github.com/dart-lang/sdk/issues/43245
Change-Id: Ie5a669608e896aa8cee74a3a4249ba99ec6f980a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161220
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-09-01 16:49:49 +00:00
Clement Skau 7a978c3a35 [API] Adds Dart_SetGCEventCallback for GC events in PRODUCT
Bug: https://github.com/dart-lang/sdk/issues/43106
Change-Id: Ied2201464eca387e0bc58ab54404041f7649e870
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160063
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-08-31 12:14:38 +00:00
Vyacheslav Egorov 50736d2bd9 [vm/compiler] Avoid redundant moves in linearscan
When resolving control flow check detect a case when all
predecessors would contain the same move and try to
emit this move at the entry to the block if possible
(i.e. when the source of the move is not destroyed by other
moves at predecessors).

Optimization discovered as part of go/dart-llvm-assessment

flutter_gallery_total_size (sizeopt) -0.7127%

R=alexmarkov@google.com

Cq-Include-Trybots:dart/try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-x64-try
Change-Id: Ic8ead8ec3974a896ac58dfe97d652ffe497dfcce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160100
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-08-28 11:47:19 +00:00
Vyacheslav Egorov f91b6d9ad5 [vm/compiler] Fix divide by zero in inliner
Sometimes we might decide to inline a function which
was never executed itself - which causes us to divide
by zero when computing scaled edge weights.

Instead use 1.0 scaling factor when function was
never executed.

Minor cleanup in SetEdgeWeight helper function.

Bug: b/166297352
Change-Id: Ibe6922d2986ba42ec1b81b2f82263c7609782ce5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160282
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-08-28 11:07:38 +00:00
Clement Skau cc148b35d6 [Nit] Remove incorrect lint for dart_tools_api.h
Change-Id: If941238d0c87f58bcbac877a049b0f11cd1e5e39
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160223
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2020-08-27 13:39:47 +00:00
Aske Simon Christensen e0c9b5e45f [vm/aot/tfa] Group unboxing info via dispatch table selector IDs.
Also fix a copy/paste error in the unboxing metadata handling which
prevented setter parameters from being unboxed.

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

Change-Id: I0a37b432f15b34e50b4f60cefea774bacca174a5
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156915
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-08-27 11:00:27 +00:00
Bruno Garcia 655675a7db decode tool from native_stack_trace
I'm going through the docs to ramp up with the split debug-info/DWARF stuff.

In [this doc, I noticed a reference to `pkg/vm/bin/convert_stack_traces.dart`](https://github.com/dart-lang/sdk/blob/52f1502191e8668e3ec216eb52cedc47e574c334/runtime/docs/dwarf_stack_traces.md#using-the-stack-trace-converter-tool) but [this code was deleted (moved) in this commit](https://github.com/dart-lang/sdk/commit/a003d5e69ac860263895f0d4f1438cb2b5ae5053#diff-23252e156bc12255fd263fe5f59b6d42).

The new file is in `pkg/native_stack_traces/bin/decode.dart` which is part of the [native_stack_traces package](https://pub.dev/packages/native_stack_traces).

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

GitOrigin-RevId: fbe926f8d1e3c0fa8cc9abcb045c9d8d750cc921
Change-Id: I5570a23af28cb66853bdc5c2835dcaf1390dd74f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160400
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2020-08-27 10:00:37 +00:00
Adam Lesinski 6bfc5fdecf Reland "[fuchsia][time] Use C11 timespec APIs for UTC time"
This is a reland of 0e1d32f10c

Original change's description:
> [fuchsia][time] Use C11 timespec APIs for UTC time
> 
> UTC time is being removed from the zircon kernel. Using timespec_get
> ensures that the correct userspace UTC clock handle (supplied to the
> process through proc_args) is used for UTC time queries.
> 
> See https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=57506
> 
> Change-Id: Id22f0c7c7b0dd785ace4b7aa47e3080addf40e61
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159589
> Commit-Queue: Zach Anderson <zra@google.com>
> Auto-Submit: Adam Lesinski <adamlesinski@google.com>
> Reviewed-by: Zach Anderson <zra@google.com>

Change-Id: I95acd36978491b468a5dfdafdd0e3319d894938b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160420
Auto-Submit: Adam Lesinski <adamlesinski@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2020-08-26 22:28:45 +00:00
Ryan Macnak d373ff5557 Revert "[vm, service] Gather used and capacity from various mallocs."
This reverts commit 84f9eee652.

Reason for revert: Weak linking does not work on iOS

Original change's description:
> [vm, service] Gather used and capacity from various mallocs.
> 
> Change-Id: I9d397b3b865a804252d1adc90c03a369bf88aff3
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159186
> Commit-Queue: Ryan Macnak <rmacnak@google.com>
> Reviewed-by: Ben Konyi <bkonyi@google.com>

TBR=bkonyi@google.com,rmacnak@google.com

Change-Id: I6c9e17783ee5a3296296677cad11d036aa8fa060
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160401
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-08-26 21:32:36 +00:00