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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 2987213002: [vm] Add Dart_CreateVMAOTSnapshotAsAssembly. (Closed)
Patch Set: . Created 3 years, 5 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/clustered_snapshot.cc ('k') | no next file » | 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 0b865fdf3952144666315a7d7d2f5245cd8e8f63..6dc3742e3eea9c00963a724b555f070fa6de6a9f 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -6564,6 +6564,37 @@ Dart_CreateAppAOTSnapshotAsAssembly(uint8_t** assembly_buffer,
#endif
}
+DART_EXPORT Dart_Handle
+Dart_CreateVMAOTSnapshotAsAssembly(uint8_t** assembly_buffer,
+ intptr_t* assembly_size) {
+#if defined(TARGET_ARCH_IA32)
+ return Api::NewError("AOT compilation is not supported on IA32.");
+#elif defined(TARGET_ARCH_DBC)
+ return Api::NewError("AOT compilation is not supported on DBC.");
+#elif !defined(DART_PRECOMPILER)
+ return Api::NewError(
+ "This VM was built without support for AOT compilation.");
+#else
+ API_TIMELINE_DURATION;
+ DARTSCOPE(Thread::Current());
+ CHECK_NULL(assembly_buffer);
+ CHECK_NULL(assembly_size);
+
+ NOT_IN_PRODUCT(TimelineDurationScope tds2(T, Timeline::GetIsolateStream(),
+ "WriteVMAOTSnapshot"));
+ AssemblyImageWriter image_writer(assembly_buffer, ApiReallocate,
+ 2 * MB /* initial_size */);
+ uint8_t* vm_snapshot_data_buffer = NULL;
+ FullSnapshotWriter writer(Snapshot::kFullAOT, &vm_snapshot_data_buffer, NULL,
+ ApiReallocate, &image_writer, NULL);
+
+ writer.WriteFullSnapshot();
+ *assembly_size = image_writer.AssemblySize();
+
+ return Api::Success();
+#endif
+}
+
DART_EXPORT Dart_Handle
Dart_CreateAppAOTSnapshotAsBlobs(uint8_t** vm_snapshot_data_buffer,
intptr_t* vm_snapshot_data_size,
« no previous file with comments | « runtime/vm/clustered_snapshot.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698