| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 #else | 47 #else |
| 48 /* __STDC_FORMAT_MACROS has to be defined before including <inttypes.h> to | 48 /* __STDC_FORMAT_MACROS has to be defined before including <inttypes.h> to |
| 49 * enable platform independent printf format specifiers. */ | 49 * enable platform independent printf format specifiers. */ |
| 50 #ifndef __STDC_FORMAT_MACROS | 50 #ifndef __STDC_FORMAT_MACROS |
| 51 #define __STDC_FORMAT_MACROS | 51 #define __STDC_FORMAT_MACROS |
| 52 #endif | 52 #endif |
| 53 #include <inttypes.h> | 53 #include <inttypes.h> |
| 54 #include <stdbool.h> | 54 #include <stdbool.h> |
| 55 #if __GNUC__ >= 4 | 55 #if __GNUC__ >= 4 |
| 56 #if defined(DART_SHARED_LIB) | 56 #if defined(DART_SHARED_LIB) |
| 57 #define DART_EXPORT DART_EXTERN_C __attribute__ ((visibility("default"))) \ | 57 #define DART_EXPORT \ |
| 58 __attribute((used)) | 58 DART_EXTERN_C __attribute__((visibility("default"))) __attribute((used)) |
| 59 #else | 59 #else |
| 60 #define DART_EXPORT DART_EXTERN_C | 60 #define DART_EXPORT DART_EXTERN_C |
| 61 #endif | 61 #endif |
| 62 #else | 62 #else |
| 63 #error Tool chain not supported. | 63 #error Tool chain not supported. |
| 64 #endif | 64 #endif |
| 65 #endif | 65 #endif |
| 66 | 66 |
| 67 #include <assert.h> | 67 #include <assert.h> |
| 68 | 68 |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 * header instead of this header. */ | 411 * header instead of this header. */ |
| 412 /** | 412 /** |
| 413 * Aborts the process if 'handle' is an error handle. | 413 * Aborts the process if 'handle' is an error handle. |
| 414 * | 414 * |
| 415 * Provided for convenience. | 415 * Provided for convenience. |
| 416 */ | 416 */ |
| 417 #define DART_CHECK_VALID(handle) \ | 417 #define DART_CHECK_VALID(handle) \ |
| 418 { \ | 418 { \ |
| 419 Dart_Handle __handle = handle; \ | 419 Dart_Handle __handle = handle; \ |
| 420 if (Dart_IsError((__handle))) { \ | 420 if (Dart_IsError((__handle))) { \ |
| 421 _Dart_ReportErrorHandle(__FILE__, __LINE__, \ | 421 _Dart_ReportErrorHandle(__FILE__, __LINE__, #handle, \ |
| 422 #handle, Dart_GetError(__handle)); \ | 422 Dart_GetError(__handle)); \ |
| 423 } \ | 423 } \ |
| 424 } \ | 424 } |
| 425 | 425 |
| 426 /** | 426 /** |
| 427 * Converts an object to a string. | 427 * Converts an object to a string. |
| 428 * | 428 * |
| 429 * May generate an unhandled exception error. | 429 * May generate an unhandled exception error. |
| 430 * | 430 * |
| 431 * \return The converted string if no error occurs during | 431 * \return The converted string if no error occurs during |
| 432 * the conversion. If an error does occur, an error handle is | 432 * the conversion. If an error does occur, an error handle is |
| 433 * returned. | 433 * returned. |
| 434 */ | 434 */ |
| (...skipping 25 matching lines...) Expand all Loading... |
| 460 DART_EXPORT uint64_t Dart_IdentityHash(Dart_Handle obj); | 460 DART_EXPORT uint64_t Dart_IdentityHash(Dart_Handle obj); |
| 461 | 461 |
| 462 /** | 462 /** |
| 463 * Allocates a handle in the current scope from a persistent handle. | 463 * Allocates a handle in the current scope from a persistent handle. |
| 464 */ | 464 */ |
| 465 DART_EXPORT Dart_Handle Dart_HandleFromPersistent(Dart_PersistentHandle object); | 465 DART_EXPORT Dart_Handle Dart_HandleFromPersistent(Dart_PersistentHandle object); |
| 466 | 466 |
| 467 /** | 467 /** |
| 468 * Allocates a handle in the current scope from a weak persistent handle. | 468 * Allocates a handle in the current scope from a weak persistent handle. |
| 469 */ | 469 */ |
| 470 DART_EXPORT Dart_Handle Dart_HandleFromWeakPersistent( | 470 DART_EXPORT Dart_Handle |
| 471 Dart_WeakPersistentHandle object); | 471 Dart_HandleFromWeakPersistent(Dart_WeakPersistentHandle object); |
| 472 | 472 |
| 473 /** | 473 /** |
| 474 * Allocates a persistent handle for an object. | 474 * Allocates a persistent handle for an object. |
| 475 * | 475 * |
| 476 * This handle has the lifetime of the current isolate unless it is | 476 * This handle has the lifetime of the current isolate unless it is |
| 477 * explicitly deallocated by calling Dart_DeletePersistentHandle. | 477 * explicitly deallocated by calling Dart_DeletePersistentHandle. |
| 478 * | 478 * |
| 479 * Requires there to be a current isolate. | 479 * Requires there to be a current isolate. |
| 480 */ | 480 */ |
| 481 DART_EXPORT Dart_PersistentHandle Dart_NewPersistentHandle(Dart_Handle object); | 481 DART_EXPORT Dart_PersistentHandle Dart_NewPersistentHandle(Dart_Handle object); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 * provided to callback when it is invoked. | 525 * provided to callback when it is invoked. |
| 526 * \param external_allocation_size The number of externally allocated | 526 * \param external_allocation_size The number of externally allocated |
| 527 * bytes for peer. Used to inform the garbage collector. | 527 * bytes for peer. Used to inform the garbage collector. |
| 528 * \param callback A function pointer that will be invoked sometime | 528 * \param callback A function pointer that will be invoked sometime |
| 529 * after the object is garbage collected, unless the handle has been deleted. | 529 * after the object is garbage collected, unless the handle has been deleted. |
| 530 * A valid callback needs to be specified it cannot be NULL. | 530 * A valid callback needs to be specified it cannot be NULL. |
| 531 * | 531 * |
| 532 * \return The weak persistent handle or NULL. NULL is returned in case of bad | 532 * \return The weak persistent handle or NULL. NULL is returned in case of bad |
| 533 * parameters. | 533 * parameters. |
| 534 */ | 534 */ |
| 535 DART_EXPORT Dart_WeakPersistentHandle Dart_NewWeakPersistentHandle( | 535 DART_EXPORT Dart_WeakPersistentHandle |
| 536 Dart_Handle object, | 536 Dart_NewWeakPersistentHandle(Dart_Handle object, |
| 537 void* peer, | 537 void* peer, |
| 538 intptr_t external_allocation_size, | 538 intptr_t external_allocation_size, |
| 539 Dart_WeakPersistentHandleFinalizer callback); | 539 Dart_WeakPersistentHandleFinalizer callback); |
| 540 | 540 |
| 541 DART_EXPORT void Dart_DeleteWeakPersistentHandle( | 541 DART_EXPORT void Dart_DeleteWeakPersistentHandle( |
| 542 Dart_Isolate isolate, | 542 Dart_Isolate isolate, |
| 543 Dart_WeakPersistentHandle object); | 543 Dart_WeakPersistentHandle object); |
| 544 | 544 |
| 545 | 545 |
| 546 /* | 546 /* |
| 547 * ============================ | 547 * ============================ |
| 548 * Garbage Collection Callbacks | 548 * Garbage Collection Callbacks |
| 549 * ============================ | 549 * ============================ |
| (...skipping 25 matching lines...) Expand all Loading... |
| 575 * if any. | 575 * if any. |
| 576 * | 576 * |
| 577 * \param epilogue_callback A function pointer to an epilogue callback function. | 577 * \param epilogue_callback A function pointer to an epilogue callback function. |
| 578 * An epilogue callback function should not be already set when this function | 578 * An epilogue callback function should not be already set when this function |
| 579 * is called. A NULL value removes the existing epilogue callback function | 579 * is called. A NULL value removes the existing epilogue callback function |
| 580 * if any. | 580 * if any. |
| 581 * | 581 * |
| 582 * \return Success if the callbacks were added. Otherwise, returns an | 582 * \return Success if the callbacks were added. Otherwise, returns an |
| 583 * error handle. | 583 * error handle. |
| 584 */ | 584 */ |
| 585 DART_EXPORT Dart_Handle Dart_SetGcCallbacks( | 585 DART_EXPORT Dart_Handle |
| 586 Dart_GcPrologueCallback prologue_callback, | 586 Dart_SetGcCallbacks(Dart_GcPrologueCallback prologue_callback, |
| 587 Dart_GcEpilogueCallback epilogue_callback); | 587 Dart_GcEpilogueCallback epilogue_callback); |
| 588 | 588 |
| 589 | 589 |
| 590 /* | 590 /* |
| 591 * ========================== | 591 * ========================== |
| 592 * Initialization and Globals | 592 * Initialization and Globals |
| 593 * ========================== | 593 * ========================== |
| 594 */ | 594 */ |
| 595 | 595 |
| 596 /** | 596 /** |
| 597 * Gets the version string for the Dart VM. | 597 * Gets the version string for the Dart VM. |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 * instructions, or NULL if no snapshot is provided. | 786 * instructions, or NULL if no snapshot is provided. |
| 787 * \param create A function to be called during isolate creation. | 787 * \param create A function to be called during isolate creation. |
| 788 * See Dart_IsolateCreateCallback. | 788 * See Dart_IsolateCreateCallback. |
| 789 * \param shutdown A function to be called when an isolate is shutdown. | 789 * \param shutdown A function to be called when an isolate is shutdown. |
| 790 * See Dart_IsolateShutdownCallback. | 790 * See Dart_IsolateShutdownCallback. |
| 791 * \param get_service_assets A function to be called by the service isolate when | 791 * \param get_service_assets A function to be called by the service isolate when |
| 792 * it requires the vmservice assets archive. | 792 * it requires the vmservice assets archive. |
| 793 * See Dart_GetVMServiceAssetsArchive. | 793 * See Dart_GetVMServiceAssetsArchive. |
| 794 */ | 794 */ |
| 795 typedef struct { | 795 typedef struct { |
| 796 int32_t version; | 796 int32_t version; |
| 797 const uint8_t* vm_isolate_snapshot; | 797 const uint8_t* vm_isolate_snapshot; |
| 798 const uint8_t* instructions_snapshot; | 798 const uint8_t* instructions_snapshot; |
| 799 const uint8_t* data_snapshot; | 799 const uint8_t* data_snapshot; |
| 800 Dart_IsolateCreateCallback create; | 800 Dart_IsolateCreateCallback create; |
| 801 Dart_IsolateShutdownCallback shutdown; | 801 Dart_IsolateShutdownCallback shutdown; |
| 802 Dart_ThreadExitCallback thread_exit; | 802 Dart_ThreadExitCallback thread_exit; |
| 803 Dart_FileOpenCallback file_open; | 803 Dart_FileOpenCallback file_open; |
| 804 Dart_FileReadCallback file_read; | 804 Dart_FileReadCallback file_read; |
| 805 Dart_FileWriteCallback file_write; | 805 Dart_FileWriteCallback file_write; |
| 806 Dart_FileCloseCallback file_close; | 806 Dart_FileCloseCallback file_close; |
| 807 Dart_EntropySource entropy_source; | 807 Dart_EntropySource entropy_source; |
| 808 Dart_GetVMServiceAssetsArchive get_service_assets; | 808 Dart_GetVMServiceAssetsArchive get_service_assets; |
| 809 } Dart_InitializeParams; | 809 } Dart_InitializeParams; |
| 810 | 810 |
| 811 /** | 811 /** |
| 812 * Initializes the VM. | 812 * Initializes the VM. |
| 813 * | 813 * |
| 814 * \param flags A struct containing initialization information. The version | 814 * \param flags A struct containing initialization information. The version |
| 815 * field of the struct must be DART_INITIALIZE_PARAMS_CURRENT_VERSION. | 815 * field of the struct must be DART_INITIALIZE_PARAMS_CURRENT_VERSION. |
| 816 * | 816 * |
| 817 * \return NULL if initialization is successful. Returns an error message | 817 * \return NULL if initialization is successful. Returns an error message |
| 818 * otherwise. The caller is responsible for freeing the error message. | 818 * otherwise. The caller is responsible for freeing the error message. |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 * | 972 * |
| 973 * Requires there to be a current isolate. | 973 * Requires there to be a current isolate. |
| 974 * | 974 * |
| 975 * \param buffer Returns a pointer to a buffer containing the | 975 * \param buffer Returns a pointer to a buffer containing the |
| 976 * snapshot. This buffer is scope allocated and is only valid | 976 * snapshot. This buffer is scope allocated and is only valid |
| 977 * until the next call to Dart_ExitScope. | 977 * until the next call to Dart_ExitScope. |
| 978 * \param size Returns the size of the buffer. | 978 * \param size Returns the size of the buffer. |
| 979 * | 979 * |
| 980 * \return A valid handle if no error occurs during the operation. | 980 * \return A valid handle if no error occurs during the operation. |
| 981 */ | 981 */ |
| 982 DART_EXPORT Dart_Handle Dart_CreateSnapshot( | 982 DART_EXPORT Dart_Handle |
| 983 uint8_t** vm_isolate_snapshot_buffer, | 983 Dart_CreateSnapshot(uint8_t** vm_isolate_snapshot_buffer, |
| 984 intptr_t* vm_isolate_snapshot_size, | 984 intptr_t* vm_isolate_snapshot_size, |
| 985 uint8_t** isolate_snapshot_buffer, | 985 uint8_t** isolate_snapshot_buffer, |
| 986 intptr_t* isolate_snapshot_size); | 986 intptr_t* isolate_snapshot_size); |
| 987 | 987 |
| 988 /** | 988 /** |
| 989 * Creates a snapshot of the application script loaded in the isolate. | 989 * Creates a snapshot of the application script loaded in the isolate. |
| 990 * | 990 * |
| 991 * A script snapshot can be used for implementing fast startup of applications | 991 * A script snapshot can be used for implementing fast startup of applications |
| 992 * (skips the script tokenizing and parsing process). A Snapshot of the script | 992 * (skips the script tokenizing and parsing process). A Snapshot of the script |
| 993 * can only be created before any dart code has executed. | 993 * can only be created before any dart code has executed. |
| 994 * | 994 * |
| 995 * Requires there to be a current isolate which already has loaded script. | 995 * Requires there to be a current isolate which already has loaded script. |
| 996 * | 996 * |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1057 | 1057 |
| 1058 /** | 1058 /** |
| 1059 * A port is used to send or receive inter-isolate messages | 1059 * A port is used to send or receive inter-isolate messages |
| 1060 */ | 1060 */ |
| 1061 typedef int64_t Dart_Port; | 1061 typedef int64_t Dart_Port; |
| 1062 | 1062 |
| 1063 /** | 1063 /** |
| 1064 * ILLEGAL_PORT is a port number guaranteed never to be associated with a valid | 1064 * ILLEGAL_PORT is a port number guaranteed never to be associated with a valid |
| 1065 * port. | 1065 * port. |
| 1066 */ | 1066 */ |
| 1067 #define ILLEGAL_PORT ((Dart_Port) 0) | 1067 #define ILLEGAL_PORT ((Dart_Port)0) |
| 1068 | 1068 |
| 1069 /** | 1069 /** |
| 1070 * A message notification callback. | 1070 * A message notification callback. |
| 1071 * | 1071 * |
| 1072 * This callback allows the embedder to provide an alternate wakeup | 1072 * This callback allows the embedder to provide an alternate wakeup |
| 1073 * mechanism for the delivery of inter-isolate messages. It is the | 1073 * mechanism for the delivery of inter-isolate messages. It is the |
| 1074 * responsibility of the embedder to call Dart_HandleMessage to | 1074 * responsibility of the embedder to call Dart_HandleMessage to |
| 1075 * process the message. | 1075 * process the message. |
| 1076 */ | 1076 */ |
| 1077 typedef void (*Dart_MessageNotifyCallback)(Dart_Isolate dest_isolate); | 1077 typedef void (*Dart_MessageNotifyCallback)(Dart_Isolate dest_isolate); |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1427 * \param object Some Object. | 1427 * \param object Some Object. |
| 1428 * | 1428 * |
| 1429 * \return true if Object is of the specified type. | 1429 * \return true if Object is of the specified type. |
| 1430 */ | 1430 */ |
| 1431 DART_EXPORT bool Dart_IsInstance(Dart_Handle object); | 1431 DART_EXPORT bool Dart_IsInstance(Dart_Handle object); |
| 1432 DART_EXPORT bool Dart_IsNumber(Dart_Handle object); | 1432 DART_EXPORT bool Dart_IsNumber(Dart_Handle object); |
| 1433 DART_EXPORT bool Dart_IsInteger(Dart_Handle object); | 1433 DART_EXPORT bool Dart_IsInteger(Dart_Handle object); |
| 1434 DART_EXPORT bool Dart_IsDouble(Dart_Handle object); | 1434 DART_EXPORT bool Dart_IsDouble(Dart_Handle object); |
| 1435 DART_EXPORT bool Dart_IsBoolean(Dart_Handle object); | 1435 DART_EXPORT bool Dart_IsBoolean(Dart_Handle object); |
| 1436 DART_EXPORT bool Dart_IsString(Dart_Handle object); | 1436 DART_EXPORT bool Dart_IsString(Dart_Handle object); |
| 1437 DART_EXPORT bool Dart_IsStringLatin1(Dart_Handle object); /* (ISO-8859-1) */ | 1437 DART_EXPORT bool Dart_IsStringLatin1(Dart_Handle object); /* (ISO-8859-1) */ |
| 1438 DART_EXPORT bool Dart_IsExternalString(Dart_Handle object); | 1438 DART_EXPORT bool Dart_IsExternalString(Dart_Handle object); |
| 1439 DART_EXPORT bool Dart_IsList(Dart_Handle object); | 1439 DART_EXPORT bool Dart_IsList(Dart_Handle object); |
| 1440 DART_EXPORT bool Dart_IsMap(Dart_Handle object); | 1440 DART_EXPORT bool Dart_IsMap(Dart_Handle object); |
| 1441 DART_EXPORT bool Dart_IsLibrary(Dart_Handle object); | 1441 DART_EXPORT bool Dart_IsLibrary(Dart_Handle object); |
| 1442 DART_EXPORT bool Dart_IsType(Dart_Handle handle); | 1442 DART_EXPORT bool Dart_IsType(Dart_Handle handle); |
| 1443 DART_EXPORT bool Dart_IsFunction(Dart_Handle handle); | 1443 DART_EXPORT bool Dart_IsFunction(Dart_Handle handle); |
| 1444 DART_EXPORT bool Dart_IsVariable(Dart_Handle handle); | 1444 DART_EXPORT bool Dart_IsVariable(Dart_Handle handle); |
| 1445 DART_EXPORT bool Dart_IsTypeVariable(Dart_Handle handle); | 1445 DART_EXPORT bool Dart_IsTypeVariable(Dart_Handle handle); |
| 1446 DART_EXPORT bool Dart_IsClosure(Dart_Handle object); | 1446 DART_EXPORT bool Dart_IsClosure(Dart_Handle object); |
| 1447 DART_EXPORT bool Dart_IsTypedData(Dart_Handle object); | 1447 DART_EXPORT bool Dart_IsTypedData(Dart_Handle object); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1711 * Latin-1 (ISO-8859-1) encoded characters. | 1711 * Latin-1 (ISO-8859-1) encoded characters. |
| 1712 * | 1712 * |
| 1713 * \param latin1_array Array of Latin-1 encoded characters. This must not move. | 1713 * \param latin1_array Array of Latin-1 encoded characters. This must not move. |
| 1714 * \param length The length of the characters array. | 1714 * \param length The length of the characters array. |
| 1715 * \param peer An external pointer to associate with this string. | 1715 * \param peer An external pointer to associate with this string. |
| 1716 * \param cback A callback to be called when this string is finalized. | 1716 * \param cback A callback to be called when this string is finalized. |
| 1717 * | 1717 * |
| 1718 * \return The String object if no error occurs. Otherwise returns | 1718 * \return The String object if no error occurs. Otherwise returns |
| 1719 * an error handle. | 1719 * an error handle. |
| 1720 */ | 1720 */ |
| 1721 DART_EXPORT Dart_Handle Dart_NewExternalLatin1String( | 1721 DART_EXPORT Dart_Handle |
| 1722 const uint8_t* latin1_array, | 1722 Dart_NewExternalLatin1String(const uint8_t* latin1_array, |
| 1723 intptr_t length, | 1723 intptr_t length, |
| 1724 void* peer, | 1724 void* peer, |
| 1725 Dart_PeerFinalizer cback); | 1725 Dart_PeerFinalizer cback); |
| 1726 | 1726 |
| 1727 /** | 1727 /** |
| 1728 * Returns a String which references an external array of UTF-16 encoded | 1728 * Returns a String which references an external array of UTF-16 encoded |
| 1729 * characters. | 1729 * characters. |
| 1730 * | 1730 * |
| 1731 * \param utf16_array An array of UTF-16 encoded characters. This must not move. | 1731 * \param utf16_array An array of UTF-16 encoded characters. This must not move. |
| 1732 * \param length The length of the characters array. | 1732 * \param length The length of the characters array. |
| 1733 * \param peer An external pointer to associate with this string. | 1733 * \param peer An external pointer to associate with this string. |
| 1734 * \param cback A callback to be called when this string is finalized. | 1734 * \param cback A callback to be called when this string is finalized. |
| 1735 * | 1735 * |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1833 * In this case the function returns the original String object as is. | 1833 * In this case the function returns the original String object as is. |
| 1834 * | 1834 * |
| 1835 * For example: | 1835 * For example: |
| 1836 * intptr_t size; | 1836 * intptr_t size; |
| 1837 * Dart_Handle result; | 1837 * Dart_Handle result; |
| 1838 * result = DartStringStorageSize(str, &size); | 1838 * result = DartStringStorageSize(str, &size); |
| 1839 * void* data = malloc(size); | 1839 * void* data = malloc(size); |
| 1840 * result = Dart_MakeExternalString(str, data, size, NULL, NULL); | 1840 * result = Dart_MakeExternalString(str, data, size, NULL, NULL); |
| 1841 * | 1841 * |
| 1842 */ | 1842 */ |
| 1843 DART_EXPORT Dart_Handle Dart_MakeExternalString( | 1843 DART_EXPORT Dart_Handle |
| 1844 Dart_Handle str, | 1844 Dart_MakeExternalString(Dart_Handle str, |
| 1845 void* array, | 1845 void* array, |
| 1846 intptr_t external_allocation_size, | 1846 intptr_t external_allocation_size, |
| 1847 void* peer, | 1847 void* peer, |
| 1848 Dart_PeerFinalizer cback); | 1848 Dart_PeerFinalizer cback); |
| 1849 | 1849 |
| 1850 /** | 1850 /** |
| 1851 * Retrieves some properties associated with a String. | 1851 * Retrieves some properties associated with a String. |
| 1852 * Properties retrieved are: | 1852 * Properties retrieved are: |
| 1853 * - character size of the string (one or two byte) | 1853 * - character size of the string (one or two byte) |
| 1854 * - length of the string | 1854 * - length of the string |
| 1855 * - peer pointer of string if it is an external string. | 1855 * - peer pointer of string if it is an external string. |
| 1856 * \param str A String. | 1856 * \param str A String. |
| 1857 * \param char_size Returns the character size of the String. | 1857 * \param char_size Returns the character size of the String. |
| 1858 * \param str_len Returns the length of the String. | 1858 * \param str_len Returns the length of the String. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1900 * If the index is out of bounds, an error occurs. | 1900 * If the index is out of bounds, an error occurs. |
| 1901 * | 1901 * |
| 1902 * May generate an unhandled exception error. | 1902 * May generate an unhandled exception error. |
| 1903 * | 1903 * |
| 1904 * \param list A List. | 1904 * \param list A List. |
| 1905 * \param index A valid index into the List. | 1905 * \param index A valid index into the List. |
| 1906 * | 1906 * |
| 1907 * \return The Object in the List at the specified index if no error | 1907 * \return The Object in the List at the specified index if no error |
| 1908 * occurs. Otherwise returns an error handle. | 1908 * occurs. Otherwise returns an error handle. |
| 1909 */ | 1909 */ |
| 1910 DART_EXPORT Dart_Handle Dart_ListGetAt(Dart_Handle list, | 1910 DART_EXPORT Dart_Handle Dart_ListGetAt(Dart_Handle list, intptr_t index); |
| 1911 intptr_t index); | |
| 1912 | 1911 |
| 1913 /** | 1912 /** |
| 1914 * Gets a range of Objects from a List. | 1913 * Gets a range of Objects from a List. |
| 1915 * | 1914 * |
| 1916 * If any of the requested index values are out of bounds, an error occurs. | 1915 * If any of the requested index values are out of bounds, an error occurs. |
| 1917 * | 1916 * |
| 1918 * May generate an unhandled exception error. | 1917 * May generate an unhandled exception error. |
| 1919 * | 1918 * |
| 1920 * \param list A List. | 1919 * \param list A List. |
| 1921 * \param offset The offset of the first item to get. | 1920 * \param offset The offset of the first item to get. |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2037 * Dart_TypedData_Type. | 2036 * Dart_TypedData_Type. |
| 2038 */ | 2037 */ |
| 2039 DART_EXPORT Dart_TypedData_Type Dart_GetTypeOfTypedData(Dart_Handle object); | 2038 DART_EXPORT Dart_TypedData_Type Dart_GetTypeOfTypedData(Dart_Handle object); |
| 2040 | 2039 |
| 2041 /** | 2040 /** |
| 2042 * Return type if this object is an external TypedData object. | 2041 * Return type if this object is an external TypedData object. |
| 2043 * | 2042 * |
| 2044 * \return kInvalid if the object is not an external TypedData object or | 2043 * \return kInvalid if the object is not an external TypedData object or |
| 2045 * the appropriate Dart_TypedData_Type. | 2044 * the appropriate Dart_TypedData_Type. |
| 2046 */ | 2045 */ |
| 2047 DART_EXPORT Dart_TypedData_Type Dart_GetTypeOfExternalTypedData( | 2046 DART_EXPORT Dart_TypedData_Type |
| 2048 Dart_Handle object); | 2047 Dart_GetTypeOfExternalTypedData(Dart_Handle object); |
| 2049 | 2048 |
| 2050 /** | 2049 /** |
| 2051 * Returns a TypedData object of the desired length and type. | 2050 * Returns a TypedData object of the desired length and type. |
| 2052 * | 2051 * |
| 2053 * \param type The type of the TypedData object. | 2052 * \param type The type of the TypedData object. |
| 2054 * \param length The length of the TypedData object (length in type units). | 2053 * \param length The length of the TypedData object (length in type units). |
| 2055 * | 2054 * |
| 2056 * \return The TypedData object if no error occurs. Otherwise returns | 2055 * \return The TypedData object if no error occurs. Otherwise returns |
| 2057 * an error handle. | 2056 * an error handle. |
| 2058 */ | 2057 */ |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2176 * Allocate a new object without invoking a constructor, and sets specified | 2175 * Allocate a new object without invoking a constructor, and sets specified |
| 2177 * native fields. | 2176 * native fields. |
| 2178 * | 2177 * |
| 2179 * \param type The type of an object to be allocated. | 2178 * \param type The type of an object to be allocated. |
| 2180 * \param num_native_fields The number of native fields to set. | 2179 * \param num_native_fields The number of native fields to set. |
| 2181 * \param native_fields An array containing the value of native fields. | 2180 * \param native_fields An array containing the value of native fields. |
| 2182 * | 2181 * |
| 2183 * \return The new object. If an error occurs during execution, then an | 2182 * \return The new object. If an error occurs during execution, then an |
| 2184 * error handle is returned. | 2183 * error handle is returned. |
| 2185 */ | 2184 */ |
| 2186 DART_EXPORT Dart_Handle Dart_AllocateWithNativeFields( | 2185 DART_EXPORT Dart_Handle |
| 2187 Dart_Handle type, | 2186 Dart_AllocateWithNativeFields(Dart_Handle type, |
| 2188 intptr_t num_native_fields, | 2187 intptr_t num_native_fields, |
| 2189 const intptr_t* native_fields); | 2188 const intptr_t* native_fields); |
| 2190 | 2189 |
| 2191 /** | 2190 /** |
| 2192 * Invokes a method or function. | 2191 * Invokes a method or function. |
| 2193 * | 2192 * |
| 2194 * The 'target' parameter may be an object, type, or library. If | 2193 * The 'target' parameter may be an object, type, or library. If |
| 2195 * 'target' is an object, then this function will invoke an instance | 2194 * 'target' is an object, then this function will invoke an instance |
| 2196 * method. If 'target' is a type, then this function will invoke a | 2195 * method. If 'target' is a type, then this function will invoke a |
| 2197 * static method. If 'target' is a library, then this function will | 2196 * static method. If 'target' is a library, then this function will |
| 2198 * invoke a top-level function from that library. | 2197 * invoke a top-level function from that library. |
| 2199 * NOTE: This API call cannot be used to invoke methods of a type object. | 2198 * NOTE: This API call cannot be used to invoke methods of a type object. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2268 * This function ignores field visibility (leading underscores in names). | 2267 * This function ignores field visibility (leading underscores in names). |
| 2269 * | 2268 * |
| 2270 * May generate an unhandled exception error. | 2269 * May generate an unhandled exception error. |
| 2271 * | 2270 * |
| 2272 * \param container An object, type, or library. | 2271 * \param container An object, type, or library. |
| 2273 * \param name A field name. | 2272 * \param name A field name. |
| 2274 * | 2273 * |
| 2275 * \return If no error occurs, then the value of the field is | 2274 * \return If no error occurs, then the value of the field is |
| 2276 * returned. Otherwise an error handle is returned. | 2275 * returned. Otherwise an error handle is returned. |
| 2277 */ | 2276 */ |
| 2278 DART_EXPORT Dart_Handle Dart_GetField(Dart_Handle container, | 2277 DART_EXPORT Dart_Handle Dart_GetField(Dart_Handle container, Dart_Handle name); |
| 2279 Dart_Handle name); | |
| 2280 | 2278 |
| 2281 /** | 2279 /** |
| 2282 * Sets the value of a field. | 2280 * Sets the value of a field. |
| 2283 * | 2281 * |
| 2284 * The 'container' parameter may actually be an object, type, or | 2282 * The 'container' parameter may actually be an object, type, or |
| 2285 * library. If 'container' is an object, then this function will | 2283 * library. If 'container' is an object, then this function will |
| 2286 * access an instance field. If 'container' is a type, then this | 2284 * access an instance field. If 'container' is a type, then this |
| 2287 * function will access a static field. If 'container' is a library, | 2285 * function will access a static field. If 'container' is a library, |
| 2288 * then this function will access a top-level variable. | 2286 * then this function will access a top-level variable. |
| 2289 * NOTE: This API call cannot be used to access fields of a type object. | 2287 * NOTE: This API call cannot be used to access fields of a type object. |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2441 enum { | 2439 enum { |
| 2442 kNativeArgNumberPos = 0, | 2440 kNativeArgNumberPos = 0, |
| 2443 kNativeArgNumberSize = 8, | 2441 kNativeArgNumberSize = 8, |
| 2444 kNativeArgTypePos = kNativeArgNumberPos + kNativeArgNumberSize, | 2442 kNativeArgTypePos = kNativeArgNumberPos + kNativeArgNumberSize, |
| 2445 kNativeArgTypeSize = 8, | 2443 kNativeArgTypeSize = 8, |
| 2446 }; | 2444 }; |
| 2447 | 2445 |
| 2448 #define BITMASK(size) ((1 << size) - 1) | 2446 #define BITMASK(size) ((1 << size) - 1) |
| 2449 #define DART_NATIVE_ARG_DESCRIPTOR(type, position) \ | 2447 #define DART_NATIVE_ARG_DESCRIPTOR(type, position) \ |
| 2450 (((type & BITMASK(kNativeArgTypeSize)) << kNativeArgTypePos) | \ | 2448 (((type & BITMASK(kNativeArgTypeSize)) << kNativeArgTypePos) | \ |
| 2451 (position & BITMASK(kNativeArgNumberSize))) | 2449 (position & BITMASK(kNativeArgNumberSize))) // NOLINT |
| 2452 | 2450 |
| 2453 /** | 2451 /** |
| 2454 * Gets the native arguments based on the types passed in and populates | 2452 * Gets the native arguments based on the types passed in and populates |
| 2455 * the passed arguments buffer with appropriate native values. | 2453 * the passed arguments buffer with appropriate native values. |
| 2456 * | 2454 * |
| 2457 * \param args the Native arguments block passed into the native call. | 2455 * \param args the Native arguments block passed into the native call. |
| 2458 * \param num_arguments length of argument descriptor array and argument | 2456 * \param num_arguments length of argument descriptor array and argument |
| 2459 * values array passed in. | 2457 * values array passed in. |
| 2460 * \param arg_descriptors an array that describes the arguments that | 2458 * \param arg_descriptors an array that describes the arguments that |
| 2461 * need to be retrieved. For each argument to be retrieved the descriptor | 2459 * need to be retrieved. For each argument to be retrieved the descriptor |
| 2462 * contains the argument number (0, 1 etc.) and the argument type | 2460 * contains the argument number (0, 1 etc.) and the argument type |
| 2463 * described using Dart_NativeArgument_Type, e.g: | 2461 * described using Dart_NativeArgument_Type, e.g: |
| 2464 * DART_NATIVE_ARG_DESCRIPTOR(Dart_NativeArgument_kBool, 1) indicates | 2462 * DART_NATIVE_ARG_DESCRIPTOR(Dart_NativeArgument_kBool, 1) indicates |
| 2465 * that the first argument is to be retrieved and it should be a boolean. | 2463 * that the first argument is to be retrieved and it should be a boolean. |
| 2466 * \param arg_values array into which the native arguments need to be | 2464 * \param arg_values array into which the native arguments need to be |
| 2467 * extracted into, the array is allocated by the caller (it could be | 2465 * extracted into, the array is allocated by the caller (it could be |
| 2468 * stack allocated to avoid the malloc/free performance overhead). | 2466 * stack allocated to avoid the malloc/free performance overhead). |
| 2469 * | 2467 * |
| 2470 * \return Success if all the arguments could be extracted correctly, | 2468 * \return Success if all the arguments could be extracted correctly, |
| 2471 * returns an error handle if there were any errors while extracting the | 2469 * returns an error handle if there were any errors while extracting the |
| 2472 * arguments (mismatched number of arguments, incorrect types, etc.). | 2470 * arguments (mismatched number of arguments, incorrect types, etc.). |
| 2473 */ | 2471 */ |
| 2474 DART_EXPORT Dart_Handle Dart_GetNativeArguments( | 2472 DART_EXPORT Dart_Handle |
| 2475 Dart_NativeArguments args, | 2473 Dart_GetNativeArguments(Dart_NativeArguments args, |
| 2476 int num_arguments, | 2474 int num_arguments, |
| 2477 const Dart_NativeArgument_Descriptor* arg_descriptors, | 2475 const Dart_NativeArgument_Descriptor* arg_descriptors, |
| 2478 Dart_NativeArgument_Value* arg_values); | 2476 Dart_NativeArgument_Value* arg_values); |
| 2479 | 2477 |
| 2480 | 2478 |
| 2481 /** | 2479 /** |
| 2482 * Gets the native argument at some index. | 2480 * Gets the native argument at some index. |
| 2483 */ | 2481 */ |
| 2484 DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, | 2482 DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, |
| 2485 int index); | 2483 int index); |
| 2486 /* TODO(turnidge): Specify the behavior of an out-of-bounds access. */ | 2484 /* TODO(turnidge): Specify the behavior of an out-of-bounds access. */ |
| 2487 | 2485 |
| 2488 /** | 2486 /** |
| 2489 * Gets the number of native arguments. | 2487 * Gets the number of native arguments. |
| 2490 */ | 2488 */ |
| 2491 DART_EXPORT int Dart_GetNativeArgumentCount(Dart_NativeArguments args); | 2489 DART_EXPORT int Dart_GetNativeArgumentCount(Dart_NativeArguments args); |
| 2492 | 2490 |
| 2493 /** | 2491 /** |
| 2494 * Gets all the native fields of the native argument at some index. | 2492 * Gets all the native fields of the native argument at some index. |
| 2495 * \param args Native arguments structure. | 2493 * \param args Native arguments structure. |
| 2496 * \param arg_index Index of the desired argument in the structure above. | 2494 * \param arg_index Index of the desired argument in the structure above. |
| 2497 * \param num_fields size of the intptr_t array 'field_values' passed in. | 2495 * \param num_fields size of the intptr_t array 'field_values' passed in. |
| 2498 * \param field_values intptr_t array in which native field values are returned. | 2496 * \param field_values intptr_t array in which native field values are returned. |
| 2499 * \return Success if the native fields where copied in successfully. Otherwise | 2497 * \return Success if the native fields where copied in successfully. Otherwise |
| 2500 * returns an error handle. On success the native field values are copied | 2498 * returns an error handle. On success the native field values are copied |
| 2501 * into the 'field_values' array, if the argument at 'arg_index' is a | 2499 * into the 'field_values' array, if the argument at 'arg_index' is a |
| 2502 * null object then 0 is copied as the native field values into the | 2500 * null object then 0 is copied as the native field values into the |
| 2503 * 'field_values' array. | 2501 * 'field_values' array. |
| 2504 */ | 2502 */ |
| 2505 DART_EXPORT Dart_Handle Dart_GetNativeFieldsOfArgument( | 2503 DART_EXPORT Dart_Handle |
| 2506 Dart_NativeArguments args, | 2504 Dart_GetNativeFieldsOfArgument(Dart_NativeArguments args, |
| 2507 int arg_index, | 2505 int arg_index, |
| 2508 int num_fields, | 2506 int num_fields, |
| 2509 intptr_t* field_values); | 2507 intptr_t* field_values); |
| 2510 | 2508 |
| 2511 /** | 2509 /** |
| 2512 * Gets the native field of the receiver. | 2510 * Gets the native field of the receiver. |
| 2513 */ | 2511 */ |
| 2514 DART_EXPORT Dart_Handle Dart_GetNativeReceiver(Dart_NativeArguments args, | 2512 DART_EXPORT Dart_Handle Dart_GetNativeReceiver(Dart_NativeArguments args, |
| 2515 intptr_t* value); | 2513 intptr_t* value); |
| 2516 | 2514 |
| 2517 /** | 2515 /** |
| 2518 * Gets a string native argument at some index. | 2516 * Gets a string native argument at some index. |
| 2519 * \param args Native arguments structure. | 2517 * \param args Native arguments structure. |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2652 */ | 2650 */ |
| 2653 typedef Dart_Handle (*Dart_EnvironmentCallback)(Dart_Handle name); | 2651 typedef Dart_Handle (*Dart_EnvironmentCallback)(Dart_Handle name); |
| 2654 | 2652 |
| 2655 /** | 2653 /** |
| 2656 * Sets the environment callback for the current isolate. This | 2654 * Sets the environment callback for the current isolate. This |
| 2657 * callback is used to lookup environment values by name in the | 2655 * callback is used to lookup environment values by name in the |
| 2658 * current environment. This enables the embedder to supply values for | 2656 * current environment. This enables the embedder to supply values for |
| 2659 * the const constructors bool.fromEnvironment, int.fromEnvironment | 2657 * the const constructors bool.fromEnvironment, int.fromEnvironment |
| 2660 * and String.fromEnvironment. | 2658 * and String.fromEnvironment. |
| 2661 */ | 2659 */ |
| 2662 DART_EXPORT Dart_Handle Dart_SetEnvironmentCallback( | 2660 DART_EXPORT Dart_Handle |
| 2663 Dart_EnvironmentCallback callback); | 2661 Dart_SetEnvironmentCallback(Dart_EnvironmentCallback callback); |
| 2664 | 2662 |
| 2665 /** | 2663 /** |
| 2666 * Sets the callback used to resolve native functions for a library. | 2664 * Sets the callback used to resolve native functions for a library. |
| 2667 * | 2665 * |
| 2668 * \param library A library. | 2666 * \param library A library. |
| 2669 * \param resolver A native entry resolver. | 2667 * \param resolver A native entry resolver. |
| 2670 * | 2668 * |
| 2671 * \return A valid handle if the native resolver was set successfully. | 2669 * \return A valid handle if the native resolver was set successfully. |
| 2672 */ | 2670 */ |
| 2673 DART_EXPORT Dart_Handle Dart_SetNativeResolver( | 2671 DART_EXPORT Dart_Handle |
| 2674 Dart_Handle library, | 2672 Dart_SetNativeResolver(Dart_Handle library, |
| 2675 Dart_NativeEntryResolver resolver, | 2673 Dart_NativeEntryResolver resolver, |
| 2676 Dart_NativeEntrySymbol symbol); | 2674 Dart_NativeEntrySymbol symbol); |
| 2677 /* TODO(turnidge): Rename to Dart_LibrarySetNativeResolver? */ | 2675 /* TODO(turnidge): Rename to Dart_LibrarySetNativeResolver? */ |
| 2678 | 2676 |
| 2679 | 2677 |
| 2680 /* | 2678 /* |
| 2681 * ===================== | 2679 * ===================== |
| 2682 * Scripts and Libraries | 2680 * Scripts and Libraries |
| 2683 * ===================== | 2681 * ===================== |
| 2684 */ | 2682 */ |
| 2685 | 2683 |
| 2686 typedef enum { | 2684 typedef enum { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2737 * or scripts in the isolate. | 2735 * or scripts in the isolate. |
| 2738 * | 2736 * |
| 2739 * \param handler Handler code to be used for handling the various tags | 2737 * \param handler Handler code to be used for handling the various tags |
| 2740 * encountered while loading libraries or scripts in the isolate. | 2738 * encountered while loading libraries or scripts in the isolate. |
| 2741 * | 2739 * |
| 2742 * \return If no error occurs, the handler is set for the isolate. | 2740 * \return If no error occurs, the handler is set for the isolate. |
| 2743 * Otherwise an error handle is returned. | 2741 * Otherwise an error handle is returned. |
| 2744 * | 2742 * |
| 2745 * TODO(turnidge): Document. | 2743 * TODO(turnidge): Document. |
| 2746 */ | 2744 */ |
| 2747 DART_EXPORT Dart_Handle Dart_SetLibraryTagHandler( | 2745 DART_EXPORT Dart_Handle |
| 2748 Dart_LibraryTagHandler handler); | 2746 Dart_SetLibraryTagHandler(Dart_LibraryTagHandler handler); |
| 2749 | 2747 |
| 2750 /** | 2748 /** |
| 2751 * Canonicalizes a url with respect to some library. | 2749 * Canonicalizes a url with respect to some library. |
| 2752 * | 2750 * |
| 2753 * The url is resolved with respect to the library's url and some url | 2751 * The url is resolved with respect to the library's url and some url |
| 2754 * normalizations are performed. | 2752 * normalizations are performed. |
| 2755 * | 2753 * |
| 2756 * This canonicalization function should be sufficient for most | 2754 * This canonicalization function should be sufficient for most |
| 2757 * embedders to implement the Dart_kCanonicalizeUrl tag. | 2755 * embedders to implement the Dart_kCanonicalizeUrl tag. |
| 2758 * | 2756 * |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3112 * | 3110 * |
| 3113 * reset_fields is true when we are about to create a precompilated snapshot. | 3111 * reset_fields is true when we are about to create a precompilated snapshot. |
| 3114 * Some fields are already been initialized as part of the loading logic, and | 3112 * Some fields are already been initialized as part of the loading logic, and |
| 3115 * we want them to be reinitialized in the new process that will load the | 3113 * we want them to be reinitialized in the new process that will load the |
| 3116 * snapshot. reset_fields is false for --noopt, which will continue running in | 3114 * snapshot. reset_fields is false for --noopt, which will continue running in |
| 3117 * the same process. | 3115 * the same process. |
| 3118 * | 3116 * |
| 3119 * \return An error handle if a compilation error or runtime error running const | 3117 * \return An error handle if a compilation error or runtime error running const |
| 3120 * constructors was encountered. | 3118 * constructors was encountered. |
| 3121 */ | 3119 */ |
| 3122 DART_EXPORT Dart_Handle Dart_Precompile( | 3120 DART_EXPORT Dart_Handle |
| 3123 Dart_QualifiedFunctionName entry_points[], | 3121 Dart_Precompile(Dart_QualifiedFunctionName entry_points[], bool reset_fields); |
| 3124 bool reset_fields); | |
| 3125 | 3122 |
| 3126 | 3123 |
| 3127 /** | 3124 /** |
| 3128 * Creates a precompiled snapshot. | 3125 * Creates a precompiled snapshot. |
| 3129 * - A root library must have been loaded. | 3126 * - A root library must have been loaded. |
| 3130 * - Dart_Precompile must have been called. | 3127 * - Dart_Precompile must have been called. |
| 3131 * | 3128 * |
| 3132 * Outputs a vm isolate snapshot, an isolate snapshot, and an assembly file | 3129 * Outputs a vm isolate snapshot, an isolate snapshot, and an assembly file |
| 3133 * defining the symbols kInstructionsSnapshot and kDataSnapshot. The assembly | 3130 * defining the symbols kInstructionsSnapshot and kDataSnapshot. The assembly |
| 3134 * should be compiled as a static or shared library and linked or loaded by the | 3131 * should be compiled as a static or shared library and linked or loaded by the |
| 3135 * embedder. | 3132 * embedder. |
| 3136 * Running this snapshot requires a VM compiled with DART_PRECOMPILED_SNAPSHOT. | 3133 * Running this snapshot requires a VM compiled with DART_PRECOMPILED_SNAPSHOT. |
| 3137 * The vm isolate snapshot, kInstructionsSnapshot and kDataSnapshot should be | 3134 * The vm isolate snapshot, kInstructionsSnapshot and kDataSnapshot should be |
| 3138 * passed as arguments to Dart_Initialize. The isolate snapshot should be | 3135 * passed as arguments to Dart_Initialize. The isolate snapshot should be |
| 3139 * passed to Dart_CreateIsolate. | 3136 * passed to Dart_CreateIsolate. |
| 3140 * | 3137 * |
| 3141 * The buffers are scope allocated and are only valid until the next call to | 3138 * The buffers are scope allocated and are only valid until the next call to |
| 3142 * Dart_ExitScope. | 3139 * Dart_ExitScope. |
| 3143 * | 3140 * |
| 3144 * \return A valid handle if no error occurs during the operation. | 3141 * \return A valid handle if no error occurs during the operation. |
| 3145 */ | 3142 */ |
| 3146 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotAssembly( | 3143 DART_EXPORT Dart_Handle |
| 3147 uint8_t** assembly_buffer, | 3144 Dart_CreatePrecompiledSnapshotAssembly(uint8_t** assembly_buffer, |
| 3148 intptr_t* assembly_size); | 3145 intptr_t* assembly_size); |
| 3149 | 3146 |
| 3150 | 3147 |
| 3151 /** | 3148 /** |
| 3152 * Same as Dart_CreatePrecompiledSnapshotAssembly, except the instruction and | 3149 * Same as Dart_CreatePrecompiledSnapshotAssembly, except the instruction and |
| 3153 * data snapshot pieces are provided directly as bytes that the embedder can | 3150 * data snapshot pieces are provided directly as bytes that the embedder can |
| 3154 * load with mmap. The instructions piece must be loaded with read and | 3151 * load with mmap. The instructions piece must be loaded with read and |
| 3155 * execute permissions; the rodata piece may be loaded as read-only. | 3152 * execute permissions; the rodata piece may be loaded as read-only. |
| 3156 */ | 3153 */ |
| 3157 DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotBlob( | 3154 DART_EXPORT Dart_Handle |
| 3158 uint8_t** vm_isolate_snapshot_buffer, | 3155 Dart_CreatePrecompiledSnapshotBlob(uint8_t** vm_isolate_snapshot_buffer, |
| 3159 intptr_t* vm_isolate_snapshot_size, | 3156 intptr_t* vm_isolate_snapshot_size, |
| 3160 uint8_t** isolate_snapshot_buffer, | 3157 uint8_t** isolate_snapshot_buffer, |
| 3161 intptr_t* isolate_snapshot_size, | 3158 intptr_t* isolate_snapshot_size, |
| 3162 uint8_t** instructions_blob_buffer, | 3159 uint8_t** instructions_blob_buffer, |
| 3163 intptr_t* instructions_blob_size, | 3160 intptr_t* instructions_blob_size, |
| 3164 uint8_t** rodata_blob_buffer, | 3161 uint8_t** rodata_blob_buffer, |
| 3165 intptr_t* rodata_blob_size); | 3162 intptr_t* rodata_blob_size); |
| 3166 | 3163 |
| 3167 | 3164 |
| 3168 DART_EXPORT Dart_Handle Dart_PrecompileJIT(); | 3165 DART_EXPORT Dart_Handle Dart_PrecompileJIT(); |
| 3169 | 3166 |
| 3170 | 3167 |
| 3171 /** | 3168 /** |
| 3172 * Creates a snapshot that caches unoptimized code and type feedback for faster | 3169 * Creates a snapshot that caches unoptimized code and type feedback for faster |
| 3173 * startup and quicker warmup in a subsequent process. | 3170 * startup and quicker warmup in a subsequent process. |
| 3174 * | 3171 * |
| 3175 * Outputs a snapshot in four pieces. The vm isolate snapshot, | 3172 * Outputs a snapshot in four pieces. The vm isolate snapshot, |
| 3176 * instructions_blob and rodata_blob should be passed as arguments to | 3173 * instructions_blob and rodata_blob should be passed as arguments to |
| 3177 * Dart_Initialize. The isolate snapshot should be passed to | 3174 * Dart_Initialize. The isolate snapshot should be passed to |
| 3178 * Dart_CreateIsolate. The instructions piece must be loaded with execute | 3175 * Dart_CreateIsolate. The instructions piece must be loaded with execute |
| 3179 * permissions; the other pieces may loaded as read-only. | 3176 * permissions; the other pieces may loaded as read-only. |
| 3180 * | 3177 * |
| 3181 * - Requires the VM to have been started with --load-deferred-eagerly. | 3178 * - Requires the VM to have been started with --load-deferred-eagerly. |
| 3182 * - Requires the VM to have not been started with --precompilation. | 3179 * - Requires the VM to have not been started with --precompilation. |
| 3183 * - Not supported when targeting IA32. | 3180 * - Not supported when targeting IA32. |
| 3184 * - The VM writing the snapshot and the VM reading the snapshot must be the | 3181 * - The VM writing the snapshot and the VM reading the snapshot must be the |
| 3185 * same version, must be built in the same DEBUG/RELEASE/PRODUCT mode, must | 3182 * same version, must be built in the same DEBUG/RELEASE/PRODUCT mode, must |
| 3186 * be targeting the same architecture, and must both be in checked mode or | 3183 * be targeting the same architecture, and must both be in checked mode or |
| 3187 * both in unchecked mode. | 3184 * both in unchecked mode. |
| 3188 * | 3185 * |
| 3189 * The buffers are scope allocated and are only valid until the next call to | 3186 * The buffers are scope allocated and are only valid until the next call to |
| 3190 * Dart_ExitScope. | 3187 * Dart_ExitScope. |
| 3191 * | 3188 * |
| 3192 * \return A valid handle if no error occurs during the operation. | 3189 * \return A valid handle if no error occurs during the operation. |
| 3193 */ | 3190 */ |
| 3194 DART_EXPORT Dart_Handle Dart_CreateAppJITSnapshot( | 3191 DART_EXPORT Dart_Handle |
| 3195 uint8_t** vm_isolate_snapshot_buffer, | 3192 Dart_CreateAppJITSnapshot(uint8_t** vm_isolate_snapshot_buffer, |
| 3196 intptr_t* vm_isolate_snapshot_size, | 3193 intptr_t* vm_isolate_snapshot_size, |
| 3197 uint8_t** isolate_snapshot_buffer, | 3194 uint8_t** isolate_snapshot_buffer, |
| 3198 intptr_t* isolate_snapshot_size, | 3195 intptr_t* isolate_snapshot_size, |
| 3199 uint8_t** instructions_blob_buffer, | 3196 uint8_t** instructions_blob_buffer, |
| 3200 intptr_t* instructions_blob_size, | 3197 intptr_t* instructions_blob_size, |
| 3201 uint8_t** rodata_blob_buffer, | 3198 uint8_t** rodata_blob_buffer, |
| 3202 intptr_t* rodata_blob_size); | 3199 intptr_t* rodata_blob_size); |
| 3203 | 3200 |
| 3204 | 3201 |
| 3205 /** | 3202 /** |
| 3206 * Returns whether the VM only supports running from precompiled snapshots and | 3203 * Returns whether the VM only supports running from precompiled snapshots and |
| 3207 * not from any other kind of snapshot or from source (that is, the VM was | 3204 * not from any other kind of snapshot or from source (that is, the VM was |
| 3208 * compiled with DART_PRECOMPILED_RUNTIME). | 3205 * compiled with DART_PRECOMPILED_RUNTIME). |
| 3209 */ | 3206 */ |
| 3210 DART_EXPORT bool Dart_IsPrecompiledRuntime(); | 3207 DART_EXPORT bool Dart_IsPrecompiledRuntime(); |
| 3211 | 3208 |
| 3212 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ | 3209 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ |
| OLD | NEW |