| 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 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 /** | 604 /** |
| 605 * Returns true if the source code could not be parsed. | 605 * Returns true if the source code could not be parsed. |
| 606 */ | 606 */ |
| 607 virtual bool HasError() = 0; | 607 virtual bool HasError() = 0; |
| 608 }; | 608 }; |
| 609 | 609 |
| 610 | 610 |
| 611 /** | 611 /** |
| 612 * The origin, within a file, of a script. | 612 * The origin, within a file, of a script. |
| 613 */ | 613 */ |
| 614 class ScriptOrigin { | 614 class V8EXPORT ScriptOrigin { |
| 615 public: | 615 public: |
| 616 V8_INLINE(ScriptOrigin( | 616 V8_INLINE(ScriptOrigin( |
| 617 Handle<Value> resource_name, | 617 Handle<Value> resource_name, |
| 618 Handle<Integer> resource_line_offset = Handle<Integer>(), | 618 Handle<Integer> resource_line_offset = Handle<Integer>(), |
| 619 Handle<Integer> resource_column_offset = Handle<Integer>())) | 619 Handle<Integer> resource_column_offset = Handle<Integer>())) |
| 620 : resource_name_(resource_name), | 620 : resource_name_(resource_name), |
| 621 resource_line_offset_(resource_line_offset), | 621 resource_line_offset_(resource_line_offset), |
| 622 resource_column_offset_(resource_column_offset) { } | 622 resource_column_offset_(resource_column_offset) { } |
| 623 V8_INLINE(Handle<Value> ResourceName() const); | 623 V8_INLINE(Handle<Value> ResourceName() const); |
| 624 V8_INLINE(Handle<Integer> ResourceLineOffset() const); | 624 V8_INLINE(Handle<Integer> ResourceLineOffset() const); |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 bool IsConstructor() const; | 897 bool IsConstructor() const; |
| 898 }; | 898 }; |
| 899 | 899 |
| 900 | 900 |
| 901 // --- Value --- | 901 // --- Value --- |
| 902 | 902 |
| 903 | 903 |
| 904 /** | 904 /** |
| 905 * The superclass of all JavaScript values and objects. | 905 * The superclass of all JavaScript values and objects. |
| 906 */ | 906 */ |
| 907 class Value : public Data { | 907 class V8EXPORT Value : public Data { |
| 908 public: | 908 public: |
| 909 /** | 909 /** |
| 910 * Returns true if this value is the undefined value. See ECMA-262 | 910 * Returns true if this value is the undefined value. See ECMA-262 |
| 911 * 4.3.10. | 911 * 4.3.10. |
| 912 */ | 912 */ |
| 913 V8_INLINE(bool IsUndefined() const); | 913 V8_INLINE(bool IsUndefined() const); |
| 914 | 914 |
| 915 /** | 915 /** |
| 916 * Returns true if this value is the null value. See ECMA-262 | 916 * Returns true if this value is the null value. See ECMA-262 |
| 917 * 4.3.11. | 917 * 4.3.11. |
| 918 */ | 918 */ |
| 919 V8_INLINE(bool IsNull() const); | 919 V8_INLINE(bool IsNull() const); |
| 920 | 920 |
| 921 /** | 921 /** |
| 922 * Returns true if this value is true. | 922 * Returns true if this value is true. |
| 923 */ | 923 */ |
| 924 V8EXPORT bool IsTrue() const; | 924 bool IsTrue() const; |
| 925 | 925 |
| 926 /** | 926 /** |
| 927 * Returns true if this value is false. | 927 * Returns true if this value is false. |
| 928 */ | 928 */ |
| 929 V8EXPORT bool IsFalse() const; | 929 bool IsFalse() const; |
| 930 | 930 |
| 931 /** | 931 /** |
| 932 * Returns true if this value is an instance of the String type. | 932 * Returns true if this value is an instance of the String type. |
| 933 * See ECMA-262 8.4. | 933 * See ECMA-262 8.4. |
| 934 */ | 934 */ |
| 935 V8_INLINE(bool IsString() const); | 935 V8_INLINE(bool IsString() const); |
| 936 | 936 |
| 937 /** | 937 /** |
| 938 * Returns true if this value is a function. | 938 * Returns true if this value is a function. |
| 939 */ | 939 */ |
| 940 V8EXPORT bool IsFunction() const; | 940 bool IsFunction() const; |
| 941 | 941 |
| 942 /** | 942 /** |
| 943 * Returns true if this value is an array. | 943 * Returns true if this value is an array. |
| 944 */ | 944 */ |
| 945 V8EXPORT bool IsArray() const; | 945 bool IsArray() const; |
| 946 | 946 |
| 947 /** | 947 /** |
| 948 * Returns true if this value is an object. | 948 * Returns true if this value is an object. |
| 949 */ | 949 */ |
| 950 V8EXPORT bool IsObject() const; | 950 bool IsObject() const; |
| 951 | 951 |
| 952 /** | 952 /** |
| 953 * Returns true if this value is boolean. | 953 * Returns true if this value is boolean. |
| 954 */ | 954 */ |
| 955 V8EXPORT bool IsBoolean() const; | 955 bool IsBoolean() const; |
| 956 | 956 |
| 957 /** | 957 /** |
| 958 * Returns true if this value is a number. | 958 * Returns true if this value is a number. |
| 959 */ | 959 */ |
| 960 V8EXPORT bool IsNumber() const; | 960 bool IsNumber() const; |
| 961 | 961 |
| 962 /** | 962 /** |
| 963 * Returns true if this value is external. | 963 * Returns true if this value is external. |
| 964 */ | 964 */ |
| 965 V8EXPORT bool IsExternal() const; | 965 bool IsExternal() const; |
| 966 | 966 |
| 967 /** | 967 /** |
| 968 * Returns true if this value is a 32-bit signed integer. | 968 * Returns true if this value is a 32-bit signed integer. |
| 969 */ | 969 */ |
| 970 V8EXPORT bool IsInt32() const; | 970 bool IsInt32() const; |
| 971 | 971 |
| 972 /** | 972 /** |
| 973 * Returns true if this value is a 32-bit unsigned integer. | 973 * Returns true if this value is a 32-bit unsigned integer. |
| 974 */ | 974 */ |
| 975 V8EXPORT bool IsUint32() const; | 975 bool IsUint32() const; |
| 976 | 976 |
| 977 /** | 977 /** |
| 978 * Returns true if this value is a Date. | 978 * Returns true if this value is a Date. |
| 979 */ | 979 */ |
| 980 V8EXPORT bool IsDate() const; | 980 bool IsDate() const; |
| 981 | 981 |
| 982 /** | 982 /** |
| 983 * Returns true if this value is a Boolean object. | 983 * Returns true if this value is a Boolean object. |
| 984 */ | 984 */ |
| 985 V8EXPORT bool IsBooleanObject() const; | 985 bool IsBooleanObject() const; |
| 986 | 986 |
| 987 /** | 987 /** |
| 988 * Returns true if this value is a Number object. | 988 * Returns true if this value is a Number object. |
| 989 */ | 989 */ |
| 990 V8EXPORT bool IsNumberObject() const; | 990 bool IsNumberObject() const; |
| 991 | 991 |
| 992 /** | 992 /** |
| 993 * Returns true if this value is a String object. | 993 * Returns true if this value is a String object. |
| 994 */ | 994 */ |
| 995 V8EXPORT bool IsStringObject() const; | 995 bool IsStringObject() const; |
| 996 | 996 |
| 997 /** | 997 /** |
| 998 * Returns true if this value is a NativeError. | 998 * Returns true if this value is a NativeError. |
| 999 */ | 999 */ |
| 1000 V8EXPORT bool IsNativeError() const; | 1000 bool IsNativeError() const; |
| 1001 | 1001 |
| 1002 /** | 1002 /** |
| 1003 * Returns true if this value is a RegExp. | 1003 * Returns true if this value is a RegExp. |
| 1004 */ | 1004 */ |
| 1005 V8EXPORT bool IsRegExp() const; | 1005 bool IsRegExp() const; |
| 1006 | 1006 |
| 1007 V8EXPORT Local<Boolean> ToBoolean() const; | 1007 Local<Boolean> ToBoolean() const; |
| 1008 V8EXPORT Local<Number> ToNumber() const; | 1008 Local<Number> ToNumber() const; |
| 1009 V8EXPORT Local<String> ToString() const; | 1009 Local<String> ToString() const; |
| 1010 V8EXPORT Local<String> ToDetailString() const; | 1010 Local<String> ToDetailString() const; |
| 1011 V8EXPORT Local<Object> ToObject() const; | 1011 Local<Object> ToObject() const; |
| 1012 V8EXPORT Local<Integer> ToInteger() const; | 1012 Local<Integer> ToInteger() const; |
| 1013 V8EXPORT Local<Uint32> ToUint32() const; | 1013 Local<Uint32> ToUint32() const; |
| 1014 V8EXPORT Local<Int32> ToInt32() const; | 1014 Local<Int32> ToInt32() const; |
| 1015 | 1015 |
| 1016 /** | 1016 /** |
| 1017 * Attempts to convert a string to an array index. | 1017 * Attempts to convert a string to an array index. |
| 1018 * Returns an empty handle if the conversion fails. | 1018 * Returns an empty handle if the conversion fails. |
| 1019 */ | 1019 */ |
| 1020 V8EXPORT Local<Uint32> ToArrayIndex() const; | 1020 Local<Uint32> ToArrayIndex() const; |
| 1021 | 1021 |
| 1022 V8EXPORT bool BooleanValue() const; | 1022 bool BooleanValue() const; |
| 1023 V8EXPORT double NumberValue() const; | 1023 double NumberValue() const; |
| 1024 V8EXPORT int64_t IntegerValue() const; | 1024 int64_t IntegerValue() const; |
| 1025 V8EXPORT uint32_t Uint32Value() const; | 1025 uint32_t Uint32Value() const; |
| 1026 V8EXPORT int32_t Int32Value() const; | 1026 int32_t Int32Value() const; |
| 1027 | 1027 |
| 1028 /** JS == */ | 1028 /** JS == */ |
| 1029 V8EXPORT bool Equals(Handle<Value> that) const; | 1029 bool Equals(Handle<Value> that) const; |
| 1030 V8EXPORT bool StrictEquals(Handle<Value> that) const; | 1030 bool StrictEquals(Handle<Value> that) const; |
| 1031 | 1031 |
| 1032 private: | 1032 private: |
| 1033 V8_INLINE(bool QuickIsUndefined() const); | 1033 V8_INLINE(bool QuickIsUndefined() const); |
| 1034 V8_INLINE(bool QuickIsNull() const); | 1034 V8_INLINE(bool QuickIsNull() const); |
| 1035 V8_INLINE(bool QuickIsString() const); | 1035 V8_INLINE(bool QuickIsString() const); |
| 1036 V8EXPORT bool FullIsUndefined() const; | 1036 bool FullIsUndefined() const; |
| 1037 V8EXPORT bool FullIsNull() const; | 1037 bool FullIsNull() const; |
| 1038 V8EXPORT bool FullIsString() const; | 1038 bool FullIsString() const; |
| 1039 }; | 1039 }; |
| 1040 | 1040 |
| 1041 | 1041 |
| 1042 /** | 1042 /** |
| 1043 * The superclass of primitive values. See ECMA-262 4.3.2. | 1043 * The superclass of primitive values. See ECMA-262 4.3.2. |
| 1044 */ | 1044 */ |
| 1045 class Primitive : public Value { }; | 1045 class V8EXPORT Primitive : public Value { }; |
| 1046 | 1046 |
| 1047 | 1047 |
| 1048 /** | 1048 /** |
| 1049 * A primitive boolean value (ECMA-262, 4.3.14). Either the true | 1049 * A primitive boolean value (ECMA-262, 4.3.14). Either the true |
| 1050 * or false value. | 1050 * or false value. |
| 1051 */ | 1051 */ |
| 1052 class Boolean : public Primitive { | 1052 class V8EXPORT Boolean : public Primitive { |
| 1053 public: | 1053 public: |
| 1054 V8EXPORT bool Value() const; | 1054 bool Value() const; |
| 1055 V8_INLINE(static Handle<Boolean> New(bool value)); | 1055 V8_INLINE(static Handle<Boolean> New(bool value)); |
| 1056 }; | 1056 }; |
| 1057 | 1057 |
| 1058 | 1058 |
| 1059 /** | 1059 /** |
| 1060 * A JavaScript string value (ECMA-262, 4.3.17). | 1060 * A JavaScript string value (ECMA-262, 4.3.17). |
| 1061 */ | 1061 */ |
| 1062 class String : public Primitive { | 1062 class V8EXPORT String : public Primitive { |
| 1063 public: | 1063 public: |
| 1064 enum Encoding { | 1064 enum Encoding { |
| 1065 UNKNOWN_ENCODING = 0x1, | 1065 UNKNOWN_ENCODING = 0x1, |
| 1066 TWO_BYTE_ENCODING = 0x0, | 1066 TWO_BYTE_ENCODING = 0x0, |
| 1067 ASCII_ENCODING = 0x4 | 1067 ASCII_ENCODING = 0x4 |
| 1068 }; | 1068 }; |
| 1069 /** | 1069 /** |
| 1070 * Returns the number of characters in this string. | 1070 * Returns the number of characters in this string. |
| 1071 */ | 1071 */ |
| 1072 V8EXPORT int Length() const; | 1072 int Length() const; |
| 1073 | 1073 |
| 1074 /** | 1074 /** |
| 1075 * Returns the number of bytes in the UTF-8 encoded | 1075 * Returns the number of bytes in the UTF-8 encoded |
| 1076 * representation of this string. | 1076 * representation of this string. |
| 1077 */ | 1077 */ |
| 1078 V8EXPORT int Utf8Length() const; | 1078 int Utf8Length() const; |
| 1079 | 1079 |
| 1080 /** | 1080 /** |
| 1081 * A fast conservative check for non-ASCII characters. May | 1081 * A fast conservative check for non-ASCII characters. May |
| 1082 * return true even for ASCII strings, but if it returns | 1082 * return true even for ASCII strings, but if it returns |
| 1083 * false you can be sure that all characters are in the range | 1083 * false you can be sure that all characters are in the range |
| 1084 * 0-127. | 1084 * 0-127. |
| 1085 */ | 1085 */ |
| 1086 V8EXPORT bool MayContainNonAscii() const; | 1086 bool MayContainNonAscii() const; |
| 1087 | 1087 |
| 1088 /** | 1088 /** |
| 1089 * Write the contents of the string to an external buffer. | 1089 * Write the contents of the string to an external buffer. |
| 1090 * If no arguments are given, expects the buffer to be large | 1090 * If no arguments are given, expects the buffer to be large |
| 1091 * enough to hold the entire string and NULL terminator. Copies | 1091 * enough to hold the entire string and NULL terminator. Copies |
| 1092 * the contents of the string and the NULL terminator into the | 1092 * the contents of the string and the NULL terminator into the |
| 1093 * buffer. | 1093 * buffer. |
| 1094 * | 1094 * |
| 1095 * WriteUtf8 will not write partial UTF-8 sequences, preferring to stop | 1095 * WriteUtf8 will not write partial UTF-8 sequences, preferring to stop |
| 1096 * before the end of the buffer. | 1096 * before the end of the buffer. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1111 * including the null terminator (if written). | 1111 * including the null terminator (if written). |
| 1112 */ | 1112 */ |
| 1113 enum WriteOptions { | 1113 enum WriteOptions { |
| 1114 NO_OPTIONS = 0, | 1114 NO_OPTIONS = 0, |
| 1115 HINT_MANY_WRITES_EXPECTED = 1, | 1115 HINT_MANY_WRITES_EXPECTED = 1, |
| 1116 NO_NULL_TERMINATION = 2, | 1116 NO_NULL_TERMINATION = 2, |
| 1117 PRESERVE_ASCII_NULL = 4 | 1117 PRESERVE_ASCII_NULL = 4 |
| 1118 }; | 1118 }; |
| 1119 | 1119 |
| 1120 // 16-bit character codes. | 1120 // 16-bit character codes. |
| 1121 V8EXPORT int Write(uint16_t* buffer, | 1121 int Write(uint16_t* buffer, |
| 1122 int start = 0, | 1122 int start = 0, |
| 1123 int length = -1, | 1123 int length = -1, |
| 1124 int options = NO_OPTIONS) const; | 1124 int options = NO_OPTIONS) const; |
| 1125 // ASCII characters. | 1125 // ASCII characters. |
| 1126 V8EXPORT int WriteAscii(char* buffer, | 1126 int WriteAscii(char* buffer, |
| 1127 int start = 0, | 1127 int start = 0, |
| 1128 int length = -1, | 1128 int length = -1, |
| 1129 int options = NO_OPTIONS) const; | 1129 int options = NO_OPTIONS) const; |
| 1130 // UTF-8 encoded characters. | 1130 // UTF-8 encoded characters. |
| 1131 V8EXPORT int WriteUtf8(char* buffer, | 1131 int WriteUtf8(char* buffer, |
| 1132 int length = -1, | 1132 int length = -1, |
| 1133 int* nchars_ref = NULL, | 1133 int* nchars_ref = NULL, |
| 1134 int options = NO_OPTIONS) const; | 1134 int options = NO_OPTIONS) const; |
| 1135 | 1135 |
| 1136 /** | 1136 /** |
| 1137 * A zero length string. | 1137 * A zero length string. |
| 1138 */ | 1138 */ |
| 1139 V8EXPORT static v8::Local<v8::String> Empty(); | 1139 static v8::Local<v8::String> Empty(); |
| 1140 V8_INLINE(static v8::Local<v8::String> Empty(Isolate* isolate)); | 1140 V8_INLINE(static v8::Local<v8::String> Empty(Isolate* isolate)); |
| 1141 | 1141 |
| 1142 /** | 1142 /** |
| 1143 * Returns true if the string is external | 1143 * Returns true if the string is external |
| 1144 */ | 1144 */ |
| 1145 V8EXPORT bool IsExternal() const; | 1145 bool IsExternal() const; |
| 1146 | 1146 |
| 1147 /** | 1147 /** |
| 1148 * Returns true if the string is both external and ASCII | 1148 * Returns true if the string is both external and ASCII |
| 1149 */ | 1149 */ |
| 1150 V8EXPORT bool IsExternalAscii() const; | 1150 bool IsExternalAscii() const; |
| 1151 | 1151 |
| 1152 class V8EXPORT ExternalStringResourceBase { // NOLINT | 1152 class V8EXPORT ExternalStringResourceBase { // NOLINT |
| 1153 public: | 1153 public: |
| 1154 virtual ~ExternalStringResourceBase() {} | 1154 virtual ~ExternalStringResourceBase() {} |
| 1155 | 1155 |
| 1156 protected: | 1156 protected: |
| 1157 ExternalStringResourceBase() {} | 1157 ExternalStringResourceBase() {} |
| 1158 | 1158 |
| 1159 /** | 1159 /** |
| 1160 * Internally V8 will call this Dispose method when the external string | 1160 * Internally V8 will call this Dispose method when the external string |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1239 /** | 1239 /** |
| 1240 * Get the ExternalStringResource for an external string. Returns | 1240 * Get the ExternalStringResource for an external string. Returns |
| 1241 * NULL if IsExternal() doesn't return true. | 1241 * NULL if IsExternal() doesn't return true. |
| 1242 */ | 1242 */ |
| 1243 V8_INLINE(ExternalStringResource* GetExternalStringResource() const); | 1243 V8_INLINE(ExternalStringResource* GetExternalStringResource() const); |
| 1244 | 1244 |
| 1245 /** | 1245 /** |
| 1246 * Get the ExternalAsciiStringResource for an external ASCII string. | 1246 * Get the ExternalAsciiStringResource for an external ASCII string. |
| 1247 * Returns NULL if IsExternalAscii() doesn't return true. | 1247 * Returns NULL if IsExternalAscii() doesn't return true. |
| 1248 */ | 1248 */ |
| 1249 V8EXPORT const ExternalAsciiStringResource* GetExternalAsciiStringResource() | 1249 const ExternalAsciiStringResource* GetExternalAsciiStringResource() const; |
| 1250 const; | |
| 1251 | 1250 |
| 1252 V8_INLINE(static String* Cast(v8::Value* obj)); | 1251 V8_INLINE(static String* Cast(v8::Value* obj)); |
| 1253 | 1252 |
| 1254 /** | 1253 /** |
| 1255 * Allocates a new string from either UTF-8 encoded or ASCII data. | 1254 * Allocates a new string from either UTF-8 encoded or ASCII data. |
| 1256 * The second parameter 'length' gives the buffer length. If omitted, | 1255 * The second parameter 'length' gives the buffer length. If omitted, |
| 1257 * the function calls 'strlen' to determine the buffer length. | 1256 * the function calls 'strlen' to determine the buffer length. |
| 1258 */ | 1257 */ |
| 1259 V8EXPORT static Local<String> New(const char* data, int length = -1); | 1258 static Local<String> New(const char* data, int length = -1); |
| 1260 | 1259 |
| 1261 /** Allocates a new string from 16-bit character codes.*/ | 1260 /** Allocates a new string from 16-bit character codes.*/ |
| 1262 V8EXPORT static Local<String> New(const uint16_t* data, int length = -1); | 1261 static Local<String> New(const uint16_t* data, int length = -1); |
| 1263 | 1262 |
| 1264 /** Creates a symbol. Returns one if it exists already.*/ | 1263 /** Creates a symbol. Returns one if it exists already.*/ |
| 1265 V8EXPORT static Local<String> NewSymbol(const char* data, int length = -1); | 1264 static Local<String> NewSymbol(const char* data, int length = -1); |
| 1266 | 1265 |
| 1267 /** | 1266 /** |
| 1268 * Creates a new string by concatenating the left and the right strings | 1267 * Creates a new string by concatenating the left and the right strings |
| 1269 * passed in as parameters. | 1268 * passed in as parameters. |
| 1270 */ | 1269 */ |
| 1271 V8EXPORT static Local<String> Concat(Handle<String> left, | 1270 static Local<String> Concat(Handle<String> left, Handle<String> right); |
| 1272 Handle<String> right); | |
| 1273 | 1271 |
| 1274 /** | 1272 /** |
| 1275 * Creates a new external string using the data defined in the given | 1273 * Creates a new external string using the data defined in the given |
| 1276 * resource. When the external string is no longer live on V8's heap the | 1274 * resource. When the external string is no longer live on V8's heap the |
| 1277 * resource will be disposed by calling its Dispose method. The caller of | 1275 * resource will be disposed by calling its Dispose method. The caller of |
| 1278 * this function should not otherwise delete or modify the resource. Neither | 1276 * this function should not otherwise delete or modify the resource. Neither |
| 1279 * should the underlying buffer be deallocated or modified except through the | 1277 * should the underlying buffer be deallocated or modified except through the |
| 1280 * destructor of the external string resource. | 1278 * destructor of the external string resource. |
| 1281 */ | 1279 */ |
| 1282 V8EXPORT static Local<String> NewExternal(ExternalStringResource* resource); | 1280 static Local<String> NewExternal(ExternalStringResource* resource); |
| 1283 | 1281 |
| 1284 /** | 1282 /** |
| 1285 * Associate an external string resource with this string by transforming it | 1283 * Associate an external string resource with this string by transforming it |
| 1286 * in place so that existing references to this string in the JavaScript heap | 1284 * in place so that existing references to this string in the JavaScript heap |
| 1287 * will use the external string resource. The external string resource's | 1285 * will use the external string resource. The external string resource's |
| 1288 * character contents need to be equivalent to this string. | 1286 * character contents need to be equivalent to this string. |
| 1289 * Returns true if the string has been changed to be an external string. | 1287 * Returns true if the string has been changed to be an external string. |
| 1290 * The string is not modified if the operation fails. See NewExternal for | 1288 * The string is not modified if the operation fails. See NewExternal for |
| 1291 * information on the lifetime of the resource. | 1289 * information on the lifetime of the resource. |
| 1292 */ | 1290 */ |
| 1293 V8EXPORT bool MakeExternal(ExternalStringResource* resource); | 1291 bool MakeExternal(ExternalStringResource* resource); |
| 1294 | 1292 |
| 1295 /** | 1293 /** |
| 1296 * Creates a new external string using the ASCII data defined in the given | 1294 * Creates a new external string using the ASCII data defined in the given |
| 1297 * resource. When the external string is no longer live on V8's heap the | 1295 * resource. When the external string is no longer live on V8's heap the |
| 1298 * resource will be disposed by calling its Dispose method. The caller of | 1296 * resource will be disposed by calling its Dispose method. The caller of |
| 1299 * this function should not otherwise delete or modify the resource. Neither | 1297 * this function should not otherwise delete or modify the resource. Neither |
| 1300 * should the underlying buffer be deallocated or modified except through the | 1298 * should the underlying buffer be deallocated or modified except through the |
| 1301 * destructor of the external string resource. | 1299 * destructor of the external string resource. |
| 1302 */ V8EXPORT static Local<String> NewExternal( | 1300 */ |
| 1303 ExternalAsciiStringResource* resource); | 1301 static Local<String> NewExternal(ExternalAsciiStringResource* resource); |
| 1304 | 1302 |
| 1305 /** | 1303 /** |
| 1306 * Associate an external string resource with this string by transforming it | 1304 * Associate an external string resource with this string by transforming it |
| 1307 * in place so that existing references to this string in the JavaScript heap | 1305 * in place so that existing references to this string in the JavaScript heap |
| 1308 * will use the external string resource. The external string resource's | 1306 * will use the external string resource. The external string resource's |
| 1309 * character contents need to be equivalent to this string. | 1307 * character contents need to be equivalent to this string. |
| 1310 * Returns true if the string has been changed to be an external string. | 1308 * Returns true if the string has been changed to be an external string. |
| 1311 * The string is not modified if the operation fails. See NewExternal for | 1309 * The string is not modified if the operation fails. See NewExternal for |
| 1312 * information on the lifetime of the resource. | 1310 * information on the lifetime of the resource. |
| 1313 */ | 1311 */ |
| 1314 V8EXPORT bool MakeExternal(ExternalAsciiStringResource* resource); | 1312 bool MakeExternal(ExternalAsciiStringResource* resource); |
| 1315 | 1313 |
| 1316 /** | 1314 /** |
| 1317 * Returns true if this string can be made external. | 1315 * Returns true if this string can be made external. |
| 1318 */ | 1316 */ |
| 1319 V8EXPORT bool CanMakeExternal(); | 1317 bool CanMakeExternal(); |
| 1320 | 1318 |
| 1321 /** Creates an undetectable string from the supplied ASCII or UTF-8 data.*/ | 1319 /** Creates an undetectable string from the supplied ASCII or UTF-8 data.*/ |
| 1322 V8EXPORT static Local<String> NewUndetectable(const char* data, | 1320 static Local<String> NewUndetectable(const char* data, int length = -1); |
| 1323 int length = -1); | |
| 1324 | 1321 |
| 1325 /** Creates an undetectable string from the supplied 16-bit character codes.*/ | 1322 /** Creates an undetectable string from the supplied 16-bit character codes.*/ |
| 1326 V8EXPORT static Local<String> NewUndetectable(const uint16_t* data, | 1323 static Local<String> NewUndetectable(const uint16_t* data, int length = -1); |
| 1327 int length = -1); | |
| 1328 | 1324 |
| 1329 /** | 1325 /** |
| 1330 * Converts an object to a UTF-8-encoded character array. Useful if | 1326 * Converts an object to a UTF-8-encoded character array. Useful if |
| 1331 * you want to print the object. If conversion to a string fails | 1327 * you want to print the object. If conversion to a string fails |
| 1332 * (e.g. due to an exception in the toString() method of the object) | 1328 * (e.g. due to an exception in the toString() method of the object) |
| 1333 * then the length() method returns 0 and the * operator returns | 1329 * then the length() method returns 0 and the * operator returns |
| 1334 * NULL. | 1330 * NULL. |
| 1335 */ | 1331 */ |
| 1336 class V8EXPORT Utf8Value { | 1332 class V8EXPORT Utf8Value { |
| 1337 public: | 1333 public: |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1388 private: | 1384 private: |
| 1389 uint16_t* str_; | 1385 uint16_t* str_; |
| 1390 int length_; | 1386 int length_; |
| 1391 | 1387 |
| 1392 // Disallow copying and assigning. | 1388 // Disallow copying and assigning. |
| 1393 Value(const Value&); | 1389 Value(const Value&); |
| 1394 void operator=(const Value&); | 1390 void operator=(const Value&); |
| 1395 }; | 1391 }; |
| 1396 | 1392 |
| 1397 private: | 1393 private: |
| 1398 V8EXPORT void VerifyExternalStringResourceBase(ExternalStringResourceBase* v, | 1394 void VerifyExternalStringResourceBase(ExternalStringResourceBase* v, |
| 1399 Encoding encoding) const; | 1395 Encoding encoding) const; |
| 1400 V8EXPORT void VerifyExternalStringResource(ExternalStringResource* val) const; | 1396 void VerifyExternalStringResource(ExternalStringResource* val) const; |
| 1401 V8EXPORT static void CheckCast(v8::Value* obj); | 1397 static void CheckCast(v8::Value* obj); |
| 1402 }; | 1398 }; |
| 1403 | 1399 |
| 1404 | 1400 |
| 1405 /** | 1401 /** |
| 1406 * A JavaScript number value (ECMA-262, 4.3.20) | 1402 * A JavaScript number value (ECMA-262, 4.3.20) |
| 1407 */ | 1403 */ |
| 1408 class Number : public Primitive { | 1404 class V8EXPORT Number : public Primitive { |
| 1409 public: | 1405 public: |
| 1410 V8EXPORT double Value() const; | 1406 double Value() const; |
| 1411 V8EXPORT static Local<Number> New(double value); | 1407 static Local<Number> New(double value); |
| 1412 V8_INLINE(static Number* Cast(v8::Value* obj)); | 1408 V8_INLINE(static Number* Cast(v8::Value* obj)); |
| 1413 private: | 1409 private: |
| 1414 V8EXPORT Number(); | 1410 Number(); |
| 1415 V8EXPORT static void CheckCast(v8::Value* obj); | 1411 static void CheckCast(v8::Value* obj); |
| 1416 }; | 1412 }; |
| 1417 | 1413 |
| 1418 | 1414 |
| 1419 /** | 1415 /** |
| 1420 * A JavaScript value representing a signed integer. | 1416 * A JavaScript value representing a signed integer. |
| 1421 */ | 1417 */ |
| 1422 class Integer : public Number { | 1418 class V8EXPORT Integer : public Number { |
| 1423 public: | 1419 public: |
| 1424 V8EXPORT static Local<Integer> New(int32_t value); | 1420 static Local<Integer> New(int32_t value); |
| 1425 V8EXPORT static Local<Integer> NewFromUnsigned(uint32_t value); | 1421 static Local<Integer> NewFromUnsigned(uint32_t value); |
| 1426 V8EXPORT static Local<Integer> New(int32_t value, Isolate*); | 1422 static Local<Integer> New(int32_t value, Isolate*); |
| 1427 V8EXPORT static Local<Integer> NewFromUnsigned(uint32_t value, Isolate*); | 1423 static Local<Integer> NewFromUnsigned(uint32_t value, Isolate*); |
| 1428 V8EXPORT int64_t Value() const; | 1424 int64_t Value() const; |
| 1429 V8_INLINE(static Integer* Cast(v8::Value* obj)); | 1425 V8_INLINE(static Integer* Cast(v8::Value* obj)); |
| 1430 private: | 1426 private: |
| 1431 V8EXPORT Integer(); | 1427 Integer(); |
| 1432 V8EXPORT static void CheckCast(v8::Value* obj); | 1428 static void CheckCast(v8::Value* obj); |
| 1433 }; | 1429 }; |
| 1434 | 1430 |
| 1435 | 1431 |
| 1436 /** | 1432 /** |
| 1437 * A JavaScript value representing a 32-bit signed integer. | 1433 * A JavaScript value representing a 32-bit signed integer. |
| 1438 */ | 1434 */ |
| 1439 class Int32 : public Integer { | 1435 class V8EXPORT Int32 : public Integer { |
| 1440 public: | 1436 public: |
| 1441 V8EXPORT int32_t Value() const; | 1437 int32_t Value() const; |
| 1442 private: | 1438 private: |
| 1443 V8EXPORT Int32(); | 1439 Int32(); |
| 1444 }; | 1440 }; |
| 1445 | 1441 |
| 1446 | 1442 |
| 1447 /** | 1443 /** |
| 1448 * A JavaScript value representing a 32-bit unsigned integer. | 1444 * A JavaScript value representing a 32-bit unsigned integer. |
| 1449 */ | 1445 */ |
| 1450 class Uint32 : public Integer { | 1446 class V8EXPORT Uint32 : public Integer { |
| 1451 public: | 1447 public: |
| 1452 V8EXPORT uint32_t Value() const; | 1448 uint32_t Value() const; |
| 1453 private: | 1449 private: |
| 1454 V8EXPORT Uint32(); | 1450 Uint32(); |
| 1455 }; | 1451 }; |
| 1456 | 1452 |
| 1457 | 1453 |
| 1458 enum PropertyAttribute { | 1454 enum PropertyAttribute { |
| 1459 None = 0, | 1455 None = 0, |
| 1460 ReadOnly = 1 << 0, | 1456 ReadOnly = 1 << 0, |
| 1461 DontEnum = 1 << 1, | 1457 DontEnum = 1 << 1, |
| 1462 DontDelete = 1 << 2 | 1458 DontDelete = 1 << 2 |
| 1463 }; | 1459 }; |
| 1464 | 1460 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1505 DEFAULT = 0, | 1501 DEFAULT = 0, |
| 1506 ALL_CAN_READ = 1, | 1502 ALL_CAN_READ = 1, |
| 1507 ALL_CAN_WRITE = 1 << 1, | 1503 ALL_CAN_WRITE = 1 << 1, |
| 1508 PROHIBITS_OVERWRITING = 1 << 2 | 1504 PROHIBITS_OVERWRITING = 1 << 2 |
| 1509 }; | 1505 }; |
| 1510 | 1506 |
| 1511 | 1507 |
| 1512 /** | 1508 /** |
| 1513 * A JavaScript object (ECMA-262, 4.3.3) | 1509 * A JavaScript object (ECMA-262, 4.3.3) |
| 1514 */ | 1510 */ |
| 1515 class Object : public Value { | 1511 class V8EXPORT Object : public Value { |
| 1516 public: | 1512 public: |
| 1517 V8EXPORT bool Set(Handle<Value> key, | 1513 bool Set(Handle<Value> key, |
| 1518 Handle<Value> value, | 1514 Handle<Value> value, |
| 1519 PropertyAttribute attribs = None); | 1515 PropertyAttribute attribs = None); |
| 1520 | 1516 |
| 1521 V8EXPORT bool Set(uint32_t index, | 1517 bool Set(uint32_t index, Handle<Value> value); |
| 1522 Handle<Value> value); | |
| 1523 | 1518 |
| 1524 // Sets a local property on this object bypassing interceptors and | 1519 // Sets a local property on this object bypassing interceptors and |
| 1525 // overriding accessors or read-only properties. | 1520 // overriding accessors or read-only properties. |
| 1526 // | 1521 // |
| 1527 // Note that if the object has an interceptor the property will be set | 1522 // Note that if the object has an interceptor the property will be set |
| 1528 // locally, but since the interceptor takes precedence the local property | 1523 // locally, but since the interceptor takes precedence the local property |
| 1529 // will only be returned if the interceptor doesn't return a value. | 1524 // will only be returned if the interceptor doesn't return a value. |
| 1530 // | 1525 // |
| 1531 // Note also that this only works for named properties. | 1526 // Note also that this only works for named properties. |
| 1532 V8EXPORT bool ForceSet(Handle<Value> key, | 1527 bool ForceSet(Handle<Value> key, |
| 1533 Handle<Value> value, | 1528 Handle<Value> value, |
| 1534 PropertyAttribute attribs = None); | 1529 PropertyAttribute attribs = None); |
| 1535 | 1530 |
| 1536 V8EXPORT Local<Value> Get(Handle<Value> key); | 1531 Local<Value> Get(Handle<Value> key); |
| 1537 | 1532 |
| 1538 V8EXPORT Local<Value> Get(uint32_t index); | 1533 Local<Value> Get(uint32_t index); |
| 1539 | 1534 |
| 1540 /** | 1535 /** |
| 1541 * Gets the property attributes of a property which can be None or | 1536 * Gets the property attributes of a property which can be None or |
| 1542 * any combination of ReadOnly, DontEnum and DontDelete. Returns | 1537 * any combination of ReadOnly, DontEnum and DontDelete. Returns |
| 1543 * None when the property doesn't exist. | 1538 * None when the property doesn't exist. |
| 1544 */ | 1539 */ |
| 1545 V8EXPORT PropertyAttribute GetPropertyAttributes(Handle<Value> key); | 1540 PropertyAttribute GetPropertyAttributes(Handle<Value> key); |
| 1546 | 1541 |
| 1547 // TODO(1245389): Replace the type-specific versions of these | 1542 // TODO(1245389): Replace the type-specific versions of these |
| 1548 // functions with generic ones that accept a Handle<Value> key. | 1543 // functions with generic ones that accept a Handle<Value> key. |
| 1549 V8EXPORT bool Has(Handle<String> key); | 1544 bool Has(Handle<String> key); |
| 1550 | 1545 |
| 1551 V8EXPORT bool Delete(Handle<String> key); | 1546 bool Delete(Handle<String> key); |
| 1552 | 1547 |
| 1553 // Delete a property on this object bypassing interceptors and | 1548 // Delete a property on this object bypassing interceptors and |
| 1554 // ignoring dont-delete attributes. | 1549 // ignoring dont-delete attributes. |
| 1555 V8EXPORT bool ForceDelete(Handle<Value> key); | 1550 bool ForceDelete(Handle<Value> key); |
| 1556 | 1551 |
| 1557 V8EXPORT bool Has(uint32_t index); | 1552 bool Has(uint32_t index); |
| 1558 | 1553 |
| 1559 V8EXPORT bool Delete(uint32_t index); | 1554 bool Delete(uint32_t index); |
| 1560 | 1555 |
| 1561 V8EXPORT bool SetAccessor(Handle<String> name, | 1556 bool SetAccessor(Handle<String> name, |
| 1562 AccessorGetter getter, | 1557 AccessorGetter getter, |
| 1563 AccessorSetter setter = 0, | 1558 AccessorSetter setter = 0, |
| 1564 Handle<Value> data = Handle<Value>(), | 1559 Handle<Value> data = Handle<Value>(), |
| 1565 AccessControl settings = DEFAULT, | 1560 AccessControl settings = DEFAULT, |
| 1566 PropertyAttribute attribute = None); | 1561 PropertyAttribute attribute = None); |
| 1567 | 1562 |
| 1568 /** | 1563 /** |
| 1569 * Returns an array containing the names of the enumerable properties | 1564 * Returns an array containing the names of the enumerable properties |
| 1570 * of this object, including properties from prototype objects. The | 1565 * of this object, including properties from prototype objects. The |
| 1571 * array returned by this method contains the same values as would | 1566 * array returned by this method contains the same values as would |
| 1572 * be enumerated by a for-in statement over this object. | 1567 * be enumerated by a for-in statement over this object. |
| 1573 */ | 1568 */ |
| 1574 V8EXPORT Local<Array> GetPropertyNames(); | 1569 Local<Array> GetPropertyNames(); |
| 1575 | 1570 |
| 1576 /** | 1571 /** |
| 1577 * This function has the same functionality as GetPropertyNames but | 1572 * This function has the same functionality as GetPropertyNames but |
| 1578 * the returned array doesn't contain the names of properties from | 1573 * the returned array doesn't contain the names of properties from |
| 1579 * prototype objects. | 1574 * prototype objects. |
| 1580 */ | 1575 */ |
| 1581 V8EXPORT Local<Array> GetOwnPropertyNames(); | 1576 Local<Array> GetOwnPropertyNames(); |
| 1582 | 1577 |
| 1583 /** | 1578 /** |
| 1584 * Get the prototype object. This does not skip objects marked to | 1579 * Get the prototype object. This does not skip objects marked to |
| 1585 * be skipped by __proto__ and it does not consult the security | 1580 * be skipped by __proto__ and it does not consult the security |
| 1586 * handler. | 1581 * handler. |
| 1587 */ | 1582 */ |
| 1588 V8EXPORT Local<Value> GetPrototype(); | 1583 Local<Value> GetPrototype(); |
| 1589 | 1584 |
| 1590 /** | 1585 /** |
| 1591 * Set the prototype object. This does not skip objects marked to | 1586 * Set the prototype object. This does not skip objects marked to |
| 1592 * be skipped by __proto__ and it does not consult the security | 1587 * be skipped by __proto__ and it does not consult the security |
| 1593 * handler. | 1588 * handler. |
| 1594 */ | 1589 */ |
| 1595 V8EXPORT bool SetPrototype(Handle<Value> prototype); | 1590 bool SetPrototype(Handle<Value> prototype); |
| 1596 | 1591 |
| 1597 /** | 1592 /** |
| 1598 * Finds an instance of the given function template in the prototype | 1593 * Finds an instance of the given function template in the prototype |
| 1599 * chain. | 1594 * chain. |
| 1600 */ | 1595 */ |
| 1601 V8EXPORT Local<Object> FindInstanceInPrototypeChain( | 1596 Local<Object> FindInstanceInPrototypeChain(Handle<FunctionTemplate> tmpl); |
| 1602 Handle<FunctionTemplate> tmpl); | |
| 1603 | 1597 |
| 1604 /** | 1598 /** |
| 1605 * Call builtin Object.prototype.toString on this object. | 1599 * Call builtin Object.prototype.toString on this object. |
| 1606 * This is different from Value::ToString() that may call | 1600 * This is different from Value::ToString() that may call |
| 1607 * user-defined toString function. This one does not. | 1601 * user-defined toString function. This one does not. |
| 1608 */ | 1602 */ |
| 1609 V8EXPORT Local<String> ObjectProtoToString(); | 1603 Local<String> ObjectProtoToString(); |
| 1610 | 1604 |
| 1611 /** | 1605 /** |
| 1612 * Returns the function invoked as a constructor for this object. | 1606 * Returns the function invoked as a constructor for this object. |
| 1613 * May be the null value. | 1607 * May be the null value. |
| 1614 */ | 1608 */ |
| 1615 V8EXPORT Local<Value> GetConstructor(); | 1609 Local<Value> GetConstructor(); |
| 1616 | 1610 |
| 1617 /** | 1611 /** |
| 1618 * Returns the name of the function invoked as a constructor for this object. | 1612 * Returns the name of the function invoked as a constructor for this object. |
| 1619 */ | 1613 */ |
| 1620 V8EXPORT Local<String> GetConstructorName(); | 1614 Local<String> GetConstructorName(); |
| 1621 | 1615 |
| 1622 /** Gets the number of internal fields for this Object. */ | 1616 /** Gets the number of internal fields for this Object. */ |
| 1623 V8EXPORT int InternalFieldCount(); | 1617 int InternalFieldCount(); |
| 1624 | 1618 |
| 1625 /** Gets the value from an internal field. */ | 1619 /** Gets the value from an internal field. */ |
| 1626 V8_INLINE(Local<Value> GetInternalField(int index)); | 1620 V8_INLINE(Local<Value> GetInternalField(int index)); |
| 1627 | 1621 |
| 1628 /** Sets the value in an internal field. */ | 1622 /** Sets the value in an internal field. */ |
| 1629 V8EXPORT void SetInternalField(int index, Handle<Value> value); | 1623 void SetInternalField(int index, Handle<Value> value); |
| 1630 | 1624 |
| 1631 /** | 1625 /** |
| 1632 * Gets a native pointer from an internal field. Deprecated. If the pointer is | 1626 * Gets a native pointer from an internal field. Deprecated. If the pointer is |
| 1633 * always 2-byte-aligned, use GetAlignedPointerFromInternalField instead, | 1627 * always 2-byte-aligned, use GetAlignedPointerFromInternalField instead, |
| 1634 * otherwise use a combination of GetInternalField, External::Cast and | 1628 * otherwise use a combination of GetInternalField, External::Cast and |
| 1635 * External::Value. | 1629 * External::Value. |
| 1636 */ | 1630 */ |
| 1637 V8EXPORT V8_DEPRECATED(void* GetPointerFromInternalField(int index)); | 1631 V8_DEPRECATED(void* GetPointerFromInternalField(int index)); |
| 1638 | 1632 |
| 1639 /** | 1633 /** |
| 1640 * Sets a native pointer in an internal field. Deprecated. If the pointer is | 1634 * Sets a native pointer in an internal field. Deprecated. If the pointer is |
| 1641 * always 2-byte aligned, use SetAlignedPointerInInternalField instead, | 1635 * always 2-byte aligned, use SetAlignedPointerInInternalField instead, |
| 1642 * otherwise use a combination of External::New and SetInternalField. | 1636 * otherwise use a combination of External::New and SetInternalField. |
| 1643 */ | 1637 */ |
| 1644 V8_DEPRECATED(V8_INLINE(void SetPointerInInternalField(int index, | 1638 V8_DEPRECATED(V8_INLINE(void SetPointerInInternalField(int index, |
| 1645 void* value))); | 1639 void* value))); |
| 1646 | 1640 |
| 1647 /** | 1641 /** |
| 1648 * Gets a 2-byte-aligned native pointer from an internal field. This field | 1642 * Gets a 2-byte-aligned native pointer from an internal field. This field |
| 1649 * must have been set by SetAlignedPointerInInternalField, everything else | 1643 * must have been set by SetAlignedPointerInInternalField, everything else |
| 1650 * leads to undefined behavior. | 1644 * leads to undefined behavior. |
| 1651 */ | 1645 */ |
| 1652 V8_INLINE(void* GetAlignedPointerFromInternalField(int index)); | 1646 V8_INLINE(void* GetAlignedPointerFromInternalField(int index)); |
| 1653 | 1647 |
| 1654 /** | 1648 /** |
| 1655 * Sets a 2-byte-aligned native pointer in an internal field. To retrieve such | 1649 * Sets a 2-byte-aligned native pointer in an internal field. To retrieve such |
| 1656 * a field, GetAlignedPointerFromInternalField must be used, everything else | 1650 * a field, GetAlignedPointerFromInternalField must be used, everything else |
| 1657 * leads to undefined behavior. | 1651 * leads to undefined behavior. |
| 1658 */ | 1652 */ |
| 1659 V8EXPORT void SetAlignedPointerInInternalField(int index, void* value); | 1653 void SetAlignedPointerInInternalField(int index, void* value); |
| 1660 | 1654 |
| 1661 // Testers for local properties. | 1655 // Testers for local properties. |
| 1662 V8EXPORT bool HasOwnProperty(Handle<String> key); | 1656 bool HasOwnProperty(Handle<String> key); |
| 1663 V8EXPORT bool HasRealNamedProperty(Handle<String> key); | 1657 bool HasRealNamedProperty(Handle<String> key); |
| 1664 V8EXPORT bool HasRealIndexedProperty(uint32_t index); | 1658 bool HasRealIndexedProperty(uint32_t index); |
| 1665 V8EXPORT bool HasRealNamedCallbackProperty(Handle<String> key); | 1659 bool HasRealNamedCallbackProperty(Handle<String> key); |
| 1666 | 1660 |
| 1667 /** | 1661 /** |
| 1668 * If result.IsEmpty() no real property was located in the prototype chain. | 1662 * If result.IsEmpty() no real property was located in the prototype chain. |
| 1669 * This means interceptors in the prototype chain are not called. | 1663 * This means interceptors in the prototype chain are not called. |
| 1670 */ | 1664 */ |
| 1671 V8EXPORT Local<Value> GetRealNamedPropertyInPrototypeChain( | 1665 Local<Value> GetRealNamedPropertyInPrototypeChain(Handle<String> key); |
| 1672 Handle<String> key); | |
| 1673 | 1666 |
| 1674 /** | 1667 /** |
| 1675 * If result.IsEmpty() no real property was located on the object or | 1668 * If result.IsEmpty() no real property was located on the object or |
| 1676 * in the prototype chain. | 1669 * in the prototype chain. |
| 1677 * This means interceptors in the prototype chain are not called. | 1670 * This means interceptors in the prototype chain are not called. |
| 1678 */ | 1671 */ |
| 1679 V8EXPORT Local<Value> GetRealNamedProperty(Handle<String> key); | 1672 Local<Value> GetRealNamedProperty(Handle<String> key); |
| 1680 | 1673 |
| 1681 /** Tests for a named lookup interceptor.*/ | 1674 /** Tests for a named lookup interceptor.*/ |
| 1682 V8EXPORT bool HasNamedLookupInterceptor(); | 1675 bool HasNamedLookupInterceptor(); |
| 1683 | 1676 |
| 1684 /** Tests for an index lookup interceptor.*/ | 1677 /** Tests for an index lookup interceptor.*/ |
| 1685 V8EXPORT bool HasIndexedLookupInterceptor(); | 1678 bool HasIndexedLookupInterceptor(); |
| 1686 | 1679 |
| 1687 /** | 1680 /** |
| 1688 * Turns on access check on the object if the object is an instance of | 1681 * Turns on access check on the object if the object is an instance of |
| 1689 * a template that has access check callbacks. If an object has no | 1682 * a template that has access check callbacks. If an object has no |
| 1690 * access check info, the object cannot be accessed by anyone. | 1683 * access check info, the object cannot be accessed by anyone. |
| 1691 */ | 1684 */ |
| 1692 V8EXPORT void TurnOnAccessCheck(); | 1685 void TurnOnAccessCheck(); |
| 1693 | 1686 |
| 1694 /** | 1687 /** |
| 1695 * Returns the identity hash for this object. The current implementation | 1688 * Returns the identity hash for this object. The current implementation |
| 1696 * uses a hidden property on the object to store the identity hash. | 1689 * uses a hidden property on the object to store the identity hash. |
| 1697 * | 1690 * |
| 1698 * The return value will never be 0. Also, it is not guaranteed to be | 1691 * The return value will never be 0. Also, it is not guaranteed to be |
| 1699 * unique. | 1692 * unique. |
| 1700 */ | 1693 */ |
| 1701 V8EXPORT int GetIdentityHash(); | 1694 int GetIdentityHash(); |
| 1702 | 1695 |
| 1703 /** | 1696 /** |
| 1704 * Access hidden properties on JavaScript objects. These properties are | 1697 * Access hidden properties on JavaScript objects. These properties are |
| 1705 * hidden from the executing JavaScript and only accessible through the V8 | 1698 * hidden from the executing JavaScript and only accessible through the V8 |
| 1706 * C++ API. Hidden properties introduced by V8 internally (for example the | 1699 * C++ API. Hidden properties introduced by V8 internally (for example the |
| 1707 * identity hash) are prefixed with "v8::". | 1700 * identity hash) are prefixed with "v8::". |
| 1708 */ | 1701 */ |
| 1709 V8EXPORT bool SetHiddenValue(Handle<String> key, Handle<Value> value); | 1702 bool SetHiddenValue(Handle<String> key, Handle<Value> value); |
| 1710 V8EXPORT Local<Value> GetHiddenValue(Handle<String> key); | 1703 Local<Value> GetHiddenValue(Handle<String> key); |
| 1711 V8EXPORT bool DeleteHiddenValue(Handle<String> key); | 1704 bool DeleteHiddenValue(Handle<String> key); |
| 1712 | 1705 |
| 1713 /** | 1706 /** |
| 1714 * Returns true if this is an instance of an api function (one | 1707 * Returns true if this is an instance of an api function (one |
| 1715 * created from a function created from a function template) and has | 1708 * created from a function created from a function template) and has |
| 1716 * been modified since it was created. Note that this method is | 1709 * been modified since it was created. Note that this method is |
| 1717 * conservative and may return true for objects that haven't actually | 1710 * conservative and may return true for objects that haven't actually |
| 1718 * been modified. | 1711 * been modified. |
| 1719 */ | 1712 */ |
| 1720 V8EXPORT bool IsDirty(); | 1713 bool IsDirty(); |
| 1721 | 1714 |
| 1722 /** | 1715 /** |
| 1723 * Clone this object with a fast but shallow copy. Values will point | 1716 * Clone this object with a fast but shallow copy. Values will point |
| 1724 * to the same values as the original object. | 1717 * to the same values as the original object. |
| 1725 */ | 1718 */ |
| 1726 V8EXPORT Local<Object> Clone(); | 1719 Local<Object> Clone(); |
| 1727 | 1720 |
| 1728 /** | 1721 /** |
| 1729 * Returns the context in which the object was created. | 1722 * Returns the context in which the object was created. |
| 1730 */ | 1723 */ |
| 1731 V8EXPORT Local<Context> CreationContext(); | 1724 Local<Context> CreationContext(); |
| 1732 | 1725 |
| 1733 /** | 1726 /** |
| 1734 * Set the backing store of the indexed properties to be managed by the | 1727 * Set the backing store of the indexed properties to be managed by the |
| 1735 * embedding layer. Access to the indexed properties will follow the rules | 1728 * embedding layer. Access to the indexed properties will follow the rules |
| 1736 * spelled out in CanvasPixelArray. | 1729 * spelled out in CanvasPixelArray. |
| 1737 * Note: The embedding program still owns the data and needs to ensure that | 1730 * Note: The embedding program still owns the data and needs to ensure that |
| 1738 * the backing store is preserved while V8 has a reference. | 1731 * the backing store is preserved while V8 has a reference. |
| 1739 */ | 1732 */ |
| 1740 V8EXPORT void SetIndexedPropertiesToPixelData(uint8_t* data, int length); | 1733 void SetIndexedPropertiesToPixelData(uint8_t* data, int length); |
| 1741 V8EXPORT bool HasIndexedPropertiesInPixelData(); | 1734 bool HasIndexedPropertiesInPixelData(); |
| 1742 V8EXPORT uint8_t* GetIndexedPropertiesPixelData(); | 1735 uint8_t* GetIndexedPropertiesPixelData(); |
| 1743 V8EXPORT int GetIndexedPropertiesPixelDataLength(); | 1736 int GetIndexedPropertiesPixelDataLength(); |
| 1744 | 1737 |
| 1745 /** | 1738 /** |
| 1746 * Set the backing store of the indexed properties to be managed by the | 1739 * Set the backing store of the indexed properties to be managed by the |
| 1747 * embedding layer. Access to the indexed properties will follow the rules | 1740 * embedding layer. Access to the indexed properties will follow the rules |
| 1748 * spelled out for the CanvasArray subtypes in the WebGL specification. | 1741 * spelled out for the CanvasArray subtypes in the WebGL specification. |
| 1749 * Note: The embedding program still owns the data and needs to ensure that | 1742 * Note: The embedding program still owns the data and needs to ensure that |
| 1750 * the backing store is preserved while V8 has a reference. | 1743 * the backing store is preserved while V8 has a reference. |
| 1751 */ | 1744 */ |
| 1752 V8EXPORT void SetIndexedPropertiesToExternalArrayData( | 1745 void SetIndexedPropertiesToExternalArrayData(void* data, |
| 1753 void* data, | 1746 ExternalArrayType array_type, |
| 1754 ExternalArrayType array_type, | 1747 int number_of_elements); |
| 1755 int number_of_elements); | 1748 bool HasIndexedPropertiesInExternalArrayData(); |
| 1756 V8EXPORT bool HasIndexedPropertiesInExternalArrayData(); | 1749 void* GetIndexedPropertiesExternalArrayData(); |
| 1757 V8EXPORT void* GetIndexedPropertiesExternalArrayData(); | 1750 ExternalArrayType GetIndexedPropertiesExternalArrayDataType(); |
| 1758 V8EXPORT ExternalArrayType GetIndexedPropertiesExternalArrayDataType(); | 1751 int GetIndexedPropertiesExternalArrayDataLength(); |
| 1759 V8EXPORT int GetIndexedPropertiesExternalArrayDataLength(); | |
| 1760 | 1752 |
| 1761 /** | 1753 /** |
| 1762 * Checks whether a callback is set by the | 1754 * Checks whether a callback is set by the |
| 1763 * ObjectTemplate::SetCallAsFunctionHandler method. | 1755 * ObjectTemplate::SetCallAsFunctionHandler method. |
| 1764 * When an Object is callable this method returns true. | 1756 * When an Object is callable this method returns true. |
| 1765 */ | 1757 */ |
| 1766 V8EXPORT bool IsCallable(); | 1758 bool IsCallable(); |
| 1767 | 1759 |
| 1768 /** | 1760 /** |
| 1769 * Call an Object as a function if a callback is set by the | 1761 * Call an Object as a function if a callback is set by the |
| 1770 * ObjectTemplate::SetCallAsFunctionHandler method. | 1762 * ObjectTemplate::SetCallAsFunctionHandler method. |
| 1771 */ | 1763 */ |
| 1772 V8EXPORT Local<Value> CallAsFunction(Handle<Object> recv, | 1764 Local<Value> CallAsFunction(Handle<Object> recv, |
| 1773 int argc, | 1765 int argc, |
| 1774 Handle<Value> argv[]); | 1766 Handle<Value> argv[]); |
| 1775 | 1767 |
| 1776 /** | 1768 /** |
| 1777 * Call an Object as a constructor if a callback is set by the | 1769 * Call an Object as a constructor if a callback is set by the |
| 1778 * ObjectTemplate::SetCallAsFunctionHandler method. | 1770 * ObjectTemplate::SetCallAsFunctionHandler method. |
| 1779 * Note: This method behaves like the Function::NewInstance method. | 1771 * Note: This method behaves like the Function::NewInstance method. |
| 1780 */ | 1772 */ |
| 1781 V8EXPORT Local<Value> CallAsConstructor(int argc, | 1773 Local<Value> CallAsConstructor(int argc, Handle<Value> argv[]); |
| 1782 Handle<Value> argv[]); | |
| 1783 | 1774 |
| 1784 V8EXPORT static Local<Object> New(); | 1775 static Local<Object> New(); |
| 1785 V8_INLINE(static Object* Cast(Value* obj)); | 1776 V8_INLINE(static Object* Cast(Value* obj)); |
| 1786 | 1777 |
| 1787 private: | 1778 private: |
| 1788 V8EXPORT Object(); | 1779 Object(); |
| 1789 V8EXPORT static void CheckCast(Value* obj); | 1780 static void CheckCast(Value* obj); |
| 1790 V8EXPORT Local<Value> SlowGetInternalField(int index); | 1781 Local<Value> SlowGetInternalField(int index); |
| 1791 V8EXPORT void* SlowGetAlignedPointerFromInternalField(int index); | 1782 void* SlowGetAlignedPointerFromInternalField(int index); |
| 1792 }; | 1783 }; |
| 1793 | 1784 |
| 1794 | 1785 |
| 1795 /** | 1786 /** |
| 1796 * An instance of the built-in array constructor (ECMA-262, 15.4.2). | 1787 * An instance of the built-in array constructor (ECMA-262, 15.4.2). |
| 1797 */ | 1788 */ |
| 1798 class Array : public Object { | 1789 class V8EXPORT Array : public Object { |
| 1799 public: | 1790 public: |
| 1800 V8EXPORT uint32_t Length() const; | 1791 uint32_t Length() const; |
| 1801 | 1792 |
| 1802 /** | 1793 /** |
| 1803 * Clones an element at index |index|. Returns an empty | 1794 * Clones an element at index |index|. Returns an empty |
| 1804 * handle if cloning fails (for any reason). | 1795 * handle if cloning fails (for any reason). |
| 1805 */ | 1796 */ |
| 1806 V8EXPORT Local<Object> CloneElementAt(uint32_t index); | 1797 Local<Object> CloneElementAt(uint32_t index); |
| 1807 | 1798 |
| 1808 /** | 1799 /** |
| 1809 * Creates a JavaScript array with the given length. If the length | 1800 * Creates a JavaScript array with the given length. If the length |
| 1810 * is negative the returned array will have length 0. | 1801 * is negative the returned array will have length 0. |
| 1811 */ | 1802 */ |
| 1812 V8EXPORT static Local<Array> New(int length = 0); | 1803 static Local<Array> New(int length = 0); |
| 1813 | 1804 |
| 1814 V8_INLINE(static Array* Cast(Value* obj)); | 1805 V8_INLINE(static Array* Cast(Value* obj)); |
| 1815 private: | 1806 private: |
| 1816 V8EXPORT Array(); | 1807 Array(); |
| 1817 V8EXPORT static void CheckCast(Value* obj); | 1808 static void CheckCast(Value* obj); |
| 1818 }; | 1809 }; |
| 1819 | 1810 |
| 1820 | 1811 |
| 1821 /** | 1812 /** |
| 1822 * A JavaScript function object (ECMA-262, 15.3). | 1813 * A JavaScript function object (ECMA-262, 15.3). |
| 1823 */ | 1814 */ |
| 1824 class Function : public Object { | 1815 class V8EXPORT Function : public Object { |
| 1825 public: | 1816 public: |
| 1826 V8EXPORT Local<Object> NewInstance() const; | 1817 Local<Object> NewInstance() const; |
| 1827 V8EXPORT Local<Object> NewInstance(int argc, Handle<Value> argv[]) const; | 1818 Local<Object> NewInstance(int argc, Handle<Value> argv[]) const; |
| 1828 V8EXPORT Local<Value> Call(Handle<Object> recv, | 1819 Local<Value> Call(Handle<Object> recv, int argc, Handle<Value> argv[]); |
| 1829 int argc, | 1820 void SetName(Handle<String> name); |
| 1830 Handle<Value> argv[]); | 1821 Handle<Value> GetName() const; |
| 1831 V8EXPORT void SetName(Handle<String> name); | |
| 1832 V8EXPORT Handle<Value> GetName() const; | |
| 1833 | 1822 |
| 1834 /** | 1823 /** |
| 1835 * Name inferred from variable or property assignment of this function. | 1824 * Name inferred from variable or property assignment of this function. |
| 1836 * Used to facilitate debugging and profiling of JavaScript code written | 1825 * Used to facilitate debugging and profiling of JavaScript code written |
| 1837 * in an OO style, where many functions are anonymous but are assigned | 1826 * in an OO style, where many functions are anonymous but are assigned |
| 1838 * to object properties. | 1827 * to object properties. |
| 1839 */ | 1828 */ |
| 1840 V8EXPORT Handle<Value> GetInferredName() const; | 1829 Handle<Value> GetInferredName() const; |
| 1841 | 1830 |
| 1842 /** | 1831 /** |
| 1843 * Returns zero based line number of function body and | 1832 * Returns zero based line number of function body and |
| 1844 * kLineOffsetNotFound if no information available. | 1833 * kLineOffsetNotFound if no information available. |
| 1845 */ | 1834 */ |
| 1846 V8EXPORT int GetScriptLineNumber() const; | 1835 int GetScriptLineNumber() const; |
| 1847 /** | 1836 /** |
| 1848 * Returns zero based column number of function body and | 1837 * Returns zero based column number of function body and |
| 1849 * kLineOffsetNotFound if no information available. | 1838 * kLineOffsetNotFound if no information available. |
| 1850 */ | 1839 */ |
| 1851 V8EXPORT int GetScriptColumnNumber() const; | 1840 int GetScriptColumnNumber() const; |
| 1852 V8EXPORT Handle<Value> GetScriptId() const; | 1841 Handle<Value> GetScriptId() const; |
| 1853 V8EXPORT ScriptOrigin GetScriptOrigin() const; | 1842 ScriptOrigin GetScriptOrigin() const; |
| 1854 V8_INLINE(static Function* Cast(Value* obj)); | 1843 V8_INLINE(static Function* Cast(Value* obj)); |
| 1855 V8EXPORT static const int kLineOffsetNotFound; | 1844 static const int kLineOffsetNotFound; |
| 1856 | 1845 |
| 1857 private: | 1846 private: |
| 1858 V8EXPORT Function(); | 1847 Function(); |
| 1859 V8EXPORT static void CheckCast(Value* obj); | 1848 static void CheckCast(Value* obj); |
| 1860 }; | 1849 }; |
| 1861 | 1850 |
| 1862 | 1851 |
| 1863 /** | 1852 /** |
| 1864 * An instance of the built-in Date constructor (ECMA-262, 15.9). | 1853 * An instance of the built-in Date constructor (ECMA-262, 15.9). |
| 1865 */ | 1854 */ |
| 1866 class Date : public Object { | 1855 class V8EXPORT Date : public Object { |
| 1867 public: | 1856 public: |
| 1868 V8EXPORT static Local<Value> New(double time); | 1857 static Local<Value> New(double time); |
| 1869 | 1858 |
| 1870 /** | 1859 /** |
| 1871 * A specialization of Value::NumberValue that is more efficient | 1860 * A specialization of Value::NumberValue that is more efficient |
| 1872 * because we know the structure of this object. | 1861 * because we know the structure of this object. |
| 1873 */ | 1862 */ |
| 1874 V8EXPORT double NumberValue() const; | 1863 double NumberValue() const; |
| 1875 | 1864 |
| 1876 V8_INLINE(static Date* Cast(v8::Value* obj)); | 1865 V8_INLINE(static Date* Cast(v8::Value* obj)); |
| 1877 | 1866 |
| 1878 /** | 1867 /** |
| 1879 * Notification that the embedder has changed the time zone, | 1868 * Notification that the embedder has changed the time zone, |
| 1880 * daylight savings time, or other date / time configuration | 1869 * daylight savings time, or other date / time configuration |
| 1881 * parameters. V8 keeps a cache of various values used for | 1870 * parameters. V8 keeps a cache of various values used for |
| 1882 * date / time computation. This notification will reset | 1871 * date / time computation. This notification will reset |
| 1883 * those cached values for the current context so that date / | 1872 * those cached values for the current context so that date / |
| 1884 * time configuration changes would be reflected in the Date | 1873 * time configuration changes would be reflected in the Date |
| 1885 * object. | 1874 * object. |
| 1886 * | 1875 * |
| 1887 * This API should not be called more than needed as it will | 1876 * This API should not be called more than needed as it will |
| 1888 * negatively impact the performance of date operations. | 1877 * negatively impact the performance of date operations. |
| 1889 */ | 1878 */ |
| 1890 V8EXPORT static void DateTimeConfigurationChangeNotification(); | 1879 static void DateTimeConfigurationChangeNotification(); |
| 1891 | 1880 |
| 1892 private: | 1881 private: |
| 1893 V8EXPORT static void CheckCast(v8::Value* obj); | 1882 static void CheckCast(v8::Value* obj); |
| 1894 }; | 1883 }; |
| 1895 | 1884 |
| 1896 | 1885 |
| 1897 /** | 1886 /** |
| 1898 * A Number object (ECMA-262, 4.3.21). | 1887 * A Number object (ECMA-262, 4.3.21). |
| 1899 */ | 1888 */ |
| 1900 class NumberObject : public Object { | 1889 class V8EXPORT NumberObject : public Object { |
| 1901 public: | 1890 public: |
| 1902 V8EXPORT static Local<Value> New(double value); | 1891 static Local<Value> New(double value); |
| 1903 | 1892 |
| 1904 /** | 1893 /** |
| 1905 * Returns the Number held by the object. | 1894 * Returns the Number held by the object. |
| 1906 */ | 1895 */ |
| 1907 V8EXPORT double NumberValue() const; | 1896 double NumberValue() const; |
| 1908 | 1897 |
| 1909 V8_INLINE(static NumberObject* Cast(v8::Value* obj)); | 1898 V8_INLINE(static NumberObject* Cast(v8::Value* obj)); |
| 1910 | 1899 |
| 1911 private: | 1900 private: |
| 1912 V8EXPORT static void CheckCast(v8::Value* obj); | 1901 static void CheckCast(v8::Value* obj); |
| 1913 }; | 1902 }; |
| 1914 | 1903 |
| 1915 | 1904 |
| 1916 /** | 1905 /** |
| 1917 * A Boolean object (ECMA-262, 4.3.15). | 1906 * A Boolean object (ECMA-262, 4.3.15). |
| 1918 */ | 1907 */ |
| 1919 class BooleanObject : public Object { | 1908 class V8EXPORT BooleanObject : public Object { |
| 1920 public: | 1909 public: |
| 1921 V8EXPORT static Local<Value> New(bool value); | 1910 static Local<Value> New(bool value); |
| 1922 | 1911 |
| 1923 /** | 1912 /** |
| 1924 * Returns the Boolean held by the object. | 1913 * Returns the Boolean held by the object. |
| 1925 */ | 1914 */ |
| 1926 V8EXPORT bool BooleanValue() const; | 1915 bool BooleanValue() const; |
| 1927 | 1916 |
| 1928 V8_INLINE(static BooleanObject* Cast(v8::Value* obj)); | 1917 V8_INLINE(static BooleanObject* Cast(v8::Value* obj)); |
| 1929 | 1918 |
| 1930 private: | 1919 private: |
| 1931 V8EXPORT static void CheckCast(v8::Value* obj); | 1920 static void CheckCast(v8::Value* obj); |
| 1932 }; | 1921 }; |
| 1933 | 1922 |
| 1934 | 1923 |
| 1935 /** | 1924 /** |
| 1936 * A String object (ECMA-262, 4.3.18). | 1925 * A String object (ECMA-262, 4.3.18). |
| 1937 */ | 1926 */ |
| 1938 class StringObject : public Object { | 1927 class V8EXPORT StringObject : public Object { |
| 1939 public: | 1928 public: |
| 1940 V8EXPORT static Local<Value> New(Handle<String> value); | 1929 static Local<Value> New(Handle<String> value); |
| 1941 | 1930 |
| 1942 /** | 1931 /** |
| 1943 * Returns the String held by the object. | 1932 * Returns the String held by the object. |
| 1944 */ | 1933 */ |
| 1945 V8EXPORT Local<String> StringValue() const; | 1934 Local<String> StringValue() const; |
| 1946 | 1935 |
| 1947 V8_INLINE(static StringObject* Cast(v8::Value* obj)); | 1936 V8_INLINE(static StringObject* Cast(v8::Value* obj)); |
| 1948 | 1937 |
| 1949 private: | 1938 private: |
| 1950 V8EXPORT static void CheckCast(v8::Value* obj); | 1939 static void CheckCast(v8::Value* obj); |
| 1951 }; | 1940 }; |
| 1952 | 1941 |
| 1953 | 1942 |
| 1954 /** | 1943 /** |
| 1955 * An instance of the built-in RegExp constructor (ECMA-262, 15.10). | 1944 * An instance of the built-in RegExp constructor (ECMA-262, 15.10). |
| 1956 */ | 1945 */ |
| 1957 class RegExp : public Object { | 1946 class V8EXPORT RegExp : public Object { |
| 1958 public: | 1947 public: |
| 1959 /** | 1948 /** |
| 1960 * Regular expression flag bits. They can be or'ed to enable a set | 1949 * Regular expression flag bits. They can be or'ed to enable a set |
| 1961 * of flags. | 1950 * of flags. |
| 1962 */ | 1951 */ |
| 1963 enum Flags { | 1952 enum Flags { |
| 1964 kNone = 0, | 1953 kNone = 0, |
| 1965 kGlobal = 1, | 1954 kGlobal = 1, |
| 1966 kIgnoreCase = 2, | 1955 kIgnoreCase = 2, |
| 1967 kMultiline = 4 | 1956 kMultiline = 4 |
| 1968 }; | 1957 }; |
| 1969 | 1958 |
| 1970 /** | 1959 /** |
| 1971 * Creates a regular expression from the given pattern string and | 1960 * Creates a regular expression from the given pattern string and |
| 1972 * the flags bit field. May throw a JavaScript exception as | 1961 * the flags bit field. May throw a JavaScript exception as |
| 1973 * described in ECMA-262, 15.10.4.1. | 1962 * described in ECMA-262, 15.10.4.1. |
| 1974 * | 1963 * |
| 1975 * For example, | 1964 * For example, |
| 1976 * RegExp::New(v8::String::New("foo"), | 1965 * RegExp::New(v8::String::New("foo"), |
| 1977 * static_cast<RegExp::Flags>(kGlobal | kMultiline)) | 1966 * static_cast<RegExp::Flags>(kGlobal | kMultiline)) |
| 1978 * is equivalent to evaluating "/foo/gm". | 1967 * is equivalent to evaluating "/foo/gm". |
| 1979 */ | 1968 */ |
| 1980 V8EXPORT static Local<RegExp> New(Handle<String> pattern, | 1969 static Local<RegExp> New(Handle<String> pattern, Flags flags); |
| 1981 Flags flags); | |
| 1982 | 1970 |
| 1983 /** | 1971 /** |
| 1984 * Returns the value of the source property: a string representing | 1972 * Returns the value of the source property: a string representing |
| 1985 * the regular expression. | 1973 * the regular expression. |
| 1986 */ | 1974 */ |
| 1987 V8EXPORT Local<String> GetSource() const; | 1975 Local<String> GetSource() const; |
| 1988 | 1976 |
| 1989 /** | 1977 /** |
| 1990 * Returns the flags bit field. | 1978 * Returns the flags bit field. |
| 1991 */ | 1979 */ |
| 1992 V8EXPORT Flags GetFlags() const; | 1980 Flags GetFlags() const; |
| 1993 | 1981 |
| 1994 V8_INLINE(static RegExp* Cast(v8::Value* obj)); | 1982 V8_INLINE(static RegExp* Cast(v8::Value* obj)); |
| 1995 | 1983 |
| 1996 private: | 1984 private: |
| 1997 V8EXPORT static void CheckCast(v8::Value* obj); | 1985 static void CheckCast(v8::Value* obj); |
| 1998 }; | 1986 }; |
| 1999 | 1987 |
| 2000 | 1988 |
| 2001 /** | 1989 /** |
| 2002 * A JavaScript value that wraps a C++ void*. This type of value is mainly used | 1990 * A JavaScript value that wraps a C++ void*. This type of value is mainly used |
| 2003 * to associate C++ data structures with JavaScript objects. | 1991 * to associate C++ data structures with JavaScript objects. |
| 2004 */ | 1992 */ |
| 2005 class External : public Value { | 1993 class V8EXPORT External : public Value { |
| 2006 public: | 1994 public: |
| 2007 /** Deprecated, use New instead. */ | 1995 /** Deprecated, use New instead. */ |
| 2008 V8_DEPRECATED(V8_INLINE(static Local<Value> Wrap(void* value))); | 1996 V8_DEPRECATED(V8_INLINE(static Local<Value> Wrap(void* value))); |
| 2009 | 1997 |
| 2010 /** Deprecated, use a combination of Cast and Value instead. */ | 1998 /** Deprecated, use a combination of Cast and Value instead. */ |
| 2011 V8_DEPRECATED(V8_INLINE(static void* Unwrap(Handle<Value> obj))); | 1999 V8_DEPRECATED(V8_INLINE(static void* Unwrap(Handle<Value> obj))); |
| 2012 | 2000 |
| 2013 V8EXPORT static Local<External> New(void* value); | 2001 static Local<External> New(void* value); |
| 2014 V8_INLINE(static External* Cast(Value* obj)); | 2002 V8_INLINE(static External* Cast(Value* obj)); |
| 2015 V8EXPORT void* Value() const; | 2003 void* Value() const; |
| 2016 private: | 2004 private: |
| 2017 V8EXPORT static void CheckCast(v8::Value* obj); | 2005 static void CheckCast(v8::Value* obj); |
| 2018 }; | 2006 }; |
| 2019 | 2007 |
| 2020 | 2008 |
| 2021 // --- Templates --- | 2009 // --- Templates --- |
| 2022 | 2010 |
| 2023 | 2011 |
| 2024 /** | 2012 /** |
| 2025 * The superclass of object and function templates. | 2013 * The superclass of object and function templates. |
| 2026 */ | 2014 */ |
| 2027 class V8EXPORT Template : public Data { | 2015 class V8EXPORT Template : public Data { |
| 2028 public: | 2016 public: |
| 2029 /** Adds a property to each instance created by this template.*/ | 2017 /** Adds a property to each instance created by this template.*/ |
| 2030 void Set(Handle<String> name, Handle<Data> value, | 2018 void Set(Handle<String> name, Handle<Data> value, |
| 2031 PropertyAttribute attributes = None); | 2019 PropertyAttribute attributes = None); |
| 2032 V8_INLINE(void Set(const char* name, Handle<Data> value)); | 2020 V8_INLINE(void Set(const char* name, Handle<Data> value)); |
| 2033 private: | 2021 private: |
| 2034 Template(); | 2022 Template(); |
| 2035 | 2023 |
| 2036 friend class ObjectTemplate; | 2024 friend class ObjectTemplate; |
| 2037 friend class FunctionTemplate; | 2025 friend class FunctionTemplate; |
| 2038 }; | 2026 }; |
| 2039 | 2027 |
| 2040 | 2028 |
| 2041 /** | 2029 /** |
| 2042 * The argument information given to function call callbacks. This | 2030 * The argument information given to function call callbacks. This |
| 2043 * class provides access to information about the context of the call, | 2031 * class provides access to information about the context of the call, |
| 2044 * including the receiver, the number and values of arguments, and | 2032 * including the receiver, the number and values of arguments, and |
| 2045 * the holder of the function. | 2033 * the holder of the function. |
| 2046 */ | 2034 */ |
| 2047 class Arguments { | 2035 class V8EXPORT Arguments { |
| 2048 public: | 2036 public: |
| 2049 V8_INLINE(int Length() const); | 2037 V8_INLINE(int Length() const); |
| 2050 V8_INLINE(Local<Value> operator[](int i) const); | 2038 V8_INLINE(Local<Value> operator[](int i) const); |
| 2051 V8_INLINE(Local<Function> Callee() const); | 2039 V8_INLINE(Local<Function> Callee() const); |
| 2052 V8_INLINE(Local<Object> This() const); | 2040 V8_INLINE(Local<Object> This() const); |
| 2053 V8_INLINE(Local<Object> Holder() const); | 2041 V8_INLINE(Local<Object> Holder() const); |
| 2054 V8_INLINE(bool IsConstructCall() const); | 2042 V8_INLINE(bool IsConstructCall() const); |
| 2055 V8_INLINE(Local<Value> Data() const); | 2043 V8_INLINE(Local<Value> Data() const); |
| 2056 V8_INLINE(Isolate* GetIsolate() const); | 2044 V8_INLINE(Isolate* GetIsolate() const); |
| 2057 | 2045 |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2937 private: | 2925 private: |
| 2938 Isolate(); | 2926 Isolate(); |
| 2939 Isolate(const Isolate&); | 2927 Isolate(const Isolate&); |
| 2940 ~Isolate(); | 2928 ~Isolate(); |
| 2941 Isolate& operator=(const Isolate&); | 2929 Isolate& operator=(const Isolate&); |
| 2942 void* operator new(size_t size); | 2930 void* operator new(size_t size); |
| 2943 void operator delete(void*, size_t); | 2931 void operator delete(void*, size_t); |
| 2944 }; | 2932 }; |
| 2945 | 2933 |
| 2946 | 2934 |
| 2947 class StartupData { | 2935 class V8EXPORT StartupData { |
| 2948 public: | 2936 public: |
| 2949 enum CompressionAlgorithm { | 2937 enum CompressionAlgorithm { |
| 2950 kUncompressed, | 2938 kUncompressed, |
| 2951 kBZip2 | 2939 kBZip2 |
| 2952 }; | 2940 }; |
| 2953 | 2941 |
| 2954 const char* data; | 2942 const char* data; |
| 2955 int compressed_size; | 2943 int compressed_size; |
| 2956 int raw_size; | 2944 int raw_size; |
| 2957 }; | 2945 }; |
| (...skipping 1904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4862 | 4850 |
| 4863 | 4851 |
| 4864 } // namespace v8 | 4852 } // namespace v8 |
| 4865 | 4853 |
| 4866 | 4854 |
| 4867 #undef V8EXPORT | 4855 #undef V8EXPORT |
| 4868 #undef TYPE_CHECK | 4856 #undef TYPE_CHECK |
| 4869 | 4857 |
| 4870 | 4858 |
| 4871 #endif // V8_H_ | 4859 #endif // V8_H_ |
| OLD | NEW |