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 "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "lib/stacktrace.h" | 10 #include "lib/stacktrace.h" |
(...skipping 6668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6679 "WriteAppAOTSnapshot")); | 6679 "WriteAppAOTSnapshot")); |
6680 AssemblyImageWriter image_writer(assembly_buffer, ApiReallocate, | 6680 AssemblyImageWriter image_writer(assembly_buffer, ApiReallocate, |
6681 2 * MB /* initial_size */); | 6681 2 * MB /* initial_size */); |
6682 uint8_t* vm_snapshot_data_buffer = NULL; | 6682 uint8_t* vm_snapshot_data_buffer = NULL; |
6683 uint8_t* isolate_snapshot_data_buffer = NULL; | 6683 uint8_t* isolate_snapshot_data_buffer = NULL; |
6684 FullSnapshotWriter writer(Snapshot::kAppAOT, &vm_snapshot_data_buffer, | 6684 FullSnapshotWriter writer(Snapshot::kAppAOT, &vm_snapshot_data_buffer, |
6685 &isolate_snapshot_data_buffer, ApiReallocate, | 6685 &isolate_snapshot_data_buffer, ApiReallocate, |
6686 &image_writer, &image_writer); | 6686 &image_writer, &image_writer); |
6687 | 6687 |
6688 writer.WriteFullSnapshot(); | 6688 writer.WriteFullSnapshot(); |
| 6689 image_writer.Finalize(); |
6689 *assembly_size = image_writer.AssemblySize(); | 6690 *assembly_size = image_writer.AssemblySize(); |
6690 | 6691 |
6691 return Api::Success(); | 6692 return Api::Success(); |
6692 #endif | 6693 #endif |
6693 } | 6694 } |
6694 | 6695 |
6695 | 6696 |
6696 DART_EXPORT Dart_Handle | 6697 DART_EXPORT Dart_Handle |
6697 Dart_CreateAppAOTSnapshotAsBlobs(uint8_t** vm_snapshot_data_buffer, | 6698 Dart_CreateAppAOTSnapshotAsBlobs(uint8_t** vm_snapshot_data_buffer, |
6698 intptr_t* vm_snapshot_data_size, | 6699 intptr_t* vm_snapshot_data_size, |
6699 uint8_t** vm_snapshot_instructions_buffer, | 6700 uint8_t** vm_snapshot_instructions_buffer, |
6700 intptr_t* vm_snapshot_instructions_size, | 6701 intptr_t* vm_snapshot_instructions_size, |
6701 uint8_t** isolate_snapshot_data_buffer, | 6702 uint8_t** isolate_snapshot_data_buffer, |
6702 intptr_t* isolate_snapshot_data_size, | 6703 intptr_t* isolate_snapshot_data_size, |
6703 uint8_t** isolate_snapshot_instructions_buffer, | 6704 uint8_t** isolate_snapshot_instructions_buffer, |
6704 intptr_t* isolate_snapshot_instructions_size) { | 6705 intptr_t* isolate_snapshot_instructions_size) { |
6705 #if defined(TARGET_ARCH_IA32) | 6706 #if defined(TARGET_ARCH_IA32) |
6706 return Api::NewError("AOT compilation is not supported on IA32."); | 6707 return Api::NewError("AOT compilation is not supported on IA32."); |
6707 #elif defined(TARGET_ARCH_DBC) | 6708 #elif defined(TARGET_ARCH_DBC) |
6708 return Api::NewError("AOT compilation is not supported on DBC."); | 6709 return Api::NewError("AOT compilation is not supported on DBC."); |
6709 #elif !defined(DART_PRECOMPILER) | 6710 #elif !defined(DART_PRECOMPILER) |
6710 return Api::NewError( | 6711 return Api::NewError( |
6711 "This VM was built without support for AOT compilation."); | 6712 "This VM was built without support for AOT compilation."); |
6712 #else | 6713 #else |
| 6714 if (FLAG_dwarf_stack_traces) { |
| 6715 return Api::NewError( |
| 6716 "--dwarf_stack_traces requires creating an AOT snapshot as assembly."); |
| 6717 } |
| 6718 |
6713 API_TIMELINE_DURATION; | 6719 API_TIMELINE_DURATION; |
6714 DARTSCOPE(Thread::Current()); | 6720 DARTSCOPE(Thread::Current()); |
6715 Isolate* I = T->isolate(); | 6721 Isolate* I = T->isolate(); |
6716 if (I->compilation_allowed()) { | 6722 if (I->compilation_allowed()) { |
6717 return Api::NewError( | 6723 return Api::NewError( |
6718 "Isolate is not precompiled. " | 6724 "Isolate is not precompiled. " |
6719 "Did you forget to call Dart_Precompile?"); | 6725 "Did you forget to call Dart_Precompile?"); |
6720 } | 6726 } |
6721 ASSERT(FLAG_load_deferred_eagerly); | 6727 ASSERT(FLAG_load_deferred_eagerly); |
6722 if (vm_snapshot_data_buffer == NULL) { | 6728 if (vm_snapshot_data_buffer == NULL) { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6835 } | 6841 } |
6836 | 6842 |
6837 | 6843 |
6838 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { | 6844 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { |
6839 #ifndef PRODUCT | 6845 #ifndef PRODUCT |
6840 Profiler::DumpStackTrace(context); | 6846 Profiler::DumpStackTrace(context); |
6841 #endif | 6847 #endif |
6842 } | 6848 } |
6843 | 6849 |
6844 } // namespace dart | 6850 } // namespace dart |
OLD | NEW |