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