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, |