| 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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 | 568 |
| 569 /** | 569 /** |
| 570 * Gets the version string for the Dart VM. | 570 * Gets the version string for the Dart VM. |
| 571 * | 571 * |
| 572 * The version of the Dart VM can be accessed without initializing the VM. | 572 * The version of the Dart VM can be accessed without initializing the VM. |
| 573 * | 573 * |
| 574 * \return The version string for the embedded Dart VM. | 574 * \return The version string for the embedded Dart VM. |
| 575 */ | 575 */ |
| 576 DART_EXPORT const char* Dart_VersionString(); | 576 DART_EXPORT const char* Dart_VersionString(); |
| 577 | 577 |
| 578 typedef struct { |
| 579 const char* library_uri; |
| 580 const char* class_name; |
| 581 const char* function_name; |
| 582 } Dart_QualifiedFunctionName; |
| 583 |
| 578 /** | 584 /** |
| 579 * Isolate specific flags are set when creating a new isolate using the | 585 * Isolate specific flags are set when creating a new isolate using the |
| 580 * Dart_IsolateFlags structure. | 586 * Dart_IsolateFlags structure. |
| 581 * | 587 * |
| 582 * Current version of flags is encoded in a 32-bit integer with 16 bits used | 588 * Current version of flags is encoded in a 32-bit integer with 16 bits used |
| 583 * for each part. | 589 * for each part. |
| 584 */ | 590 */ |
| 585 | 591 |
| 586 #define DART_FLAGS_CURRENT_VERSION (0x00000003) | 592 #define DART_FLAGS_CURRENT_VERSION (0x00000004) |
| 587 | 593 |
| 588 typedef struct { | 594 typedef struct { |
| 589 int32_t version; | 595 int32_t version; |
| 590 bool enable_type_checks; | 596 bool enable_type_checks; |
| 591 bool enable_asserts; | 597 bool enable_asserts; |
| 592 bool enable_error_on_bad_type; | 598 bool enable_error_on_bad_type; |
| 593 bool enable_error_on_bad_override; | 599 bool enable_error_on_bad_override; |
| 594 bool use_field_guards; | 600 bool use_field_guards; |
| 595 bool use_osr; | 601 bool use_osr; |
| 596 bool use_dart_frontend; | 602 bool use_dart_frontend; |
| 603 bool obfuscate; |
| 604 Dart_QualifiedFunctionName* entry_points; |
| 597 } Dart_IsolateFlags; | 605 } Dart_IsolateFlags; |
| 598 | 606 |
| 599 /** | 607 /** |
| 608 * Initialize Dart_IsolateFlags with correct version and default values. |
| 609 */ |
| 610 DART_EXPORT void Dart_IsolateFlagsInitialize(Dart_IsolateFlags* flags); |
| 611 |
| 612 /** |
| 600 * An isolate creation and initialization callback function. | 613 * An isolate creation and initialization callback function. |
| 601 * | 614 * |
| 602 * This callback, provided by the embedder, is called when the vm | 615 * This callback, provided by the embedder, is called when the vm |
| 603 * needs to create an isolate. The callback should create an isolate | 616 * needs to create an isolate. The callback should create an isolate |
| 604 * by calling Dart_CreateIsolate and load any scripts required for | 617 * by calling Dart_CreateIsolate and load any scripts required for |
| 605 * execution. | 618 * execution. |
| 606 * | 619 * |
| 607 * When the function returns false, it is the responsibility of this | 620 * When the function returns false, it is the responsibility of this |
| 608 * function to ensure that Dart_ShutdownIsolate has been called if | 621 * function to ensure that Dart_ShutdownIsolate has been called if |
| 609 * required (for example, if the isolate was created successfully by | 622 * required (for example, if the isolate was created successfully by |
| (...skipping 2575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3185 * - are running the same Dart program | 3198 * - are running the same Dart program |
| 3186 * - are built from the same version of the VM | 3199 * - are built from the same version of the VM |
| 3187 * - agree on whether type checks and assertions are enabled | 3200 * - agree on whether type checks and assertions are enabled |
| 3188 * | 3201 * |
| 3189 * \return Returns an error handler if the VM was built in a mode that does not | 3202 * \return Returns an error handler if the VM was built in a mode that does not |
| 3190 * support saving JIT feedback. | 3203 * support saving JIT feedback. |
| 3191 */ | 3204 */ |
| 3192 DART_EXPORT Dart_Handle Dart_SaveJITFeedback(uint8_t** buffer, | 3205 DART_EXPORT Dart_Handle Dart_SaveJITFeedback(uint8_t** buffer, |
| 3193 intptr_t* buffer_length); | 3206 intptr_t* buffer_length); |
| 3194 | 3207 |
| 3195 typedef struct { | |
| 3196 const char* library_uri; | |
| 3197 const char* class_name; | |
| 3198 const char* function_name; | |
| 3199 } Dart_QualifiedFunctionName; | |
| 3200 | |
| 3201 /** | 3208 /** |
| 3202 * Compiles all functions reachable from the provided entry points and marks | 3209 * Compiles all functions reachable from the provided entry points and marks |
| 3203 * the isolate to disallow future compilation. | 3210 * the isolate to disallow future compilation. |
| 3204 * | 3211 * |
| 3205 * \param entry_points A list of functions that may be invoked through the | 3212 * \param entry_points A list of functions that may be invoked through the |
| 3206 * embedding API, e.g. Dart_Invoke/GetField/SetField/New/InvokeClosure. | 3213 * embedding API, e.g. Dart_Invoke/GetField/SetField/New/InvokeClosure. |
| 3207 * | 3214 * |
| 3208 * \param reset_fields Controls whether static fields are reset. Fields without | 3215 * \param reset_fields Controls whether static fields are reset. Fields without |
| 3209 * an initializer will be set to null, and fields with an initializer will have | 3216 * an initializer will be set to null, and fields with an initializer will have |
| 3210 * their initializer run the next time they are accessed. | 3217 * their initializer run the next time they are accessed. |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3317 uint8_t** vm_snapshot_data_buffer, | 3324 uint8_t** vm_snapshot_data_buffer, |
| 3318 intptr_t* vm_snapshot_data_size, | 3325 intptr_t* vm_snapshot_data_size, |
| 3319 uint8_t** vm_snapshot_instructions_buffer, | 3326 uint8_t** vm_snapshot_instructions_buffer, |
| 3320 intptr_t* vm_snapshot_instructions_size, | 3327 intptr_t* vm_snapshot_instructions_size, |
| 3321 uint8_t** isolate_snapshot_data_buffer, | 3328 uint8_t** isolate_snapshot_data_buffer, |
| 3322 intptr_t* isolate_snapshot_data_size, | 3329 intptr_t* isolate_snapshot_data_size, |
| 3323 uint8_t** isolate_snapshot_instructions_buffer, | 3330 uint8_t** isolate_snapshot_instructions_buffer, |
| 3324 intptr_t* isolate_snapshot_instructions_size); | 3331 intptr_t* isolate_snapshot_instructions_size); |
| 3325 | 3332 |
| 3326 /** | 3333 /** |
| 3334 * Get obfuscation map for precompiled code. |
| 3335 * |
| 3336 * Obfuscation map is encoded as a JSON array of pairs (original name, |
| 3337 * obfuscated name). |
| 3338 * |
| 3339 * \return Returns an error handler if the VM was built in a mode that does not |
| 3340 * support obfuscation. |
| 3341 */ |
| 3342 DART_EXPORT Dart_Handle Dart_GetObfuscationMap(uint8_t** buffer, |
| 3343 intptr_t* buffer_length); |
| 3344 |
| 3345 /** |
| 3327 * Returns whether the VM only supports running from precompiled snapshots and | 3346 * Returns whether the VM only supports running from precompiled snapshots and |
| 3328 * not from any other kind of snapshot or from source (that is, the VM was | 3347 * not from any other kind of snapshot or from source (that is, the VM was |
| 3329 * compiled with DART_PRECOMPILED_RUNTIME). | 3348 * compiled with DART_PRECOMPILED_RUNTIME). |
| 3330 */ | 3349 */ |
| 3331 DART_EXPORT bool Dart_IsPrecompiledRuntime(); | 3350 DART_EXPORT bool Dart_IsPrecompiledRuntime(); |
| 3332 | 3351 |
| 3333 /** | 3352 /** |
| 3334 * Print a native stack trace. Used for crash handling. | 3353 * Print a native stack trace. Used for crash handling. |
| 3335 */ | 3354 */ |
| 3336 DART_EXPORT void Dart_DumpNativeStackTrace(void* context); | 3355 DART_EXPORT void Dart_DumpNativeStackTrace(void* context); |
| 3337 | 3356 |
| 3338 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ | 3357 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ |
| OLD | NEW |