OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 * Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
3 * for details. All rights reserved. Use of this source code is governed by a | 3 * for details. All rights reserved. Use of this source code is governed by a |
4 * BSD-style license that can be found in the LICENSE file. | 4 * BSD-style license that can be found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 #ifndef RUNTIME_INCLUDE_DART_API_H_ | 7 #ifndef RUNTIME_INCLUDE_DART_API_H_ |
8 #define RUNTIME_INCLUDE_DART_API_H_ | 8 #define RUNTIME_INCLUDE_DART_API_H_ |
9 | 9 |
10 /** \mainpage Dart Embedding API Reference | 10 /** \mainpage Dart Embedding API Reference |
(...skipping 3167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3178 */ | 3178 */ |
3179 DART_EXPORT Dart_Port Dart_ServiceWaitForLoadPort(); | 3179 DART_EXPORT Dart_Port Dart_ServiceWaitForLoadPort(); |
3180 | 3180 |
3181 | 3181 |
3182 /* | 3182 /* |
3183 * ============== | 3183 * ============== |
3184 * Precompilation | 3184 * Precompilation |
3185 * ============== | 3185 * ============== |
3186 */ | 3186 */ |
3187 | 3187 |
3188 /** | |
3189 * Saves a serialized version of the information collected for use by the | |
3190 * optimizing compiler, such as type feedback and usage counters. When this | |
3191 * information is passed to Dart_Precompile, the AOT compiler may use it to | |
3192 * produce faster and smaller code. The feedback is only used if the JIT that | |
3193 * created it and the AOT compiler consuming it | |
3194 * - are running the same Dart program | |
3195 * - are built from the same version of the VM | |
3196 * - agree on whether type checks and assertions are enabled | |
3197 * | |
3198 * \return Returns an error handler if the VM was built in a mode that does not | |
3199 * support saving JIT feedback. | |
3200 */ | |
3201 DART_EXPORT Dart_Handle Dart_SaveJITFeedback(uint8_t** buffer, | |
3202 intptr_t* buffer_length); | |
3203 | |
3204 | 3188 |
3205 typedef struct { | 3189 typedef struct { |
3206 const char* library_uri; | 3190 const char* library_uri; |
3207 const char* class_name; | 3191 const char* class_name; |
3208 const char* function_name; | 3192 const char* function_name; |
3209 } Dart_QualifiedFunctionName; | 3193 } Dart_QualifiedFunctionName; |
3210 | 3194 |
3211 | 3195 |
3212 /** | 3196 /** |
3213 * Compiles all functions reachable from the provided entry points and marks | 3197 * Compiles all functions reachable from the provided entry points and marks |
3214 * the isolate to disallow future compilation. | 3198 * the isolate to disallow future compilation. |
3215 * | 3199 * |
3216 * \param entry_points A list of functions that may be invoked through the | 3200 * \param entry_points A list of functions that may be invoked through the |
3217 * embedding API, e.g. Dart_Invoke/GetField/SetField/New/InvokeClosure. | 3201 * embedding API, e.g. Dart_Invoke/GetField/SetField/New/InvokeClosure. |
3218 * | 3202 * |
3219 * \param reset_fields Controls whether static fields are reset. Fields without | 3203 * \param reset_fields Controls whether static fields are reset. Fields without |
3220 * an initializer will be set to null, and fields with an initializer will have | 3204 * an initializer will be set to null, and fields with an initializer will have |
3221 * their initializer run the next time they are accessed. | 3205 * their initializer run the next time they are accessed. |
3222 * | 3206 * |
3223 * reset_fields is true when we are about to create a precompilated snapshot. | 3207 * reset_fields is true when we are about to create a precompilated snapshot. |
3224 * Some fields are already been initialized as part of the loading logic, and | 3208 * Some fields are already been initialized as part of the loading logic, and |
3225 * we want them to be reinitialized in the new process that will load the | 3209 * we want them to be reinitialized in the new process that will load the |
3226 * snapshot. reset_fields is false for --noopt, which will continue running in | 3210 * snapshot. reset_fields is false for --noopt, which will continue running in |
3227 * the same process. | 3211 * the same process. |
3228 * | 3212 * |
3229 * \return An error handle if a compilation error or runtime error running const | 3213 * \return An error handle if a compilation error or runtime error running const |
3230 * constructors was encountered. | 3214 * constructors was encountered. |
3231 */ | 3215 */ |
3232 DART_EXPORT Dart_Handle | 3216 DART_EXPORT Dart_Handle |
3233 Dart_Precompile(Dart_QualifiedFunctionName entry_points[], | 3217 Dart_Precompile(Dart_QualifiedFunctionName entry_points[], bool reset_fields); |
3234 bool reset_fields, | |
3235 uint8_t* jit_feedback, | |
3236 intptr_t jit_feedback_length); | |
3237 | 3218 |
3238 | 3219 |
3239 /** | 3220 /** |
3240 * Creates a precompiled snapshot. | 3221 * Creates a precompiled snapshot. |
3241 * - A root library must have been loaded. | 3222 * - A root library must have been loaded. |
3242 * - Dart_Precompile must have been called. | 3223 * - Dart_Precompile must have been called. |
3243 * | 3224 * |
3244 * Outputs a vm isolate snapshot, an isolate snapshot, and an assembly file | 3225 * Outputs a vm isolate snapshot, an isolate snapshot, and an assembly file |
3245 * defining the symbols kInstructionsSnapshot and kDataSnapshot. The assembly | 3226 * defining the symbols kInstructionsSnapshot and kDataSnapshot. The assembly |
3246 * should be compiled as a static or shared library and linked or loaded by the | 3227 * should be compiled as a static or shared library and linked or loaded by the |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3321 */ | 3302 */ |
3322 DART_EXPORT bool Dart_IsPrecompiledRuntime(); | 3303 DART_EXPORT bool Dart_IsPrecompiledRuntime(); |
3323 | 3304 |
3324 | 3305 |
3325 /** | 3306 /** |
3326 * Print a native stack trace. Used for crash handling. | 3307 * Print a native stack trace. Used for crash handling. |
3327 */ | 3308 */ |
3328 DART_EXPORT void Dart_DumpNativeStackTrace(void* context); | 3309 DART_EXPORT void Dart_DumpNativeStackTrace(void* context); |
3329 | 3310 |
3330 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ | 3311 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ |
OLD | NEW |