Commit Graph

230 Commits

Author SHA1 Message Date
Martin Kustermann 8054409a02 Reland "[VM] Introduction of type testing stubs - Part 1-4"
Relands 165c583d57

    [VM] Introduction of type testing stubs - Part 1

    This CL:

      * Adds a field to [RawAbstractType] which will always hold a pointer
        to the entrypoint of a type testing stub

      * Makes this new field be initialized to a default stub whenever a
        instances are created (e.g. via Type::New(), snapshot reader, ...)

      * Makes the clustered snapshotter write a reference to the
        corresponding [RawInstructions] object when writing the field and do
        the reverse when reading it.

      * Makes us call the type testing stub for performing assert-assignable
        checks.

    To reduce unnecessary loads on callsites, we store the entrypoint of the
    type testing stubs directly in the type objects.  This means that the
    caller of type testing stubs can simply branch there without populating
    a code object first.  This also means that the type testing stubs
    themselves have no access to a pool and we therefore also don't hold on
    to the [Code] object, only the [Instruction] object is necessary.

    The type testing stubs do not setup a frame themselves and also have no
    safepoint.  In the case when the type testing stubs could not determine
    a positive answer they will tail-call a general-purpose stub.

    The general-purpose stub sets up a stub frame, tries to consult a
    [SubtypeTestCache] and bails out to runtime if this was unsuccessful.

    This CL is just the the first, for ease of reviewing.  The actual
    type-specialized type testing stubs will be generated in later CLs.

    Reviewed-on: https://dart-review.googlesource.com/44787

Relands f226c22424

    [VM] Introduction of type testing stubs - Part 2

    This CL starts building type testing stubs specialzed for [Type] objects
    we test against.

    More specifically, it adds support for:

      * Handling obvious fast cases on the call sites (while still having a
        call to stub for negative case)

      * Handling type tests against type parameters, by loading the value
        of the type parameter on the call sites and invoking it's type testing stub.

      * Specialzed type testing stubs for instantiated types where we can
        do [CidRange]-based subtype-checks.

        ==> e.g. String/List<dynamic>

      * Specialzed type testing stubs for instantiated types where we can
        do [CidRange]-based subclass-checks for the class and
        [CidRange]-based subtype-checks for the type arguments.

        ==> e.g. Widget<State>, where we know [Widget] is only extended and not
                 implemented.

      * Specialzed type testing stubs for certain non-instantiated types where we
        can do [CidRange]-based subclass-checks for the class and
        [CidRange]-based subtype-checks for the instantiated type arguments and
        cid based comparisons for type parameters.  (Note that this fast-case migth
        result in some false-negatives!)

        ==> e.g. _HashMapEntry<K, V>, where we know [_HashMapEntry] is only
                 extended and not implemented.

       This optimizes cases where the caller uses `new HashMap<A, B>()` and only
       uses `A` and `B` as key/values (and not subclasses of it).  The false-negative
       can occur when subtypes of A or B are used.  In such cases we fall back to the
       [SubtypeTestCache]-based imlementation.

    Reviewed-on: https://dart-review.googlesource.com/44788

Relands 25f98bcc75

    [VM] Introduction of type testing stubs - Part 3

    The changes include:

      * Make AssertAssignableInstr no longer have a call-summary, which
        helps methods with several parameter checks by not having to
        re-load/re-initialize type arguments registers

      * Lazily create SubtypeTestCaches: We already go to runtime to warm up
        the caches, so we now also create the caches on the first runtime
        call and patch the pool entries.

      * No longer load the destination name into a register: We only need
        the name when we throw an exception, so it is not on the hot path.
        Instead we let the runtime look at the call site, decoding a pool
        index from the instructions stream.  The destination name will be
        available in the pool, at a consecutive index to the subtype cache.

      * Remove the fall-through to N=1 case for probing subtypeing tests,
        since those will always be handled by the optimized stubs.

      * Do not generate optimized stubs for FutureOr<T> (so far it just
        falled-through to TTS).  We can make optimzed version of that later,
        but it requires special subtyping rules.

      * Local code quality improvement in the type-testing-stubs: Avoid
        extra jump at last case of cid-class-range checks.

    There are still a number of optimization opportunities we can do in
    future changes.

    Reviewed-on: https://dart-review.googlesource.com/46984

Relands 2c52480ec8

    [VM] Introduction of type testing stubs - Part 4

    In order to avoid generating type testing stubs for too many types in
    the system - and thereby potentially cause an increase in code size -
    this change introduces a smarter way to decide for which types we should
    generate optimized type testing stubs.

    The precompiler creates a [TypeUsageInfo] which we use to collect
    information.  More specifically:

       a) We collect the destination types for all type checks we emit
          (we do this inside AssertAssignableInstr::EmitNativeCode).

          -> These are types we might want to generate optimized type testing
             stubs for.

       b) We collect type argument vectors used in instance creations (we do
          this inside AllocateObjectInstr::EmitNativeCode) and keep a set of
          of used type argument vectors for each class.

    After the precompiler has finished compiling normal code we scan the set
    of destination types collected in a) for uninstantiated types (or more
    specifically, type parameter types).

    We then propagate the type argument vectors used on object allocation sites,
    which were collected in b), in order to find out what kind of types are flowing
    into those type parameters.

    This allows us to extend the set of types which we test against, by
    adding the types that flow into type parameters.

    We use this final augmented set of destination types as a "filter" when
    making the decision whether to generate an optimized type testing stub
    for a given type.

    Reviewed-on: https://dart-review.googlesource.com/48640

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

Change-Id: I44a1d5d4b27454ae026aef2a301aada3dd399ea0
Reviewed-on: https://dart-review.googlesource.com/49861
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-04-09 11:25:36 +00:00
Martin Kustermann dbb1d3d44f Revert "[VM] Introduction of type testing stubs - Part 1-4"
This reverts commit 2c52480ec8.
This reverts commit 25f98bcc75.
This reverts commit f226c22424.
This reverts commit 165c583d57.

Change-Id: I3892d672b9ca0b0acc0b9b83c32ecc92355839c2
Reviewed-on: https://dart-review.googlesource.com/49843
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-04-06 08:35:01 +00:00
Martin Kustermann 2c52480ec8 [VM] Introduction of type testing stubs - Part 4
In order to avoid generating type testing stubs for too many types in
the system - and thereby potentially cause an increase in code size -
this change introduces a smarter way to decide for which types we should
generate optimized type testing stubs.

The precompiler creates a [TypeUsageInfo] which we use to collect
information.  More specifically:

   a) We collect the destination types for all type checks we emit
      (we do this inside AssertAssignableInstr::EmitNativeCode).

      -> These are types we might want to generate optimized type testing
         stubs for.

   b) We collect type argument vectors used in instance creations (we do
      this inside AllocateObjectInstr::EmitNativeCode) and keep a set of
      of used type argument vectors for each class.

After the precompiler has finished compiling normal code we scan the set
of destination types collected in a) for uninstantiated types (or more
specifically, type parameter types).

We then propagate the type argument vectors used on object allocation sites,
which were collected in b), in order to find out what kind of types are flowing
into those type parameters.

This allows us to extend the set of types which we test against, by
adding the types that flow into type parameters.

We use this final augmented set of destination types as a "filter" when
making the decision whether to generate an optimized type testing stub
for a given type.

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

Measured impact on flutter HEAD-HEAD-HEAD with TTS Part 1 - 4 applied (2018-04-03):

      * stock build benchmark: around 4% improvement
      * gallery app.so size: -2.68%  (13987348 -> 13612928)
      * gallery memory: no sigificant changes:
         - SubtypeTestCache: - 10kb
         - ObjectPool: + 6 kb
         - Type: no change (probably due to wasted alignment slot before)
         - TypeParameter: + 4 kb (can get rid of the field here later)
      * gallery AOT compile-time: measured +1.3%, inside flakiness range

Change-Id: I12a398d18f970ba2db741913bb47b0f36ae38d58
Reviewed-on: https://dart-review.googlesource.com/48640
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-04-06 07:00:50 +00:00
Ryan Macnak 8590919ca6 [vm] Add a timeline stream for recording the zone high watermark.
Change-Id: Ic7f899dbb29eb732b54d7164968a176d7b1025b9
Reviewed-on: https://dart-review.googlesource.com/45544
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2018-03-16 17:43:27 +00:00
Martin Kustermann 65b2b1a671 [VM] Split handling of Code from non-Code in Thread::{CanLoadFromThread,OffsetFromThread}
Not only does it speed the two methods a bit up, it will also allow us to use the assembler
before all of the stubs are initialized.

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

Change-Id: Ic14743ecd9d11ca4cbc5208cacad30beee0982ef
Reviewed-on: https://dart-review.googlesource.com/44500
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-02 14:52:04 +00:00
Martin Kustermann cf8a6063f8 [VM] Improve AssertAssignable/InstanceOf by having a fast case for non-generic, instantiated types
When the type to test against is instantiated and has no type arguments
there is a high probability that we receive instances of that class or
subclasses at runtime.

This CL therefore extends the fast-path of AssertAssignable/InstanceOf
by checking whether the instance class id is within the cid ranges that
directly/indirectly implement/extend the type to test against.

Currently we have an almost depth-first preorder numbering of class ids
in AOT, but there are exceptions.  So each class can have a number of
cid-ranges as subclasses / classes which implement it's interface.

This seems to improve performance of dart-aot-v2
  * flutter stock build by 15+%
  * DeltaBlueClosures by 10+%

and reduces code size on
  * flutter gallery by -3%

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

Change-Id: I07dd91589cc3fcd8c5952bdba339e2e2a459e08e
Reviewed-on: https://dart-review.googlesource.com/35620
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-01-25 07:13:42 +00:00
Ryan Macnak d01d0ea8e6 [vm] Check for stack headroom before starting a hot reload.
Split up the StackOverflow runtime entry.

Bug: https://github.com/dart-lang/sdk/issues/31578
Change-Id: Ibe26101db1651d6e776c3da5fde6b44fd27cd00e
Reviewed-on: https://dart-review.googlesource.com/27414
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2017-12-08 18:07:31 +00:00
Zachary Anderson f97e11f624 [Fuchsia] Safestack fix for exceptions
The safestack stack pointer is cached when invoking Dart code, and
manually restored when jumping over C++ frames for Dart exceptions
in Exceptions::JumpToFrame().

fixes #31356

Change-Id: I71c2e86d1d4f24571dd618a5db06fd1277339ebc
Reviewed-on: https://dart-review.googlesource.com/23141
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-11-22 19:27:54 +00:00
Ryan Macnak b85a7fecd0 Reapply "[vm] Prefer stack bounds from the system thread library for overflow checks."
Mark some profiler tests on Windows as failing.

Bug: https://github.com/dart-lang/sdk/issues/31137
Change-Id: I46a5d4838443e5cfdac6043ea8dcfeb3d05d4823
Reviewed-on: https://dart-review.googlesource.com/14920
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-18 21:15:49 +00:00
Dmitry Stefantsov a227b168da Revert "Reapply "[vm] Prefer stack bounds from the system thread library for overflow checks.""
This reverts commit 5a022b9db6.

The reverted CL caused some redness on some vm and vm-precomp bots.

TBR=rmacnak@google.com
Change-Id: I9be670f3c3e341ec6d95082f288bc569834e38c7
Reviewed-on: https://dart-review.googlesource.com/13460
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Karl Klose <karlklose@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2017-10-12 07:32:30 +00:00
Ryan Macnak 5a022b9db6 Reapply "[vm] Prefer stack bounds from the system thread library for overflow checks."
Fix accounting of guard pages to move the stack limit up instead of down.

Change-Id: I2f6577a12cf95707c186884f0bd3def03eac12ed
Reviewed-on: https://dart-review.googlesource.com/13381
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2017-10-12 02:17:11 +00:00
Ryan Macnak 6ecf6dd0a3 Revert "[vm] Prefer stack bounds from the system thread library for overflow checks."
This reverts commit af251ddfec.

Reason for revert: Crashes on Windows.

Original change's description:
> [vm] Prefer stack bounds from the system thread library for overflow checks.
> 
> Before this change, we would assume all stacks have the size the VM specifies for threads it creates, but this won't be accurate for the initial thread or threads created by the embedder.
> 
> Change-Id: I6605a88d6666a6f9d47fbe047d3fdd02aa22c80a
> Reviewed-on: https://dart-review.googlesource.com/10209
> Reviewed-by: Zach Anderson <zra@google.com>

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

Change-Id: I96eaccdc8edf6e3d319827a63d168534bad0518e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/13106
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-10-11 21:17:28 +00:00
Ryan Macnak af251ddfec [vm] Prefer stack bounds from the system thread library for overflow checks.
Before this change, we would assume all stacks have the size the VM specifies for threads it creates, but this won't be accurate for the initial thread or threads created by the embedder.

Change-Id: I6605a88d6666a6f9d47fbe047d3fdd02aa22c80a
Reviewed-on: https://dart-review.googlesource.com/10209
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-11 19:35:44 +00:00
Ryan Macnak 031069d2bd [vm] Avoid using a generated stub to get the current SP, since generated stubs aren't available during early start up.
Change-Id: Ib0d78965ba5ccb1fa2b084d82b2bb79485b7900f
Reviewed-on: https://dart-review.googlesource.com/12780
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-10 22:52:25 +00:00
Ryan Macnak 8879e6a2c0 [vm, gardening] Move --trace-service output to stderr.
Prevents interleaving with output on stdout that is parsed. E.g.,

R=cbernaschina@google.com

FormatException: Invalid character (at character 24)
http://127.0.0.1:59909/[+400ms] Isolate kernel-service.dart.snapshot$main-5...
Review-Url: https://codereview.chromium.org/2998713002 .
2017-08-09 13:06:14 -07:00
Diogenes Nunez 699f84f941 Moves the top_ and end_ words of the Scavenger into mutator thread.
This is the first step to adding Thread Local Allocation Buffers to
the VM.

In this step, the mutator alone allocates to the new space, but keeps
track of the start and end of the space. This is akin to a single large
TLAB.

As a result, the generated code and the dbc simulator changed how they
allocate objects into the new space as well.

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2980033002 .
2017-07-13 13:46:17 -07:00
Zachary Anderson 6cd8a79078 VM: Re-format to use at most one newline between functions
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2974233002 .
2017-07-13 08:08:37 -07:00
Diogenes Nunez c0d4e02693 Revert "Moves the top_ and end_ words of the Scavenger into mutator thread."
This reverts commit 710544a907.

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2974403002 .
2017-07-12 14:30:06 -07:00
Diogenes Nunez 710544a907 Moves the top_ and end_ words of the Scavenger into mutator thread.
This is the first step to adding Thread Local Allocation Buffers to
the VM.

In this step, the mutator alone allocates to the new space, but keeps
track of the start and end of the space. This is akin to a single large
TLAB.
BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2951333002 .
2017-07-12 14:09:07 -07:00
Ryan Macnak 936cbb2075 [arm64] Fix the GetStackPointer stub to return the C stack pointer.
Fixes stack overflow checks when compiled with -fsanitize=safe-stack, and presumably -fsanitize=address as well.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2918393002 .
2017-06-05 12:16:35 -07:00
Martin Kustermann ac8d2056a3 Fix asserts in StackFrameIterator which were effectively disabled
The assertions which tried to assert that we only use
StackFrameIterator to walk frames of the current thread was incorrect.
We already have cases where other threads will walk the stack of the
mutator thread, see below for an example where this can happen.

Thread::VisitObjectPointers was incorrectly passing Thread::Current() to
the StackFrameIterator instead of 'this'.  (Code in thread_registry.cc will
loop over a number of threads and calls VisitObjectPointers on them)

  Mutator thread:

    0  pthread_cond_wait@@GLIBC_2.3.2
    1  dart::Monitor::WaitMicros
    2  dart::Monitor::Wait
    3  dart::MonitorLocker::Wait
    4  dart::ThreadBarrier::Sync
    5  dart::GCMarker::MarkObjects
    6  dart::PageSpace::MarkSweep
    7  dart::Heap::CollectOldSpaceGarbage
    8  dart::Heap::CollectNewSpaceGarbage
    9  dart::Heap::CollectGarbage
    10 dart::DN_HelperObject_<native>
    11 dart::BootstrapNatives::<native>
    <dart frames>

  MarkTask thread:

    1  dart::EntryFrame::VisitObjectPointers
    2  dart::Thread::VisitObjectPointers          <---- Walks mutator thread stack
    3  dart::ThreadRegistry::VisitObjectPointers  <---- Iterates over a number of threads
    4  dart::Isolate::VisitStackPointers
    5  dart::Isolate::VisitObjectPointers
    6  dart::GCMarker::IterateRoots
    7  dart::MarkTask::Run
    8  dart::ThreadPool::Worker::Loop
    9  dart::ThreadPool::Worker::Main
    10 dart::ThreadStart

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2845053003 .
2017-05-03 10:27:01 +02:00
Ryan Macnak 06080dae96 Fix some assertion failures on Fuchsia
- Fix longjmp asserts to work with -fsanitize=safe-stack.
 - Remove outdated asserts in gen_snapshot assuming generation of a core snapshot.
 - Move depfile resolution so it happens outside of the tag handler.

Issue #29458

R=asiva@google.com, johnmccutchan@google.com, zra@google.com

Review-Url: https://codereview.chromium.org/2837873005 .
2017-04-26 15:34:31 -07:00
Ryan Macnak 9ce48e63b2 Remove background finalization.
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2809863002 .
2017-04-11 09:54:25 -07:00
Ben Konyi c0511ad2ef Reimplemented zone memory tracking to avoid race conditions that were causing crashes in the previous implementation and made some minor name changes.
BUG=
R=asiva@google.com, johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2762323002 .
2017-03-23 09:03:08 -07:00
John McCutchan a4adbffb50 Remove legacy restart code
Also fixes #29092 by threading Error objects back to the message handler.

BUG=
R=asiva@google.com, rmacnak@google.com

Review-Url: https://codereview.chromium.org/2759533002 .
2017-03-20 08:47:39 -07:00
Ben Konyi 6e02846b6d Temporarily disabling JSON generation for Zone statistics to resolve flakiness in tests until a better implementation is written. Issue #28885 (https://github.com/dart-lang/sdk/issues/28885).
BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2728743003 .
2017-03-03 10:43:11 -08:00
John McCutchan a0ee5b24db Track async causal stack traces
This CL improves the stack traces that accompany exceptions. Whenever an
async function is entered, we remember how we got there. This is similar
in spirit to package:stack_trace but the implementation is more efficient
and memory usage can be more easily reasoned about.

Tracking causal stack traces:

- [x] Upon entry to an async function, capture the synchronous stack trace prefix and store it into the closure.
- [x] Upon entry to an async* function, capture the synchronous stack trace prefix and store it into the closure.
- [x] Before returning from an async function, clear the Thread's asynchronous stack trace.
- [x] After resuming an async function, load the sychronous stack trace prefix into the Thread.
- [x] Filter stack traces to remove async machinery.

Service protocol changes:

- [x] Send causal async stack trace.

Observatory changes:

- [x] Display causal async stack trace below async functions.

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

R=asiva@google.com, rmacnak@google.com

Comparisons: https://docs.google.com/a/google.com/document/d/10r6jEqr8OCiDZ4y9SYU_uOimcHiOGAZMly2ghTErALI/edit?usp=sharing
Review-Url: https://codereview.chromium.org/2646443005 .
2017-02-09 15:39:44 -08:00
Ben Konyi 171a27b79c Fixed issue where initial 1KB zone buffer was not being accounted for when tracking thread zone memory usage.
BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2651273004 .
2017-01-31 14:32:26 -08:00
Ben Konyi 259c7ac2be Resolution for issue #5092: Unit test handle checks consider dangling handles to be valid.
Updated the IS_VALID(handle) macro to also check if the handle is still in
scope or is a read-only handle.

BUG=
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2640573003 .
2017-01-20 15:50:15 -08:00
Ben Konyi 4024151adb Added isolate + thread high watermark tracking to Observatory
This is a fixed version of c84f30741c90d040254767ff769a40d2cba3fb1a that
resolves issues with comparing uint and intptr_t.

Original Commit Message:
Added tracking of memory usage inside of threads. In addition, the max memory usage is kept track of using a high watermark for both the threads and the isolates. Isolate high watermark information is updated when a thread exits the isolate. The isolate high watermark consists of the sum of all thread high watermarks (including the high watermark of the exiting thread). High watermark information for both threads and isolates is now visible in the isolate view in the Observatory.

BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2610253002 .
2017-01-05 14:24:53 -08:00
Ben Konyi ffda801791 Revert "Added isolate + thread high watermark tracking to Observatory"
This reverts commit c84f30741c90d040254767ff769a40d2cba3fb1a.

TBR=johnmccutchan@google.com

BUG=

Review-Url: https://codereview.chromium.org/2617513004 .
2017-01-04 15:21:35 -08:00
Ben Konyi b3c55f972f Added isolate + thread high watermark tracking to Observatory
Added tracking of memory usage inside of threads. In addition, the max memory usage is kept track of using a high watermark for both the threads and the isolates. Isolate high watermark information is updated when a thread exits the isolate. The isolate high watermark consists of the sum of all thread high watermarks (including the high watermark of the exiting thread). High watermark information for both threads and isolates is now visible in the isolate view in the Observatory.

BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2609253002 .
2017-01-04 15:08:02 -08:00
Ben Konyi 82cf4cc374 Added methods to surface number of zone and scoped handles for each isolate.
Added methods to surface number of zone and scoped handles in each isolate. These values are displayed in the isolate view page in the Observatory. These handle counts for the native IO isolate will be surfaced in another CL.

BUG=
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2601153002 .
2017-01-03 12:21:16 -08:00
Ben Konyi e28b3e3c60 Revert "Added isolate + thread high watermark tracking to Observatory"
This reverts commit 0a1a534fd9.

BUG=
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2605933003 .
2016-12-28 16:49:47 -08:00
Ben Konyi 0a1a534fd9 Added isolate + thread high watermark tracking to Observatory
Added tracking of memory usage inside of threads. In addition, the max memory usage is kept track of using a high watermark for both the threads and the isolates. Isolate high watermark information is updated when a thread exits the isolate. The isolate high watermark consists of the sum of all thread high watermarks (including the high watermark of the exiting thread). High watermark information for both threads and isolates is now visible in the isolate view in the Observatory.

BUG=
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2608463002 .
2016-12-28 14:59:22 -08:00
Ryan Macnak 4607e38d28 Reapply "Save and restore feedback from JIT."
Ensure ICData is attached to the callee flow graph in the inliner when built from kernel IR, not just from source.

R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2572423004 .
2016-12-16 16:00:17 -08:00
Ryan Macnak 176d732cc3 Revert "Save and restore feedback from JIT."
This reverts commit 31ee20297e.

Review-Url: https://codereview.chromium.org/2579413002 .
2016-12-16 13:53:20 -08:00
Ryan Macnak 31ee20297e Save and restore feedback from JIT.
- Adjust fingerprints to be independent of the library's private key, which varies with load order.
 - Use usage_counter in AOT inlining decisions if JIT feedback is available.
 - Reduce inlining in cold functions.

dart2js product aot snapshot 15841351 -> 14436273 (-8.86%)

R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2562693003 .
2016-12-16 10:21:40 -08:00
Ryan Macnak e48f143006 Internally measure isolate uptime with monotonic time.
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2583663002 .
2016-12-15 14:34:04 -08:00
Ben Konyi 9f8a85c19b Added task kind field to thread JSON output.
BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2565253004 .
2016-12-12 17:08:45 -08:00
Ben Konyi 21192e0227 Updated format string to reflect actual type.
BUG=
R=zra@google.com

Review URL: https://codereview.chromium.org/2566283002 .
2016-12-12 11:13:22 -08:00
Ben Konyi 69be515447 Fixed build issue introduced with last commit.
BUG=
R=johnmccutchan@google.com, zra@google.com

Review URL: https://codereview.chromium.org/2573483004 .
2016-12-12 10:32:01 -08:00
Ben Konyi d217b21ca6 Added conversion from thread id to intptr that fixes breaking build.
BUG=
R=johnmccutchan@google.com, zra@google.com

Review URL: https://codereview.chromium.org/2570583002 .
2016-12-12 10:13:44 -08:00
Ben Konyi 35a49bc1ff Created methods to surface zone memory information for each isolate and thread in JSON.
BUG=
R=asiva@google.com, johnmccutchan@google.com, zra@google.com

Review URL: https://codereview.chromium.org/2554983002 .
2016-12-12 09:56:49 -08:00
Todd Turnidge 2d22e85cf0 Revert "Revert "JumpToFrame refactor"" + Fix
This reverts commit 1cdb3d2155.

I have also added in a fix for the lazy-deopt in exception handler case.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2506503002 .
2016-11-21 08:49:18 -08:00
Todd Turnidge 1cdb3d2155 Revert "JumpToFrame refactor"
This reverts commit 5ed13d3298.

BUG=

Review URL: https://codereview.chromium.org/2503623003 .
2016-11-14 15:57:01 -08:00
Todd Turnidge 5ed13d3298 JumpToFrame refactor
- Refactor the JumpToExceptionHandle code so that it is now built from
  two pieces: JumpToFrame and RunExceptionHandler.

- Refactor the Simulator::Longjmp() code so that it is no longer
  exception-specific.  Instead it uses the RunExceptionHandler stub.

This makes it so that the JumpToFrame stub and Simulator::JumpToFrame
have the same semantics.  This will make it easier to land the Rewind
changes I am working on.

There are some oddities for dbc.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2503653002 .
2016-11-14 14:38:21 -08:00
Zachary Anderson a1bcf051d8 clang-format runtime/vm
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2481873005 .
2016-11-08 13:54:47 -08:00
John McCutchan bc119f28bb Relax zone allocation assertion
- [x] Allow allocation in any zone that is owned by the current thread not just the top zone.

BUG=
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2360963005 .
2016-09-23 13:06:14 -07:00
Siva Annamalai da487a567c Fix for issue 27380 - VM stuck in deadlock with background finalization and background compiler thread
- fixed an inadvertant flip in the safepoint check in this cl
    https://github.com/dart-lang/sdk/commit/e72c1fb47

  -  return (IsMutatorThread() ||
  -          (isolate_ != NULL && !isolate_->thread_registry()->AtSafepoint()));
  +  return (IsMutatorThread() || IsAtSafepoint());

- increase the scope of CanCollectGarbage in Heap::AllocateOld to also
  account for the tasks lock as checking for tasks inside a safepoint
  scope can lead to deadlocks

- fix an aggressive assertion in compiler for expected errors being only
  LanguageErrors to allowing UnhandledExceptions (OOM, stack overflows etc.)

- fix an aggressive assert in exception handler (handler pc can be 0 even in the mutator thread.

- workaround issue 27413 in PageSpace::CanIncreaseCapacityInWords

BUG=27380
R=fschneider@google.com

Review URL: https://codereview.chromium.org/2363823002 .
2016-09-23 10:14:12 -07:00