Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 2922913004: Add Dart_Save/LoadCompilationTrace. (Closed)
Patch Set: . Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/compilation_trace.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index fd6ff190f364a23ea0dca9ab485680cb8e79b777..8f131db016283467611944b983379745f0ccd7fd 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -6,10 +6,11 @@
#include "include/dart_mirrors_api.h"
#include "include/dart_native_api.h"
-#include "platform/assert.h"
#include "lib/stacktrace.h"
+#include "platform/assert.h"
#include "vm/class_finalizer.h"
#include "vm/clustered_snapshot.h"
+#include "vm/compilation_trace.h"
#include "vm/compiler.h"
#include "vm/dart.h"
#include "vm/dart_api_impl.h"
@@ -23,25 +24,25 @@
#include "vm/exceptions.h"
#include "vm/flags.h"
#include "vm/growable_array.h"
-#include "vm/lockers.h"
#include "vm/isolate_reload.h"
#include "vm/kernel_isolate.h"
+#include "vm/lockers.h"
#include "vm/message.h"
#include "vm/message_handler.h"
#include "vm/native_entry.h"
#include "vm/object.h"
#include "vm/object_store.h"
-#include "vm/os_thread.h"
#include "vm/os.h"
+#include "vm/os_thread.h"
#include "vm/port.h"
#include "vm/precompiler.h"
#include "vm/profiler.h"
#include "vm/program_visitor.h"
#include "vm/resolver.h"
#include "vm/reusable_handles.h"
+#include "vm/service.h"
#include "vm/service_event.h"
#include "vm/service_isolate.h"
-#include "vm/service.h"
#include "vm/stack_frame.h"
#include "vm/symbols.h"
#include "vm/tags.h"
@@ -6488,6 +6489,37 @@ DART_EXPORT void Dart_SetThreadName(const char* name) {
}
+DART_EXPORT
+Dart_Handle Dart_SaveCompilationTrace(uint8_t** buffer,
+ intptr_t* buffer_length) {
+ API_TIMELINE_DURATION;
+ Thread* thread = Thread::Current();
+ DARTSCOPE(thread);
+ CHECK_NULL(buffer);
+ CHECK_NULL(buffer_length);
+ CompilationTraceSaver saver(thread->zone());
+ ProgramVisitor::VisitFunctions(&saver);
+ saver.StealBuffer(buffer, buffer_length);
+ return Api::Success();
+}
+
+
+DART_EXPORT
+Dart_Handle Dart_LoadCompilationTrace(uint8_t* buffer, intptr_t buffer_length) {
+ Thread* thread = Thread::Current();
+ API_TIMELINE_DURATION;
+ DARTSCOPE(thread);
+ CHECK_NULL(buffer);
+ CompilationTraceLoader loader(thread);
+ const Object& error =
+ Object::Handle(loader.CompileTrace(reinterpret_cast<char*>(buffer)));
+ if (error.IsError()) {
+ return Api::NewHandle(T, Error::Cast(error).raw());
+ }
+ return Api::Success();
+}
+
+
DART_EXPORT
Dart_Handle Dart_SaveJITFeedback(uint8_t** buffer, intptr_t* buffer_length) {
#if defined(DART_PRECOMPILED_RUNTIME)
« no previous file with comments | « runtime/vm/compilation_trace.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698