| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
| 7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
| 8 | 8 |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
| (...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1282 } | 1282 } |
| 1283 | 1283 |
| 1284 | 1284 |
| 1285 DART_EXPORT Dart_Handle Dart_DebugName() { | 1285 DART_EXPORT Dart_Handle Dart_DebugName() { |
| 1286 DARTSCOPE(Thread::Current()); | 1286 DARTSCOPE(Thread::Current()); |
| 1287 Isolate* I = T->isolate(); | 1287 Isolate* I = T->isolate(); |
| 1288 return Api::NewHandle(T, String::New(I->name())); | 1288 return Api::NewHandle(T, String::New(I->name())); |
| 1289 } | 1289 } |
| 1290 | 1290 |
| 1291 | 1291 |
| 1292 | |
| 1293 DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate) { | 1292 DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate) { |
| 1294 CHECK_NO_ISOLATE(Isolate::Current()); | 1293 CHECK_NO_ISOLATE(Isolate::Current()); |
| 1295 // TODO(16615): Validate isolate parameter. | 1294 // TODO(16615): Validate isolate parameter. |
| 1296 Isolate* iso = reinterpret_cast<Isolate*>(isolate); | 1295 Isolate* iso = reinterpret_cast<Isolate*>(isolate); |
| 1297 if (iso->HasMutatorThread()) { | 1296 if (iso->HasMutatorThread()) { |
| 1298 FATAL("Multiple mutators within one isolate is not supported."); | 1297 FATAL("Multiple mutators within one isolate is not supported."); |
| 1299 } | 1298 } |
| 1300 Thread::EnterIsolate(iso); | 1299 Thread::EnterIsolate(iso); |
| 1301 } | 1300 } |
| 1302 | 1301 |
| (...skipping 4418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5721 Timeline::ReclaimCachedBlocksFromThreads(); | 5720 Timeline::ReclaimCachedBlocksFromThreads(); |
| 5722 JSONStream js; | 5721 JSONStream js; |
| 5723 IsolateTimelineEventFilter filter(isolate->main_port()); | 5722 IsolateTimelineEventFilter filter(isolate->main_port()); |
| 5724 timeline_recorder->PrintTraceEvent(&js, &filter); | 5723 timeline_recorder->PrintTraceEvent(&js, &filter); |
| 5725 return StreamTraceEvents(consumer, user_data, &js); | 5724 return StreamTraceEvents(consumer, user_data, &js); |
| 5726 } | 5725 } |
| 5727 | 5726 |
| 5728 | 5727 |
| 5729 DART_EXPORT bool Dart_GlobalTimelineGetTrace(Dart_StreamConsumer consumer, | 5728 DART_EXPORT bool Dart_GlobalTimelineGetTrace(Dart_StreamConsumer consumer, |
| 5730 void* user_data) { | 5729 void* user_data) { |
| 5730 // To support various embedders, it must be possible to call this function |
| 5731 // from a thread for which we have not entered an Isolate and set up a Thread |
| 5732 // TLS object. Therefore, a Zone may not be available, a StackZone cannot be |
| 5733 // created, and no ZoneAllocated objects can be allocated. |
| 5731 if (consumer == NULL) { | 5734 if (consumer == NULL) { |
| 5732 return false; | 5735 return false; |
| 5733 } | 5736 } |
| 5734 TimelineEventRecorder* timeline_recorder = Timeline::recorder(); | 5737 TimelineEventRecorder* timeline_recorder = Timeline::recorder(); |
| 5735 if (timeline_recorder == NULL) { | 5738 if (timeline_recorder == NULL) { |
| 5736 // Nothing has been recorded. | 5739 // Nothing has been recorded. |
| 5737 return false; | 5740 return false; |
| 5738 } | 5741 } |
| 5739 Thread* T = Thread::Current(); | |
| 5740 StackZone zone(T); | |
| 5741 Timeline::ReclaimCachedBlocksFromThreads(); | 5742 Timeline::ReclaimCachedBlocksFromThreads(); |
| 5742 JSONStream js; | 5743 JSONStream js; |
| 5743 TimelineEventFilter filter; | 5744 TimelineEventFilter filter; |
| 5744 timeline_recorder->PrintTraceEvent(&js, &filter); | 5745 timeline_recorder->PrintTraceEvent(&js, &filter); |
| 5745 return StreamTraceEvents(consumer, user_data, &js); | 5746 return StreamTraceEvents(consumer, user_data, &js); |
| 5746 } | 5747 } |
| 5747 | 5748 |
| 5748 | 5749 |
| 5749 DART_EXPORT Dart_Handle Dart_TimelineDuration(const char* label, | 5750 DART_EXPORT Dart_Handle Dart_TimelineDuration(const char* label, |
| 5750 int64_t start_micros, | 5751 int64_t start_micros, |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5918 ApiReallocate); | 5919 ApiReallocate); |
| 5919 writer.WriteFullSnapshot(); | 5920 writer.WriteFullSnapshot(); |
| 5920 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); | 5921 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); |
| 5921 *isolate_snapshot_size = writer.IsolateSnapshotSize(); | 5922 *isolate_snapshot_size = writer.IsolateSnapshotSize(); |
| 5922 *instructions_snapshot_size = writer.InstructionsSnapshotSize(); | 5923 *instructions_snapshot_size = writer.InstructionsSnapshotSize(); |
| 5923 | 5924 |
| 5924 return Api::Success(); | 5925 return Api::Success(); |
| 5925 } | 5926 } |
| 5926 | 5927 |
| 5927 } // namespace dart | 5928 } // namespace dart |
| OLD | NEW |