Commit Graph

32 Commits

Author SHA1 Message Date
Dmitry Stefantsov df8deddfa5 [vm] Skip functions in source reports if their token pos is unknown
Change-Id: I2f953ee5745dd7193a77098d0e83d5ac247f5886
Reviewed-on: https://dart-review.googlesource.com/43720
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-02-26 14:35:56 +00:00
Ryan Macnak 074b43c863 [vm] Don't let the optimizer mislead coverage data.
Coverage uses the value of an execution counter to detect executed functions. However non-positive execution counter does not necessary mean that a function was never executed because we sometimes reset the counter.

Introduce additional bit on a function that is set whenever we reset positive execution counter and use this bit when generating coverage data.

Bug: https://github.com/dart-lang/sdk/issues/31326
Change-Id: I5357109603defad7e7c9415c433203f16bcf88f4
Reviewed-on: https://dart-review.googlesource.com/19760
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2017-11-10 22:35:48 +00:00
Ryan Macnak 3d409223a3 [vm] Report a coverage tick for the function as a whole.
This ensures leaf functions have some coverage data.

Bug: https://github.com/dart-lang/sdk/issues/31215
Change-Id: I6efc2e1c002e26cd0483dce5a8a1c2b6d8958d13
Reviewed-on: https://dart-review.googlesource.com/16684
Reviewed-by: Zach Anderson <zra@google.com>
2017-10-26 16:50:30 +00:00
Vyacheslav Egorov 8a179fb953 [VM, Compiler] Move compiler to a separate folder.
New folder structure (nested under vm/):

- compiler/
-   jit/         - JIT specific code
-   aot/         - AOT specific code
-   backend/     - all middle-end and back-end code (IL, flow graph)
-   assembler/   - assemblers and disassemblers
-   frontend/    - front ends (AST -> IL, Kernel -> IL)

compiler/README.md would be the documentation root for the compiler
pipeline

Bug: https://github.com/dart-lang/sdk/issues/30575
Change-Id: I2dfd9688793bff737f7632ddc77fca766875ce36
Reviewed-on: https://dart-review.googlesource.com/2940
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2017-09-04 15:15:18 +00:00
Alexander Markov bda3c9c2b2 Simplify and fix implicit closure check, speed up Closure_equals, v2
This is the re-application of 44e8da3ecd
with fixes:
* Dartanalyzer error is fixed in the new test isolate/message4_test
* The new test is skipped in the status file in dart2j/non-d8 modes,
  issue #30247 is created.
* Minor tweak of Closure_equals: other.IsClosure() is tested earlier.

Original CL review:

https://codereview.chromium.org/2989493002/

Original CL description:

This CL introduces a new Function kind, kImplicitClosureFunction, in
order to simplify check for implicit closures and make it more
efficient.

This CL also fixes Function::IsImplicitStaticClosureFunction(RawFunction*)
to correctly handle implicit closures created from static native
functions.

Closes #30203.

As the result of a faster check for implicit closures and slight
refactoring of Closure_equals, micro-benchmark exercising Closure_equals
speeds up from 9618ms to 6700ms for implicit closures case and
insignificantly for other cases.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2987703002 .
2017-07-24 09:43:52 -07:00
Alexander Markov 45dddb2807 Revert "Simplify and fix implicit closure check, speed up Closure_equals"
This reverts commit 44e8da3ecd.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2984083002 .
2017-07-21 15:39:20 -07:00
Alexander Markov 44e8da3ecd Simplify and fix implicit closure check, speed up Closure_equals
This CL introduces a new Function kind, kImplicitClosureFunction, in
order to simplify check for implicit closures and make it more
efficient.

This CL also fixes Function::IsImplicitStaticClosureFunction(RawFunction*)
to correctly handle implicit closures created from static native
functions.

Closes #30203.

As the result of a faster check for implicit closures and slight
refactoring of Closure_equals, micro-benchmark exercising Closure_equals
speeds up from 9618ms to 6700ms for implicit closures case and
insignificantly for other cases.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2989493002 .
2017-07-21 14:26:56 -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
Ben Konyi cc68a66f28 Updated native memory allocation profiling to use its own sample buffer instead of sharing a sample buffer with the CPU profiler, which did lead to samples being quickly overwritten even if the memory hadn't yet been freed. This will ensure allocations are accurately displayed in Observatory as the CPU profiler will no longer overwrite samples associated with native memory allocations.
BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2966593002 .
2017-07-10 10:31:45 -07:00
Matthias Hausner 408a64756e Fix setting breakpoint setting in await statements
CL https://codereview.chromium.org/2626753002 introduced a “real” token
position for the synthetic code that re-throws an exception returned
by an await’ed expression. This interferes with setting a breakpoint
in a line that contains an await, since the synthetic code happens to
be at the lowest compiled code address and will thus be picked as the
breakpoint location.

This CL makes the re-throw a synthetic token position again, but
includes synthetic token positions in stack traces. This is an alternative
fix for bug #28325.

BUG=#28770
R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2727803002 .
2017-03-02 12:21:42 -08:00
Ben Konyi 68a102cab2 Fixed tests not having MallocHooks initialized for tests in release mode.
Revert "Revert "Fixed issue in MallocHooks where a MallocHookScope was accidentally removed during a merge, causing a deadlock in the hooks. Also turned off stack trace collection in a test that was timing out as a result of the stack trace collection.""

This reverts commit 1a5b555aa9.

BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2711353003 .
2017-02-24 13:56:06 -08:00
Ben Konyi 1a5b555aa9 Revert "Fixed issue in MallocHooks where a MallocHookScope was accidentally removed during a merge, causing a deadlock in the hooks. Also turned off stack trace collection in a test that was timing out as a result of the stack trace collection."
This reverts commit 44a9a4ede3.

BUG=

Review-Url: https://codereview.chromium.org/2714083002 .
2017-02-23 19:21:00 -08:00
Ben Konyi 44a9a4ede3 Fixed issue in MallocHooks where a MallocHookScope was accidentally removed during a merge, causing a deadlock in the hooks. Also turned off stack trace collection in a test that was timing out as a result of the stack trace collection.
Updated MallocHooks to collect stack traces when memory is allocated.

BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2718523003 .
2017-02-23 18:58:50 -08:00
Ben Konyi d4f026c2e0 Revert "Updated MallocHooks to collect stack traces when memory is allocated."
This reverts commit a486a8a26b51dce728373183ab02aeda70e6f2d0.

R=johnmccutchan@google.com
TBR=johnmccutchan@google.com
BUG=

Review-Url: https://codereview.chromium.org/2713803003 .
2017-02-23 13:13:44 -08:00
Ben Konyi 47f0da9cd7 Updated MallocHooks to collect stack traces when memory is allocated.
BUG=
R=johnmccutchan@google.com, zra@google.com

Review-Url: https://codereview.chromium.org/2680213002 .
2017-02-23 12:42:18 -08:00
Florian Schneider 5399d8acf6 Fix Flutter profile_unopt and release_unopt builds
Fixes #27862.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2516033002 .
2016-11-20 12:17:50 -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
Ryan Macnak 5f2ea64b13 Remove dead code for writing ICData entries.
R=cbernaschina@google.com

Review URL: https://codereview.chromium.org/2307673002 .
2016-09-01 15:58:32 -07:00
Zachary Anderson e933f28a18 Remove some uses of STL map.
This CL removes the use of STL map from freelist.cc by adding
MallocDirectChainedHashMap in hash_map.h and adding an iterator for
BaseDirectChainedHashMap there.

It also removes a use of STL map from hash_table.h that was dead code.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2083103002 .
2016-06-22 08:32:37 -07:00
Todd Turnidge 424ca27a15 Fix various nefarious problems with the script table used in source reports.
Before we could get duplicate or spurious script table entries.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2038203002 .
2016-06-06 11:22:46 -07:00
Zachary Anderson 1dfc62c870 Fix Observatory crash for DBC
related #26405

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1971543002 .
2016-05-10 14:37:51 -07:00
Zachary Anderson 87c4171b64 SourceReport should test result of RestoreIcDataMap for NULL entries
Entries in the result can't be the null object, but they can be NULL.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1965523002 .
2016-05-09 14:21:10 -07:00
Todd Turnidge 956ac4c183 Fix getSourceReport's forceCompile option for unused classes.
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1916243002 .
2016-05-04 11:02:06 -07:00
John McCutchan a48732a03d Remember thread's task when sampling use it when filtering
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1820013002 .
2016-03-22 08:42:06 -07:00
John McCutchan ffbd0b763a Add profile data to getSourceReport
- Add new getSourceReport kind 'Profile'.
- Add "profileTicks" to source ranges that have profile data.
- "profileTicks" is organized as three arrays: positions, inclusive ticks, and exclusive ticks. These arrays are indexed together.
- Keep source positions in profile sorted by token position value.
- Misc improvements to debug printing in profiler.
- Add unit test for profile getSourceReport.

R=turnidge@google.com

Review URL: https://codereview.chromium.org/1779333004 .
2016-03-14 07:04:23 -07:00
Srdjan Mitrovic 420843a75f Clone both descriptor and data array when compiling in background. Eliminates crashes when ic_data array invocation counter is changed while compiling (e.g., NumberOfUsedChecks can change on the fly).
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/1700463002 .
2016-02-12 14:54:55 -08:00
Srdjan Mitrovic 5cba052d70 Bailout if field state changed during background compilation.
Bailout if deferred loading cleared ic_data_array.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1672873003 .
2016-02-08 12:51:15 -08:00
John McCutchan d77d376124 Replace intptr_t with TokenDescriptor
- Use TokenDescriptor instead of intptr_t for all token positions.
- Use TokenDescriptor in raw_object instead of int32_t.
- TokenDescriptor is a POD with an int32_t (this shrinks the size of AST and IR nodes by 32-bits on 64-bit architectures).

There are some cleanups I plan on doing as a follow up CL:

- Replace TokenDescriptor::value() with TokenDescriptor::TokenPos()

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

Review URL: https://codereview.chromium.org/1644793002 .
2016-02-02 10:15:44 -08:00
Todd Turnidge 539ac23fb4 Add PossibleBreakpoints source reporting.
This allows tools developers to discover which token positions
correspond to possible breakpoints in the code.

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1586253002 .
2016-01-15 09:02:38 -08:00
Todd Turnidge a283265955 Add the forceCompile param to _getSourceReport.
Deal with some empty ranges that were being emitted.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1562993003 .
2016-01-07 11:33:33 -08:00
Todd Turnidge 61d9752c7e Expose the new _getSourceReport api in the service protocol.
Allow multiple reports to be requested simultaneously.

I'm not exposing this publicly yet -- still nailing down the format a bit.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1566793002 .
2016-01-06 13:01:33 -08:00
Todd Turnidge 26af34a1b3 Add SourceReport, a class for generating Dart source-level reports.
These reports provide information tied to token positions in the
Dart source program.

SourceReport can generate multiple kinds of reports.  Right now it
implements code coverage and call site reports.  In the future it
could provide, for example, valid breakpoint sites or source-level
profiles.

Scripts are refered to by index within the report and a script table
is tacked on the end.  This avoids a bit of duplication.

In a future cl I will expose this reporting through the vm service.
After that, we can remove our older coverage/callsite code.

----------
Very simple, sample coverage report:

{
  "type": "SourceReport",
  "ranges": [
    {
      "scriptIndex": 0,
      "startPos": 0,
      "endPos": 4,
      "compiled": true,
      "coverage": {
        "hits": [],
        "misses": []
      }
    },
    {
      "scriptIndex": 0,
      "startPos": 6,
      "endPos": 10,
      "compiled": false
    },
    {
      "scriptIndex": 0,
      "startPos": 12,
      "endPos": 39,
      "compiled": true,
      "coverage": {
        "hits": [ 23 ],
        "misses": [ 32 ]
      }
    }
  ],
  "scripts": [
    {
      "type": "@Script",
      "fixedId": true,
      "id": "libraries\/15\/scripts\/test-lib",
      "uri": "test-lib",
      "_kind": "script"
    }
  ]
}

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1533653003 .
2016-01-04 10:56:52 -08:00