Commit graph

34 commits

Author SHA1 Message Date
Clement Skau 3c8115db5a [test] Fixes memory issue in json test.
JSON_JSONStream_DartObject used to elide a JSON string longer
than 1024 into a buffer of 1024 bytes, which was causing memory
issues, including tripping ASAN.
This is fixed by doubling the buffer.

This CL also adds ASSERTs to ensure all buffers used with
`ElideJSONSubstring(..)` are big enough.

TEST=Existing, updated tests.
Bug: https://github.com/dart-lang/sdk/issues/46246
Change-Id: I7ce86429efecd91e768be413fd86f7d3c53c5d52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202244
Auto-Submit: Clement Skau <cskau@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2021-06-03 13:14:14 +00:00
Ben Konyi fa5da6a944 [ VM / Service ] Move sourceLocation property to reference objects for Class, Function, and Field.
Token position and script reference information are cheap to provide and
make it possible to tie objects to scripts without requiring additional
requests for full objects.

TEST=Existing

Change-Id: I917714149a72a53081fee5626ccad858e86f5313
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201864
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2021-06-02 22:18:32 +00:00
Tess Strickland fa03ee7782 [vm] Create a common base class for TextBuffer/ZoneTextBuffer.
Generally, methods that take a *TextBuffer pointer do not care how the
internal buffer is allocated, and so they could be used for either if
both were subclasses of a base class that contained the printing
methods.  This CL makes that base class, and now TextBuffer and
ZoneTextBuffer now share the exact same set of methods for printing to
the internal buffer.

Since the base class is in platform, this does mean dropping the
overload of AddString for Dart String objects that was part of
ZoneTextBuffer.  Instead, this CL just adds an intermediate call to
ToCString() for the small number of callers that used the overload,
keeping the printing interface the same for both.

In addition, one use of TextBuffer that then re-allocated the buffer
contents into the zone manually has been replaced with a ZoneTextBuffer
instead.

Change-Id: I438a085e7e20d55d93987fd7f36afd636f95955f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157741
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2020-08-07 18:09:35 +00:00
Ben Konyi bdc91968a2 [ VM / Service ] Updated JSONWriter::PrintValue(double) to use double_conversion instead of Printf.
Fixes #31737

Change-Id: If70b7b6bdd1e977bda310a2b0566dcd48c6b3c6a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/101101
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2019-05-03 18:07:27 +00:00
Vyacheslav Egorov 1dd4559271 [vm] Add Native->VM transitions when dereferencing API handles.
For example setting return value unwraps handles and stores
raw pointer values to the stack which might race with GC
in another thread.

This CL adds assertions in helper methods from Api class which
unwrap API handles and fixes all places that were revealed by
those assertions.

Caveat: we still permit to check whether handle contains
Smi or not without entering VM state - because GC does not
change this property.

Bug: b/127482366
Change-Id: I59f08c2a91935995514fb70607c2777aa2844d94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95654
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-03-08 00:06:37 +00:00
Ryan Macnak 7514ce941e [vm] Assert handles are only allocated when the thread is preventing safepoints.
Threads in the native or blocked states don't prevent safepoints, so they may run concurrently with a safepoint operation like GC. It is not safe for handles to be allocated while the GC is visiting them, so these threads must not allocate handles. Assert only threads in the VM or generated states, which prevent safepoints until they check in, may allocate handles. (Generated code does not allocate handles, but leaf runtime entries remain in the generated state.)

Bug: https://github.com/dart-lang/sdk/issues/34883
Change-Id: I1a211778f7ef96b53a2405f0ee9dde7871b122b6
Reviewed-on: https://dart-review.googlesource.com/c/81540
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-10-31 19:51:52 +00:00
Ryan Macnak 3d21a46b72 Limit preserialized JSON for timeline events from Dart code to the arguments.
Avoids string copies in C++ and map copies in Dart.

Also remove some vestiages of removed feature that allowed an embedder to add pre-encoded events to the timeline.

Change-Id: I962a67093ba461c991d9169b0391c44af1d489db
Bug: https://github.com/dart-lang/sdk/issues/30787
Reviewed-on: https://dart-review.googlesource.com/6762
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2017-09-19 23:29:55 +00: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
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
Carlo Bernaschina 21ce02fb70 Use official JSON encoding for stream
Closes https://github.com/dart-lang/sdk/issues/26721

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/2081433002 .
2016-06-28 15:40:08 -07:00
John McCutchan 9bc7398eb8 Ensure embedder timeline callbacks are called for service protocol requests
BUG=
R=chinmaygarde@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org/1799933002 .
2016-03-15 07:59:04 -07:00
John McCutchan d295b9c311 Remove many features when building product mode
Move all JSON printing code from object.cc to object_service.cc.

Not compiled in:

- Service protocol
- Debugger
- Debugger API
- JSONStream
- ObjectIdRing
- Profiler service
- Object JSON printing

Size of dart_bootstrap before: 5670365 bytes
Size of dart_bootstrap after: 5287631 bytes

Reduction in size: 382734 bytes.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1660063002 .
2016-02-05 09:55:51 -08:00
Todd Turnidge 222f6726d0 getObject now supports specifying offset,count for strings.
Closes #25157

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1653183002 .
2016-02-01 14:49:47 -08:00
Ivan Posva 6249c2bcf3 - Remove the legacy debug protocol.
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org/1497033003 .
2015-12-03 17:46:02 -08:00
Todd Turnidge b0ca0789be Fix a variety of service protocol bugs.
Add documentation for breakpoint.

Fix Instance.pattern documentation.

Fix Instance.bytes documentation.

Add class field for null instances.

Fix documentation of Context and closureContext.

Make getObject return Collected for deleted breakpoints.

Closes #24247
Closes #24249
Closes #24309
Closes #24325
Closes #24326
Closes #24327

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1341473002 .
2015-09-11 12:29:21 -07:00
Todd Turnidge 8adf7de6d1 Introduce Instance.kind.
Use this instead of subclassing Instance in the service protocol.

Revise many instance property names.

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

Review URL: https://codereview.chromium.org//1162133002
2015-05-29 13:02:36 -07:00
John McCutchan b7534facef Include 'fixedId' key when printing service ids
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1157173005
2015-05-26 16:56:31 -07:00
turnidge@google.com d554f4fbfe Finish moving service protocol to json rpc.
Service

- Remove support for old-style service requests.

- Drop 'arguments' from JsonStream and ServiceRequestHandler.

- Json-rpc inspired renaming: command->method, options->params all over.

- Implement getFlagList, setFlag, getObjectByAddress.

- Add helpers PrintMissingParamError and PrintInvalidParamError
  to make our error messages more regular.

- Update tests.

- Service_SetSource removed for now.  John will resurrect.

Observatory

- Drop all Deprecated 'get' functions.  We now use json rpc for everything.

- Drop 'link' and 'relativeLink' from ServiceObject -- they were
  ui-specific and they are no longer meaningful anyways.  Use 'id' instead.

- New pages: VMPage, FlagsPage, InspectPage, ErrorPage.  All urls
  used by Observatory are now 'new school' and have a proper
  prefix.  ErrorPage is the new catch-all.

- Pages now use a Uri instead of a url String.  This lets them
  grab query parameters more easily.

- SimplePage replaces IsolateSuffixPage.

- We now use gotoLink() or makeLink() to make our navigation
  links.  gotoLink gets some optional parameters to make it
  easier to construct links to ServiceObjects.

- Rework mouse clicks on the heap map to use getObjectByAddress.

- Remove the breakpoint_list.  It wasn't working.  I'll add it back later.

- Silence logging of getIsolateMetric/getVMMetric.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//897193002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43514 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-05 17:45:52 +00:00
koda@google.com 5aabe1feaf Fix out-of-bounds access in JSONStream test.
Found using AddressSanitizer.

R=asiva@google.com

Review URL: https://codereview.chromium.org//821193003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42562 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-23 17:24:13 +00:00
rmacnak@google.com 128148aafc Preserve the contents of Dart strings with unmatched surrogate halfs by avoiding a UTF16 -> UTF8 -> UTF16 conversion.
Clean up some confusion between code points and code units.

BUG=http://dartbug.com/20583
BUG=http://dartbug.com/20874
R=turnidge@google.com

Review URL: https://codereview.chromium.org//558853004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40174 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-11 18:42:04 +00:00
turnidge@google.com 320c1bb74d Rework how types work in the VM Service.
We now return a "type" property and an optional "_vmType" property for
each response.  We use this to "hide" vm implementation specifics in
the VM Service protocol.

For example, before we might have returned an integer reference with type
"@Smi".  Now it would have the type "@int" and the _vmType "@Smi".

This also allows us to hide funky vm internal types behind the generic
"Object" type.

Updated the protocol.md file somewhat to describe a notion of "private
properties".

Updated the Observatory and unit tests.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//547703002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40044 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-09 17:25:52 +00:00
zra@google.com 7d0b680f95 Adds Simulator Longjmp and enables many tests for arm64.
R=regis@google.com

Review URL: https://codereview.chromium.org//264753002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35603 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-30 23:07:47 +00:00
turnidge@google.com 9243ffc4ff Always use the same json for null in the vm service.
PrintToJSONStream -> PrintJSON.

ALSO:

Fix <em> tags in the Observatory.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//257053003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35532 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-29 18:10:02 +00:00
zra@google.com 2fe51715e5 Begins work on ARM64, first assembler test.
Most new code is in constants_arm64.h and
{assembler,disassembler,simulator}_arm64.{h,cc}

The rest of the CL just #def's out tests, modifies status files,
and adds UNIMPLEMENTED functions, etc.

R=regis@google.com

Review URL: https://codereview.chromium.org//221133002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34654 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-02 17:39:32 +00:00
johnmccutchan@google.com ab19ef4f31 Redo allocationprofile options
BUG=
R=turnidge@google.com

Review URL: https://codereview.chromium.org//217323006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34620 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-01 22:05:39 +00:00
iposva@google.com 52a736ee38 - Disallow copy constructors.
Review URL: https://codereview.chromium.org//23903034

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27346 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-10 17:47:55 +00:00
iposva@google.com 74b2a34d5b - Base JSON stream printing on stack objects.
- Simplify creation of a JSONStream.

- Add experimental coverage output to the VM.

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

Review URL: https://codereview.chromium.org//23875015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27344 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-10 17:21:59 +00:00
hausner@google.com a105ba48fc JSON string decoding for VM debugger
The VM must properly decode JSON strings it receives.

R=regis@google.com

Review URL: https://codereview.chromium.org//23439002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26668 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-26 20:59:16 +00:00
johnmccutchan@google.com 6424b00fa2 Escape strings when writing to JSON.
BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org//22599002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25897 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-07 19:52:32 +00:00
johnmccutchan@google.com 97ef50a1b2 Support stacktrace and objecthistogram service commands
R=asiva@google.com

Review URL: https://codereview.chromium.org//19870006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25726 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-02 00:24:09 +00:00
johnmccutchan@google.com 0ba453b4b6 JSONStream Print Dart Objects
R=iposva@google.com

Review URL: https://codereview.chromium.org//18472009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24841 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-09 14:07:14 +00:00
johnmccutchan@google.com b7608cc5a4 JSONStream and tests
R=iposva@google.com

Review URL: https://codereview.chromium.org//18168003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24697 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-02 16:58:02 +00:00
hausner@google.com 95be46105a Beginnings of a debugger wire protocol
The debugger wire handler is implemented similarly to the io event handler.
A dedicated thread monitors the debugger port for incoming connection
requests. When a debugger is connected, the VM sends events messages
over the wire and handles debugger requests.

To start the VM with a debugger connection, use the option
--debug:<portnumber>. The VM pauses at the beginning of main()
and waits for a debugger to connect.

Subsequent changes will implement debugger commands one by one.
With this change, the VM only understands "resume" commands. 
Review URL: https://chromiumcodereview.appspot.com//10357003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7330 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-04 15:25:49 +00:00
hausner@google.com 84d10e0561 Basic support for reading and writing JSON objects.
This is a minimal implementation that we can grow as needed
for debugger protocols and isolate communication.
Review URL: https://chromiumcodereview.appspot.com//9949054

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6362 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-10 15:28:07 +00:00