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 |
3188 | 3204 |
3189 typedef struct { | 3205 typedef struct { |
3190 const char* library_uri; | 3206 const char* library_uri; |
3191 const char* class_name; | 3207 const char* class_name; |
3192 const char* function_name; | 3208 const char* function_name; |
3193 } Dart_QualifiedFunctionName; | 3209 } Dart_QualifiedFunctionName; |
3194 | 3210 |
3195 | 3211 |
3196 /** | 3212 /** |
3197 * Compiles all functions reachable from the provided entry points and marks | 3213 * Compiles all functions reachable from the provided entry points and marks |
3198 * the isolate to disallow future compilation. | 3214 * the isolate to disallow future compilation. |
3199 * | 3215 * |
3200 * \param entry_points A list of functions that may be invoked through the | 3216 * \param entry_points A list of functions that may be invoked through the |
3201 * embedding API, e.g. Dart_Invoke/GetField/SetField/New/InvokeClosure. | 3217 * embedding API, e.g. Dart_Invoke/GetField/SetField/New/InvokeClosure. |
3202 * | 3218 * |
3203 * \param reset_fields Controls whether static fields are reset. Fields without | 3219 * \param reset_fields Controls whether static fields are reset. Fields without |
3204 * an initializer will be set to null, and fields with an initializer will have | 3220 * an initializer will be set to null, and fields with an initializer will have |
3205 * their initializer run the next time they are accessed. | 3221 * their initializer run the next time they are accessed. |
3206 * | 3222 * |
3207 * reset_fields is true when we are about to create a precompilated snapshot. | 3223 * reset_fields is true when we are about to create a precompilated snapshot. |
3208 * Some fields are already been initialized as part of the loading logic, and | 3224 * Some fields are already been initialized as part of the loading logic, and |
3209 * we want them to be reinitialized in the new process that will load the | 3225 * we want them to be reinitialized in the new process that will load the |
3210 * snapshot. reset_fields is false for --noopt, which will continue running in | 3226 * snapshot. reset_fields is false for --noopt, which will continue running in |
3211 * the same process. | 3227 * the same process. |
3212 * | 3228 * |
3213 * \return An error handle if a compilation error or runtime error running const | 3229 * \return An error handle if a compilation error or runtime error running const |
3214 * constructors was encountered. | 3230 * constructors was encountered. |
3215 */ | 3231 */ |
3216 DART_EXPORT Dart_Handle | 3232 DART_EXPORT Dart_Handle |
3217 Dart_Precompile(Dart_QualifiedFunctionName entry_points[], bool reset_fields); | 3233 Dart_Precompile(Dart_QualifiedFunctionName entry_points[], |
| 3234 bool reset_fields, |
| 3235 uint8_t* jit_feedback, |
| 3236 intptr_t jit_feedback_length); |
3218 | 3237 |
3219 | 3238 |
3220 /** | 3239 /** |
3221 * Creates a precompiled snapshot. | 3240 * Creates a precompiled snapshot. |
3222 * - A root library must have been loaded. | 3241 * - A root library must have been loaded. |
3223 * - Dart_Precompile must have been called. | 3242 * - Dart_Precompile must have been called. |
3224 * | 3243 * |
3225 * Outputs a vm isolate snapshot, an isolate snapshot, and an assembly file | 3244 * Outputs a vm isolate snapshot, an isolate snapshot, and an assembly file |
3226 * defining the symbols kInstructionsSnapshot and kDataSnapshot. The assembly | 3245 * defining the symbols kInstructionsSnapshot and kDataSnapshot. The assembly |
3227 * should be compiled as a static or shared library and linked or loaded by the | 3246 * 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... |
3302 */ | 3321 */ |
3303 DART_EXPORT bool Dart_IsPrecompiledRuntime(); | 3322 DART_EXPORT bool Dart_IsPrecompiledRuntime(); |
3304 | 3323 |
3305 | 3324 |
3306 /** | 3325 /** |
3307 * Print a native stack trace. Used for crash handling. | 3326 * Print a native stack trace. Used for crash handling. |
3308 */ | 3327 */ |
3309 DART_EXPORT void Dart_DumpNativeStackTrace(void* context); | 3328 DART_EXPORT void Dart_DumpNativeStackTrace(void* context); |
3310 | 3329 |
3311 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ | 3330 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ |
OLD | NEW |