OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 22 matching lines...) Expand all Loading... |
33 * V8 header file, include/v8.h. | 33 * V8 header file, include/v8.h. |
34 * | 34 * |
35 * For other documentation see http://code.google.com/apis/v8/ | 35 * For other documentation see http://code.google.com/apis/v8/ |
36 */ | 36 */ |
37 | 37 |
38 #ifndef V8_H_ | 38 #ifndef V8_H_ |
39 #define V8_H_ | 39 #define V8_H_ |
40 | 40 |
41 #include "v8stdint.h" | 41 #include "v8stdint.h" |
42 | 42 |
| 43 // We reserve the V8_* prefix for macros defined in V8 public API and |
| 44 // assume there are no name conflicts with the embedder's code. |
| 45 |
43 #ifdef _WIN32 | 46 #ifdef _WIN32 |
44 | 47 |
45 // Setup for Windows DLL export/import. When building the V8 DLL the | 48 // Setup for Windows DLL export/import. When building the V8 DLL the |
46 // BUILDING_V8_SHARED needs to be defined. When building a program which uses | 49 // BUILDING_V8_SHARED needs to be defined. When building a program which uses |
47 // the V8 DLL USING_V8_SHARED needs to be defined. When either building the V8 | 50 // the V8 DLL USING_V8_SHARED needs to be defined. When either building the V8 |
48 // static library or building a program which uses the V8 static library neither | 51 // static library or building a program which uses the V8 static library neither |
49 // BUILDING_V8_SHARED nor USING_V8_SHARED should be defined. | 52 // BUILDING_V8_SHARED nor USING_V8_SHARED should be defined. |
50 #if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED) | 53 #if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED) |
51 #error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check the\ | 54 #error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check the\ |
52 build configuration to ensure that at most one of these is set | 55 build configuration to ensure that at most one of these is set |
53 #endif | 56 #endif |
54 | 57 |
55 #ifdef BUILDING_V8_SHARED | 58 #ifdef BUILDING_V8_SHARED |
56 #define V8EXPORT __declspec(dllexport) | 59 #define V8_EXPORT __declspec(dllexport) |
57 #elif USING_V8_SHARED | 60 #elif USING_V8_SHARED |
58 #define V8EXPORT __declspec(dllimport) | 61 #define V8_EXPORT __declspec(dllimport) |
59 #else | 62 #else |
60 #define V8EXPORT | 63 #define V8_EXPORT |
61 #endif // BUILDING_V8_SHARED | 64 #endif // BUILDING_V8_SHARED |
62 | 65 |
63 #else // _WIN32 | 66 #else // _WIN32 |
64 | 67 |
65 // Setup for Linux shared library export. | 68 // Setup for Linux shared library export. |
66 #if defined(__GNUC__) && ((__GNUC__ >= 4) || \ | 69 #if defined(__GNUC__) && ((__GNUC__ >= 4) || \ |
67 (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(V8_SHARED) | 70 (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(V8_SHARED) |
68 #ifdef BUILDING_V8_SHARED | 71 #ifdef BUILDING_V8_SHARED |
69 #define V8EXPORT __attribute__ ((visibility("default"))) | 72 #define V8_EXPORT __attribute__ ((visibility("default"))) |
70 #else | 73 #else |
71 #define V8EXPORT | 74 #define V8_EXPORT |
72 #endif | 75 #endif |
73 #else | 76 #else |
74 #define V8EXPORT | 77 #define V8_EXPORT |
75 #endif | 78 #endif |
76 | 79 |
77 #endif // _WIN32 | 80 #endif // _WIN32 |
78 | 81 |
79 #if defined(__GNUC__) && !defined(DEBUG) | 82 #if defined(__GNUC__) && !defined(DEBUG) |
80 #define V8_INLINE(declarator) inline __attribute__((always_inline)) declarator | 83 #define V8_INLINE(declarator) inline __attribute__((always_inline)) declarator |
81 #elif defined(_MSC_VER) && !defined(DEBUG) | 84 #elif defined(_MSC_VER) && !defined(DEBUG) |
82 #define V8_INLINE(declarator) __forceinline declarator | 85 #define V8_INLINE(declarator) __forceinline declarator |
83 #else | 86 #else |
84 #define V8_INLINE(declarator) inline declarator | 87 #define V8_INLINE(declarator) inline declarator |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 * deleted or another handle scope is created. If there is already a | 797 * deleted or another handle scope is created. If there is already a |
795 * handle scope and a new one is created, all allocations will take | 798 * handle scope and a new one is created, all allocations will take |
796 * place in the new handle scope until it is deleted. After that, | 799 * place in the new handle scope until it is deleted. After that, |
797 * new handles will again be allocated in the original handle scope. | 800 * new handles will again be allocated in the original handle scope. |
798 * | 801 * |
799 * After the handle scope of a local handle has been deleted the | 802 * After the handle scope of a local handle has been deleted the |
800 * garbage collector will no longer track the object stored in the | 803 * garbage collector will no longer track the object stored in the |
801 * handle and may deallocate it. The behavior of accessing a handle | 804 * handle and may deallocate it. The behavior of accessing a handle |
802 * for which the handle scope has been deleted is undefined. | 805 * for which the handle scope has been deleted is undefined. |
803 */ | 806 */ |
804 class V8EXPORT HandleScope { | 807 class V8_EXPORT HandleScope { |
805 public: | 808 public: |
806 // TODO(svenpanne) Deprecate me when Chrome is fixed! | 809 // TODO(svenpanne) Deprecate me when Chrome is fixed! |
807 HandleScope(); | 810 HandleScope(); |
808 | 811 |
809 HandleScope(Isolate* isolate); | 812 HandleScope(Isolate* isolate); |
810 | 813 |
811 ~HandleScope(); | 814 ~HandleScope(); |
812 | 815 |
813 /** | 816 /** |
814 * Closes the handle scope and returns the value as a handle in the | 817 * Closes the handle scope and returns the value as a handle in the |
(...skipping 18 matching lines...) Expand all Loading... |
833 private: | 836 private: |
834 // Make it hard to create heap-allocated or illegal handle scopes by | 837 // Make it hard to create heap-allocated or illegal handle scopes by |
835 // disallowing certain operations. | 838 // disallowing certain operations. |
836 HandleScope(const HandleScope&); | 839 HandleScope(const HandleScope&); |
837 void operator=(const HandleScope&); | 840 void operator=(const HandleScope&); |
838 void* operator new(size_t size); | 841 void* operator new(size_t size); |
839 void operator delete(void*, size_t); | 842 void operator delete(void*, size_t); |
840 | 843 |
841 // This Data class is accessible internally as HandleScopeData through a | 844 // This Data class is accessible internally as HandleScopeData through a |
842 // typedef in the ImplementationUtilities class. | 845 // typedef in the ImplementationUtilities class. |
843 class V8EXPORT Data { | 846 class V8_EXPORT Data { |
844 public: | 847 public: |
845 internal::Object** next; | 848 internal::Object** next; |
846 internal::Object** limit; | 849 internal::Object** limit; |
847 int level; | 850 int level; |
848 V8_INLINE(void Initialize()) { | 851 V8_INLINE(void Initialize()) { |
849 next = limit = NULL; | 852 next = limit = NULL; |
850 level = 0; | 853 level = 0; |
851 } | 854 } |
852 }; | 855 }; |
853 | 856 |
(...skipping 12 matching lines...) Expand all Loading... |
866 friend class ImplementationUtilities; | 869 friend class ImplementationUtilities; |
867 }; | 870 }; |
868 | 871 |
869 | 872 |
870 // --- Special objects --- | 873 // --- Special objects --- |
871 | 874 |
872 | 875 |
873 /** | 876 /** |
874 * The superclass of values and API object templates. | 877 * The superclass of values and API object templates. |
875 */ | 878 */ |
876 class V8EXPORT Data { | 879 class V8_EXPORT Data { |
877 private: | 880 private: |
878 Data(); | 881 Data(); |
879 }; | 882 }; |
880 | 883 |
881 | 884 |
882 /** | 885 /** |
883 * Pre-compilation data that can be associated with a script. This | 886 * Pre-compilation data that can be associated with a script. This |
884 * data can be calculated for a script in advance of actually | 887 * data can be calculated for a script in advance of actually |
885 * compiling it, and can be stored between compilations. When script | 888 * compiling it, and can be stored between compilations. When script |
886 * data is given to the compile method compilation will be faster. | 889 * data is given to the compile method compilation will be faster. |
887 */ | 890 */ |
888 class V8EXPORT ScriptData { // NOLINT | 891 class V8_EXPORT ScriptData { // NOLINT |
889 public: | 892 public: |
890 virtual ~ScriptData() { } | 893 virtual ~ScriptData() { } |
891 | 894 |
892 /** | 895 /** |
893 * Pre-compiles the specified script (context-independent). | 896 * Pre-compiles the specified script (context-independent). |
894 * | 897 * |
895 * \param input Pointer to UTF-8 script source code. | 898 * \param input Pointer to UTF-8 script source code. |
896 * \param length Length of UTF-8 script source code. | 899 * \param length Length of UTF-8 script source code. |
897 */ | 900 */ |
898 static ScriptData* PreCompile(const char* input, int length); | 901 static ScriptData* PreCompile(const char* input, int length); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 Handle<Value> resource_name_; | 959 Handle<Value> resource_name_; |
957 Handle<Integer> resource_line_offset_; | 960 Handle<Integer> resource_line_offset_; |
958 Handle<Integer> resource_column_offset_; | 961 Handle<Integer> resource_column_offset_; |
959 Handle<Boolean> resource_is_shared_cross_origin_; | 962 Handle<Boolean> resource_is_shared_cross_origin_; |
960 }; | 963 }; |
961 | 964 |
962 | 965 |
963 /** | 966 /** |
964 * A compiled JavaScript script. | 967 * A compiled JavaScript script. |
965 */ | 968 */ |
966 class V8EXPORT Script { | 969 class V8_EXPORT Script { |
967 public: | 970 public: |
968 /** | 971 /** |
969 * Compiles the specified script (context-independent). | 972 * Compiles the specified script (context-independent). |
970 * | 973 * |
971 * \param source Script source code. | 974 * \param source Script source code. |
972 * \param origin Script origin, owned by caller, no references are kept | 975 * \param origin Script origin, owned by caller, no references are kept |
973 * when New() returns | 976 * when New() returns |
974 * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile() | 977 * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile() |
975 * using pre_data speeds compilation if it's done multiple times. | 978 * using pre_data speeds compilation if it's done multiple times. |
976 * Owned by caller, no references are kept when New() returns. | 979 * Owned by caller, no references are kept when New() returns. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1074 */ | 1077 */ |
1075 int GetLineNumber(int code_pos); | 1078 int GetLineNumber(int code_pos); |
1076 | 1079 |
1077 static const int kNoScriptId = 0; | 1080 static const int kNoScriptId = 0; |
1078 }; | 1081 }; |
1079 | 1082 |
1080 | 1083 |
1081 /** | 1084 /** |
1082 * An error message. | 1085 * An error message. |
1083 */ | 1086 */ |
1084 class V8EXPORT Message { | 1087 class V8_EXPORT Message { |
1085 public: | 1088 public: |
1086 Local<String> Get() const; | 1089 Local<String> Get() const; |
1087 Local<String> GetSourceLine() const; | 1090 Local<String> GetSourceLine() const; |
1088 | 1091 |
1089 /** | 1092 /** |
1090 * Returns the resource name for the script from where the function causing | 1093 * Returns the resource name for the script from where the function causing |
1091 * the error originates. | 1094 * the error originates. |
1092 */ | 1095 */ |
1093 Handle<Value> GetScriptResourceName() const; | 1096 Handle<Value> GetScriptResourceName() const; |
1094 | 1097 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1146 static const int kNoLineNumberInfo = 0; | 1149 static const int kNoLineNumberInfo = 0; |
1147 static const int kNoColumnInfo = 0; | 1150 static const int kNoColumnInfo = 0; |
1148 }; | 1151 }; |
1149 | 1152 |
1150 | 1153 |
1151 /** | 1154 /** |
1152 * Representation of a JavaScript stack trace. The information collected is a | 1155 * Representation of a JavaScript stack trace. The information collected is a |
1153 * snapshot of the execution stack and the information remains valid after | 1156 * snapshot of the execution stack and the information remains valid after |
1154 * execution continues. | 1157 * execution continues. |
1155 */ | 1158 */ |
1156 class V8EXPORT StackTrace { | 1159 class V8_EXPORT StackTrace { |
1157 public: | 1160 public: |
1158 /** | 1161 /** |
1159 * Flags that determine what information is placed captured for each | 1162 * Flags that determine what information is placed captured for each |
1160 * StackFrame when grabbing the current stack trace. | 1163 * StackFrame when grabbing the current stack trace. |
1161 */ | 1164 */ |
1162 enum StackTraceOptions { | 1165 enum StackTraceOptions { |
1163 kLineNumber = 1, | 1166 kLineNumber = 1, |
1164 kColumnOffset = 1 << 1 | kLineNumber, | 1167 kColumnOffset = 1 << 1 | kLineNumber, |
1165 kScriptName = 1 << 2, | 1168 kScriptName = 1 << 2, |
1166 kFunctionName = 1 << 3, | 1169 kFunctionName = 1 << 3, |
(...skipping 28 matching lines...) Expand all Loading... |
1195 */ | 1198 */ |
1196 static Local<StackTrace> CurrentStackTrace( | 1199 static Local<StackTrace> CurrentStackTrace( |
1197 int frame_limit, | 1200 int frame_limit, |
1198 StackTraceOptions options = kOverview); | 1201 StackTraceOptions options = kOverview); |
1199 }; | 1202 }; |
1200 | 1203 |
1201 | 1204 |
1202 /** | 1205 /** |
1203 * A single JavaScript stack frame. | 1206 * A single JavaScript stack frame. |
1204 */ | 1207 */ |
1205 class V8EXPORT StackFrame { | 1208 class V8_EXPORT StackFrame { |
1206 public: | 1209 public: |
1207 /** | 1210 /** |
1208 * Returns the number, 1-based, of the line for the associate function call. | 1211 * Returns the number, 1-based, of the line for the associate function call. |
1209 * This method will return Message::kNoLineNumberInfo if it is unable to | 1212 * This method will return Message::kNoLineNumberInfo if it is unable to |
1210 * retrieve the line number, or if kLineNumber was not passed as an option | 1213 * retrieve the line number, or if kLineNumber was not passed as an option |
1211 * when capturing the StackTrace. | 1214 * when capturing the StackTrace. |
1212 */ | 1215 */ |
1213 int GetLineNumber() const; | 1216 int GetLineNumber() const; |
1214 | 1217 |
1215 /** | 1218 /** |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1250 * Returns whether or not the associated function is called as a | 1253 * Returns whether or not the associated function is called as a |
1251 * constructor via "new". | 1254 * constructor via "new". |
1252 */ | 1255 */ |
1253 bool IsConstructor() const; | 1256 bool IsConstructor() const; |
1254 }; | 1257 }; |
1255 | 1258 |
1256 | 1259 |
1257 /** | 1260 /** |
1258 * A JSON Parser. | 1261 * A JSON Parser. |
1259 */ | 1262 */ |
1260 class V8EXPORT JSON { | 1263 class V8_EXPORT JSON { |
1261 public: | 1264 public: |
1262 /** | 1265 /** |
1263 * Tries to parse the string |json_string| and returns it as object if | 1266 * Tries to parse the string |json_string| and returns it as object if |
1264 * successful. | 1267 * successful. |
1265 * | 1268 * |
1266 * \param json_string The string to parse. | 1269 * \param json_string The string to parse. |
1267 * \return The corresponding object if successfully parsed. | 1270 * \return The corresponding object if successfully parsed. |
1268 */ | 1271 */ |
1269 static Local<Object> Parse(Local<String> json_string); | 1272 static Local<Object> Parse(Local<String> json_string); |
1270 }; | 1273 }; |
1271 | 1274 |
1272 | 1275 |
1273 // --- Value --- | 1276 // --- Value --- |
1274 | 1277 |
1275 | 1278 |
1276 /** | 1279 /** |
1277 * The superclass of all JavaScript values and objects. | 1280 * The superclass of all JavaScript values and objects. |
1278 */ | 1281 */ |
1279 class V8EXPORT Value : public Data { | 1282 class V8_EXPORT Value : public Data { |
1280 public: | 1283 public: |
1281 /** | 1284 /** |
1282 * Returns true if this value is the undefined value. See ECMA-262 | 1285 * Returns true if this value is the undefined value. See ECMA-262 |
1283 * 4.3.10. | 1286 * 4.3.10. |
1284 */ | 1287 */ |
1285 V8_INLINE(bool IsUndefined() const); | 1288 V8_INLINE(bool IsUndefined() const); |
1286 | 1289 |
1287 /** | 1290 /** |
1288 * Returns true if this value is the null value. See ECMA-262 | 1291 * Returns true if this value is the null value. See ECMA-262 |
1289 * 4.3.11. | 1292 * 4.3.11. |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1500 V8_INLINE(bool QuickIsString() const); | 1503 V8_INLINE(bool QuickIsString() const); |
1501 bool FullIsUndefined() const; | 1504 bool FullIsUndefined() const; |
1502 bool FullIsNull() const; | 1505 bool FullIsNull() const; |
1503 bool FullIsString() const; | 1506 bool FullIsString() const; |
1504 }; | 1507 }; |
1505 | 1508 |
1506 | 1509 |
1507 /** | 1510 /** |
1508 * The superclass of primitive values. See ECMA-262 4.3.2. | 1511 * The superclass of primitive values. See ECMA-262 4.3.2. |
1509 */ | 1512 */ |
1510 class V8EXPORT Primitive : public Value { }; | 1513 class V8_EXPORT Primitive : public Value { }; |
1511 | 1514 |
1512 | 1515 |
1513 /** | 1516 /** |
1514 * A primitive boolean value (ECMA-262, 4.3.14). Either the true | 1517 * A primitive boolean value (ECMA-262, 4.3.14). Either the true |
1515 * or false value. | 1518 * or false value. |
1516 */ | 1519 */ |
1517 class V8EXPORT Boolean : public Primitive { | 1520 class V8_EXPORT Boolean : public Primitive { |
1518 public: | 1521 public: |
1519 bool Value() const; | 1522 bool Value() const; |
1520 V8_INLINE(static Handle<Boolean> New(bool value)); | 1523 V8_INLINE(static Handle<Boolean> New(bool value)); |
1521 }; | 1524 }; |
1522 | 1525 |
1523 | 1526 |
1524 /** | 1527 /** |
1525 * A JavaScript string value (ECMA-262, 4.3.17). | 1528 * A JavaScript string value (ECMA-262, 4.3.17). |
1526 */ | 1529 */ |
1527 class V8EXPORT String : public Primitive { | 1530 class V8_EXPORT String : public Primitive { |
1528 public: | 1531 public: |
1529 enum Encoding { | 1532 enum Encoding { |
1530 UNKNOWN_ENCODING = 0x1, | 1533 UNKNOWN_ENCODING = 0x1, |
1531 TWO_BYTE_ENCODING = 0x0, | 1534 TWO_BYTE_ENCODING = 0x0, |
1532 ASCII_ENCODING = 0x4, | 1535 ASCII_ENCODING = 0x4, |
1533 ONE_BYTE_ENCODING = 0x4 | 1536 ONE_BYTE_ENCODING = 0x4 |
1534 }; | 1537 }; |
1535 /** | 1538 /** |
1536 * Returns the number of characters in this string. | 1539 * Returns the number of characters in this string. |
1537 */ | 1540 */ |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1623 /** | 1626 /** |
1624 * Returns true if the string is external | 1627 * Returns true if the string is external |
1625 */ | 1628 */ |
1626 bool IsExternal() const; | 1629 bool IsExternal() const; |
1627 | 1630 |
1628 /** | 1631 /** |
1629 * Returns true if the string is both external and ASCII | 1632 * Returns true if the string is both external and ASCII |
1630 */ | 1633 */ |
1631 bool IsExternalAscii() const; | 1634 bool IsExternalAscii() const; |
1632 | 1635 |
1633 class V8EXPORT ExternalStringResourceBase { // NOLINT | 1636 class V8_EXPORT ExternalStringResourceBase { // NOLINT |
1634 public: | 1637 public: |
1635 virtual ~ExternalStringResourceBase() {} | 1638 virtual ~ExternalStringResourceBase() {} |
1636 | 1639 |
1637 protected: | 1640 protected: |
1638 ExternalStringResourceBase() {} | 1641 ExternalStringResourceBase() {} |
1639 | 1642 |
1640 /** | 1643 /** |
1641 * Internally V8 will call this Dispose method when the external string | 1644 * Internally V8 will call this Dispose method when the external string |
1642 * resource is no longer needed. The default implementation will use the | 1645 * resource is no longer needed. The default implementation will use the |
1643 * delete operator. This method can be overridden in subclasses to | 1646 * delete operator. This method can be overridden in subclasses to |
1644 * control how allocated external string resources are disposed. | 1647 * control how allocated external string resources are disposed. |
1645 */ | 1648 */ |
1646 virtual void Dispose() { delete this; } | 1649 virtual void Dispose() { delete this; } |
1647 | 1650 |
1648 private: | 1651 private: |
1649 // Disallow copying and assigning. | 1652 // Disallow copying and assigning. |
1650 ExternalStringResourceBase(const ExternalStringResourceBase&); | 1653 ExternalStringResourceBase(const ExternalStringResourceBase&); |
1651 void operator=(const ExternalStringResourceBase&); | 1654 void operator=(const ExternalStringResourceBase&); |
1652 | 1655 |
1653 friend class v8::internal::Heap; | 1656 friend class v8::internal::Heap; |
1654 }; | 1657 }; |
1655 | 1658 |
1656 /** | 1659 /** |
1657 * An ExternalStringResource is a wrapper around a two-byte string | 1660 * An ExternalStringResource is a wrapper around a two-byte string |
1658 * buffer that resides outside V8's heap. Implement an | 1661 * buffer that resides outside V8's heap. Implement an |
1659 * ExternalStringResource to manage the life cycle of the underlying | 1662 * ExternalStringResource to manage the life cycle of the underlying |
1660 * buffer. Note that the string data must be immutable. | 1663 * buffer. Note that the string data must be immutable. |
1661 */ | 1664 */ |
1662 class V8EXPORT ExternalStringResource | 1665 class V8_EXPORT ExternalStringResource |
1663 : public ExternalStringResourceBase { | 1666 : public ExternalStringResourceBase { |
1664 public: | 1667 public: |
1665 /** | 1668 /** |
1666 * Override the destructor to manage the life cycle of the underlying | 1669 * Override the destructor to manage the life cycle of the underlying |
1667 * buffer. | 1670 * buffer. |
1668 */ | 1671 */ |
1669 virtual ~ExternalStringResource() {} | 1672 virtual ~ExternalStringResource() {} |
1670 | 1673 |
1671 /** | 1674 /** |
1672 * The string data from the underlying buffer. | 1675 * The string data from the underlying buffer. |
(...skipping 13 matching lines...) Expand all Loading... |
1686 * An ExternalAsciiStringResource is a wrapper around an ASCII | 1689 * An ExternalAsciiStringResource is a wrapper around an ASCII |
1687 * string buffer that resides outside V8's heap. Implement an | 1690 * string buffer that resides outside V8's heap. Implement an |
1688 * ExternalAsciiStringResource to manage the life cycle of the | 1691 * ExternalAsciiStringResource to manage the life cycle of the |
1689 * underlying buffer. Note that the string data must be immutable | 1692 * underlying buffer. Note that the string data must be immutable |
1690 * and that the data must be strict (7-bit) ASCII, not Latin-1 or | 1693 * and that the data must be strict (7-bit) ASCII, not Latin-1 or |
1691 * UTF-8, which would require special treatment internally in the | 1694 * UTF-8, which would require special treatment internally in the |
1692 * engine and, in the case of UTF-8, do not allow efficient indexing. | 1695 * engine and, in the case of UTF-8, do not allow efficient indexing. |
1693 * Use String::New or convert to 16 bit data for non-ASCII. | 1696 * Use String::New or convert to 16 bit data for non-ASCII. |
1694 */ | 1697 */ |
1695 | 1698 |
1696 class V8EXPORT ExternalAsciiStringResource | 1699 class V8_EXPORT ExternalAsciiStringResource |
1697 : public ExternalStringResourceBase { | 1700 : public ExternalStringResourceBase { |
1698 public: | 1701 public: |
1699 /** | 1702 /** |
1700 * Override the destructor to manage the life cycle of the underlying | 1703 * Override the destructor to manage the life cycle of the underlying |
1701 * buffer. | 1704 * buffer. |
1702 */ | 1705 */ |
1703 virtual ~ExternalAsciiStringResource() {} | 1706 virtual ~ExternalAsciiStringResource() {} |
1704 /** The string data from the underlying buffer.*/ | 1707 /** The string data from the underlying buffer.*/ |
1705 virtual const char* data() const = 0; | 1708 virtual const char* data() const = 0; |
1706 /** The number of ASCII characters in the string.*/ | 1709 /** The number of ASCII characters in the string.*/ |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1839 V8_INLINE(static Local<String> NewUndetectable( | 1842 V8_INLINE(static Local<String> NewUndetectable( |
1840 const uint16_t* data, int length = -1)); | 1843 const uint16_t* data, int length = -1)); |
1841 | 1844 |
1842 /** | 1845 /** |
1843 * Converts an object to a UTF-8-encoded character array. Useful if | 1846 * Converts an object to a UTF-8-encoded character array. Useful if |
1844 * you want to print the object. If conversion to a string fails | 1847 * you want to print the object. If conversion to a string fails |
1845 * (e.g. due to an exception in the toString() method of the object) | 1848 * (e.g. due to an exception in the toString() method of the object) |
1846 * then the length() method returns 0 and the * operator returns | 1849 * then the length() method returns 0 and the * operator returns |
1847 * NULL. | 1850 * NULL. |
1848 */ | 1851 */ |
1849 class V8EXPORT Utf8Value { | 1852 class V8_EXPORT Utf8Value { |
1850 public: | 1853 public: |
1851 explicit Utf8Value(Handle<v8::Value> obj); | 1854 explicit Utf8Value(Handle<v8::Value> obj); |
1852 ~Utf8Value(); | 1855 ~Utf8Value(); |
1853 char* operator*() { return str_; } | 1856 char* operator*() { return str_; } |
1854 const char* operator*() const { return str_; } | 1857 const char* operator*() const { return str_; } |
1855 int length() const { return length_; } | 1858 int length() const { return length_; } |
1856 private: | 1859 private: |
1857 char* str_; | 1860 char* str_; |
1858 int length_; | 1861 int length_; |
1859 | 1862 |
1860 // Disallow copying and assigning. | 1863 // Disallow copying and assigning. |
1861 Utf8Value(const Utf8Value&); | 1864 Utf8Value(const Utf8Value&); |
1862 void operator=(const Utf8Value&); | 1865 void operator=(const Utf8Value&); |
1863 }; | 1866 }; |
1864 | 1867 |
1865 /** | 1868 /** |
1866 * Converts an object to an ASCII string. | 1869 * Converts an object to an ASCII string. |
1867 * Useful if you want to print the object. | 1870 * Useful if you want to print the object. |
1868 * If conversion to a string fails (eg. due to an exception in the toString() | 1871 * If conversion to a string fails (eg. due to an exception in the toString() |
1869 * method of the object) then the length() method returns 0 and the * operator | 1872 * method of the object) then the length() method returns 0 and the * operator |
1870 * returns NULL. | 1873 * returns NULL. |
1871 */ | 1874 */ |
1872 class V8EXPORT AsciiValue { | 1875 class V8_EXPORT AsciiValue { |
1873 public: | 1876 public: |
1874 // TODO(dcarney): deprecate | 1877 // TODO(dcarney): deprecate |
1875 explicit AsciiValue(Handle<v8::Value> obj); | 1878 explicit AsciiValue(Handle<v8::Value> obj); |
1876 ~AsciiValue(); | 1879 ~AsciiValue(); |
1877 char* operator*() { return str_; } | 1880 char* operator*() { return str_; } |
1878 const char* operator*() const { return str_; } | 1881 const char* operator*() const { return str_; } |
1879 int length() const { return length_; } | 1882 int length() const { return length_; } |
1880 private: | 1883 private: |
1881 char* str_; | 1884 char* str_; |
1882 int length_; | 1885 int length_; |
1883 | 1886 |
1884 // Disallow copying and assigning. | 1887 // Disallow copying and assigning. |
1885 AsciiValue(const AsciiValue&); | 1888 AsciiValue(const AsciiValue&); |
1886 void operator=(const AsciiValue&); | 1889 void operator=(const AsciiValue&); |
1887 }; | 1890 }; |
1888 | 1891 |
1889 /** | 1892 /** |
1890 * Converts an object to a two-byte string. | 1893 * Converts an object to a two-byte string. |
1891 * If conversion to a string fails (eg. due to an exception in the toString() | 1894 * If conversion to a string fails (eg. due to an exception in the toString() |
1892 * method of the object) then the length() method returns 0 and the * operator | 1895 * method of the object) then the length() method returns 0 and the * operator |
1893 * returns NULL. | 1896 * returns NULL. |
1894 */ | 1897 */ |
1895 class V8EXPORT Value { | 1898 class V8_EXPORT Value { |
1896 public: | 1899 public: |
1897 explicit Value(Handle<v8::Value> obj); | 1900 explicit Value(Handle<v8::Value> obj); |
1898 ~Value(); | 1901 ~Value(); |
1899 uint16_t* operator*() { return str_; } | 1902 uint16_t* operator*() { return str_; } |
1900 const uint16_t* operator*() const { return str_; } | 1903 const uint16_t* operator*() const { return str_; } |
1901 int length() const { return length_; } | 1904 int length() const { return length_; } |
1902 private: | 1905 private: |
1903 uint16_t* str_; | 1906 uint16_t* str_; |
1904 int length_; | 1907 int length_; |
1905 | 1908 |
1906 // Disallow copying and assigning. | 1909 // Disallow copying and assigning. |
1907 Value(const Value&); | 1910 Value(const Value&); |
1908 void operator=(const Value&); | 1911 void operator=(const Value&); |
1909 }; | 1912 }; |
1910 | 1913 |
1911 private: | 1914 private: |
1912 void VerifyExternalStringResourceBase(ExternalStringResourceBase* v, | 1915 void VerifyExternalStringResourceBase(ExternalStringResourceBase* v, |
1913 Encoding encoding) const; | 1916 Encoding encoding) const; |
1914 void VerifyExternalStringResource(ExternalStringResource* val) const; | 1917 void VerifyExternalStringResource(ExternalStringResource* val) const; |
1915 static void CheckCast(v8::Value* obj); | 1918 static void CheckCast(v8::Value* obj); |
1916 }; | 1919 }; |
1917 | 1920 |
1918 | 1921 |
1919 /** | 1922 /** |
1920 * A JavaScript symbol (ECMA-262 edition 6) | 1923 * A JavaScript symbol (ECMA-262 edition 6) |
1921 * | 1924 * |
1922 * This is an experimental feature. Use at your own risk. | 1925 * This is an experimental feature. Use at your own risk. |
1923 */ | 1926 */ |
1924 class V8EXPORT Symbol : public Primitive { | 1927 class V8_EXPORT Symbol : public Primitive { |
1925 public: | 1928 public: |
1926 // Returns the print name string of the symbol, or undefined if none. | 1929 // Returns the print name string of the symbol, or undefined if none. |
1927 Local<Value> Name() const; | 1930 Local<Value> Name() const; |
1928 | 1931 |
1929 // Create a symbol without a print name. | 1932 // Create a symbol without a print name. |
1930 static Local<Symbol> New(Isolate* isolate); | 1933 static Local<Symbol> New(Isolate* isolate); |
1931 | 1934 |
1932 // Create a symbol with a print name. | 1935 // Create a symbol with a print name. |
1933 static Local<Symbol> New(Isolate *isolate, const char* data, int length = -1); | 1936 static Local<Symbol> New(Isolate *isolate, const char* data, int length = -1); |
1934 | 1937 |
1935 V8_INLINE(static Symbol* Cast(v8::Value* obj)); | 1938 V8_INLINE(static Symbol* Cast(v8::Value* obj)); |
1936 private: | 1939 private: |
1937 Symbol(); | 1940 Symbol(); |
1938 static void CheckCast(v8::Value* obj); | 1941 static void CheckCast(v8::Value* obj); |
1939 }; | 1942 }; |
1940 | 1943 |
1941 | 1944 |
1942 /** | 1945 /** |
1943 * A JavaScript number value (ECMA-262, 4.3.20) | 1946 * A JavaScript number value (ECMA-262, 4.3.20) |
1944 */ | 1947 */ |
1945 class V8EXPORT Number : public Primitive { | 1948 class V8_EXPORT Number : public Primitive { |
1946 public: | 1949 public: |
1947 double Value() const; | 1950 double Value() const; |
1948 static Local<Number> New(double value); | 1951 static Local<Number> New(double value); |
1949 static Local<Number> New(Isolate* isolate, double value); | 1952 static Local<Number> New(Isolate* isolate, double value); |
1950 V8_INLINE(static Number* Cast(v8::Value* obj)); | 1953 V8_INLINE(static Number* Cast(v8::Value* obj)); |
1951 private: | 1954 private: |
1952 Number(); | 1955 Number(); |
1953 static void CheckCast(v8::Value* obj); | 1956 static void CheckCast(v8::Value* obj); |
1954 }; | 1957 }; |
1955 | 1958 |
1956 | 1959 |
1957 /** | 1960 /** |
1958 * A JavaScript value representing a signed integer. | 1961 * A JavaScript value representing a signed integer. |
1959 */ | 1962 */ |
1960 class V8EXPORT Integer : public Number { | 1963 class V8_EXPORT Integer : public Number { |
1961 public: | 1964 public: |
1962 static Local<Integer> New(int32_t value); | 1965 static Local<Integer> New(int32_t value); |
1963 static Local<Integer> NewFromUnsigned(uint32_t value); | 1966 static Local<Integer> NewFromUnsigned(uint32_t value); |
1964 static Local<Integer> New(int32_t value, Isolate*); | 1967 static Local<Integer> New(int32_t value, Isolate*); |
1965 static Local<Integer> NewFromUnsigned(uint32_t value, Isolate*); | 1968 static Local<Integer> NewFromUnsigned(uint32_t value, Isolate*); |
1966 int64_t Value() const; | 1969 int64_t Value() const; |
1967 V8_INLINE(static Integer* Cast(v8::Value* obj)); | 1970 V8_INLINE(static Integer* Cast(v8::Value* obj)); |
1968 private: | 1971 private: |
1969 Integer(); | 1972 Integer(); |
1970 static void CheckCast(v8::Value* obj); | 1973 static void CheckCast(v8::Value* obj); |
1971 }; | 1974 }; |
1972 | 1975 |
1973 | 1976 |
1974 /** | 1977 /** |
1975 * A JavaScript value representing a 32-bit signed integer. | 1978 * A JavaScript value representing a 32-bit signed integer. |
1976 */ | 1979 */ |
1977 class V8EXPORT Int32 : public Integer { | 1980 class V8_EXPORT Int32 : public Integer { |
1978 public: | 1981 public: |
1979 int32_t Value() const; | 1982 int32_t Value() const; |
1980 private: | 1983 private: |
1981 Int32(); | 1984 Int32(); |
1982 }; | 1985 }; |
1983 | 1986 |
1984 | 1987 |
1985 /** | 1988 /** |
1986 * A JavaScript value representing a 32-bit unsigned integer. | 1989 * A JavaScript value representing a 32-bit unsigned integer. |
1987 */ | 1990 */ |
1988 class V8EXPORT Uint32 : public Integer { | 1991 class V8_EXPORT Uint32 : public Integer { |
1989 public: | 1992 public: |
1990 uint32_t Value() const; | 1993 uint32_t Value() const; |
1991 private: | 1994 private: |
1992 Uint32(); | 1995 Uint32(); |
1993 }; | 1996 }; |
1994 | 1997 |
1995 | 1998 |
1996 enum PropertyAttribute { | 1999 enum PropertyAttribute { |
1997 None = 0, | 2000 None = 0, |
1998 ReadOnly = 1 << 0, | 2001 ReadOnly = 1 << 0, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2050 DEFAULT = 0, | 2053 DEFAULT = 0, |
2051 ALL_CAN_READ = 1, | 2054 ALL_CAN_READ = 1, |
2052 ALL_CAN_WRITE = 1 << 1, | 2055 ALL_CAN_WRITE = 1 << 1, |
2053 PROHIBITS_OVERWRITING = 1 << 2 | 2056 PROHIBITS_OVERWRITING = 1 << 2 |
2054 }; | 2057 }; |
2055 | 2058 |
2056 | 2059 |
2057 /** | 2060 /** |
2058 * A JavaScript object (ECMA-262, 4.3.3) | 2061 * A JavaScript object (ECMA-262, 4.3.3) |
2059 */ | 2062 */ |
2060 class V8EXPORT Object : public Value { | 2063 class V8_EXPORT Object : public Value { |
2061 public: | 2064 public: |
2062 bool Set(Handle<Value> key, | 2065 bool Set(Handle<Value> key, |
2063 Handle<Value> value, | 2066 Handle<Value> value, |
2064 PropertyAttribute attribs = None); | 2067 PropertyAttribute attribs = None); |
2065 | 2068 |
2066 bool Set(uint32_t index, Handle<Value> value); | 2069 bool Set(uint32_t index, Handle<Value> value); |
2067 | 2070 |
2068 // Sets a local property on this object bypassing interceptors and | 2071 // Sets a local property on this object bypassing interceptors and |
2069 // overriding accessors or read-only properties. | 2072 // overriding accessors or read-only properties. |
2070 // | 2073 // |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2322 Object(); | 2325 Object(); |
2323 static void CheckCast(Value* obj); | 2326 static void CheckCast(Value* obj); |
2324 Local<Value> SlowGetInternalField(int index); | 2327 Local<Value> SlowGetInternalField(int index); |
2325 void* SlowGetAlignedPointerFromInternalField(int index); | 2328 void* SlowGetAlignedPointerFromInternalField(int index); |
2326 }; | 2329 }; |
2327 | 2330 |
2328 | 2331 |
2329 /** | 2332 /** |
2330 * An instance of the built-in array constructor (ECMA-262, 15.4.2). | 2333 * An instance of the built-in array constructor (ECMA-262, 15.4.2). |
2331 */ | 2334 */ |
2332 class V8EXPORT Array : public Object { | 2335 class V8_EXPORT Array : public Object { |
2333 public: | 2336 public: |
2334 uint32_t Length() const; | 2337 uint32_t Length() const; |
2335 | 2338 |
2336 /** | 2339 /** |
2337 * Clones an element at index |index|. Returns an empty | 2340 * Clones an element at index |index|. Returns an empty |
2338 * handle if cloning fails (for any reason). | 2341 * handle if cloning fails (for any reason). |
2339 */ | 2342 */ |
2340 Local<Object> CloneElementAt(uint32_t index); | 2343 Local<Object> CloneElementAt(uint32_t index); |
2341 | 2344 |
2342 /** | 2345 /** |
2343 * Creates a JavaScript array with the given length. If the length | 2346 * Creates a JavaScript array with the given length. If the length |
2344 * is negative the returned array will have length 0. | 2347 * is negative the returned array will have length 0. |
2345 */ | 2348 */ |
2346 static Local<Array> New(int length = 0); | 2349 static Local<Array> New(int length = 0); |
2347 | 2350 |
2348 V8_INLINE(static Array* Cast(Value* obj)); | 2351 V8_INLINE(static Array* Cast(Value* obj)); |
2349 private: | 2352 private: |
2350 Array(); | 2353 Array(); |
2351 static void CheckCast(Value* obj); | 2354 static void CheckCast(Value* obj); |
2352 }; | 2355 }; |
2353 | 2356 |
2354 | 2357 |
2355 /** | 2358 /** |
2356 * A JavaScript function object (ECMA-262, 15.3). | 2359 * A JavaScript function object (ECMA-262, 15.3). |
2357 */ | 2360 */ |
2358 class V8EXPORT Function : public Object { | 2361 class V8_EXPORT Function : public Object { |
2359 public: | 2362 public: |
2360 Local<Object> NewInstance() const; | 2363 Local<Object> NewInstance() const; |
2361 Local<Object> NewInstance(int argc, Handle<Value> argv[]) const; | 2364 Local<Object> NewInstance(int argc, Handle<Value> argv[]) const; |
2362 Local<Value> Call(Handle<Object> recv, int argc, Handle<Value> argv[]); | 2365 Local<Value> Call(Handle<Object> recv, int argc, Handle<Value> argv[]); |
2363 void SetName(Handle<String> name); | 2366 void SetName(Handle<String> name); |
2364 Handle<Value> GetName() const; | 2367 Handle<Value> GetName() const; |
2365 | 2368 |
2366 /** | 2369 /** |
2367 * Name inferred from variable or property assignment of this function. | 2370 * Name inferred from variable or property assignment of this function. |
2368 * Used to facilitate debugging and profiling of JavaScript code written | 2371 * Used to facilitate debugging and profiling of JavaScript code written |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2404 | 2407 |
2405 #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT | 2408 #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT |
2406 // The number of required internal fields can be defined by embedder. | 2409 // The number of required internal fields can be defined by embedder. |
2407 #define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2 | 2410 #define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2 |
2408 #endif | 2411 #endif |
2409 | 2412 |
2410 /** | 2413 /** |
2411 * An instance of the built-in ArrayBuffer constructor (ES6 draft 15.13.5). | 2414 * An instance of the built-in ArrayBuffer constructor (ES6 draft 15.13.5). |
2412 * This API is experimental and may change significantly. | 2415 * This API is experimental and may change significantly. |
2413 */ | 2416 */ |
2414 class V8EXPORT ArrayBuffer : public Object { | 2417 class V8_EXPORT ArrayBuffer : public Object { |
2415 public: | 2418 public: |
2416 /** | 2419 /** |
2417 * Allocator that V8 uses to allocate |ArrayBuffer|'s memory. | 2420 * Allocator that V8 uses to allocate |ArrayBuffer|'s memory. |
2418 * The allocator is a global V8 setting. It should be set with | 2421 * The allocator is a global V8 setting. It should be set with |
2419 * V8::SetArrayBufferAllocator prior to creation of a first ArrayBuffer. | 2422 * V8::SetArrayBufferAllocator prior to creation of a first ArrayBuffer. |
2420 * | 2423 * |
2421 * This API is experimental and may change significantly. | 2424 * This API is experimental and may change significantly. |
2422 */ | 2425 */ |
2423 class V8EXPORT Allocator { // NOLINT | 2426 class V8_EXPORT Allocator { // NOLINT |
2424 public: | 2427 public: |
2425 virtual ~Allocator() {} | 2428 virtual ~Allocator() {} |
2426 | 2429 |
2427 /** | 2430 /** |
2428 * Allocate |length| bytes. Return NULL if allocation is not successful. | 2431 * Allocate |length| bytes. Return NULL if allocation is not successful. |
2429 * Memory should be initialized to zeroes. | 2432 * Memory should be initialized to zeroes. |
2430 */ | 2433 */ |
2431 virtual void* Allocate(size_t length) = 0; | 2434 virtual void* Allocate(size_t length) = 0; |
2432 | 2435 |
2433 /** | 2436 /** |
(...skipping 26 matching lines...) Expand all Loading... |
2460 /** | 2463 /** |
2461 * The contents of an |ArrayBuffer|. Externalization of |ArrayBuffer| | 2464 * The contents of an |ArrayBuffer|. Externalization of |ArrayBuffer| |
2462 * returns an instance of this class, populated, with a pointer to data | 2465 * returns an instance of this class, populated, with a pointer to data |
2463 * and byte length. | 2466 * and byte length. |
2464 * | 2467 * |
2465 * The Data pointer of ArrayBuffer::Contents is always allocated with | 2468 * The Data pointer of ArrayBuffer::Contents is always allocated with |
2466 * Allocator::Allocate that is set with V8::SetArrayBufferAllocator. | 2469 * Allocator::Allocate that is set with V8::SetArrayBufferAllocator. |
2467 * | 2470 * |
2468 * This API is experimental and may change significantly. | 2471 * This API is experimental and may change significantly. |
2469 */ | 2472 */ |
2470 class V8EXPORT Contents { // NOLINT | 2473 class V8_EXPORT Contents { // NOLINT |
2471 public: | 2474 public: |
2472 Contents() : data_(NULL), byte_length_(0) {} | 2475 Contents() : data_(NULL), byte_length_(0) {} |
2473 | 2476 |
2474 void* Data() const { return data_; } | 2477 void* Data() const { return data_; } |
2475 size_t ByteLength() const { return byte_length_; } | 2478 size_t ByteLength() const { return byte_length_; } |
2476 | 2479 |
2477 private: | 2480 private: |
2478 void* data_; | 2481 void* data_; |
2479 size_t byte_length_; | 2482 size_t byte_length_; |
2480 | 2483 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2543 #define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT 2 | 2546 #define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT 2 |
2544 #endif | 2547 #endif |
2545 | 2548 |
2546 | 2549 |
2547 /** | 2550 /** |
2548 * A base class for an instance of one of "views" over ArrayBuffer, | 2551 * A base class for an instance of one of "views" over ArrayBuffer, |
2549 * including TypedArrays and DataView (ES6 draft 15.13). | 2552 * including TypedArrays and DataView (ES6 draft 15.13). |
2550 * | 2553 * |
2551 * This API is experimental and may change significantly. | 2554 * This API is experimental and may change significantly. |
2552 */ | 2555 */ |
2553 class V8EXPORT ArrayBufferView : public Object { | 2556 class V8_EXPORT ArrayBufferView : public Object { |
2554 public: | 2557 public: |
2555 /** | 2558 /** |
2556 * Returns underlying ArrayBuffer. | 2559 * Returns underlying ArrayBuffer. |
2557 */ | 2560 */ |
2558 Local<ArrayBuffer> Buffer(); | 2561 Local<ArrayBuffer> Buffer(); |
2559 /** | 2562 /** |
2560 * Byte offset in |Buffer|. | 2563 * Byte offset in |Buffer|. |
2561 */ | 2564 */ |
2562 size_t ByteOffset(); | 2565 size_t ByteOffset(); |
2563 /** | 2566 /** |
(...skipping 14 matching lines...) Expand all Loading... |
2578 ArrayBufferView(); | 2581 ArrayBufferView(); |
2579 static void CheckCast(Value* obj); | 2582 static void CheckCast(Value* obj); |
2580 }; | 2583 }; |
2581 | 2584 |
2582 | 2585 |
2583 /** | 2586 /** |
2584 * A base class for an instance of TypedArray series of constructors | 2587 * A base class for an instance of TypedArray series of constructors |
2585 * (ES6 draft 15.13.6). | 2588 * (ES6 draft 15.13.6). |
2586 * This API is experimental and may change significantly. | 2589 * This API is experimental and may change significantly. |
2587 */ | 2590 */ |
2588 class V8EXPORT TypedArray : public ArrayBufferView { | 2591 class V8_EXPORT TypedArray : public ArrayBufferView { |
2589 public: | 2592 public: |
2590 /** | 2593 /** |
2591 * Number of elements in this typed array | 2594 * Number of elements in this typed array |
2592 * (e.g. for Int16Array, |ByteLength|/2). | 2595 * (e.g. for Int16Array, |ByteLength|/2). |
2593 */ | 2596 */ |
2594 size_t Length(); | 2597 size_t Length(); |
2595 | 2598 |
2596 V8_INLINE(static TypedArray* Cast(Value* obj)); | 2599 V8_INLINE(static TypedArray* Cast(Value* obj)); |
2597 | 2600 |
2598 private: | 2601 private: |
2599 TypedArray(); | 2602 TypedArray(); |
2600 static void CheckCast(Value* obj); | 2603 static void CheckCast(Value* obj); |
2601 }; | 2604 }; |
2602 | 2605 |
2603 | 2606 |
2604 /** | 2607 /** |
2605 * An instance of Uint8Array constructor (ES6 draft 15.13.6). | 2608 * An instance of Uint8Array constructor (ES6 draft 15.13.6). |
2606 * This API is experimental and may change significantly. | 2609 * This API is experimental and may change significantly. |
2607 */ | 2610 */ |
2608 class V8EXPORT Uint8Array : public TypedArray { | 2611 class V8_EXPORT Uint8Array : public TypedArray { |
2609 public: | 2612 public: |
2610 static Local<Uint8Array> New(Handle<ArrayBuffer> array_buffer, | 2613 static Local<Uint8Array> New(Handle<ArrayBuffer> array_buffer, |
2611 size_t byte_offset, size_t length); | 2614 size_t byte_offset, size_t length); |
2612 V8_INLINE(static Uint8Array* Cast(Value* obj)); | 2615 V8_INLINE(static Uint8Array* Cast(Value* obj)); |
2613 | 2616 |
2614 private: | 2617 private: |
2615 Uint8Array(); | 2618 Uint8Array(); |
2616 static void CheckCast(Value* obj); | 2619 static void CheckCast(Value* obj); |
2617 }; | 2620 }; |
2618 | 2621 |
2619 | 2622 |
2620 /** | 2623 /** |
2621 * An instance of Uint8ClampedArray constructor (ES6 draft 15.13.6). | 2624 * An instance of Uint8ClampedArray constructor (ES6 draft 15.13.6). |
2622 * This API is experimental and may change significantly. | 2625 * This API is experimental and may change significantly. |
2623 */ | 2626 */ |
2624 class V8EXPORT Uint8ClampedArray : public TypedArray { | 2627 class V8_EXPORT Uint8ClampedArray : public TypedArray { |
2625 public: | 2628 public: |
2626 static Local<Uint8ClampedArray> New(Handle<ArrayBuffer> array_buffer, | 2629 static Local<Uint8ClampedArray> New(Handle<ArrayBuffer> array_buffer, |
2627 size_t byte_offset, size_t length); | 2630 size_t byte_offset, size_t length); |
2628 V8_INLINE(static Uint8ClampedArray* Cast(Value* obj)); | 2631 V8_INLINE(static Uint8ClampedArray* Cast(Value* obj)); |
2629 | 2632 |
2630 private: | 2633 private: |
2631 Uint8ClampedArray(); | 2634 Uint8ClampedArray(); |
2632 static void CheckCast(Value* obj); | 2635 static void CheckCast(Value* obj); |
2633 }; | 2636 }; |
2634 | 2637 |
2635 /** | 2638 /** |
2636 * An instance of Int8Array constructor (ES6 draft 15.13.6). | 2639 * An instance of Int8Array constructor (ES6 draft 15.13.6). |
2637 * This API is experimental and may change significantly. | 2640 * This API is experimental and may change significantly. |
2638 */ | 2641 */ |
2639 class V8EXPORT Int8Array : public TypedArray { | 2642 class V8_EXPORT Int8Array : public TypedArray { |
2640 public: | 2643 public: |
2641 static Local<Int8Array> New(Handle<ArrayBuffer> array_buffer, | 2644 static Local<Int8Array> New(Handle<ArrayBuffer> array_buffer, |
2642 size_t byte_offset, size_t length); | 2645 size_t byte_offset, size_t length); |
2643 V8_INLINE(static Int8Array* Cast(Value* obj)); | 2646 V8_INLINE(static Int8Array* Cast(Value* obj)); |
2644 | 2647 |
2645 private: | 2648 private: |
2646 Int8Array(); | 2649 Int8Array(); |
2647 static void CheckCast(Value* obj); | 2650 static void CheckCast(Value* obj); |
2648 }; | 2651 }; |
2649 | 2652 |
2650 | 2653 |
2651 /** | 2654 /** |
2652 * An instance of Uint16Array constructor (ES6 draft 15.13.6). | 2655 * An instance of Uint16Array constructor (ES6 draft 15.13.6). |
2653 * This API is experimental and may change significantly. | 2656 * This API is experimental and may change significantly. |
2654 */ | 2657 */ |
2655 class V8EXPORT Uint16Array : public TypedArray { | 2658 class V8_EXPORT Uint16Array : public TypedArray { |
2656 public: | 2659 public: |
2657 static Local<Uint16Array> New(Handle<ArrayBuffer> array_buffer, | 2660 static Local<Uint16Array> New(Handle<ArrayBuffer> array_buffer, |
2658 size_t byte_offset, size_t length); | 2661 size_t byte_offset, size_t length); |
2659 V8_INLINE(static Uint16Array* Cast(Value* obj)); | 2662 V8_INLINE(static Uint16Array* Cast(Value* obj)); |
2660 | 2663 |
2661 private: | 2664 private: |
2662 Uint16Array(); | 2665 Uint16Array(); |
2663 static void CheckCast(Value* obj); | 2666 static void CheckCast(Value* obj); |
2664 }; | 2667 }; |
2665 | 2668 |
2666 | 2669 |
2667 /** | 2670 /** |
2668 * An instance of Int16Array constructor (ES6 draft 15.13.6). | 2671 * An instance of Int16Array constructor (ES6 draft 15.13.6). |
2669 * This API is experimental and may change significantly. | 2672 * This API is experimental and may change significantly. |
2670 */ | 2673 */ |
2671 class V8EXPORT Int16Array : public TypedArray { | 2674 class V8_EXPORT Int16Array : public TypedArray { |
2672 public: | 2675 public: |
2673 static Local<Int16Array> New(Handle<ArrayBuffer> array_buffer, | 2676 static Local<Int16Array> New(Handle<ArrayBuffer> array_buffer, |
2674 size_t byte_offset, size_t length); | 2677 size_t byte_offset, size_t length); |
2675 V8_INLINE(static Int16Array* Cast(Value* obj)); | 2678 V8_INLINE(static Int16Array* Cast(Value* obj)); |
2676 | 2679 |
2677 private: | 2680 private: |
2678 Int16Array(); | 2681 Int16Array(); |
2679 static void CheckCast(Value* obj); | 2682 static void CheckCast(Value* obj); |
2680 }; | 2683 }; |
2681 | 2684 |
2682 | 2685 |
2683 /** | 2686 /** |
2684 * An instance of Uint32Array constructor (ES6 draft 15.13.6). | 2687 * An instance of Uint32Array constructor (ES6 draft 15.13.6). |
2685 * This API is experimental and may change significantly. | 2688 * This API is experimental and may change significantly. |
2686 */ | 2689 */ |
2687 class V8EXPORT Uint32Array : public TypedArray { | 2690 class V8_EXPORT Uint32Array : public TypedArray { |
2688 public: | 2691 public: |
2689 static Local<Uint32Array> New(Handle<ArrayBuffer> array_buffer, | 2692 static Local<Uint32Array> New(Handle<ArrayBuffer> array_buffer, |
2690 size_t byte_offset, size_t length); | 2693 size_t byte_offset, size_t length); |
2691 V8_INLINE(static Uint32Array* Cast(Value* obj)); | 2694 V8_INLINE(static Uint32Array* Cast(Value* obj)); |
2692 | 2695 |
2693 private: | 2696 private: |
2694 Uint32Array(); | 2697 Uint32Array(); |
2695 static void CheckCast(Value* obj); | 2698 static void CheckCast(Value* obj); |
2696 }; | 2699 }; |
2697 | 2700 |
2698 | 2701 |
2699 /** | 2702 /** |
2700 * An instance of Int32Array constructor (ES6 draft 15.13.6). | 2703 * An instance of Int32Array constructor (ES6 draft 15.13.6). |
2701 * This API is experimental and may change significantly. | 2704 * This API is experimental and may change significantly. |
2702 */ | 2705 */ |
2703 class V8EXPORT Int32Array : public TypedArray { | 2706 class V8_EXPORT Int32Array : public TypedArray { |
2704 public: | 2707 public: |
2705 static Local<Int32Array> New(Handle<ArrayBuffer> array_buffer, | 2708 static Local<Int32Array> New(Handle<ArrayBuffer> array_buffer, |
2706 size_t byte_offset, size_t length); | 2709 size_t byte_offset, size_t length); |
2707 V8_INLINE(static Int32Array* Cast(Value* obj)); | 2710 V8_INLINE(static Int32Array* Cast(Value* obj)); |
2708 | 2711 |
2709 private: | 2712 private: |
2710 Int32Array(); | 2713 Int32Array(); |
2711 static void CheckCast(Value* obj); | 2714 static void CheckCast(Value* obj); |
2712 }; | 2715 }; |
2713 | 2716 |
2714 | 2717 |
2715 /** | 2718 /** |
2716 * An instance of Float32Array constructor (ES6 draft 15.13.6). | 2719 * An instance of Float32Array constructor (ES6 draft 15.13.6). |
2717 * This API is experimental and may change significantly. | 2720 * This API is experimental and may change significantly. |
2718 */ | 2721 */ |
2719 class V8EXPORT Float32Array : public TypedArray { | 2722 class V8_EXPORT Float32Array : public TypedArray { |
2720 public: | 2723 public: |
2721 static Local<Float32Array> New(Handle<ArrayBuffer> array_buffer, | 2724 static Local<Float32Array> New(Handle<ArrayBuffer> array_buffer, |
2722 size_t byte_offset, size_t length); | 2725 size_t byte_offset, size_t length); |
2723 V8_INLINE(static Float32Array* Cast(Value* obj)); | 2726 V8_INLINE(static Float32Array* Cast(Value* obj)); |
2724 | 2727 |
2725 private: | 2728 private: |
2726 Float32Array(); | 2729 Float32Array(); |
2727 static void CheckCast(Value* obj); | 2730 static void CheckCast(Value* obj); |
2728 }; | 2731 }; |
2729 | 2732 |
2730 | 2733 |
2731 /** | 2734 /** |
2732 * An instance of Float64Array constructor (ES6 draft 15.13.6). | 2735 * An instance of Float64Array constructor (ES6 draft 15.13.6). |
2733 * This API is experimental and may change significantly. | 2736 * This API is experimental and may change significantly. |
2734 */ | 2737 */ |
2735 class V8EXPORT Float64Array : public TypedArray { | 2738 class V8_EXPORT Float64Array : public TypedArray { |
2736 public: | 2739 public: |
2737 static Local<Float64Array> New(Handle<ArrayBuffer> array_buffer, | 2740 static Local<Float64Array> New(Handle<ArrayBuffer> array_buffer, |
2738 size_t byte_offset, size_t length); | 2741 size_t byte_offset, size_t length); |
2739 V8_INLINE(static Float64Array* Cast(Value* obj)); | 2742 V8_INLINE(static Float64Array* Cast(Value* obj)); |
2740 | 2743 |
2741 private: | 2744 private: |
2742 Float64Array(); | 2745 Float64Array(); |
2743 static void CheckCast(Value* obj); | 2746 static void CheckCast(Value* obj); |
2744 }; | 2747 }; |
2745 | 2748 |
2746 | 2749 |
2747 /** | 2750 /** |
2748 * An instance of DataView constructor (ES6 draft 15.13.7). | 2751 * An instance of DataView constructor (ES6 draft 15.13.7). |
2749 * This API is experimental and may change significantly. | 2752 * This API is experimental and may change significantly. |
2750 */ | 2753 */ |
2751 class V8EXPORT DataView : public ArrayBufferView { | 2754 class V8_EXPORT DataView : public ArrayBufferView { |
2752 public: | 2755 public: |
2753 static Local<DataView> New(Handle<ArrayBuffer> array_buffer, | 2756 static Local<DataView> New(Handle<ArrayBuffer> array_buffer, |
2754 size_t byte_offset, size_t length); | 2757 size_t byte_offset, size_t length); |
2755 V8_INLINE(static DataView* Cast(Value* obj)); | 2758 V8_INLINE(static DataView* Cast(Value* obj)); |
2756 | 2759 |
2757 private: | 2760 private: |
2758 DataView(); | 2761 DataView(); |
2759 static void CheckCast(Value* obj); | 2762 static void CheckCast(Value* obj); |
2760 }; | 2763 }; |
2761 | 2764 |
2762 | 2765 |
2763 /** | 2766 /** |
2764 * An instance of the built-in Date constructor (ECMA-262, 15.9). | 2767 * An instance of the built-in Date constructor (ECMA-262, 15.9). |
2765 */ | 2768 */ |
2766 class V8EXPORT Date : public Object { | 2769 class V8_EXPORT Date : public Object { |
2767 public: | 2770 public: |
2768 static Local<Value> New(double time); | 2771 static Local<Value> New(double time); |
2769 | 2772 |
2770 // Deprecated, use Date::ValueOf() instead. | 2773 // Deprecated, use Date::ValueOf() instead. |
2771 // TODO(svenpanne) Actually deprecate when Chrome is adapted. | 2774 // TODO(svenpanne) Actually deprecate when Chrome is adapted. |
2772 double NumberValue() const { return ValueOf(); } | 2775 double NumberValue() const { return ValueOf(); } |
2773 | 2776 |
2774 /** | 2777 /** |
2775 * A specialization of Value::NumberValue that is more efficient | 2778 * A specialization of Value::NumberValue that is more efficient |
2776 * because we know the structure of this object. | 2779 * because we know the structure of this object. |
(...skipping 17 matching lines...) Expand all Loading... |
2794 static void DateTimeConfigurationChangeNotification(); | 2797 static void DateTimeConfigurationChangeNotification(); |
2795 | 2798 |
2796 private: | 2799 private: |
2797 static void CheckCast(v8::Value* obj); | 2800 static void CheckCast(v8::Value* obj); |
2798 }; | 2801 }; |
2799 | 2802 |
2800 | 2803 |
2801 /** | 2804 /** |
2802 * A Number object (ECMA-262, 4.3.21). | 2805 * A Number object (ECMA-262, 4.3.21). |
2803 */ | 2806 */ |
2804 class V8EXPORT NumberObject : public Object { | 2807 class V8_EXPORT NumberObject : public Object { |
2805 public: | 2808 public: |
2806 static Local<Value> New(double value); | 2809 static Local<Value> New(double value); |
2807 | 2810 |
2808 // Deprecated, use NumberObject::ValueOf() instead. | 2811 // Deprecated, use NumberObject::ValueOf() instead. |
2809 // TODO(svenpanne) Actually deprecate when Chrome is adapted. | 2812 // TODO(svenpanne) Actually deprecate when Chrome is adapted. |
2810 double NumberValue() const { return ValueOf(); } | 2813 double NumberValue() const { return ValueOf(); } |
2811 | 2814 |
2812 /** | 2815 /** |
2813 * Returns the Number held by the object. | 2816 * Returns the Number held by the object. |
2814 */ | 2817 */ |
2815 double ValueOf() const; | 2818 double ValueOf() const; |
2816 | 2819 |
2817 V8_INLINE(static NumberObject* Cast(v8::Value* obj)); | 2820 V8_INLINE(static NumberObject* Cast(v8::Value* obj)); |
2818 | 2821 |
2819 private: | 2822 private: |
2820 static void CheckCast(v8::Value* obj); | 2823 static void CheckCast(v8::Value* obj); |
2821 }; | 2824 }; |
2822 | 2825 |
2823 | 2826 |
2824 /** | 2827 /** |
2825 * A Boolean object (ECMA-262, 4.3.15). | 2828 * A Boolean object (ECMA-262, 4.3.15). |
2826 */ | 2829 */ |
2827 class V8EXPORT BooleanObject : public Object { | 2830 class V8_EXPORT BooleanObject : public Object { |
2828 public: | 2831 public: |
2829 static Local<Value> New(bool value); | 2832 static Local<Value> New(bool value); |
2830 | 2833 |
2831 // Deprecated, use BooleanObject::ValueOf() instead. | 2834 // Deprecated, use BooleanObject::ValueOf() instead. |
2832 // TODO(svenpanne) Actually deprecate when Chrome is adapted. | 2835 // TODO(svenpanne) Actually deprecate when Chrome is adapted. |
2833 bool BooleanValue() const { return ValueOf(); } | 2836 bool BooleanValue() const { return ValueOf(); } |
2834 | 2837 |
2835 /** | 2838 /** |
2836 * Returns the Boolean held by the object. | 2839 * Returns the Boolean held by the object. |
2837 */ | 2840 */ |
2838 bool ValueOf() const; | 2841 bool ValueOf() const; |
2839 | 2842 |
2840 V8_INLINE(static BooleanObject* Cast(v8::Value* obj)); | 2843 V8_INLINE(static BooleanObject* Cast(v8::Value* obj)); |
2841 | 2844 |
2842 private: | 2845 private: |
2843 static void CheckCast(v8::Value* obj); | 2846 static void CheckCast(v8::Value* obj); |
2844 }; | 2847 }; |
2845 | 2848 |
2846 | 2849 |
2847 /** | 2850 /** |
2848 * A String object (ECMA-262, 4.3.18). | 2851 * A String object (ECMA-262, 4.3.18). |
2849 */ | 2852 */ |
2850 class V8EXPORT StringObject : public Object { | 2853 class V8_EXPORT StringObject : public Object { |
2851 public: | 2854 public: |
2852 static Local<Value> New(Handle<String> value); | 2855 static Local<Value> New(Handle<String> value); |
2853 | 2856 |
2854 // Deprecated, use StringObject::ValueOf() instead. | 2857 // Deprecated, use StringObject::ValueOf() instead. |
2855 // TODO(svenpanne) Actually deprecate when Chrome is adapted. | 2858 // TODO(svenpanne) Actually deprecate when Chrome is adapted. |
2856 Local<String> StringValue() const { return ValueOf(); } | 2859 Local<String> StringValue() const { return ValueOf(); } |
2857 | 2860 |
2858 /** | 2861 /** |
2859 * Returns the String held by the object. | 2862 * Returns the String held by the object. |
2860 */ | 2863 */ |
2861 Local<String> ValueOf() const; | 2864 Local<String> ValueOf() const; |
2862 | 2865 |
2863 V8_INLINE(static StringObject* Cast(v8::Value* obj)); | 2866 V8_INLINE(static StringObject* Cast(v8::Value* obj)); |
2864 | 2867 |
2865 private: | 2868 private: |
2866 static void CheckCast(v8::Value* obj); | 2869 static void CheckCast(v8::Value* obj); |
2867 }; | 2870 }; |
2868 | 2871 |
2869 | 2872 |
2870 /** | 2873 /** |
2871 * A Symbol object (ECMA-262 edition 6). | 2874 * A Symbol object (ECMA-262 edition 6). |
2872 * | 2875 * |
2873 * This is an experimental feature. Use at your own risk. | 2876 * This is an experimental feature. Use at your own risk. |
2874 */ | 2877 */ |
2875 class V8EXPORT SymbolObject : public Object { | 2878 class V8_EXPORT SymbolObject : public Object { |
2876 public: | 2879 public: |
2877 static Local<Value> New(Isolate* isolate, Handle<Symbol> value); | 2880 static Local<Value> New(Isolate* isolate, Handle<Symbol> value); |
2878 | 2881 |
2879 // Deprecated, use SymbolObject::ValueOf() instead. | 2882 // Deprecated, use SymbolObject::ValueOf() instead. |
2880 // TODO(svenpanne) Actually deprecate when Chrome is adapted. | 2883 // TODO(svenpanne) Actually deprecate when Chrome is adapted. |
2881 Local<Symbol> SymbolValue() const { return ValueOf(); } | 2884 Local<Symbol> SymbolValue() const { return ValueOf(); } |
2882 | 2885 |
2883 /** | 2886 /** |
2884 * Returns the Symbol held by the object. | 2887 * Returns the Symbol held by the object. |
2885 */ | 2888 */ |
2886 Local<Symbol> ValueOf() const; | 2889 Local<Symbol> ValueOf() const; |
2887 | 2890 |
2888 V8_INLINE(static SymbolObject* Cast(v8::Value* obj)); | 2891 V8_INLINE(static SymbolObject* Cast(v8::Value* obj)); |
2889 | 2892 |
2890 private: | 2893 private: |
2891 static void CheckCast(v8::Value* obj); | 2894 static void CheckCast(v8::Value* obj); |
2892 }; | 2895 }; |
2893 | 2896 |
2894 | 2897 |
2895 /** | 2898 /** |
2896 * An instance of the built-in RegExp constructor (ECMA-262, 15.10). | 2899 * An instance of the built-in RegExp constructor (ECMA-262, 15.10). |
2897 */ | 2900 */ |
2898 class V8EXPORT RegExp : public Object { | 2901 class V8_EXPORT RegExp : public Object { |
2899 public: | 2902 public: |
2900 /** | 2903 /** |
2901 * Regular expression flag bits. They can be or'ed to enable a set | 2904 * Regular expression flag bits. They can be or'ed to enable a set |
2902 * of flags. | 2905 * of flags. |
2903 */ | 2906 */ |
2904 enum Flags { | 2907 enum Flags { |
2905 kNone = 0, | 2908 kNone = 0, |
2906 kGlobal = 1, | 2909 kGlobal = 1, |
2907 kIgnoreCase = 2, | 2910 kIgnoreCase = 2, |
2908 kMultiline = 4 | 2911 kMultiline = 4 |
(...skipping 26 matching lines...) Expand all Loading... |
2935 | 2938 |
2936 private: | 2939 private: |
2937 static void CheckCast(v8::Value* obj); | 2940 static void CheckCast(v8::Value* obj); |
2938 }; | 2941 }; |
2939 | 2942 |
2940 | 2943 |
2941 /** | 2944 /** |
2942 * A JavaScript value that wraps a C++ void*. This type of value is mainly used | 2945 * A JavaScript value that wraps a C++ void*. This type of value is mainly used |
2943 * to associate C++ data structures with JavaScript objects. | 2946 * to associate C++ data structures with JavaScript objects. |
2944 */ | 2947 */ |
2945 class V8EXPORT External : public Value { | 2948 class V8_EXPORT External : public Value { |
2946 public: | 2949 public: |
2947 static Local<External> New(void* value); | 2950 static Local<External> New(void* value); |
2948 V8_INLINE(static External* Cast(Value* obj)); | 2951 V8_INLINE(static External* Cast(Value* obj)); |
2949 void* Value() const; | 2952 void* Value() const; |
2950 private: | 2953 private: |
2951 static void CheckCast(v8::Value* obj); | 2954 static void CheckCast(v8::Value* obj); |
2952 }; | 2955 }; |
2953 | 2956 |
2954 | 2957 |
2955 // --- Templates --- | 2958 // --- Templates --- |
2956 | 2959 |
2957 | 2960 |
2958 /** | 2961 /** |
2959 * The superclass of object and function templates. | 2962 * The superclass of object and function templates. |
2960 */ | 2963 */ |
2961 class V8EXPORT Template : public Data { | 2964 class V8_EXPORT Template : public Data { |
2962 public: | 2965 public: |
2963 /** Adds a property to each instance created by this template.*/ | 2966 /** Adds a property to each instance created by this template.*/ |
2964 void Set(Handle<String> name, Handle<Data> value, | 2967 void Set(Handle<String> name, Handle<Data> value, |
2965 PropertyAttribute attributes = None); | 2968 PropertyAttribute attributes = None); |
2966 V8_INLINE(void Set(const char* name, Handle<Data> value)); | 2969 V8_INLINE(void Set(const char* name, Handle<Data> value)); |
2967 private: | 2970 private: |
2968 Template(); | 2971 Template(); |
2969 | 2972 |
2970 friend class ObjectTemplate; | 2973 friend class ObjectTemplate; |
2971 friend class FunctionTemplate; | 2974 friend class FunctionTemplate; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3039 internal::Object** values, | 3042 internal::Object** values, |
3040 int length, | 3043 int length, |
3041 bool is_construct_call)); | 3044 bool is_construct_call)); |
3042 internal::Object** implicit_args_; | 3045 internal::Object** implicit_args_; |
3043 internal::Object** values_; | 3046 internal::Object** values_; |
3044 int length_; | 3047 int length_; |
3045 bool is_construct_call_; | 3048 bool is_construct_call_; |
3046 }; | 3049 }; |
3047 | 3050 |
3048 | 3051 |
3049 class V8EXPORT Arguments : public FunctionCallbackInfo<Value> { | 3052 class V8_EXPORT Arguments : public FunctionCallbackInfo<Value> { |
3050 private: | 3053 private: |
3051 friend class internal::FunctionCallbackArguments; | 3054 friend class internal::FunctionCallbackArguments; |
3052 V8_INLINE(Arguments(internal::Object** implicit_args, | 3055 V8_INLINE(Arguments(internal::Object** implicit_args, |
3053 internal::Object** values, | 3056 internal::Object** values, |
3054 int length, | 3057 int length, |
3055 bool is_construct_call)); | 3058 bool is_construct_call)); |
3056 }; | 3059 }; |
3057 | 3060 |
3058 /** | 3061 /** |
3059 * The information passed to a property callback about the context | 3062 * The information passed to a property callback about the context |
(...skipping 20 matching lines...) Expand all Loading... |
3080 static const int kReturnValueIndex = -3; | 3083 static const int kReturnValueIndex = -3; |
3081 static const int kReturnValueDefaultValueIndex = -4; | 3084 static const int kReturnValueDefaultValueIndex = -4; |
3082 static const int kIsolateIndex = -5; | 3085 static const int kIsolateIndex = -5; |
3083 | 3086 |
3084 V8_INLINE(PropertyCallbackInfo(internal::Object** args)) | 3087 V8_INLINE(PropertyCallbackInfo(internal::Object** args)) |
3085 : args_(args) { } | 3088 : args_(args) { } |
3086 internal::Object** args_; | 3089 internal::Object** args_; |
3087 }; | 3090 }; |
3088 | 3091 |
3089 | 3092 |
3090 class V8EXPORT AccessorInfo : public PropertyCallbackInfo<Value> { | 3093 class V8_EXPORT AccessorInfo : public PropertyCallbackInfo<Value> { |
3091 private: | 3094 private: |
3092 friend class internal::PropertyCallbackArguments; | 3095 friend class internal::PropertyCallbackArguments; |
3093 V8_INLINE(AccessorInfo(internal::Object** args)) | 3096 V8_INLINE(AccessorInfo(internal::Object** args)) |
3094 : PropertyCallbackInfo<Value>(args) { } | 3097 : PropertyCallbackInfo<Value>(args) { } |
3095 }; | 3098 }; |
3096 | 3099 |
3097 | 3100 |
3098 typedef Handle<Value> (*InvocationCallback)(const Arguments& args); | 3101 typedef Handle<Value> (*InvocationCallback)(const Arguments& args); |
3099 typedef void (*FunctionCallback)(const FunctionCallbackInfo<Value>& info); | 3102 typedef void (*FunctionCallback)(const FunctionCallbackInfo<Value>& info); |
3100 | 3103 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3328 * | 3331 * |
3329 * The Child function and Child instance will have the following | 3332 * The Child function and Child instance will have the following |
3330 * properties: | 3333 * properties: |
3331 * | 3334 * |
3332 * \code | 3335 * \code |
3333 * child_func.prototype.__proto__ == function.prototype; | 3336 * child_func.prototype.__proto__ == function.prototype; |
3334 * child_instance.instance_accessor calls 'InstanceAccessorCallback' | 3337 * child_instance.instance_accessor calls 'InstanceAccessorCallback' |
3335 * child_instance.instance_property == 3; | 3338 * child_instance.instance_property == 3; |
3336 * \endcode | 3339 * \endcode |
3337 */ | 3340 */ |
3338 class V8EXPORT FunctionTemplate : public Template { | 3341 class V8_EXPORT FunctionTemplate : public Template { |
3339 public: | 3342 public: |
3340 /** Creates a function template.*/ | 3343 /** Creates a function template.*/ |
3341 V8_DEPRECATED(static Local<FunctionTemplate> New( | 3344 V8_DEPRECATED(static Local<FunctionTemplate> New( |
3342 InvocationCallback callback, | 3345 InvocationCallback callback, |
3343 Handle<Value> data = Handle<Value>(), | 3346 Handle<Value> data = Handle<Value>(), |
3344 Handle<Signature> signature = Handle<Signature>(), | 3347 Handle<Signature> signature = Handle<Signature>(), |
3345 int length = 0)); | 3348 int length = 0)); |
3346 static Local<FunctionTemplate> New( | 3349 static Local<FunctionTemplate> New( |
3347 FunctionCallback callback = 0, | 3350 FunctionCallback callback = 0, |
3348 Handle<Value> data = Handle<Value>(), | 3351 Handle<Value> data = Handle<Value>(), |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3419 friend class ObjectTemplate; | 3422 friend class ObjectTemplate; |
3420 }; | 3423 }; |
3421 | 3424 |
3422 | 3425 |
3423 /** | 3426 /** |
3424 * An ObjectTemplate is used to create objects at runtime. | 3427 * An ObjectTemplate is used to create objects at runtime. |
3425 * | 3428 * |
3426 * Properties added to an ObjectTemplate are added to each object | 3429 * Properties added to an ObjectTemplate are added to each object |
3427 * created from the ObjectTemplate. | 3430 * created from the ObjectTemplate. |
3428 */ | 3431 */ |
3429 class V8EXPORT ObjectTemplate : public Template { | 3432 class V8_EXPORT ObjectTemplate : public Template { |
3430 public: | 3433 public: |
3431 /** Creates an ObjectTemplate. */ | 3434 /** Creates an ObjectTemplate. */ |
3432 static Local<ObjectTemplate> New(); | 3435 static Local<ObjectTemplate> New(); |
3433 | 3436 |
3434 /** Creates a new instance of this template.*/ | 3437 /** Creates a new instance of this template.*/ |
3435 Local<Object> NewInstance(); | 3438 Local<Object> NewInstance(); |
3436 | 3439 |
3437 /** | 3440 /** |
3438 * Sets an accessor on the object template. | 3441 * Sets an accessor on the object template. |
3439 * | 3442 * |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3605 ObjectTemplate(); | 3608 ObjectTemplate(); |
3606 static Local<ObjectTemplate> New(Handle<FunctionTemplate> constructor); | 3609 static Local<ObjectTemplate> New(Handle<FunctionTemplate> constructor); |
3607 friend class FunctionTemplate; | 3610 friend class FunctionTemplate; |
3608 }; | 3611 }; |
3609 | 3612 |
3610 | 3613 |
3611 /** | 3614 /** |
3612 * A Signature specifies which receivers and arguments are valid | 3615 * A Signature specifies which receivers and arguments are valid |
3613 * parameters to a function. | 3616 * parameters to a function. |
3614 */ | 3617 */ |
3615 class V8EXPORT Signature : public Data { | 3618 class V8_EXPORT Signature : public Data { |
3616 public: | 3619 public: |
3617 static Local<Signature> New(Handle<FunctionTemplate> receiver = | 3620 static Local<Signature> New(Handle<FunctionTemplate> receiver = |
3618 Handle<FunctionTemplate>(), | 3621 Handle<FunctionTemplate>(), |
3619 int argc = 0, | 3622 int argc = 0, |
3620 Handle<FunctionTemplate> argv[] = 0); | 3623 Handle<FunctionTemplate> argv[] = 0); |
3621 private: | 3624 private: |
3622 Signature(); | 3625 Signature(); |
3623 }; | 3626 }; |
3624 | 3627 |
3625 | 3628 |
3626 /** | 3629 /** |
3627 * An AccessorSignature specifies which receivers are valid parameters | 3630 * An AccessorSignature specifies which receivers are valid parameters |
3628 * to an accessor callback. | 3631 * to an accessor callback. |
3629 */ | 3632 */ |
3630 class V8EXPORT AccessorSignature : public Data { | 3633 class V8_EXPORT AccessorSignature : public Data { |
3631 public: | 3634 public: |
3632 static Local<AccessorSignature> New(Handle<FunctionTemplate> receiver = | 3635 static Local<AccessorSignature> New(Handle<FunctionTemplate> receiver = |
3633 Handle<FunctionTemplate>()); | 3636 Handle<FunctionTemplate>()); |
3634 private: | 3637 private: |
3635 AccessorSignature(); | 3638 AccessorSignature(); |
3636 }; | 3639 }; |
3637 | 3640 |
3638 | 3641 |
3639 class V8EXPORT DeclaredAccessorDescriptor : public Data { | 3642 class V8_EXPORT DeclaredAccessorDescriptor : public Data { |
3640 private: | 3643 private: |
3641 DeclaredAccessorDescriptor(); | 3644 DeclaredAccessorDescriptor(); |
3642 }; | 3645 }; |
3643 | 3646 |
3644 | 3647 |
3645 class V8EXPORT ObjectOperationDescriptor : public Data { | 3648 class V8_EXPORT ObjectOperationDescriptor : public Data { |
3646 public: | 3649 public: |
3647 // This function is not yet stable and should not be used at this time. | 3650 // This function is not yet stable and should not be used at this time. |
3648 static Local<RawOperationDescriptor> NewInternalFieldDereference( | 3651 static Local<RawOperationDescriptor> NewInternalFieldDereference( |
3649 Isolate* isolate, | 3652 Isolate* isolate, |
3650 int internal_field); | 3653 int internal_field); |
3651 private: | 3654 private: |
3652 ObjectOperationDescriptor(); | 3655 ObjectOperationDescriptor(); |
3653 }; | 3656 }; |
3654 | 3657 |
3655 | 3658 |
3656 enum DeclaredAccessorDescriptorDataType { | 3659 enum DeclaredAccessorDescriptorDataType { |
3657 kDescriptorBoolType, | 3660 kDescriptorBoolType, |
3658 kDescriptorInt8Type, kDescriptorUint8Type, | 3661 kDescriptorInt8Type, kDescriptorUint8Type, |
3659 kDescriptorInt16Type, kDescriptorUint16Type, | 3662 kDescriptorInt16Type, kDescriptorUint16Type, |
3660 kDescriptorInt32Type, kDescriptorUint32Type, | 3663 kDescriptorInt32Type, kDescriptorUint32Type, |
3661 kDescriptorFloatType, kDescriptorDoubleType | 3664 kDescriptorFloatType, kDescriptorDoubleType |
3662 }; | 3665 }; |
3663 | 3666 |
3664 | 3667 |
3665 class V8EXPORT RawOperationDescriptor : public Data { | 3668 class V8_EXPORT RawOperationDescriptor : public Data { |
3666 public: | 3669 public: |
3667 Local<DeclaredAccessorDescriptor> NewHandleDereference(Isolate* isolate); | 3670 Local<DeclaredAccessorDescriptor> NewHandleDereference(Isolate* isolate); |
3668 Local<RawOperationDescriptor> NewRawDereference(Isolate* isolate); | 3671 Local<RawOperationDescriptor> NewRawDereference(Isolate* isolate); |
3669 Local<RawOperationDescriptor> NewRawShift(Isolate* isolate, | 3672 Local<RawOperationDescriptor> NewRawShift(Isolate* isolate, |
3670 int16_t byte_offset); | 3673 int16_t byte_offset); |
3671 Local<DeclaredAccessorDescriptor> NewPointerCompare(Isolate* isolate, | 3674 Local<DeclaredAccessorDescriptor> NewPointerCompare(Isolate* isolate, |
3672 void* compare_value); | 3675 void* compare_value); |
3673 Local<DeclaredAccessorDescriptor> NewPrimitiveValue( | 3676 Local<DeclaredAccessorDescriptor> NewPrimitiveValue( |
3674 Isolate* isolate, | 3677 Isolate* isolate, |
3675 DeclaredAccessorDescriptorDataType data_type, | 3678 DeclaredAccessorDescriptorDataType data_type, |
(...skipping 12 matching lines...) Expand all Loading... |
3688 | 3691 |
3689 private: | 3692 private: |
3690 RawOperationDescriptor(); | 3693 RawOperationDescriptor(); |
3691 }; | 3694 }; |
3692 | 3695 |
3693 | 3696 |
3694 /** | 3697 /** |
3695 * A utility for determining the type of objects based on the template | 3698 * A utility for determining the type of objects based on the template |
3696 * they were constructed from. | 3699 * they were constructed from. |
3697 */ | 3700 */ |
3698 class V8EXPORT TypeSwitch : public Data { | 3701 class V8_EXPORT TypeSwitch : public Data { |
3699 public: | 3702 public: |
3700 static Local<TypeSwitch> New(Handle<FunctionTemplate> type); | 3703 static Local<TypeSwitch> New(Handle<FunctionTemplate> type); |
3701 static Local<TypeSwitch> New(int argc, Handle<FunctionTemplate> types[]); | 3704 static Local<TypeSwitch> New(int argc, Handle<FunctionTemplate> types[]); |
3702 int match(Handle<Value> value); | 3705 int match(Handle<Value> value); |
3703 private: | 3706 private: |
3704 TypeSwitch(); | 3707 TypeSwitch(); |
3705 }; | 3708 }; |
3706 | 3709 |
3707 | 3710 |
3708 // --- Extensions --- | 3711 // --- Extensions --- |
3709 | 3712 |
3710 class V8EXPORT ExternalAsciiStringResourceImpl | 3713 class V8_EXPORT ExternalAsciiStringResourceImpl |
3711 : public String::ExternalAsciiStringResource { | 3714 : public String::ExternalAsciiStringResource { |
3712 public: | 3715 public: |
3713 ExternalAsciiStringResourceImpl() : data_(0), length_(0) {} | 3716 ExternalAsciiStringResourceImpl() : data_(0), length_(0) {} |
3714 ExternalAsciiStringResourceImpl(const char* data, size_t length) | 3717 ExternalAsciiStringResourceImpl(const char* data, size_t length) |
3715 : data_(data), length_(length) {} | 3718 : data_(data), length_(length) {} |
3716 const char* data() const { return data_; } | 3719 const char* data() const { return data_; } |
3717 size_t length() const { return length_; } | 3720 size_t length() const { return length_; } |
3718 | 3721 |
3719 private: | 3722 private: |
3720 const char* data_; | 3723 const char* data_; |
3721 size_t length_; | 3724 size_t length_; |
3722 }; | 3725 }; |
3723 | 3726 |
3724 /** | 3727 /** |
3725 * Ignore | 3728 * Ignore |
3726 */ | 3729 */ |
3727 class V8EXPORT Extension { // NOLINT | 3730 class V8_EXPORT Extension { // NOLINT |
3728 public: | 3731 public: |
3729 // Note that the strings passed into this constructor must live as long | 3732 // Note that the strings passed into this constructor must live as long |
3730 // as the Extension itself. | 3733 // as the Extension itself. |
3731 Extension(const char* name, | 3734 Extension(const char* name, |
3732 const char* source = 0, | 3735 const char* source = 0, |
3733 int dep_count = 0, | 3736 int dep_count = 0, |
3734 const char** deps = 0, | 3737 const char** deps = 0, |
3735 int source_length = -1); | 3738 int source_length = -1); |
3736 virtual ~Extension() { } | 3739 virtual ~Extension() { } |
3737 virtual v8::Handle<v8::FunctionTemplate> | 3740 virtual v8::Handle<v8::FunctionTemplate> |
(...skipping 17 matching lines...) Expand all Loading... |
3755 int dep_count_; | 3758 int dep_count_; |
3756 const char** deps_; | 3759 const char** deps_; |
3757 bool auto_enable_; | 3760 bool auto_enable_; |
3758 | 3761 |
3759 // Disallow copying and assigning. | 3762 // Disallow copying and assigning. |
3760 Extension(const Extension&); | 3763 Extension(const Extension&); |
3761 void operator=(const Extension&); | 3764 void operator=(const Extension&); |
3762 }; | 3765 }; |
3763 | 3766 |
3764 | 3767 |
3765 void V8EXPORT RegisterExtension(Extension* extension); | 3768 void V8_EXPORT RegisterExtension(Extension* extension); |
3766 | 3769 |
3767 | 3770 |
3768 /** | 3771 /** |
3769 * Ignore | 3772 * Ignore |
3770 */ | 3773 */ |
3771 class V8EXPORT DeclareExtension { | 3774 class V8_EXPORT DeclareExtension { |
3772 public: | 3775 public: |
3773 V8_INLINE(DeclareExtension(Extension* extension)) { | 3776 V8_INLINE(DeclareExtension(Extension* extension)) { |
3774 RegisterExtension(extension); | 3777 RegisterExtension(extension); |
3775 } | 3778 } |
3776 }; | 3779 }; |
3777 | 3780 |
3778 | 3781 |
3779 // --- Statics --- | 3782 // --- Statics --- |
3780 | 3783 |
3781 | 3784 |
3782 Handle<Primitive> V8EXPORT Undefined(); | 3785 Handle<Primitive> V8_EXPORT Undefined(); |
3783 Handle<Primitive> V8EXPORT Null(); | 3786 Handle<Primitive> V8_EXPORT Null(); |
3784 Handle<Boolean> V8EXPORT True(); | 3787 Handle<Boolean> V8_EXPORT True(); |
3785 Handle<Boolean> V8EXPORT False(); | 3788 Handle<Boolean> V8_EXPORT False(); |
3786 | 3789 |
3787 V8_INLINE(Handle<Primitive> Undefined(Isolate* isolate)); | 3790 V8_INLINE(Handle<Primitive> Undefined(Isolate* isolate)); |
3788 V8_INLINE(Handle<Primitive> Null(Isolate* isolate)); | 3791 V8_INLINE(Handle<Primitive> Null(Isolate* isolate)); |
3789 V8_INLINE(Handle<Boolean> True(Isolate* isolate)); | 3792 V8_INLINE(Handle<Boolean> True(Isolate* isolate)); |
3790 V8_INLINE(Handle<Boolean> False(Isolate* isolate)); | 3793 V8_INLINE(Handle<Boolean> False(Isolate* isolate)); |
3791 | 3794 |
3792 | 3795 |
3793 /** | 3796 /** |
3794 * A set of constraints that specifies the limits of the runtime's memory use. | 3797 * A set of constraints that specifies the limits of the runtime's memory use. |
3795 * You must set the heap size before initializing the VM - the size cannot be | 3798 * You must set the heap size before initializing the VM - the size cannot be |
3796 * adjusted after the VM is initialized. | 3799 * adjusted after the VM is initialized. |
3797 * | 3800 * |
3798 * If you are using threads then you should hold the V8::Locker lock while | 3801 * If you are using threads then you should hold the V8::Locker lock while |
3799 * setting the stack limit and you must set a non-default stack limit separately | 3802 * setting the stack limit and you must set a non-default stack limit separately |
3800 * for each thread. | 3803 * for each thread. |
3801 */ | 3804 */ |
3802 class V8EXPORT ResourceConstraints { | 3805 class V8_EXPORT ResourceConstraints { |
3803 public: | 3806 public: |
3804 ResourceConstraints(); | 3807 ResourceConstraints(); |
3805 int max_young_space_size() const { return max_young_space_size_; } | 3808 int max_young_space_size() const { return max_young_space_size_; } |
3806 void set_max_young_space_size(int value) { max_young_space_size_ = value; } | 3809 void set_max_young_space_size(int value) { max_young_space_size_ = value; } |
3807 int max_old_space_size() const { return max_old_space_size_; } | 3810 int max_old_space_size() const { return max_old_space_size_; } |
3808 void set_max_old_space_size(int value) { max_old_space_size_ = value; } | 3811 void set_max_old_space_size(int value) { max_old_space_size_ = value; } |
3809 int max_executable_size() { return max_executable_size_; } | 3812 int max_executable_size() { return max_executable_size_; } |
3810 void set_max_executable_size(int value) { max_executable_size_ = value; } | 3813 void set_max_executable_size(int value) { max_executable_size_ = value; } |
3811 uint32_t* stack_limit() const { return stack_limit_; } | 3814 uint32_t* stack_limit() const { return stack_limit_; } |
3812 // Sets an address beyond which the VM's stack may not grow. | 3815 // Sets an address beyond which the VM's stack may not grow. |
3813 void set_stack_limit(uint32_t* value) { stack_limit_ = value; } | 3816 void set_stack_limit(uint32_t* value) { stack_limit_ = value; } |
3814 private: | 3817 private: |
3815 int max_young_space_size_; | 3818 int max_young_space_size_; |
3816 int max_old_space_size_; | 3819 int max_old_space_size_; |
3817 int max_executable_size_; | 3820 int max_executable_size_; |
3818 uint32_t* stack_limit_; | 3821 uint32_t* stack_limit_; |
3819 }; | 3822 }; |
3820 | 3823 |
3821 | 3824 |
3822 bool V8EXPORT SetResourceConstraints(ResourceConstraints* constraints); | 3825 bool V8_EXPORT SetResourceConstraints(ResourceConstraints* constraints); |
3823 | 3826 |
3824 | 3827 |
3825 // --- Exceptions --- | 3828 // --- Exceptions --- |
3826 | 3829 |
3827 | 3830 |
3828 typedef void (*FatalErrorCallback)(const char* location, const char* message); | 3831 typedef void (*FatalErrorCallback)(const char* location, const char* message); |
3829 | 3832 |
3830 | 3833 |
3831 typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> error); | 3834 typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> error); |
3832 | 3835 |
3833 | 3836 |
3834 /** | 3837 /** |
3835 * Schedules an exception to be thrown when returning to JavaScript. When an | 3838 * Schedules an exception to be thrown when returning to JavaScript. When an |
3836 * exception has been scheduled it is illegal to invoke any JavaScript | 3839 * exception has been scheduled it is illegal to invoke any JavaScript |
3837 * operation; the caller must return immediately and only after the exception | 3840 * operation; the caller must return immediately and only after the exception |
3838 * has been handled does it become legal to invoke JavaScript operations. | 3841 * has been handled does it become legal to invoke JavaScript operations. |
3839 */ | 3842 */ |
3840 Handle<Value> V8EXPORT ThrowException(Handle<Value> exception); | 3843 Handle<Value> V8_EXPORT ThrowException(Handle<Value> exception); |
3841 | 3844 |
3842 /** | 3845 /** |
3843 * Create new error objects by calling the corresponding error object | 3846 * Create new error objects by calling the corresponding error object |
3844 * constructor with the message. | 3847 * constructor with the message. |
3845 */ | 3848 */ |
3846 class V8EXPORT Exception { | 3849 class V8_EXPORT Exception { |
3847 public: | 3850 public: |
3848 static Local<Value> RangeError(Handle<String> message); | 3851 static Local<Value> RangeError(Handle<String> message); |
3849 static Local<Value> ReferenceError(Handle<String> message); | 3852 static Local<Value> ReferenceError(Handle<String> message); |
3850 static Local<Value> SyntaxError(Handle<String> message); | 3853 static Local<Value> SyntaxError(Handle<String> message); |
3851 static Local<Value> TypeError(Handle<String> message); | 3854 static Local<Value> TypeError(Handle<String> message); |
3852 static Local<Value> Error(Handle<String> message); | 3855 static Local<Value> Error(Handle<String> message); |
3853 }; | 3856 }; |
3854 | 3857 |
3855 | 3858 |
3856 // --- Counters Callbacks --- | 3859 // --- Counters Callbacks --- |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3930 | 3933 |
3931 typedef void (*GCCallback)(); | 3934 typedef void (*GCCallback)(); |
3932 | 3935 |
3933 | 3936 |
3934 /** | 3937 /** |
3935 * Collection of V8 heap information. | 3938 * Collection of V8 heap information. |
3936 * | 3939 * |
3937 * Instances of this class can be passed to v8::V8::HeapStatistics to | 3940 * Instances of this class can be passed to v8::V8::HeapStatistics to |
3938 * get heap statistics from V8. | 3941 * get heap statistics from V8. |
3939 */ | 3942 */ |
3940 class V8EXPORT HeapStatistics { | 3943 class V8_EXPORT HeapStatistics { |
3941 public: | 3944 public: |
3942 HeapStatistics(); | 3945 HeapStatistics(); |
3943 size_t total_heap_size() { return total_heap_size_; } | 3946 size_t total_heap_size() { return total_heap_size_; } |
3944 size_t total_heap_size_executable() { return total_heap_size_executable_; } | 3947 size_t total_heap_size_executable() { return total_heap_size_executable_; } |
3945 size_t total_physical_size() { return total_physical_size_; } | 3948 size_t total_physical_size() { return total_physical_size_; } |
3946 size_t used_heap_size() { return used_heap_size_; } | 3949 size_t used_heap_size() { return used_heap_size_; } |
3947 size_t heap_size_limit() { return heap_size_limit_; } | 3950 size_t heap_size_limit() { return heap_size_limit_; } |
3948 | 3951 |
3949 private: | 3952 private: |
3950 size_t total_heap_size_; | 3953 size_t total_heap_size_; |
(...skipping 11 matching lines...) Expand all Loading... |
3962 | 3965 |
3963 /** | 3966 /** |
3964 * Isolate represents an isolated instance of the V8 engine. V8 | 3967 * Isolate represents an isolated instance of the V8 engine. V8 |
3965 * isolates have completely separate states. Objects from one isolate | 3968 * isolates have completely separate states. Objects from one isolate |
3966 * must not be used in other isolates. When V8 is initialized a | 3969 * must not be used in other isolates. When V8 is initialized a |
3967 * default isolate is implicitly created and entered. The embedder | 3970 * default isolate is implicitly created and entered. The embedder |
3968 * can create additional isolates and use them in parallel in multiple | 3971 * can create additional isolates and use them in parallel in multiple |
3969 * threads. An isolate can be entered by at most one thread at any | 3972 * threads. An isolate can be entered by at most one thread at any |
3970 * given time. The Locker/Unlocker API must be used to synchronize. | 3973 * given time. The Locker/Unlocker API must be used to synchronize. |
3971 */ | 3974 */ |
3972 class V8EXPORT Isolate { | 3975 class V8_EXPORT Isolate { |
3973 public: | 3976 public: |
3974 /** | 3977 /** |
3975 * Stack-allocated class which sets the isolate for all operations | 3978 * Stack-allocated class which sets the isolate for all operations |
3976 * executed within a local scope. | 3979 * executed within a local scope. |
3977 */ | 3980 */ |
3978 class V8EXPORT Scope { | 3981 class V8_EXPORT Scope { |
3979 public: | 3982 public: |
3980 explicit Scope(Isolate* isolate) : isolate_(isolate) { | 3983 explicit Scope(Isolate* isolate) : isolate_(isolate) { |
3981 isolate->Enter(); | 3984 isolate->Enter(); |
3982 } | 3985 } |
3983 | 3986 |
3984 ~Scope() { isolate_->Exit(); } | 3987 ~Scope() { isolate_->Exit(); } |
3985 | 3988 |
3986 private: | 3989 private: |
3987 Isolate* const isolate_; | 3990 Isolate* const isolate_; |
3988 | 3991 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4116 private: | 4119 private: |
4117 Isolate(); | 4120 Isolate(); |
4118 Isolate(const Isolate&); | 4121 Isolate(const Isolate&); |
4119 ~Isolate(); | 4122 ~Isolate(); |
4120 Isolate& operator=(const Isolate&); | 4123 Isolate& operator=(const Isolate&); |
4121 void* operator new(size_t size); | 4124 void* operator new(size_t size); |
4122 void operator delete(void*, size_t); | 4125 void operator delete(void*, size_t); |
4123 }; | 4126 }; |
4124 | 4127 |
4125 | 4128 |
4126 class V8EXPORT StartupData { | 4129 class V8_EXPORT StartupData { |
4127 public: | 4130 public: |
4128 enum CompressionAlgorithm { | 4131 enum CompressionAlgorithm { |
4129 kUncompressed, | 4132 kUncompressed, |
4130 kBZip2 | 4133 kBZip2 |
4131 }; | 4134 }; |
4132 | 4135 |
4133 const char* data; | 4136 const char* data; |
4134 int compressed_size; | 4137 int compressed_size; |
4135 int raw_size; | 4138 int raw_size; |
4136 }; | 4139 }; |
4137 | 4140 |
4138 | 4141 |
4139 /** | 4142 /** |
4140 * A helper class for driving V8 startup data decompression. It is based on | 4143 * A helper class for driving V8 startup data decompression. It is based on |
4141 * "CompressedStartupData" API functions from the V8 class. It isn't mandatory | 4144 * "CompressedStartupData" API functions from the V8 class. It isn't mandatory |
4142 * for an embedder to use this class, instead, API functions can be used | 4145 * for an embedder to use this class, instead, API functions can be used |
4143 * directly. | 4146 * directly. |
4144 * | 4147 * |
4145 * For an example of the class usage, see the "shell.cc" sample application. | 4148 * For an example of the class usage, see the "shell.cc" sample application. |
4146 */ | 4149 */ |
4147 class V8EXPORT StartupDataDecompressor { // NOLINT | 4150 class V8_EXPORT StartupDataDecompressor { // NOLINT |
4148 public: | 4151 public: |
4149 StartupDataDecompressor(); | 4152 StartupDataDecompressor(); |
4150 virtual ~StartupDataDecompressor(); | 4153 virtual ~StartupDataDecompressor(); |
4151 int Decompress(); | 4154 int Decompress(); |
4152 | 4155 |
4153 protected: | 4156 protected: |
4154 virtual int DecompressData(char* raw_data, | 4157 virtual int DecompressData(char* raw_data, |
4155 int* raw_data_size, | 4158 int* raw_data_size, |
4156 const char* compressed_data, | 4159 const char* compressed_data, |
4157 int compressed_data_size) = 0; | 4160 int compressed_data_size) = 0; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4281 * Callback function passed to SetJitCodeEventHandler. | 4284 * Callback function passed to SetJitCodeEventHandler. |
4282 * | 4285 * |
4283 * \param event code add, move or removal event. | 4286 * \param event code add, move or removal event. |
4284 */ | 4287 */ |
4285 typedef void (*JitCodeEventHandler)(const JitCodeEvent* event); | 4288 typedef void (*JitCodeEventHandler)(const JitCodeEvent* event); |
4286 | 4289 |
4287 | 4290 |
4288 /** | 4291 /** |
4289 * Interface for iterating through all external resources in the heap. | 4292 * Interface for iterating through all external resources in the heap. |
4290 */ | 4293 */ |
4291 class V8EXPORT ExternalResourceVisitor { // NOLINT | 4294 class V8_EXPORT ExternalResourceVisitor { // NOLINT |
4292 public: | 4295 public: |
4293 virtual ~ExternalResourceVisitor() {} | 4296 virtual ~ExternalResourceVisitor() {} |
4294 virtual void VisitExternalString(Handle<String> string) {} | 4297 virtual void VisitExternalString(Handle<String> string) {} |
4295 }; | 4298 }; |
4296 | 4299 |
4297 | 4300 |
4298 /** | 4301 /** |
4299 * Interface for iterating through all the persistent handles in the heap. | 4302 * Interface for iterating through all the persistent handles in the heap. |
4300 */ | 4303 */ |
4301 class V8EXPORT PersistentHandleVisitor { // NOLINT | 4304 class V8_EXPORT PersistentHandleVisitor { // NOLINT |
4302 public: | 4305 public: |
4303 virtual ~PersistentHandleVisitor() {} | 4306 virtual ~PersistentHandleVisitor() {} |
4304 virtual void VisitPersistentHandle(Persistent<Value>* value, | 4307 virtual void VisitPersistentHandle(Persistent<Value>* value, |
4305 uint16_t class_id) {} | 4308 uint16_t class_id) {} |
4306 }; | 4309 }; |
4307 | 4310 |
4308 | 4311 |
4309 /** | 4312 /** |
4310 * Asserts that no action is performed that could cause a handle's value | 4313 * Asserts that no action is performed that could cause a handle's value |
4311 * to be modified. Useful when otherwise unsafe handle operations need to | 4314 * to be modified. Useful when otherwise unsafe handle operations need to |
4312 * be performed. | 4315 * be performed. |
4313 */ | 4316 */ |
4314 class V8EXPORT AssertNoGCScope { | 4317 class V8_EXPORT AssertNoGCScope { |
4315 #ifndef DEBUG | 4318 #ifndef DEBUG |
4316 // TODO(yangguo): remove isolate argument. | 4319 // TODO(yangguo): remove isolate argument. |
4317 V8_INLINE(AssertNoGCScope(Isolate* isolate)) { } | 4320 V8_INLINE(AssertNoGCScope(Isolate* isolate)) { } |
4318 #else | 4321 #else |
4319 AssertNoGCScope(Isolate* isolate); | 4322 AssertNoGCScope(Isolate* isolate); |
4320 ~AssertNoGCScope(); | 4323 ~AssertNoGCScope(); |
4321 private: | 4324 private: |
4322 void* disallow_heap_allocation_; | 4325 void* disallow_heap_allocation_; |
4323 #endif | 4326 #endif |
4324 }; | 4327 }; |
4325 | 4328 |
4326 | 4329 |
4327 /** | 4330 /** |
4328 * Container class for static utility functions. | 4331 * Container class for static utility functions. |
4329 */ | 4332 */ |
4330 class V8EXPORT V8 { | 4333 class V8_EXPORT V8 { |
4331 public: | 4334 public: |
4332 /** Set the callback to invoke in case of fatal errors. */ | 4335 /** Set the callback to invoke in case of fatal errors. */ |
4333 static void SetFatalErrorHandler(FatalErrorCallback that); | 4336 static void SetFatalErrorHandler(FatalErrorCallback that); |
4334 | 4337 |
4335 /** | 4338 /** |
4336 * Set the callback to invoke to check if code generation from | 4339 * Set the callback to invoke to check if code generation from |
4337 * strings should be allowed. | 4340 * strings should be allowed. |
4338 */ | 4341 */ |
4339 static void SetAllowCodeGenerationFromStringsCallback( | 4342 static void SetAllowCodeGenerationFromStringsCallback( |
4340 AllowCodeGenerationFromStringsCallback that); | 4343 AllowCodeGenerationFromStringsCallback that); |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4788 template <class T> friend class Handle; | 4791 template <class T> friend class Handle; |
4789 template <class T> friend class Local; | 4792 template <class T> friend class Local; |
4790 template <class T> friend class Persistent; | 4793 template <class T> friend class Persistent; |
4791 friend class Context; | 4794 friend class Context; |
4792 }; | 4795 }; |
4793 | 4796 |
4794 | 4797 |
4795 /** | 4798 /** |
4796 * An external exception handler. | 4799 * An external exception handler. |
4797 */ | 4800 */ |
4798 class V8EXPORT TryCatch { | 4801 class V8_EXPORT TryCatch { |
4799 public: | 4802 public: |
4800 /** | 4803 /** |
4801 * Creates a new try/catch block and registers it with v8. Note that | 4804 * Creates a new try/catch block and registers it with v8. Note that |
4802 * all TryCatch blocks should be stack allocated because the memory | 4805 * all TryCatch blocks should be stack allocated because the memory |
4803 * location itself is compared against JavaScript try/catch blocks. | 4806 * location itself is compared against JavaScript try/catch blocks. |
4804 */ | 4807 */ |
4805 TryCatch(); | 4808 TryCatch(); |
4806 | 4809 |
4807 /** | 4810 /** |
4808 * Unregisters and deletes this try/catch block. | 4811 * Unregisters and deletes this try/catch block. |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4921 friend class v8::internal::Isolate; | 4924 friend class v8::internal::Isolate; |
4922 }; | 4925 }; |
4923 | 4926 |
4924 | 4927 |
4925 // --- Context --- | 4928 // --- Context --- |
4926 | 4929 |
4927 | 4930 |
4928 /** | 4931 /** |
4929 * Ignore | 4932 * Ignore |
4930 */ | 4933 */ |
4931 class V8EXPORT ExtensionConfiguration { | 4934 class V8_EXPORT ExtensionConfiguration { |
4932 public: | 4935 public: |
4933 ExtensionConfiguration(int name_count, const char* names[]) | 4936 ExtensionConfiguration(int name_count, const char* names[]) |
4934 : name_count_(name_count), names_(names) { } | 4937 : name_count_(name_count), names_(names) { } |
4935 private: | 4938 private: |
4936 friend class ImplementationUtilities; | 4939 friend class ImplementationUtilities; |
4937 int name_count_; | 4940 int name_count_; |
4938 const char** names_; | 4941 const char** names_; |
4939 }; | 4942 }; |
4940 | 4943 |
4941 | 4944 |
4942 /** | 4945 /** |
4943 * A sandboxed execution context with its own set of built-in objects | 4946 * A sandboxed execution context with its own set of built-in objects |
4944 * and functions. | 4947 * and functions. |
4945 */ | 4948 */ |
4946 class V8EXPORT Context { | 4949 class V8_EXPORT Context { |
4947 public: | 4950 public: |
4948 /** | 4951 /** |
4949 * Returns the global proxy object or global object itself for | 4952 * Returns the global proxy object or global object itself for |
4950 * detached contexts. | 4953 * detached contexts. |
4951 * | 4954 * |
4952 * Global proxy object is a thin wrapper whose prototype points to | 4955 * Global proxy object is a thin wrapper whose prototype points to |
4953 * actual context's global object with the properties like Object, etc. | 4956 * actual context's global object with the properties like Object, etc. |
4954 * This is done that way for security reasons (for more details see | 4957 * This is done that way for security reasons (for more details see |
4955 * https://wiki.mozilla.org/Gecko:SplitWindow). | 4958 * https://wiki.mozilla.org/Gecko:SplitWindow). |
4956 * | 4959 * |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5221 * // V8 not locked. | 5224 * // V8 not locked. |
5222 * } | 5225 * } |
5223 * isolate->Enter(); | 5226 * isolate->Enter(); |
5224 * // V8 locked again (2 levels). | 5227 * // V8 locked again (2 levels). |
5225 * } | 5228 * } |
5226 * // V8 still locked (1 level). | 5229 * // V8 still locked (1 level). |
5227 * } | 5230 * } |
5228 * // V8 Now no longer locked. | 5231 * // V8 Now no longer locked. |
5229 * \endcode | 5232 * \endcode |
5230 */ | 5233 */ |
5231 class V8EXPORT Unlocker { | 5234 class V8_EXPORT Unlocker { |
5232 public: | 5235 public: |
5233 /** | 5236 /** |
5234 * Initialize Unlocker for a given Isolate. | 5237 * Initialize Unlocker for a given Isolate. |
5235 */ | 5238 */ |
5236 V8_INLINE(explicit Unlocker(Isolate* isolate)) { Initialize(isolate); } | 5239 V8_INLINE(explicit Unlocker(Isolate* isolate)) { Initialize(isolate); } |
5237 | 5240 |
5238 /** Deprecated. Use Isolate version instead. */ | 5241 /** Deprecated. Use Isolate version instead. */ |
5239 V8_DEPRECATED(Unlocker()); | 5242 V8_DEPRECATED(Unlocker()); |
5240 | 5243 |
5241 ~Unlocker(); | 5244 ~Unlocker(); |
5242 private: | 5245 private: |
5243 void Initialize(Isolate* isolate); | 5246 void Initialize(Isolate* isolate); |
5244 | 5247 |
5245 internal::Isolate* isolate_; | 5248 internal::Isolate* isolate_; |
5246 }; | 5249 }; |
5247 | 5250 |
5248 | 5251 |
5249 class V8EXPORT Locker { | 5252 class V8_EXPORT Locker { |
5250 public: | 5253 public: |
5251 /** | 5254 /** |
5252 * Initialize Locker for a given Isolate. | 5255 * Initialize Locker for a given Isolate. |
5253 */ | 5256 */ |
5254 V8_INLINE(explicit Locker(Isolate* isolate)) { Initialize(isolate); } | 5257 V8_INLINE(explicit Locker(Isolate* isolate)) { Initialize(isolate); } |
5255 | 5258 |
5256 /** Deprecated. Use Isolate version instead. */ | 5259 /** Deprecated. Use Isolate version instead. */ |
5257 V8_DEPRECATED(Locker()); | 5260 V8_DEPRECATED(Locker()); |
5258 | 5261 |
5259 ~Locker(); | 5262 ~Locker(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5300 | 5303 |
5301 /** | 5304 /** |
5302 * A struct for exporting HeapStats data from V8, using "push" model. | 5305 * A struct for exporting HeapStats data from V8, using "push" model. |
5303 */ | 5306 */ |
5304 struct HeapStatsUpdate; | 5307 struct HeapStatsUpdate; |
5305 | 5308 |
5306 | 5309 |
5307 /** | 5310 /** |
5308 * An interface for exporting data from V8, using "push" model. | 5311 * An interface for exporting data from V8, using "push" model. |
5309 */ | 5312 */ |
5310 class V8EXPORT OutputStream { // NOLINT | 5313 class V8_EXPORT OutputStream { // NOLINT |
5311 public: | 5314 public: |
5312 enum OutputEncoding { | 5315 enum OutputEncoding { |
5313 kAscii = 0 // 7-bit ASCII. | 5316 kAscii = 0 // 7-bit ASCII. |
5314 }; | 5317 }; |
5315 enum WriteResult { | 5318 enum WriteResult { |
5316 kContinue = 0, | 5319 kContinue = 0, |
5317 kAbort = 1 | 5320 kAbort = 1 |
5318 }; | 5321 }; |
5319 virtual ~OutputStream() {} | 5322 virtual ~OutputStream() {} |
5320 /** Notify about the end of stream. */ | 5323 /** Notify about the end of stream. */ |
(...skipping 16 matching lines...) Expand all Loading... |
5337 virtual WriteResult WriteHeapStatsChunk(HeapStatsUpdate* data, int count) { | 5340 virtual WriteResult WriteHeapStatsChunk(HeapStatsUpdate* data, int count) { |
5338 return kAbort; | 5341 return kAbort; |
5339 }; | 5342 }; |
5340 }; | 5343 }; |
5341 | 5344 |
5342 | 5345 |
5343 /** | 5346 /** |
5344 * An interface for reporting progress and controlling long-running | 5347 * An interface for reporting progress and controlling long-running |
5345 * activities. | 5348 * activities. |
5346 */ | 5349 */ |
5347 class V8EXPORT ActivityControl { // NOLINT | 5350 class V8_EXPORT ActivityControl { // NOLINT |
5348 public: | 5351 public: |
5349 enum ControlOption { | 5352 enum ControlOption { |
5350 kContinue = 0, | 5353 kContinue = 0, |
5351 kAbort = 1 | 5354 kAbort = 1 |
5352 }; | 5355 }; |
5353 virtual ~ActivityControl() {} | 5356 virtual ~ActivityControl() {} |
5354 /** | 5357 /** |
5355 * Notify about current progress. The activity can be stopped by | 5358 * Notify about current progress. The activity can be stopped by |
5356 * returning kAbort as the callback result. | 5359 * returning kAbort as the callback result. |
5357 */ | 5360 */ |
(...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6551 | 6554 |
6552 | 6555 |
6553 /** | 6556 /** |
6554 * \example process.cc | 6557 * \example process.cc |
6555 */ | 6558 */ |
6556 | 6559 |
6557 | 6560 |
6558 } // namespace v8 | 6561 } // namespace v8 |
6559 | 6562 |
6560 | 6563 |
6561 #undef V8EXPORT | |
6562 #undef TYPE_CHECK | 6564 #undef TYPE_CHECK |
6563 | 6565 |
6564 | 6566 |
6565 #endif // V8_H_ | 6567 #endif // V8_H_ |
OLD | NEW |