| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #include "vm/unicode.h" | 44 #include "vm/unicode.h" |
| 45 #include "vm/verifier.h" | 45 #include "vm/verifier.h" |
| 46 #include "vm/version.h" | 46 #include "vm/version.h" |
| 47 | 47 |
| 48 namespace dart { | 48 namespace dart { |
| 49 | 49 |
| 50 // Facilitate quick access to the current zone once we have the curren thread. | 50 // Facilitate quick access to the current zone once we have the curren thread. |
| 51 #define Z (T->zone()) | 51 #define Z (T->zone()) |
| 52 | 52 |
| 53 | 53 |
| 54 DECLARE_FLAG(bool, load_deferred_eagerly); |
| 55 DECLARE_FLAG(bool, precompilation); |
| 54 DECLARE_FLAG(bool, print_class_table); | 56 DECLARE_FLAG(bool, print_class_table); |
| 55 DECLARE_FLAG(bool, verify_handles); | 57 DECLARE_FLAG(bool, verify_handles); |
| 56 #if defined(DART_NO_SNAPSHOT) | 58 #if defined(DART_NO_SNAPSHOT) |
| 57 DEFINE_FLAG(bool, check_function_fingerprints, true, | 59 DEFINE_FLAG(bool, check_function_fingerprints, true, |
| 58 "Check function fingerprints"); | 60 "Check function fingerprints"); |
| 59 #endif // defined(DART_NO_SNAPSHOT). | 61 #endif // defined(DART_NO_SNAPSHOT). |
| 60 DEFINE_FLAG(bool, verify_acquired_data, false, | 62 DEFINE_FLAG(bool, verify_acquired_data, false, |
| 61 "Verify correct API acquire/release of typed data."); | 63 "Verify correct API acquire/release of typed data."); |
| 62 | 64 |
| 63 ThreadLocalKey Api::api_native_key_ = kUnsetThreadLocalKey; | 65 ThreadLocalKey Api::api_native_key_ = kUnsetThreadLocalKey; |
| (...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1138 Dart_IsolateCreateCallback create, | 1140 Dart_IsolateCreateCallback create, |
| 1139 Dart_IsolateInterruptCallback interrupt, | 1141 Dart_IsolateInterruptCallback interrupt, |
| 1140 Dart_IsolateUnhandledExceptionCallback unhandled, | 1142 Dart_IsolateUnhandledExceptionCallback unhandled, |
| 1141 Dart_IsolateShutdownCallback shutdown, | 1143 Dart_IsolateShutdownCallback shutdown, |
| 1142 Dart_FileOpenCallback file_open, | 1144 Dart_FileOpenCallback file_open, |
| 1143 Dart_FileReadCallback file_read, | 1145 Dart_FileReadCallback file_read, |
| 1144 Dart_FileWriteCallback file_write, | 1146 Dart_FileWriteCallback file_write, |
| 1145 Dart_FileCloseCallback file_close, | 1147 Dart_FileCloseCallback file_close, |
| 1146 Dart_EntropySource entropy_source, | 1148 Dart_EntropySource entropy_source, |
| 1147 Dart_GetVMServiceAssetsArchive get_service_assets) { | 1149 Dart_GetVMServiceAssetsArchive get_service_assets) { |
| 1148 if ((instructions_snapshot != NULL) && !FLAG_precompiled_mode) { | 1150 if ((instructions_snapshot != NULL) && !FLAG_precompilation) { |
| 1149 return strdup("Flag --precompilation was not specified."); | 1151 return strdup("Flag --precompilation was not specified."); |
| 1150 } | 1152 } |
| 1151 if (interrupt != NULL) { | 1153 if (interrupt != NULL) { |
| 1152 return strdup("Dart_Initialize: " | 1154 return strdup("Dart_Initialize: " |
| 1153 "Setting of interrupt callback is not supported."); | 1155 "Setting of interrupt callback is not supported."); |
| 1154 } | 1156 } |
| 1155 if (unhandled != NULL) { | 1157 if (unhandled != NULL) { |
| 1156 return strdup("Dart_Initialize: " | 1158 return strdup("Dart_Initialize: " |
| 1157 "Setting of unhandled exception callback is not supported."); | 1159 "Setting of unhandled exception callback is not supported."); |
| 1158 } | 1160 } |
| (...skipping 4932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6091 return 0; | 6093 return 0; |
| 6092 } | 6094 } |
| 6093 | 6095 |
| 6094 #else // DART_PRECOMPILER | 6096 #else // DART_PRECOMPILER |
| 6095 | 6097 |
| 6096 DART_EXPORT Dart_Handle Dart_Precompile( | 6098 DART_EXPORT Dart_Handle Dart_Precompile( |
| 6097 Dart_QualifiedFunctionName entry_points[], | 6099 Dart_QualifiedFunctionName entry_points[], |
| 6098 bool reset_fields) { | 6100 bool reset_fields) { |
| 6099 API_TIMELINE_BEGIN_END; | 6101 API_TIMELINE_BEGIN_END; |
| 6100 DARTSCOPE(Thread::Current()); | 6102 DARTSCOPE(Thread::Current()); |
| 6101 if (!FLAG_precompiled_mode) { | 6103 if (!FLAG_precompilation) { |
| 6102 return Dart_NewApiError("Flag --precompilation was not specified."); | 6104 return Dart_NewApiError("Flag --precompilation was not specified."); |
| 6103 } | 6105 } |
| 6104 Dart_Handle result = Api::CheckAndFinalizePendingClasses(T); | 6106 Dart_Handle result = Api::CheckAndFinalizePendingClasses(T); |
| 6105 if (::Dart_IsError(result)) { | 6107 if (::Dart_IsError(result)) { |
| 6106 return result; | 6108 return result; |
| 6107 } | 6109 } |
| 6108 CHECK_CALLBACK_STATE(T); | 6110 CHECK_CALLBACK_STATE(T); |
| 6109 const Error& error = Error::Handle(Precompiler::CompileAll(entry_points, | 6111 const Error& error = Error::Handle(Precompiler::CompileAll(entry_points, |
| 6110 reset_fields)); | 6112 reset_fields)); |
| 6111 if (!error.IsNull()) { | 6113 if (!error.IsNull()) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6166 return Api::Success(); | 6168 return Api::Success(); |
| 6167 } | 6169 } |
| 6168 #endif // DART_PRECOMPILER | 6170 #endif // DART_PRECOMPILER |
| 6169 | 6171 |
| 6170 | 6172 |
| 6171 DART_EXPORT bool Dart_IsRunningPrecompiledCode() { | 6173 DART_EXPORT bool Dart_IsRunningPrecompiledCode() { |
| 6172 return Dart::IsRunningPrecompiledCode(); | 6174 return Dart::IsRunningPrecompiledCode(); |
| 6173 } | 6175 } |
| 6174 | 6176 |
| 6175 } // namespace dart | 6177 } // namespace dart |
| OLD | NEW |