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 "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
(...skipping 5877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5888 ASSERT(stream != NULL); | 5888 ASSERT(stream != NULL); |
5889 TimelineEvent* event = stream->StartEvent(); | 5889 TimelineEvent* event = stream->StartEvent(); |
5890 if (event != NULL) { | 5890 if (event != NULL) { |
5891 event->AsyncEnd(label, async_id); | 5891 event->AsyncEnd(label, async_id); |
5892 event->Complete(); | 5892 event->Complete(); |
5893 } | 5893 } |
5894 return Api::Success(); | 5894 return Api::Success(); |
5895 } | 5895 } |
5896 | 5896 |
5897 | 5897 |
5898 static void Precompile(Isolate* isolate, Dart_Handle* result) { | 5898 DART_EXPORT Dart_Handle Dart_Precompile( |
5899 ASSERT(isolate != NULL); | 5899 Dart_QualifiedFunctionName* entry_points) { |
5900 const Error& error = Error::Handle(isolate, Precompiler::CompileAll()); | |
5901 if (error.IsNull()) { | |
5902 *result = Api::Success(); | |
5903 } else { | |
5904 *result = Api::NewHandle(isolate, error.raw()); | |
5905 } | |
5906 } | |
5907 | |
5908 | |
5909 DART_EXPORT Dart_Handle Dart_Precompile() { | |
5910 DARTSCOPE(Thread::Current()); | 5900 DARTSCOPE(Thread::Current()); |
5911 Dart_Handle result = Api::CheckAndFinalizePendingClasses(I); | 5901 Dart_Handle result = Api::CheckAndFinalizePendingClasses(I); |
5912 if (::Dart_IsError(result)) { | 5902 if (::Dart_IsError(result)) { |
5913 return result; | 5903 return result; |
5914 } | 5904 } |
5915 CHECK_CALLBACK_STATE(I); | 5905 CHECK_CALLBACK_STATE(I); |
5916 Precompile(I, &result); | 5906 const Error& error = Error::Handle(Precompiler::CompileAll(entry_points)); |
5917 return result; | 5907 if (!error.IsNull()) { |
| 5908 return Api::NewHandle(I, error.raw()); |
| 5909 } |
| 5910 return Api::Success(); |
5918 } | 5911 } |
5919 | 5912 |
5920 | 5913 |
5921 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshot( | 5914 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshot( |
5922 uint8_t** vm_isolate_snapshot_buffer, | 5915 uint8_t** vm_isolate_snapshot_buffer, |
5923 intptr_t* vm_isolate_snapshot_size, | 5916 intptr_t* vm_isolate_snapshot_size, |
5924 uint8_t** isolate_snapshot_buffer, | 5917 uint8_t** isolate_snapshot_buffer, |
5925 intptr_t* isolate_snapshot_size, | 5918 intptr_t* isolate_snapshot_size, |
5926 uint8_t** instructions_snapshot_buffer, | 5919 uint8_t** instructions_snapshot_buffer, |
5927 intptr_t* instructions_snapshot_size) { | 5920 intptr_t* instructions_snapshot_size) { |
(...skipping 29 matching lines...) Expand all Loading... |
5957 ApiReallocate); | 5950 ApiReallocate); |
5958 writer.WriteFullSnapshot(); | 5951 writer.WriteFullSnapshot(); |
5959 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); | 5952 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); |
5960 *isolate_snapshot_size = writer.IsolateSnapshotSize(); | 5953 *isolate_snapshot_size = writer.IsolateSnapshotSize(); |
5961 *instructions_snapshot_size = writer.InstructionsSnapshotSize(); | 5954 *instructions_snapshot_size = writer.InstructionsSnapshotSize(); |
5962 | 5955 |
5963 return Api::Success(); | 5956 return Api::Success(); |
5964 } | 5957 } |
5965 | 5958 |
5966 } // namespace dart | 5959 } // namespace dart |
OLD | NEW |