Commit Graph

16828 Commits

Author SHA1 Message Date
Martin Kustermann 933d8e913f [vm/compiler] Do not speculate operands to e kSmiCid if we know from interface target it cannot be a Smi
Hitting the assertion from the issue (see below) is innocent: It
informs us that we should avoid speculating operands to be Smis if we
actually know for sure the receiver cannot be a Smi (based on interface
target).

This particular case was hit on an instance call `a ^ b` where the interface
type tells us it is `boo.^` - so we shouldn't insert CheckedSmiOp.

There might be more cases where we insert CheckedSmiOp/CheckedSmiComparison
instructions where we shouldn't (because interface target tells us
receiver cannot be a Smi).
-> In debug mode we'll hit this assertion, so if the fuzzer finds more such
   cases, we should fix them one-by-one.

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

Change-Id: I55624f77b9edeece4d1334f1629ce5514cf3784a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139812
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-03-17 19:59:05 +00:00
Martin Kustermann a67aac8c6a Re-land "[vm/tfa] Convert named and optional parameters to required parameters where possible."
When performing protobuf-aware treeshaking, we may generate a kernel
file which will later be used in conjunction with a non-transformed
platform kernel. In this case signature shaking is unsafe.

The original revision is in patchset 1.

This reverts commit b59dad38df.

Change-Id: I1a85e42f245fcdbd821fa1f07b2e9966b8c2d958
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139100
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-03-17 19:54:05 +00:00
Martin Kustermann 1569b25fde [vm] Follow-up changes to process_fuchsia.cc
This is a follow-up to

 https://dart-review.googlesource.com/c/sdk/+/139640

Due to the lack of fuchsia builders on Dart CI this was only uncovered
by the roller.

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

Change-Id: Ib2bb69aa3b6d1a12f79e544323a8bd3cefe496e0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139810
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-03-17 18:26:50 +00:00
Martin Kustermann 8acd25a2e8 [vm/reload] Use CFEs Class::hasConstConstructor flag
The CFE has added this flag (on VM's request) in [0]. We can now use it
instead of our approximation of all fields are final (i.e. this is a
follow-up to [1])

[0] https://dart-review.googlesource.com/c/sdk/+/134292
[1] https://dart-review.googlesource.com/c/sdk/+/133228

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

Change-Id: I3975ef84f29cd47d56b5a3211c649d42da654f53
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139620
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-03-17 17:33:02 +00:00
Ryan Macnak 5379edb62b [vm] Fix CreateWithinExistingIsolateGroup calling RegisterIsolate without a write lock.
Detected by TSAN as a data race between the registration code and iteration code.

Bug: https://github.com/dart-lang/sdk/issues/39611
Change-Id: Ic232e9382a775369ce5898f3c4e5a90e8c0160c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139495
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-03-17 17:08:53 +00:00
Ryan Macnak b87a2bf9ae [vm] Remove an access to the Dart heap while in the kThreadInNative state.
TSAN reported this as a data race between the native resolution reading the resolver function when the compactor could move it.

Fix a similar pattern in reload.

Bug: https://github.com/dart-lang/sdk/issues/39611
Change-Id: Ia62a8201aacfe105697d4af6dc6724fbc513dbfc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139540
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-03-17 17:03:31 +00:00
Martin Kustermann 7310377823 [vm/compiler] Tests, cleanups and fixes to Type Testing Stubs.
So far we relied on our normal Dart tests to exercise and test TTS.

This CL adds concrete TTS unit tests, which directly construct the
values the TTS accepts via the calling convention (instance,
dst_type, instantiator tav, function tav), and allows us to test

  * whether TTS handled the type test
  * whether TTS was falling back to STC which handled the type test
  * whether TTS (and STC) preserve the necessary registers

This CL also gets rid of TMP usage in TTS related code.

This CL also adds documentation about TTS to
runtime/docs/compiler/type_testing_stubs.md.

This CL also fixes two issues:

  * handle all-dynamic null vector `as Foo<..., T, ...>`
  * compare the actual type parameter value in `as Foo<..., T, ...>`
    (instead of using type_class_id>)

There seem to be no major performance changes, some benchmarks change
positive/negative but many of them seem to be bi-modal.

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

Change-Id: Iad41e405fe693c67be6221a18e3dad03cc0a5f24
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139461
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2020-03-17 14:11:02 +00:00
Martin Kustermann 0ae869771a [vm] Avoid allocating Monitor/Mutex/... with global initializer, use Init()/Cleanup() functions instead
This CL adds a `dart::embedder::Cleanup()` (we already have `dart::embedder::InitOnce()`).
This allows us to allocate the global state and also tear it down.

As a side-effect this will also not allocate those variables if not
needed, which should fix b/151210948

Change-Id: I3c5c619586380bf27ee863ba026bbc631f243d85
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139640
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-03-17 08:49:52 +00:00
Ryan Macnak 056bbd88f9 [vm, gc] Fix data races on Scavenger::external_size_.
Mutliple isolates can now concurrently allocate or delete weak handles in the same new-space.

Bug: https://github.com/dart-lang/sdk/issues/39611
Change-Id: I09f1668bcd887e9e7f84de51d1e268846e3725ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139741
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-03-16 23:47:31 +00:00
Ryan Macnak 714b1d197f [vm] Fix flaky debug-mode crashes when GC happens while a mutator thread is descheduled.
A thread can exit an isolate while it still has Dart frames. The Dart frames must still be visited by the GC, but the dart::Thread is no longer associated with an dart::OSThread.

Add the PID to stack dumps to make it easier to match core dumps to stacks dumps.

Change-Id: Icb427ad99f4c0072d54b7c9516e922904403d1c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139747
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-03-16 23:46:01 +00:00
Simon Binder f9e67ea621 Fix observatory crash with null root uri of library
The observatory used to crash when viewing a library without a root uri,
because it attempts to view a script that doesn't exist. Now, we show a
message explaining that the library doesn't have a root script instead.

I also noticed that, for sources without file uris (which in my understanding
is legal in Kernel), the ScriptRefElement displays an empty link that
can't be clicked. Now we show some a fallback text.

Change-Id: I5f67d3a308eee44d2d05cc2427c5e75d6af89f18
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139287
Auto-Submit: Simon Binder <simolus3@gmail.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-03-16 23:34:31 +00:00
Alexander Markov 70e5532795 [vm] Optimize phis and branches more extensively
Remove phis which have redefinitions of the same value in the arguments:

  v1 = ...
  v2 = Redefinition(v1)
  v3 = phi(v1, v2)

Also eliminate redundant branches after DCE and merge blocks after
branches are eliminated.

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

Change-Id: I9d4e6c8ed356ab185fee85678e45841d82357403
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139602
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-03-16 22:19:46 +00:00
Regis Crelier 7953996d4c [VM/nnbd] Print non-nullable Object as bound in strong mode only.
Change-Id: I030ca9e1f8dd5f1a764ba83d7949fc596cbaded3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139687
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2020-03-16 22:02:26 +00:00
Ben Konyi 2cfa00791a [ dart:http ] Update HTTP client request logging to use filterKey TimelineTask constructor
Change-Id: Id99e102c455fade1165f650a4bcc4f7589a7f398
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139685
Reviewed-by: Kenzie Schmoll <kenzieschmoll@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-03-16 19:38:51 +00:00
Jason Simmons 704e8eae49 [build] Add the depfile as an output for gen_kernel_bytecode_dill
This will ensure that the depfile's directory is created before running
gen_kernel.

Change-Id: I82452b0161e533f31e1749f8e5894be7e58a6b4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139146
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Jason Simmons <jsimmons@google.com>
2020-03-16 18:23:58 +00:00
Ben Konyi 09f756b9a1 [ dart:developer ] Added filterKey optional parameter to TimelineTask constructors.
Providing `filterKey` will result in all timeline events associated with
the TimelineTask including a `filterKey` entry in their arguments map,
set to the value provided in the constructor. This will allow for a
consistent way for tooling to filter asynchronous timeline events.

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

Change-Id: I06d3f9c73f06c2ff0e495f1b6a57fcf357d625a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139312
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Kenzie Schmoll <kenzieschmoll@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-03-16 18:04:58 +00:00
Dmitry Stefantsov 928f9fc932 [cfe] Remove flag --force-nnbd-checks
The checks are now always enabled for the "non-nullable" experiment

Closes #40980.

Bug: https://github.com/dart-lang/sdk/issues/40980
Change-Id: I32a141a93f0ba86ebdab554e1f312c2147927993
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139440
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-03-16 15:01:38 +00:00
Erik Ernst 330ec173a9 Add bool.hasEnvironment constructor and tests
Change-Id: I65ebfcb48bf46292d5ae611ecb7431e0666f753c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139286
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2020-03-16 11:17:58 +00:00
Ryan Macnak 5ba84ae6f7 [vm] Restore invariant that all application isolates shut down before the kernel isolate.
Bug: https://github.com/dart-lang/sdk/issues/40894
Change-Id: I22795b9afb9f370da11344c91b214be0fd1ff6bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139521
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-03-14 00:07:27 +00:00
Regis Crelier cfc006a8f4 [VM/nnbd] Fix sharing of type argument vectors (fixes #40451).
Apply the same fix as in https://dart-review.googlesource.com/c/sdk/+/136709
to TypeArguments::CanShareInstantiatorTypeArguments and to TypeArguments::CanShareFunctionTypeArguments.

Move the inlined code performing an instantiation cache lookup to stubs in order to reduce code size.
Add stubs checking nullability of type arguments to share instantiator (or function) type arguments before looking up instantiation cache, and possibly calling into the runtime for instantiation.
Modify constant propagator to instantiate constant type arguments at compile time.

Change-Id: I72fee1a6881ac3bec55fae7d0ef5a3361544a141
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138009
Commit-Queue: Régis Crelier <regis@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-03-13 22:29:47 +00:00
Ben Konyi 95620c87c1 Reland "[vm] Don't insert CheckedSmi* instructions when the interface target suggests it's wrong."
This reverts commit 91484a543d.

Reason for revert: Unknown failures on bots.

Original change's description:
> Revert "[vm] Don't insert CheckedSmi* instructions when the interface target suggests it's wrong."
> 
> This reverts commit 8d26e3df23.
> 
> Reason: causing regular crashes during DartFuzz runs. Issue: https://github.com/dart-lang/sdk/issues/40937
> 
> Change-Id: I81f7065b2a54adb7320d7ef7500ae2f4030211d5
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139500
> Reviewed-by: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Ben Konyi <bkonyi@google.com>

TBR=kustermann@google.com,bkonyi@google.com,sjindel@google.com,asiva@google.com

Change-Id: I77812303d1e52f479a3cf86aa717ff0a3c85469d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139488
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-03-13 20:15:05 +00:00
Ben Konyi 91484a543d Revert "[vm] Don't insert CheckedSmi* instructions when the interface target suggests it's wrong."
This reverts commit 8d26e3df23.

Reason: causing regular crashes during DartFuzz runs. Issue: https://github.com/dart-lang/sdk/issues/40937

Change-Id: I81f7065b2a54adb7320d7ef7500ae2f4030211d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139500
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-03-13 18:29:41 +00:00
Teagan Strickland 2195c3282a [vm] Reland two dispatch table related changes as a single change.
These changes were originally submitted separately on different days,
and a major performance regression was seen after the first change
when creating snapshots that led to both being reverted. However,
that performance regression should be addressed by the followup.

First change:
"[vm] Treat the dispatch table as a root in the snapshot.

Additional changes:
* Only serialize a dispatch table in precompiled snapshots.
* Add information in v8 snapshot profiles for the dispatch table.
* Fix a typo in a field name.
* Print the number of Instructions objects (or payloads, for
  precompiled bare instructions mode) in the fake cluster for
  the data section.
* Fix v8 snapshots profiles so objects in memory mapped segments
  and only those are prefixed with "(RO) ".
* Add names for Instructions objects in v8 snapshot profiles
  when we can use the assembly namer.
* Add command line flag for old #define'd false flag."

Second change:
"[vm/aot] Keep GC-visible references to dispatch table Code entries.

This change splits dispatch table handling into four distinct
parts:

* The dispatch table generator does not make a dispatch table
  directly, but rather creates an Array that contains the Code
  objects for dispatch table entries.
* The precompiler takes this Array and puts it in the object
  store, which makes it a new GC root.
* The serializer takes this information and serializes the
  dispatch table information in the same form as before.
* The deserializer creates a DispatchTable object and populates
  it using the serialized information.

The change in the precompiler ensures that the Code objects
used in the dispatch table have GC-visible references. Thus,
even if all other references to them from the other GC roots
were removed, they would be accessible in the serializer in
the case of a GC pass between the precompiler and serializer.

This change also means that the serializer can retrieve and
trace the Code objects directly rather than first looking up
the Code objects by their entry point."

Bug: https://github.com/dart-lang/sdk/issues/41022
Change-Id: I52c83b0536fc588da0bef9aed1f0c72e8ee4663f
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139285
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-03-13 17:19:52 +00:00
Ryan Macnak bc23401ff2 [vm, test] Fix vm/cc/DartAPI_StackOverflowStackTrace* under MSAN.
The old code would unpoison the stack in one operation, based on the requested size of the stack for threads created by the VM. This may be smaller than the actual size of the stack, leaving some of the stack still poisoned.

The new code unpoisons the stack frame by frame, and only frames created by generated code. For exit frames, it guesses the frame size, but for all other frames it is precise.

Change-Id: Ice16480feca19727fcfadf19c9ec6cf205607946
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137725
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-03-13 16:58:41 +00:00
Dmitry Stefantsov 25d7331443 Pass --force-nnbd-checks whenever NNBD experiment is enabled
This is a preliminary step before removing the flag completely.

Bug: https://github.com/dart-lang/sdk/issues/40980
Change-Id: Ib2135180aa0f30dd301beaacb842105096f8948c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139289
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2020-03-13 15:08:11 +00:00
Teagan Strickland 3fef227419 [vm] Generate static symbols for Code payloads in the debug info.
This was already done when generating ELF snapshots, but not when
generating assembly ones. This unifies the approaches so that
the static symbol is created while adding the Code payload instead
of as a separate step.

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-win-release-x64-try
Change-Id: I191120728e03fdcd4d8df8a8fd3db00ce9175723
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139202
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-03-13 14:14:01 +00:00
Alexander Aprelev 0d83ff51be Revert "[vm] Treat the dispatch table as a root in the snapshot."
This reverts commit ba68d04d3f being culprit for performance regression.

Revert "[vm/aot] Keep GC-visible references to dispatch table Code entries."

This reverts commit 98d09f8f78 being collateral damage for culprit cl for clean revert.

Bug: https://github.com/dart-lang/sdk/issues/41022
Change-Id: If62d3228f96c6b0a8884f77d0a549b5e5984cd4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139305
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-03-12 19:27:56 +00:00
Teagan Strickland 98d09f8f78 [vm/aot] Keep GC-visible references to dispatch table Code entries.
This change splits dispatch table handling into four distinct
parts:

* The dispatch table generator does not make a dispatch table
  directly, but rather creates an Array that contains the Code
  objects for dispatch table entries.
* The precompiler takes this Array and puts it in the object
  store, which makes it a new GC root.
* The serializer takes this information and serializes the
  dispatch table information in the same form as before.
* The deserializer creates a DispatchTable object and populates
  it using the serialized information.

The change in the precompiler ensures that the Code objects
used in the dispatch table have GC-visible references. Thus,
even if all other references to them from the other GC roots
were removed, they would be accessible in the serializer in
the case of a GC pass between the precompiler and serializer.

This change also means that the serializer can retrieve and
trace the Code objects directly rather than first looking up
the Code objects by their entry point.

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-win-release-x64-try
Change-Id: Ic9ba29dfd64945a6e9a51f9de73f74d9202b58b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138288
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2020-03-12 13:22:22 +00:00
Leaf Petersen 5e9be81d5e Make all CastErrors be TypeErrors.
This makes CastError implement TypeError, and changes all test
expectations to look for TypeError.  A followup CL will deprecate
CastError.

Bug: https://github.com/dart-lang/language/issues/787
Bug: https://github.com/dart-lang/sdk/issues/34097
Change-Id: I7102c6260901317572d2df08c4be9c4c48197688
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138670
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-03-11 23:31:06 +00:00
Alexander Markov 5eccf7e1c2 [vm/nnbd] Optimize 'is' tests with non-legacy types
Fixes https://github.com/dart-lang/sdk/issues/40936

Change-Id: I2151c317c40de356d48d0ddcf2e41832f455bc6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139032
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-03-11 22:57:08 +00:00
Ryan Macnak 991da7169a [vm, service] Fix data races between sample collection and sample processing.
Bug: https://github.com/dart-lang/sdk/issues/39611
Bug: https://github.com/dart-lang/sdk/issues/30309
Change-Id: I79daec2183be40aa07d652b149d182316df8458c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139025
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-03-11 22:03:50 +00:00
Samir Jindel 4c6a2ab47c Re-land "[vm] Aggressive write-barrier elimination."
Three bugs were fixed:

1. BitVector::Equals was not fully fixed by the original CL.
2. We need to add old objects to the deferred marking queue during
   RememberLiveTemporaries().
3. The thread being scanned in RestoreWriteBarrierInvariant may not
   be scheduled, so we cannot use its store buffer block.

In addition, this changed uncovered another bug fixed in:
https://dart-review.googlesource.com/c/sdk/+/138960.

Original CL is in patchset 3.

This reverts commit 30a12a349e.

Change-Id: I36169b09563998ed5b3c3eac70ee0ebe78853e62
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138920
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2020-03-11 13:05:59 +00:00
Teagan Strickland ba68d04d3f [vm] Treat the dispatch table as a root in the snapshot.
Additional changes:
* Only serialize a dispatch table in precompiled snapshots.
* Add information in v8 snapshot profiles for the dispatch table.
* Fix a typo in a field name.
* Print the number of Instructions objects (or payloads, for
  precompiled bare instructions mode) in the fake cluster for
  the data section.
* Fix v8 snapshots profiles so objects in memory mapped segments
  and only those are prefixed with "(RO) ".
* Add names for Instructions objects in v8 snapshot profiles
  when we can use the assembly namer.
* Add command line flag for old #define'd false flag.

Change-Id: I1e3be59c7a6312efd76afca560ba465cc17cb22b
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138089
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-03-11 10:40:59 +00:00
Nathan Rogers 24480f24b6 [fuchsia] Use lib/ based trace engine paths
Bug: fxb/23054 (PT-193)
Change-Id: I4ab96f25c59b63f3c833a8e4e80dd305f60f8aa8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138742
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-03-10 23:29:18 +00:00
Samir Jindel 40cd5fc5f6 [vm, gc] Avoid double-enqueuing WeakProperties when they end up in the deferred marking list.
Change-Id: Iac3a30aaaf2c2b513d8e39b3bef787462fd91c6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138960
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-03-10 23:04:48 +00:00
asiva e33d023fa0 [BUILD] - Format gn files, this is being done to ensure the unfork CL
doesn't show these formatting changes as diffs.

Change-Id: I69ccbf4adabc66d88371cece785a2c1bce60f133
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138962
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-03-10 21:56:11 +00:00
Ryan Macnak e8f27551e5 [vm, gc] Add some high-level documentation of write barrier elimination.
Change-Id: Ied50ccd2847f7a7ded7ad8dfe25413208e13f324
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138788
Reviewed-by: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-03-10 16:50:20 +00:00
Martin Kustermann 30a12a349e Revert "Re-land "[vm] Aggressive write-barrier elimination.""
This reverts commit eff1a9ff97.

Reason for revert:
  Causes flaky hits of RELEASE_ASSERT in marker.cc, see b/151131634.

Original change's description:
> Re-land "[vm] Aggressive write-barrier elimination."
> 
> The original revision is in Patchset 3.
> 
> Four bugs were fixed:
> 
> 1. JoinEntryInstr::SuccessorCount() is not the correct way to get the
>    number of successor blocks from the Join block;
>    JoinEntryInstr::last_instruction()->SuccessorCount() must be used
>    instead.
> 
> 2. BitVector::Equals() was non-deterministically returning 'false'
>    for equal vectors.
> 
> 3. All blocks need to be processed at least once during the Analysis
>    phase (not only in the SaveResults phase).
> 
> 4. We were not removing write barriers from StoreIndexed instructions,
>    even though we had support for it.
> 
> This reverts commit 7fd8ad5a2d.
> 
> Fixes https://github.com/dart-lang/sdk/issues/40780
> 
> Change-Id: I9650ec2c547ec49cf88ca0524e14f6c245621f6a
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138086
> Commit-Queue: Samir Jindel <sjindel@google.com>
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

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

Change-Id: If9afd84465175fad2431405a97e9293c8bd5e476
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138808
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-03-10 10:15:30 +00:00
Ben Konyi b01cb58320 Revert "Re-land "[vm] Add type to _AsyncAwaitCompleter.start.""
This reverts commit 4049ab54e4.

Reason for revert: Appears to break standalone_2/dwarf_stack_trace_test and other related tests.

https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket.appspot.com/8886276259895791440/+/steps/test_results/0/logs/new_test_failures__logs_/0

Original change's description:
> Re-land "[vm] Add type to _AsyncAwaitCompleter.start."
> 
> We need to relax vm/dart/causal_stacks/async_throws_stack_no_causal_test
> 
> Change-Id: I40c08d432afeac839ce4f49bbf48c3707b23ef7f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138804
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Samir Jindel <sjindel@google.com>

TBR=kustermann@google.com,sjindel@google.com,cskau@google.com

Change-Id: Ib77bdb5ba9927cf5a9a588570a5d70641e912aed
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138791
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-03-09 22:16:39 +00:00
Samir Jindel 4049ab54e4 Re-land "[vm] Add type to _AsyncAwaitCompleter.start."
We need to relax vm/dart/causal_stacks/async_throws_stack_no_causal_test

Change-Id: I40c08d432afeac839ce4f49bbf48c3707b23ef7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138804
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2020-03-09 19:23:20 +00:00
Samir Jindel eff1a9ff97 Re-land "[vm] Aggressive write-barrier elimination."
The original revision is in Patchset 3.

Four bugs were fixed:

1. JoinEntryInstr::SuccessorCount() is not the correct way to get the
   number of successor blocks from the Join block;
   JoinEntryInstr::last_instruction()->SuccessorCount() must be used
   instead.

2. BitVector::Equals() was non-deterministically returning 'false'
   for equal vectors.

3. All blocks need to be processed at least once during the Analysis
   phase (not only in the SaveResults phase).

4. We were not removing write barriers from StoreIndexed instructions,
   even though we had support for it.

This reverts commit 7fd8ad5a2d.

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

Change-Id: I9650ec2c547ec49cf88ca0524e14f6c245621f6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138086
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-03-09 14:37:27 +00:00
Samir Jindel 0f284647b1 [vm] Improve docs for Dart_LoadELF.
Change-Id: Ied56910220fb6599b374f8adc3091fb696a49b5f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138088
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2020-03-09 14:16:47 +00:00
Ryan Macnak 80ed949678 [vm, reload] Don't drop unwind errors for isolates other than the first isolate in a group during a reload.
Bug: https://github.com/dart-lang/sdk/issues/40894
Change-Id: Id63a8c8d214c3233ef85fdf96982eda0d5471cb9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138572
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-03-06 22:03:43 +00:00
Victor Lima 8fd8fec185 [vm/aot] Add support to instance calls with unboxed parameters
In order to have instance calls with unboxed parameters, all
the possible targets need to be able to those parameters unboxed.
Then, the methods were partitioned according to the class hierarchy,
and the inferred types from TFA are used to determine the parameters
that could be unboxed.

This is done for non-nullable integer and double parameters, and
return value.

dart-aot linux x64:

Bench2D                8.028%
DeltaBlue              4.688%
ParticleSystemPaint    27.79%

Flutter release android-armv8:

velocity_tracker_bench -2.026% (less is better)

flutter_gallery_total_size -0.1460%
flutter_gallery_instructions_size -0.2715%
flutter_gallery_readonlydata_size 0.0539%

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

Change-Id: Iedd9b4321c3d78b406ea1708e15c747754433027
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138501
Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2020-03-06 19:47:23 +00:00
Liam Appelbe 2c5a56e7bb [vm] Disable late field init for constructor initialized fields
Change-Id: Ibdab37839d07b77bf2c92a09f760f44b54d94bcb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138620
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2020-03-06 17:10:08 +00:00
Clement Skau b0b8304b87 [Cleanup] Simplifies use_slow_path handling to remove unreachable asm.
As a side-effect this should result in slightly less stub code when
--use_slow_path is passed.

Note:
Most of the delta is indentation of code now enclosed in:
if (!FLAG_use_slow_path) {...}
Functionally this hoists the flag check out to simply not emit the ASM
that would otherwise ultimately get unconditionally jmp'd over.

Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try
Change-Id: I22dad5a33bbd66e0e5ab50517e9d96a278383479
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137781
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2020-03-06 12:44:44 +00:00
Daco Harkes 6facea722b [vm/ffi] Unbox Pointer data field - fix bytecode
Fixes: https://github.com/dart-lang/sdk/issues/40898

Change-Id: Ife33da9c9e87e26b21fee30f7fa97292dbd8e31e
Cq-Include-Trybots: luci.dart.try:vm-dartkb-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138506
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2020-03-06 09:15:51 +00:00
Liam Appelbe 331067017f [vm] Fix late field store bug
Late field stores were being incorrectly marked as initializations,
causing them to be incorrectly optimised out in some cases.

Change-Id: I7487d24238af3b3922e76a9ca6ae6df4bf5ab849
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138566
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2020-03-05 23:34:16 +00:00
Samir Jindel 8d26e3df23 [vm] Don't insert CheckedSmi* instructions when the interface target suggests it's wrong.
Change-Id: I97e45dc5c74f0d6e9193c0fa95dd679a42133f78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138521
Reviewed-by: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2020-03-05 18:38:39 +00:00
Ryan Macnak 2a8127dbfa [vm, gc] Take heap size into account when deciding when to start concurrent marking.
Begin concurrent marking when available space in old-space is less than 5% or than the size of new-space, whichever comes first.

Avoids concurrent marking starting too late in larger heaps, where the program would exceed the hard threshold before concurrent marking would finish.

Change-Id: I6a1991331a1450ffa647bf0e21dfc19e82537268
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134466
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-03-05 17:49:54 +00:00