| 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 "lib/stacktrace.h" |
| 9 #include "platform/assert.h" | 10 #include "platform/assert.h" |
| 10 #include "lib/stacktrace.h" | |
| 11 #include "vm/class_finalizer.h" | 11 #include "vm/class_finalizer.h" |
| 12 #include "vm/clustered_snapshot.h" | 12 #include "vm/clustered_snapshot.h" |
| 13 #include "vm/compilation_trace.h" |
| 13 #include "vm/compiler.h" | 14 #include "vm/compiler.h" |
| 14 #include "vm/dart.h" | 15 #include "vm/dart.h" |
| 15 #include "vm/dart_api_impl.h" | 16 #include "vm/dart_api_impl.h" |
| 16 #include "vm/dart_api_message.h" | 17 #include "vm/dart_api_message.h" |
| 17 #include "vm/dart_api_state.h" | 18 #include "vm/dart_api_state.h" |
| 18 #include "vm/dart_entry.h" | 19 #include "vm/dart_entry.h" |
| 19 #include "vm/debugger.h" | 20 #include "vm/debugger.h" |
| 20 #if !defined(DART_PRECOMPILED_RUNTIME) | 21 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 21 #include "vm/kernel_reader.h" | 22 #include "vm/kernel_reader.h" |
| 22 #endif | 23 #endif |
| 23 #include "vm/exceptions.h" | 24 #include "vm/exceptions.h" |
| 24 #include "vm/flags.h" | 25 #include "vm/flags.h" |
| 25 #include "vm/growable_array.h" | 26 #include "vm/growable_array.h" |
| 26 #include "vm/lockers.h" | |
| 27 #include "vm/isolate_reload.h" | 27 #include "vm/isolate_reload.h" |
| 28 #include "vm/kernel_isolate.h" | 28 #include "vm/kernel_isolate.h" |
| 29 #include "vm/lockers.h" |
| 29 #include "vm/message.h" | 30 #include "vm/message.h" |
| 30 #include "vm/message_handler.h" | 31 #include "vm/message_handler.h" |
| 31 #include "vm/native_entry.h" | 32 #include "vm/native_entry.h" |
| 32 #include "vm/object.h" | 33 #include "vm/object.h" |
| 33 #include "vm/object_store.h" | 34 #include "vm/object_store.h" |
| 35 #include "vm/os.h" |
| 34 #include "vm/os_thread.h" | 36 #include "vm/os_thread.h" |
| 35 #include "vm/os.h" | |
| 36 #include "vm/port.h" | 37 #include "vm/port.h" |
| 37 #include "vm/precompiler.h" | 38 #include "vm/precompiler.h" |
| 38 #include "vm/profiler.h" | 39 #include "vm/profiler.h" |
| 39 #include "vm/program_visitor.h" | 40 #include "vm/program_visitor.h" |
| 40 #include "vm/resolver.h" | 41 #include "vm/resolver.h" |
| 41 #include "vm/reusable_handles.h" | 42 #include "vm/reusable_handles.h" |
| 43 #include "vm/service.h" |
| 42 #include "vm/service_event.h" | 44 #include "vm/service_event.h" |
| 43 #include "vm/service_isolate.h" | 45 #include "vm/service_isolate.h" |
| 44 #include "vm/service.h" | |
| 45 #include "vm/stack_frame.h" | 46 #include "vm/stack_frame.h" |
| 46 #include "vm/symbols.h" | 47 #include "vm/symbols.h" |
| 47 #include "vm/tags.h" | 48 #include "vm/tags.h" |
| 48 #include "vm/thread_registry.h" | 49 #include "vm/thread_registry.h" |
| 49 #include "vm/timeline.h" | 50 #include "vm/timeline.h" |
| 50 #include "vm/timer.h" | 51 #include "vm/timer.h" |
| 51 #include "vm/unicode.h" | 52 #include "vm/unicode.h" |
| 52 #include "vm/uri.h" | 53 #include "vm/uri.h" |
| 53 #include "vm/verifier.h" | 54 #include "vm/verifier.h" |
| 54 #include "vm/version.h" | 55 #include "vm/version.h" |
| (...skipping 6427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6482 OSThread* thread = OSThread::Current(); | 6483 OSThread* thread = OSThread::Current(); |
| 6483 if (thread == NULL) { | 6484 if (thread == NULL) { |
| 6484 // VM is shutting down. | 6485 // VM is shutting down. |
| 6485 return; | 6486 return; |
| 6486 } | 6487 } |
| 6487 thread->SetName(name); | 6488 thread->SetName(name); |
| 6488 } | 6489 } |
| 6489 | 6490 |
| 6490 | 6491 |
| 6491 DART_EXPORT | 6492 DART_EXPORT |
| 6493 Dart_Handle Dart_SaveCompilationTrace(uint8_t** buffer, |
| 6494 intptr_t* buffer_length) { |
| 6495 API_TIMELINE_DURATION; |
| 6496 Thread* thread = Thread::Current(); |
| 6497 DARTSCOPE(thread); |
| 6498 CHECK_NULL(buffer); |
| 6499 CHECK_NULL(buffer_length); |
| 6500 CompilationTraceSaver saver(thread->zone()); |
| 6501 ProgramVisitor::VisitFunctions(&saver); |
| 6502 saver.StealBuffer(buffer, buffer_length); |
| 6503 return Api::Success(); |
| 6504 } |
| 6505 |
| 6506 |
| 6507 DART_EXPORT |
| 6508 Dart_Handle Dart_LoadCompilationTrace(uint8_t* buffer, intptr_t buffer_length) { |
| 6509 Thread* thread = Thread::Current(); |
| 6510 API_TIMELINE_DURATION; |
| 6511 DARTSCOPE(thread); |
| 6512 CHECK_NULL(buffer); |
| 6513 CompilationTraceLoader loader(thread); |
| 6514 const Object& error = |
| 6515 Object::Handle(loader.CompileTrace(reinterpret_cast<char*>(buffer))); |
| 6516 if (error.IsError()) { |
| 6517 return Api::NewHandle(T, Error::Cast(error).raw()); |
| 6518 } |
| 6519 return Api::Success(); |
| 6520 } |
| 6521 |
| 6522 |
| 6523 DART_EXPORT |
| 6492 Dart_Handle Dart_SaveJITFeedback(uint8_t** buffer, intptr_t* buffer_length) { | 6524 Dart_Handle Dart_SaveJITFeedback(uint8_t** buffer, intptr_t* buffer_length) { |
| 6493 #if defined(DART_PRECOMPILED_RUNTIME) | 6525 #if defined(DART_PRECOMPILED_RUNTIME) |
| 6494 return Api::NewError("No JIT feedback to save on an AOT runtime."); | 6526 return Api::NewError("No JIT feedback to save on an AOT runtime."); |
| 6495 #elif defined(PRODUCT) | 6527 #elif defined(PRODUCT) |
| 6496 // TOOD(rmacnak): We'd need to include the JSON printing code again. | 6528 // TOOD(rmacnak): We'd need to include the JSON printing code again. |
| 6497 return Api::NewError("Dart_SaveJITFeedback not supported in PRODUCT mode."); | 6529 return Api::NewError("Dart_SaveJITFeedback not supported in PRODUCT mode."); |
| 6498 #else | 6530 #else |
| 6499 Thread* thread = Thread::Current(); | 6531 Thread* thread = Thread::Current(); |
| 6500 DARTSCOPE(thread); | 6532 DARTSCOPE(thread); |
| 6501 Isolate* isolate = thread->isolate(); | 6533 Isolate* isolate = thread->isolate(); |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6916 } | 6948 } |
| 6917 | 6949 |
| 6918 | 6950 |
| 6919 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { | 6951 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { |
| 6920 #ifndef PRODUCT | 6952 #ifndef PRODUCT |
| 6921 Profiler::DumpStackTrace(context); | 6953 Profiler::DumpStackTrace(context); |
| 6922 #endif | 6954 #endif |
| 6923 } | 6955 } |
| 6924 | 6956 |
| 6925 } // namespace dart | 6957 } // namespace dart |
| OLD | NEW |