Chromium Code Reviews| 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..8b31a3325d6e5c8c12ea717a167bc991d716e1e6 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, &image_writer); |
|
siva
2017/08/01 22:55:38
The second &image_write parameter can be NULL righ
rmacnak
2017/08/02 00:55:39
Yes, done.
|
| + |
| + 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, |