Commit Graph

1132 Commits

Author SHA1 Message Date
John McCutchan 3d0c4bf586 Make timeline use the same clock source as mojo's tracing infrastructure
- This ensures that we have consistent timestamps across processes.
- This is necessary to properly support mojo.
- Add new public API to query timeline clock.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1367973004 .
2015-09-25 10:04:23 -07:00
John McCutchan 255fbac021 Fix off by one error in trace-event output
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1368783002 .
2015-09-24 14:02:40 -07:00
John McCutchan 037deed29d Make output of Dart_TimelineGetTrace consumable by mojo
- Mojo TraceCollector expects a comma separated stream of event maps. Adjust the output of Dart_TimelineGetTrace to match that.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1370553002 .
2015-09-24 13:25:18 -07:00
John McCutchan db3421ecfc Make TimelineEventBlocks reclaimable
- Add Timeline::ReclaimAllBlocks and Timeline::ReclaimIsolateBlocks utility functions to ensure that all cached blocks are closed before reporting the timeline
- Adjust Timeline_Dart_GlobalTimelineGetTrace to exercise block reclaiming
- Add ability to reclaim blocks from threads entered into an isolate
- Fix IsolateTimelineEventFilter to actually filter out open blocks
- Make some existing tests call Timeline::ReclaimIsolateBlocks before reporting
- Added implementation and locking notes to timeline.cc

R=turnidge@google.com

Review URL: https://codereview.chromium.org//1363033003 .
2015-09-24 11:32:21 -07:00
Ryan Macnak f6021d0608 Let the embedder provide entry points to Dart_Precompile.
R=srdjan@google.com

Review URL: https://codereview.chromium.org//1359963002 .
2015-09-23 13:18:56 -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
John McCutchan 59ecb80998 Add API to get the VM global timeline
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1360813002 .
2015-09-22 10:53:24 -07:00
John McCutchan 860b9140a7 Add global timeline stream overrides
- Needed for the mojo TraceProvider implementation

R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1362503002 .
2015-09-21 14:23:59 -07:00
Zachary Anderson 7093f2996b VM thread shutdown.
BUG=
R=iposva@google.com, turnidge@google.com

Review URL: https://codereview.chromium.org//1275353005 .
2015-09-15 12:49:52 -07:00
Siva Annamalai 79ef28317f Changes to prepare for allowing script snapshots to be taken after running the main application:
- Rename accessors of class Field to make it more apparent as to what is being accessed (static field values or instance field offsets
- Use precompiled initializer state (Used only during precompilation) to also store saved initial value of static fields (Used only during application snapshot   generation)

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

Review URL: https://codereview.chromium.org//1289643005 .
2015-09-04 11:03:46 -07:00
Ryan Macnak 0ed4d44a99 Toward precompiled snapshots.
Gets as far as encountering null Instructions in the first Dart_Invoke after loading the snapshot.

R=asiva@google.com

Review URL: https://codereview.chromium.org//1318803002 .
2015-09-02 16:15:02 -07:00
Ivan Posva 4bd7cdc75c - Ensure that HandleScope is initialized with a thread. (Remove
deprecated isolate based API.)
- Update all code impacted by this change. E.g. DARTSCOPE
- TEST_CASE now passes the current thread as a parameter to the   unit test.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1310463005 .
2015-09-01 17:18:55 -07:00
Ryan Macnak c3abcd8f93 Add argument to Dart_Initialize for precompiled instructions.
R=asiva@google.com

Review URL: https://codereview.chromium.org//1311963002 .
2015-08-26 11:04:27 -07:00
Ivan Posva 3ff350ed09 - Clarify the order of setting the interrupt bit and posting a message in
Dart_InterruptIsolate.

BUG=

Review URL: https://codereview.chromium.org//1290893006 .
2015-08-20 19:26:25 -07:00
Ryan Macnak 7055e4862b Toward precompiled snapshots.
R=asiva@google.com, fschneider@google.com

Review URL: https://codereview.chromium.org//1290933002 .
2015-08-19 15:34:17 -07:00
Daniel Andersson 00ef260503 Enable concurrent optimization test after migrating scopes to Thread*
Also move static call target table allocation into old space.

Note that stats are not thread-safe, so running two compilers concurrently may lead to inaccurate stats.

BUG=https://github.com/dart-lang/sdk/issues/24109

Review URL: https://codereview.chromium.org//1291803009 .
2015-08-19 15:16:47 -07:00
John McCutchan 1ff7144c31 Switch to a VM wide timeline recorder
- Initialize and shutdown timeline recorder with VM.
- Allocate global blocks for timeline events without an isolate.
- Stop storing the Stream pointer inside a TimelineEvent.
- Store category name in TimelineEvent.
- Store isolate pointer in TimelineEvent.
- TimelineEventRecorder::WriteTo is full VM dump.
- Allow JSONStream to be used without an isolate.
- When a ThreadRegistry is deleted, Finish all open timeline blocks.
- PrintJSON takes a filter.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1294023009 .
2015-08-18 15:18:02 -07:00
Siva Annamalai 228e0877a7 Use Object::null_instance and Object::null_function and do not create Handles everytime.
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//1289813005 .
2015-08-13 10:57:18 -07:00
Adam Barth d6ff3530c7 Fix the Mac build
TBR=asiva@google.com

Review URL: https://codereview.chromium.org//1287883004 .
2015-08-12 16:54:12 -07:00
Adam Barth bc88578fe1 Add Dart_ListGetRange
This API lets you get multiple values out of a list at once, saving overhead.

R=asiva@google.com

Review URL: https://codereview.chromium.org//1284633004 .
2015-08-12 16:46:38 -07:00
John McCutchan 8be0e8a9c5 Refactor Dart_TimelineGetTrace to use a StreamConsumer callback
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1287543003 .
2015-08-11 10:08:31 -07:00
John McCutchan 35cd1fa13c Add timeline stream control and trace retrieval to the dart embedder api.
BUG=
R=turnidge@google.com

Review URL: https://codereview.chromium.org//1276903004 .
2015-08-10 13:47:03 -07:00
Zachary Anderson d4d89d6f12 Reverts VM thread cleanup
BUG=

Review URL: https://codereview.chromium.org//1275853008 .
2015-08-07 19:10:31 -07:00
Zachary Anderson 55bfb3d54b Clean VM thread shutdown:
Second attempt at: https://codereview.chromium.org/1177153005/

This time with fixed error propagation in the embedder.

R=turnidge@google.com

Review URL: https://codereview.chromium.org//1279733003 .
2015-08-07 18:42:00 -07:00
Siva Annamalai 521dee763c 1. Fix the type arguments recursion problem that gets introduced when canonicalization of type arguments is deferred while reading a script snapshot. This problem was shows up as random stack overflow crashes when running pub
2. Patching of the type arguments field in a GrowableObjectArray was missed

BUG=23930
R=regis@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org//1276753002 .
2015-08-06 10:55:48 -07:00
Zachary Anderson 4ca87e6d88 Revert VM thread cleanup
TBR

BUG=

Review URL: https://codereview.chromium.org//1270323002 .
2015-08-05 01:27:01 -07:00
Zachary Anderson 174d552574 Enables clean VM shutdown.
. Disables isolate spawning during Dart_Cleanup.
. Adds a static call Isolate::KillAllIsolates, which sends the
  OOB Kill message to all isolates when called from
  Dart_Cleanup.
. Modifies thread pool shutdown to block until all threads have
  exited.
. Fixes tests.

BUG=
R=turnidge@google.com

Review URL: https://codereview.chromium.org//1177153005 .
2015-08-04 23:29:25 -07:00
Daniel Andersson 7d82391e89 Fix race and limit access to mutator_thread_.
Unsynchronized access to the contents of another thread is dangerous, even for just ASSERTs, as shown by issue 23958.

Verify the bidirectional Isolate<->Thread pointer invariant when *setting* the mutator_thread_ field, and
limit the interface to comparisons with NULL and the current thread.

BUG=https://github.com/dart-lang/sdk/issues/23958
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1260283007 .
2015-08-04 13:30:50 -07:00
John McCutchan 7a0501ce87 Fix shutdown failure path
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1255793005 .
2015-08-04 08:45:01 -07:00
Daniel Andersson fc8286ae71 Migrate NoSafepointScope to Thread, so that helper threads can successfully call Heap::Allocate (but only for old space).
Safepointing is not yet implemented, so helper threads can only allocate when growth control is off and no Dart code is running. But extend unit test to ensure this code path remains exercised as more functionality is added.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1250463004 .
2015-07-22 15:09:54 -07:00
Daniel Andersson 700bd54362 Remove more uses of Isolate::current_zone.
The most substantial change is in Parser and ParsedFunction, which now cache their calling thread. (A similar change was tried unsuccessfully in the past, but can now be safely implemented thanks to the ThreadRegistry state saving.)

Only remaining users are the Object::Handle(Isolate*, [...]) methods. Then, this deprecated interface will be removed.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1242343002 .
2015-07-21 09:37:23 -07:00
Siva Annamalai 69b8da5d86 Fix assertion in FunctionVisitor to account for unresolved types.
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1241953008 .
2015-07-16 14:41:34 -07:00
Todd Turnidge e4684c7627 Provide stdout and stderr output in the Observatory debugger.
Implement two new streams, 'Stdout' and 'Stderr' in the service protocol.

BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1232193003 .
2015-07-14 12:54:07 -07:00
Daniel Andersson c089a152ac Migrate most uses of Isolate::current_zone to Thread::zone.
After https://codereview.chromium.org/1204303003/ is submitted, the last remaining uses can go.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1220193009 .
2015-07-08 09:59:32 -07:00
Daniel Andersson 3fc6fce1c0 Safer interface for heap iteration.
Address issue 21620, by sharing code to wait for concurrent sweeper to finish, and freeing the caller from this responsibility. The new public interface is Heap::Iterate*, and the old Heap::Visit* are made private, for GC use only.

(Eventually, we'll want to support iterating over the heap while concurrent GC runs, but that will have to wait until all header accesss is synchronized.)

BUG=21620
R=asiva@google.com

Review URL: https://codereview.chromium.org//1212943010 .
2015-07-07 17:20:20 -07:00
Daniel Andersson 2789021e45 Fix --verify_handles mode by properly checking for the static API handles.
This was an omission from 9a5dc19140.
Also set this flag and --verify_on_transition in CustomIsolateTest to extend coverage.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1173293007.
2015-06-22 07:19:56 -07:00
Siva Annamalai 769829a1b8 Fix build break.
BUG=

Review URL: https://codereview.chromium.org//1196823002.
2015-06-19 17:28:01 -07:00
Siva Annamalai 80fd71f3c5 Fix build break.
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1193873003.
2015-06-19 17:22:02 -07:00
Siva Annamalai e9de48f49a Fix for issue 23646 https://github.com/dart-lang/sdk/issues/23646
Allow an ApiError or CompilationError to be passed into Dart_NewUnhandledExceptionError and use the error message in these objects as the Dart instance to throw.

BUG=23646
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1190413006.
2015-06-19 16:55:47 -07:00
Daniel Andersson 9a5dc19140 Move allocation of static API handles Dart_True, etc.
Instead of an unbalanced local scope, allocate them alongside the corresponding static VM handles.

BUG=
R=iposva@google.com

Review URL: https://codereview.chromium.org//1186353004.
2015-06-17 12:46:32 -07:00
John McCutchan f58029a0cd Refactor some Timeline interfaces to be simpler and support streaming
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1173333007.
2015-06-16 10:52:48 -07:00
John McCutchan c7187924a9 Initial Timeline Events
- Each isolate has its own TimelineEventBuffer
- Each isolate has TimelineEventStreams for API, Compiler, Embedder, Isolate, and GC
- Compiler, Isolate, Embedder, and GC are being inserted into the stream
- Basic unit tests
- Dart API for injecting timeline events
- Arbitrary number of native and Dart arguments can be attached to each event
- JSON printing
- Output can be loaded by about://tracing
- Add --timeline-trace-dir flag

Short term follow up CLS:
- Service protocol requests to enable / disable tracing and retrieve a trace
- UI for Observatory
- Dart code EventStreams and Events

R=asiva@google.com

Review URL: https://codereview.chromium.org//1170503004.
2015-06-16 10:10:14 -07:00
Daniel Andersson 24c51b4eea Assert typed data is external iff actually not in heap.
BUG=
R=asiva@google.com, fschneider@google.com

Review URL: https://codereview.chromium.org//1182103003.
2015-06-16 05:32:28 -07:00
Florian Schneider 19bb19d716 Fix bug in Dart_GetTypeOfExternalTypedData.
This API function would return true for typed data view objects, even
if the view has a non-external data object underneath.

It is used e.g. by Builtin_LoadSource. This function copies the data
object for internal typed-data objects.
When it wrongly be identifies a view as external, it consequently results
in crash/undefined behavior because GC may interfere with this internal
data pointer.

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

Review URL: https://codereview.chromium.org//1182123002.
2015-06-12 18:41:07 +02:00
Siva Annamalai 298a2f467f Add an assertion to ensure that the return type and types of parameters are canonical or a TypeParameter.
BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org//1182673002.
2015-06-11 18:09:41 -07:00
Siva Annamalai c67f93099f Fix for issue 23598, add a Dart_CreateLibrarySnapshot entrypoint to the API.
BUG=23598
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//1168223002.
2015-06-08 18:05:16 -07:00
Ivan Posva f5e3f94019 Fix http://dartbug.com/23578:
- Complete revamp of isolate-specific flags.
- Associate flags with the isolate on creation.
- Dart_CreateIsolate and associate callback do take an
  extra flags argument.
- Make sure to clear IC data array when clearing code.

BUG=23578

Review URL: https://codereview.chromium.org//1162033005
2015-06-07 17:57:34 +02:00
Srdjan Mitrovic defec9c960 --check_function_fingerprints is available only in dart_no_snapshot, i.e., it was not tested. Make it default true, catch failure at build time then
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1166813002
2015-06-02 16:36:54 -07:00
Srdjan Mitrovic fc3cd69c05 Load deferred classes eagerly when generating script snapshots
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1155183003
2015-05-27 17:11:35 -07:00
Daniel Andersson 6542a451c3 Refactor Isolate -> Thread in NativeArguments and exception handler jump.
Further reduces the one-to-one assumption about isolates and threads: native entries now ask the thread for its isolate, rather than the other way around.

R=srdjan@google.com

Review URL: https://codereview.chromium.org//1156143003
2015-05-26 16:49:51 -07:00