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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
This reverts commit 0ea18ffb36.
Reason for revert: Tree is on fire
Original change's description:
> [ Service / DDS ] Advertise DDS as the VM service, bump version to 4.0
>
> This change does the following:
> - The DDS URI will be reported by the VM as the VM service URI. If DDS
> disconnects, the VM service URI will be reported instead. This only
> impacts the standalone VM.
> - Updated the service protocol to 4.0 and removed the following
> deprecated functionality:
> - Client synchronization RPCs (these now live in DDS)
> - getWebSocketTarget (no longer needed as the VM service no longer
> tries to redirect web socket clients to DDS)
> - Regenerates package:vm_service based on the new spec, prepare for
> 5.0 release
>
> Change-Id: I8a2b401062342eb99b81ef10ef6926baa88f946e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160141
> Reviewed-by: Siva Annamalai <asiva@google.com>
TBR=bkonyi@google.com,rmacnak@google.com,asiva@google.com
Change-Id: I6a16e9fa7ceb18555d6424a169cfa811d3833419
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160340
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
This change does the following:
- The DDS URI will be reported by the VM as the VM service URI. If DDS
disconnects, the VM service URI will be reported instead. This only
impacts the standalone VM.
- Updated the service protocol to 4.0 and removed the following
deprecated functionality:
- Client synchronization RPCs (these now live in DDS)
- getWebSocketTarget (no longer needed as the VM service no longer
tries to redirect web socket clients to DDS)
- Regenerates package:vm_service based on the new spec, prepare for
5.0 release
Change-Id: I8a2b401062342eb99b81ef10ef6926baa88f946e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160141
Reviewed-by: Siva Annamalai <asiva@google.com>
This adds a mechanism similar to that used in async functions where
exceptions are caught in the synthetic code and passed into the
generated body to be rethrow'n.
This ensures the exception is throw'n from the same place as the
original yield*, as per the spec.
Bug: https://github.com/dart-lang/sdk/issues/42466
Change-Id: I553dd89141985f6f30751913a1c8a62b1229af04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158543
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Unify the order of checks in both LoadFieldInstr::MakeLocationSummary()
and LoadFieldInstr::EmitNativeCode() so that all architectures first
check the slot representation, then for unboxed fields when optimizing,
then for potential unboxed fields.
Add kUnboxedInt64 handling to IA32, so that all architectures support
the same set of unboxed slot representations.
For 32-bit architectures, use RepresentationUtils::ValueSize to
determine when to use single registers vs. pairs of registers for
unboxed integers.
Move (and dedup) any asserts in LoadFieldInstr::EmitNativeCode() into
LoadFieldInstr::MakeLocationSummary(), since the latter is always called
first, making the ASSERTs fail as soon as possible, and there's no need
to re-check the duplicated ASSERTS.
Change-Id: Ia0f8fddd5a3cda036f9e4c51e3e9a374be121e7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159667
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>