Commit Graph

494 Commits

Author SHA1 Message Date
Siva Annamalai 3067a27a8c Make the lock/unlock and Enter/Exit methods in Mutex and Monitor private so taht we always use the locker objects for operating on mutexes/monitors.
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1758503002 .
2016-03-02 09:20:40 -08:00
John McCutchan b2249f30fd Add persistent handles to service protocol and Observatory UI
VM Changes:

- Add private _getPersistentHandles service RPC.
- Add service_test for _getPersistentHandles.

Observatory Changes:

- Add Persistent Handles page.
- Display persistent handles in a curly-block
- Display weak persistent handles in a sortable table.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1719313002 .
2016-03-01 07:31:29 -08:00
John McCutchan b482480b65 Improve behaviour when we hit a stack overflow / OOM error
Fixes #25815

VM changes:

- Don't crash in SignalExceptionThrown when we have no stack frames.

- Notify the debugger about an unhandled stack overflow / OOM *after* setting the sticky error. This allows Observatory to display it.

- When pausing without a debugger attached, print the sticky error if one is set.

- Improve stack trace frame numbers when printing for a stack overflow.

Observatory changes:

- Report the sticky error for pause at unhandled exception as well as exit.

- Let the user know that we cannot pause for unhandled stack overflow / OOM exceptions.

- Don't show the "at <func> (<script location>)" string in the isolate summary, if we don't have a top frame.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1709383002 .
2016-02-25 07:33:01 -08:00
Ryan Macnak 0c86f0d58b VM service fixes for noopt/precompiled.
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1701383002 .
2016-02-17 14:06:24 -08:00
John McCutchan 5c8d79c55a Add step OverAwait to service protocol
Additions to service protocol:

- PauseEvent includes an "atAsyncContinuation" boolean value.
- Resume command can take an 'OverAsyncContinuation' step mode.
- Breakpoints have an optional 'isSyntheticAsyncContinuation' boolean value.

Added low level step_over_await_test.

Issuing the OverAsyncContinuation resume command does the following:

- Adds a synthetic breakpoint (#1) to the async closure.
- Resumes the isolate.
- When we hit #1, the VM issues a StepOver and then reports us paused at #1.

At the next resume command, the VM will remove #1.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1699153002 .
2016-02-17 11:02:55 -08:00
John McCutchan 87b1ead8f5 Fix windows build by not using strcasestr
- Also fix no_support_timeline test.

Review URL: https://codereview.chromium.org/1692743003 .
2016-02-12 14:02:09 -08:00
John McCutchan cda760915c Add fine grained command line and service protocol control over timeline streams recording
- Add --timeline-streams= flag which takes a comma separated list of streams to record.
- Send "availableStreams" and "recordedStreams" in the _getVMTimelineFlags RPC. Also include the type of recorder we are using.
- Enable setting of "recordedStreams" in the _setVMTimelineFlags RPC.

R=zra@google.com

Review URL: https://codereview.chromium.org/1690333002 .
2016-02-12 13:18:25 -08:00
John McCutchan 1e6c5f196b Add 'runnable' to Isolate service response
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1676233003 .
2016-02-08 10:14:17 -08: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
John McCutchan 6f76e2af99 Add necessary support functions so that embedders can implemented pause on start and exit
- Add Dart_ShouldPauseOnStart, Dart_SetShouldPauseOnStart, Dart_IsPausedOnStart, Dart_SetPausedOnStart, Dart_ShouldPauseOnExit, Dart_SetShouldPauseOnExit, Dart_IsPausedOnExit, Dart_SetPausedOnExit to query and control pause on start / exit from outside of the default message handler.
- Add Dart_HandleMessages to process all regular messages from outside the default message handler.
- Allow per isolate overriding of pause on start / pause on exit flags.
- Set the resume_request bit when resuming from isolate start / exit.
- Clear the resume_request bit in the default message handler.
- Rename MessageHandler fields and accessors.
- Rename Isolate::Resume to Isolate::SetResumeRequest.

R=turnidge@google.com

Review URL: https://codereview.chromium.org/1665773004 .
2016-02-03 15:33:40 -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
Siva Annamalai e72c1fb47d Implement safepointing of threads :
- uses thread execution status transition to track when a thread is in a safepoint or needs to block for a safepoint
 - introduces a monitor per Thread object
 - uses a per thread safepoint handshake between the thread requesting a safepoint and the requested thread.

The ThreadRegistry class now contains only the thread list for an isolate and the functionality of scheduling a thread onto an Isolate and unscheduling it from teh isolate. We could fold this functionality into the Isolate class in a different CL.

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

Review URL: https://codereview.chromium.org/1541073002 .
2016-02-01 10:57:34 -08:00
Todd Turnidge 0f1d73fd07 Add --warn-on-pause-with-no-debugger flag. Add this to --observe behavior.
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1649843002 .
2016-01-29 12:19:33 -08:00
John McCutchan ce650790a1 Return an error in many service RPCs if the isolate is not runnable
- Return kIsolateMustBeRunnable error when an isolate must be runnable for a service RPC to complete.

R=turnidge@google.com

Review URL: https://codereview.chromium.org/1645423002 .
2016-01-29 11:16:23 -08:00
Todd Turnidge bf385e448c Document the getSourceReport rpc in service.md. Bump version to 3.1.
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1641133004 .
2016-01-29 10:40:18 -08:00
Todd Turnidge f23610b3e3 Use getSourceReport for coverage/callsites in Observatory.
Move script reloading into the script inset instead of the navbar.

Make the refresh icon do a sticky-header scroll thing (fancy!).

Remove old coverage code from observatory.

BUG=

Review URL: https://codereview.chromium.org/1584173003 .
2016-01-15 09:18:57 -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
John McCutchan bedd2cbf25 Support narrowing a timeline to a given time window
- Assign correct timestamps for timeline events from Dart code.
- Support optional 'timeOriginMicros' and 'timeExtentMicros' to _getVMTimeline service RPC.
- Relax time extent check in profiler.

R=asiva@google.com

Review URL: https://codereview.chromium.org/1533323004 .
2015-12-22 09:18:45 -08:00
John McCutchan d187d4745e Support narrowing a cpu profile to a given time window
- Add optional 'timeOriginMicros' and 'timeExtentMicros' parameters to all CPU profile service protocol RPCs.
- Add test to verify that time filtering works.

R=asiva@google.com

Review URL: https://codereview.chromium.org/1541893002 .
2015-12-21 14:07:49 -08:00
John McCutchan 89c49b9e87 Add dart:developer.postEvent for posting events to the service protocol from Dart code
- Add dart:developer.postEvent for posting events to the service protocol.
- Add 'Extension' service protocol event stream.
- Unit test.
- Update service.md

- Bug fix for logging stream.

R=turnidge@google.com

Review URL: https://codereview.chromium.org/1537523002 .
2015-12-17 09:34:52 -08:00
Ryan Macnak 55a22037fb Fix get_cpu_profile_timeline_rpc_test.
AddProperty64 encodes as a JSON integer, not a JSON string.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1535513002 .
2015-12-16 13:42:06 -08:00
Ryan Macnak a0e0ac78cb Observatory: Include profiler samples in the timeline view.
- Add pre-isolate service RPC that emits profiler samples in about:tracing format.
 - Make timeline UI automatically merge the event timeline with the sample timelines.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1525913002 .
2015-12-16 10:11:44 -08:00
Zachary Anderson a0970835f0 Adds a special case for sending an int over a port with the native API.
This improves dart <=> C++ IPC round-trip-times for Mojo by 10-20%.

BUG=

Review URL: https://codereview.chromium.org/1499853004 .
2015-12-11 16:07:16 -08:00
Matthias Hausner e3457758ed Remove Field::FindFieldIndex() and update service protocol
This paves the way to remove functions and fields from top-level
classes. They are looked up via the class dictionary when resolving
names.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1477573002 .
2015-11-24 15:42:03 -08:00
Ryan Macnak 75cd019a9c Add RPC and UI for reachable size of an object / all instances of a class.
BUG=http://dartbug.com/24945
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1453983002 .
2015-11-20 10:02:16 -08:00
Florian Schneider 64e71a0b2e VM: Make more globals constant where easily possible.
Remove -fdata-section again from the Linux build configuration: It prevented
some optimizations in gcc and clang - fewer things were recognized as constants.

Add const to pointers/arrays in some places to help compilers with determining
what is a constant.  A common pattern is strlen of a string literal const char*,
or an array of function pointers.

Tested with gcc 4.8.4 / clang 3.4 and improves code qualtiy + reduces binary size.

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

Review URL: https://codereview.chromium.org/1462953002 .
2015-11-20 10:52:07 +01:00
Matthias Hausner 648e52baa8 Collect closure functions in isolate
Instead of collecting closures functions in each class object, maintain one list per isolate. This is a step towards getting rid of top-level classes.

I'd appreciate if John could take a look at the service isolate and coverage related change.

I'd appreciate if Ryan could take a look at the precompilation related change.

When compiling all of corelib, the list of closures in the isolate is about 600 entries long. If this linear list should become a bottleneck, I'll deal with it later. (Sadly, some code relies on the fact that a closure can be identified with a list index, so making it a hash table instead of an array does not work.)

BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1436243005 .
2015-11-17 15:40:27 -08:00
John McCutchan 43b0ae00e7 Timeline service protocol support with Observatory UI
Service Protocol:
- _clearVMTimeline (clear timeline)
- _getVMTimeline (fetch timeline)
- _setVMTimelineFlag (control recording)
- _getVMTimelineFlag (...)
- _getVMTimeline service unit test

Observatory:
- timeline page with record on/off, clear timeline, and refresh buttons.
- trace-viewer based timeline view that runs in an iframe driven by a small javascript program

Misc:
- Fix default enable logic bugs
- Add 'Debugger Pause' timeline event
- Threads can have a name and that name will be displayed in Observatory
- Tighten up locking when printing JSON

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1406413006 .
2015-11-10 08:02:22 -08:00
Ryan Macnak 37dd876bf1 VM: Service isolate under precompilation.
- Include the embedder's portion of the service isolate's Dart code in precompiled snapshots. Swap it in as the root library when running precompiled instead of loading from source.
- Make linter happy with gen_snapshot.
- Fix profiler to consider Instructions in the VM isolate may have their corresponding Code in the regular isolate.
- Make non-functional service RPCs fail cleanly instead of crashing.

BUG=http://dartbug.com/24651
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1418833004 .
2015-10-29 15:15:46 -07:00
Srdjan Mitrovic cd98aff665 Getting rid of Isolate::current_zone() usage. Pass thread instead of isolate where it makes sense.
BUG=
R=hausner@google.com, johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1424703004 .
2015-10-26 15:31:50 -07:00
John McCutchan 2844eb86ca Service isolate requests Observatory assets from embedder
- Provide a new callback to Dart_Initialize that will be called when the service isolate needs the Observatory assets
- Move asset management code out of embedder and into common dart:_vmservice
- Use the tar format as the archive format
- Add build script to generate .cc file containing the archive
- Add a simple tar parser to service isolate

This makes it possible for embedders to not bake Observatory into their executable but instead load it off disk or over the network. The standalone embedder still links Observatory into the executable.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1411853003 .
2015-10-26 07:21:23 -07:00
Srdjan Mitrovic b9426418d8 Get rid of deprecated methods accessing mutator_thread_ instead of current thread
BUG=
R=zra@google.com

Review URL: https://codereview.chromium.org/1410643008 .
2015-10-20 10:26:08 -07:00
Srdjan Mitrovic 465cf10a7c Remove some Isolate::current_zone() calls, as it gets the zone from mutator thread not the current thread
BUG=
R=zra@google.com

Review URL: https://codereview.chromium.org/1414493003 .
2015-10-19 10:27:36 -07:00
Todd Turnidge cc672473b9 Use offset and count to request slices of lists, maps, and typed_data.
This should allow debugging clients to support pagination of these
potentially large types.

Closes #24536

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1400393002 .
2015-10-14 11:05:21 -07:00
Ryan Macnak 8df96f0f48 -Fix display of megamorphic miss function.
-Fix inbound reference of megamorphic miss function.
-Speculative fix for eval Script.
-Rationalize isolate list as isolate list.
-Fix attempted eval in precompiled isolate.

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1403883002 .
2015-10-13 10:26:44 -07:00
Srdjan Mitrovic 5039117f50 Remove isolate parameter when allocating handles
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1401643002 .
2015-10-12 15:51:06 -07:00
John McCutchan 9bd7fe7fd3 Add kInvalidExceptionPauseInfo and fix the build
BUG=
R=iposva@google.com

Review URL: https://codereview.chromium.org/1399583003 .
2015-10-12 11:33:04 -07:00
John McCutchan 9dd7680fd8 Straw man setExceptionPauseMode
BUG=
R=turnidge@google.com

Review URL: https://codereview.chromium.org/1399743002 .
2015-10-12 11:04:44 -07:00
Srdjan Mitrovic 53e814f0dd Move reusable handles from isolate to thread.
BUG=
R=koda@google.com

Review URL: https://codereview.chromium.org/1394673002 .
2015-10-09 10:10:34 -07:00
Todd Turnidge 435bcdbe6c We can now name the current VM using the service protocol.
Adds a 'VM' stream and a 'VMUpdate' event.

Makes Event.isolate optional in service.md.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/1398823002 .
2015-10-08 15:37:49 -07:00
Todd Turnidge 0d501ad53d VM restart + shutdown fixes
This change add the ability to restart the vm through the service
protocol.  All isolates are killed, and then the main isolate is
restarted cooperatively by the embedder.

This change also fixes the message handler to prevent it from
accidentally ignoring vm shutdown messages.

Previously, we would stop handling messages whenever we hit an error
(such as a compile error or an unhandled exception).  This would leave
shutdown requests sitting the oob queue, neglected.

We now process *all* oob requests, up to the first shutdown request.
When we hit a shutdown request, we clear the oob queue and process no
more messages.

To make all of this work, we had to change the return value of
HandleMessage from bool to a new enum type, allowing the message
handler to distinguish *normal* error cases from the more rarified
shutdown and restart cases.

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

Review URL: https://codereview.chromium.org/1371193005 .
2015-10-06 11:27:26 -07:00
John McCutchan fd6135927e Ensure that service protocol specification and implementation use the correct numeric types
Fixes #24245

R=turnidge@google.com

Review URL: https://codereview.chromium.org/1387433002 .
2015-10-01 11:05:13 -07:00
Todd Turnidge 473413753d Some changes to service protocol before we land 1.13.
- Split AddBreakpoint into two rpcs: AddBreakpoint and
  AddBreakpointWithScriptUri.

- Remove Isolate.entry.

Closes #24329

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1379163002 .
2015-10-01 10:46:44 -07:00
Todd Turnidge 66f9abc7e3 Refactor isolate interrupts to use OOB messages instead of interrupt bits.
Closes #24349

R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1344993002 .
2015-09-23 12:13:25 -07: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
John McCutchan fdf79d85a2 Add LookupHeapObjectMessage and hook into LookupHeapObject
- This makes isolate messages behave like other instances over the service protocol.

R=turnidge@google.com

Review URL: https://codereview.chromium.org//1339713002 .
2015-09-11 10:22:40 -07:00
Todd Turnidge dee6ddf966 Support column-based breakpoints in the VM and Observatory.
BUG=
R=hausner@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org//1312763010 .
2015-09-09 09:01:13 -07:00
Ivan Posva 0a0b101fbd - Remove deprecated StackZone constructor with Isolate parameter.
R=srdjan@google.com

Review URL: https://codereview.chromium.org//1312813006 .
2015-09-02 16:07:48 -07:00