Chromium Code Reviews| 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, |
|
Michael Starzinger
2013/01/11 14:06:33
Indentation is off.
Sven Panne
2013/01/14 07:35:54
Done.
| |
| 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, |
|
Michael Starzinger
2013/01/11 14:06:33
Likewise.
Sven Panne
2013/01/14 07:35:54
Done.
| |
| 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, |
|
Michael Starzinger
2013/01/11 14:06:33
Likewise.
Sven Panne
2013/01/14 07:35:54
Done.
| |
| 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() |
|
Michael Starzinger
2013/01/11 14:06:33
Fits into one line now.
Sven Panne
2013/01/14 07:35:54
Done.
| |
| 1250 const; | 1250 const; |
| 1251 | 1251 |
| 1252 V8_INLINE(static String* Cast(v8::Value* obj)); | 1252 V8_INLINE(static String* Cast(v8::Value* obj)); |
| 1253 | 1253 |
| 1254 /** | 1254 /** |
| 1255 * Allocates a new string from either UTF-8 encoded or ASCII data. | 1255 * Allocates a new string from either UTF-8 encoded or ASCII data. |
| 1256 * The second parameter 'length' gives the buffer length. If omitted, | 1256 * The second parameter 'length' gives the buffer length. If omitted, |
| 1257 * the function calls 'strlen' to determine the buffer length. | 1257 * the function calls 'strlen' to determine the buffer length. |
| 1258 */ | 1258 */ |
| 1259 V8EXPORT static Local<String> New(const char* data, int length = -1); | 1259 static Local<String> New(const char* data, int length = -1); |
| 1260 | 1260 |
| 1261 /** Allocates a new string from 16-bit character codes.*/ | 1261 /** Allocates a new string from 16-bit character codes.*/ |
| 1262 V8EXPORT static Local<String> New(const uint16_t* data, int length = -1); | 1262 static Local<String> New(const uint16_t* data, int length = -1); |
| 1263 | 1263 |
| 1264 /** Creates a symbol. Returns one if it exists already.*/ | 1264 /** Creates a symbol. Returns one if it exists already.*/ |
| 1265 V8EXPORT static Local<String> NewSymbol(const char* data, int length = -1); | 1265 static Local<String> NewSymbol(const char* data, int length = -1); |
| 1266 | 1266 |
| 1267 /** | 1267 /** |
| 1268 * Creates a new string by concatenating the left and the right strings | 1268 * Creates a new string by concatenating the left and the right strings |
| 1269 * passed in as parameters. | 1269 * passed in as parameters. |
| 1270 */ | 1270 */ |
| 1271 V8EXPORT static Local<String> Concat(Handle<String> left, | 1271 static Local<String> Concat(Handle<String> left, Handle<String> right); |
| 1272 Handle<String> right); | |
| 1273 | 1272 |
| 1274 /** | 1273 /** |
| 1275 * Creates a new external string using the data defined in the given | 1274 * 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 | 1275 * 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 | 1276 * resource will be disposed by calling its Dispose method. The caller of |
| 1278 * this function should not otherwise delete or modify the resource. Neither | 1277 * this function should not otherwise delete or modify the resource. Neither |
| 1279 * should the underlying buffer be deallocated or modified except through the | 1278 * should the underlying buffer be deallocated or modified except through the |
| 1280 * destructor of the external string resource. | 1279 * destructor of the external string resource. |
| 1281 */ | 1280 */ |
| 1282 V8EXPORT static Local<String> NewExternal(ExternalStringResource* resource); | 1281 static Local<String> NewExternal(ExternalStringResource* resource); |
| 1283 | 1282 |
| 1284 /** | 1283 /** |
| 1285 * Associate an external string resource with this string by transforming it | 1284 * 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 | 1285 * 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 | 1286 * will use the external string resource. The external string resource's |
| 1288 * character contents need to be equivalent to this string. | 1287 * character contents need to be equivalent to this string. |
| 1289 * Returns true if the string has been changed to be an external string. | 1288 * 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 | 1289 * The string is not modified if the operation fails. See NewExternal for |
| 1291 * information on the lifetime of the resource. | 1290 * information on the lifetime of the resource. |
| 1292 */ | 1291 */ |
| 1293 V8EXPORT bool MakeExternal(ExternalStringResource* resource); | 1292 bool MakeExternal(ExternalStringResource* resource); |
| 1294 | 1293 |
| 1295 /** | 1294 /** |
| 1296 * Creates a new external string using the ASCII data defined in the given | 1295 * 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 | 1296 * 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 | 1297 * resource will be disposed by calling its Dispose method. The caller of |
| 1299 * this function should not otherwise delete or modify the resource. Neither | 1298 * this function should not otherwise delete or modify the resource. Neither |
| 1300 * should the underlying buffer be deallocated or modified except through the | 1299 * should the underlying buffer be deallocated or modified except through the |
| 1301 * destructor of the external string resource. | 1300 * destructor of the external string resource. |
| 1302 */ V8EXPORT static Local<String> NewExternal( | 1301 */ |
| 1303 ExternalAsciiStringResource* resource); | 1302 static Local<String> NewExternal(ExternalAsciiStringResource* resource); |
| 1304 | 1303 |
| 1305 /** | 1304 /** |
| 1306 * Associate an external string resource with this string by transforming it | 1305 * 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 | 1306 * 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 | 1307 * will use the external string resource. The external string resource's |
| 1309 * character contents need to be equivalent to this string. | 1308 * character contents need to be equivalent to this string. |
| 1310 * Returns true if the string has been changed to be an external string. | 1309 * 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 | 1310 * The string is not modified if the operation fails. See NewExternal for |
| 1312 * information on the lifetime of the resource. | 1311 * information on the lifetime of the resource. |
| 1313 */ | 1312 */ |
| 1314 V8EXPORT bool MakeExternal(ExternalAsciiStringResource* resource); | 1313 bool MakeExternal(ExternalAsciiStringResource* resource); |
| 1315 | 1314 |
| 1316 /** | 1315 /** |
| 1317 * Returns true if this string can be made external. | 1316 * Returns true if this string can be made external. |
| 1318 */ | 1317 */ |
| 1319 V8EXPORT bool CanMakeExternal(); | 1318 bool CanMakeExternal(); |
| 1320 | 1319 |
| 1321 /** Creates an undetectable string from the supplied ASCII or UTF-8 data.*/ | 1320 /** Creates an undetectable string from the supplied ASCII or UTF-8 data.*/ |
| 1322 V8EXPORT static Local<String> NewUndetectable(const char* data, | 1321 static Local<String> NewUndetectable(const char* data, int length = -1); |
| 1323 int length = -1); | |
| 1324 | 1322 |
| 1325 /** Creates an undetectable string from the supplied 16-bit character codes.*/ | 1323 /** Creates an undetectable string from the supplied 16-bit character codes.*/ |
| 1326 V8EXPORT static Local<String> NewUndetectable(const uint16_t* data, | 1324 static Local<String> NewUndetectable(const uint16_t* data, int length = -1); |
| 1327 int length = -1); | |
| 1328 | 1325 |
| 1329 /** | 1326 /** |
| 1330 * Converts an object to a UTF-8-encoded character array. Useful if | 1327 * 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 | 1328 * 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) | 1329 * (e.g. due to an exception in the toString() method of the object) |
| 1333 * then the length() method returns 0 and the * operator returns | 1330 * then the length() method returns 0 and the * operator returns |
| 1334 * NULL. | 1331 * NULL. |
| 1335 */ | 1332 */ |
| 1336 class V8EXPORT Utf8Value { | 1333 class V8EXPORT Utf8Value { |
| 1337 public: | 1334 public: |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1388 private: | 1385 private: |
| 1389 uint16_t* str_; | 1386 uint16_t* str_; |
| 1390 int length_; | 1387 int length_; |
| 1391 | 1388 |
| 1392 // Disallow copying and assigning. | 1389 // Disallow copying and assigning. |
| 1393 Value(const Value&); | 1390 Value(const Value&); |
| 1394 void operator=(const Value&); | 1391 void operator=(const Value&); |
| 1395 }; | 1392 }; |
| 1396 | 1393 |
| 1397 private: | 1394 private: |
| 1398 V8EXPORT void VerifyExternalStringResourceBase(ExternalStringResourceBase* v, | 1395 void VerifyExternalStringResourceBase(ExternalStringResourceBase* v, |
| 1399 Encoding encoding) const; | 1396 Encoding encoding) const; |
|
Michael Starzinger
2013/01/11 14:06:33
Indentation is off.
Sven Panne
2013/01/14 07:35:54
Done.
| |
| 1400 V8EXPORT void VerifyExternalStringResource(ExternalStringResource* val) const; | 1397 void VerifyExternalStringResource(ExternalStringResource* val) const; |
| 1401 V8EXPORT static void CheckCast(v8::Value* obj); | 1398 static void CheckCast(v8::Value* obj); |
| 1402 }; | 1399 }; |
| 1403 | 1400 |
| 1404 | 1401 |
| 1405 /** | 1402 /** |
| 1406 * A JavaScript number value (ECMA-262, 4.3.20) | 1403 * A JavaScript number value (ECMA-262, 4.3.20) |
| 1407 */ | 1404 */ |
| 1408 class Number : public Primitive { | 1405 class V8EXPORT Number : public Primitive { |
| 1409 public: | 1406 public: |
| 1410 V8EXPORT double Value() const; | 1407 double Value() const; |
| 1411 V8EXPORT static Local<Number> New(double value); | 1408 static Local<Number> New(double value); |
| 1412 V8_INLINE(static Number* Cast(v8::Value* obj)); | 1409 V8_INLINE(static Number* Cast(v8::Value* obj)); |
| 1413 private: | 1410 private: |
| 1414 V8EXPORT Number(); | 1411 Number(); |
| 1415 V8EXPORT static void CheckCast(v8::Value* obj); | 1412 static void CheckCast(v8::Value* obj); |
| 1416 }; | 1413 }; |
| 1417 | 1414 |
| 1418 | 1415 |
| 1419 /** | 1416 /** |
| 1420 * A JavaScript value representing a signed integer. | 1417 * A JavaScript value representing a signed integer. |
| 1421 */ | 1418 */ |
| 1422 class Integer : public Number { | 1419 class V8EXPORT Integer : public Number { |
| 1423 public: | 1420 public: |
| 1424 V8EXPORT static Local<Integer> New(int32_t value); | 1421 static Local<Integer> New(int32_t value); |
| 1425 V8EXPORT static Local<Integer> NewFromUnsigned(uint32_t value); | 1422 static Local<Integer> NewFromUnsigned(uint32_t value); |
| 1426 V8EXPORT static Local<Integer> New(int32_t value, Isolate*); | 1423 static Local<Integer> New(int32_t value, Isolate*); |
| 1427 V8EXPORT static Local<Integer> NewFromUnsigned(uint32_t value, Isolate*); | 1424 static Local<Integer> NewFromUnsigned(uint32_t value, Isolate*); |
| 1428 V8EXPORT int64_t Value() const; | 1425 int64_t Value() const; |
| 1429 V8_INLINE(static Integer* Cast(v8::Value* obj)); | 1426 V8_INLINE(static Integer* Cast(v8::Value* obj)); |
| 1430 private: | 1427 private: |
| 1431 V8EXPORT Integer(); | 1428 Integer(); |
| 1432 V8EXPORT static void CheckCast(v8::Value* obj); | 1429 static void CheckCast(v8::Value* obj); |
| 1433 }; | 1430 }; |
| 1434 | 1431 |
| 1435 | 1432 |
| 1436 /** | 1433 /** |
| 1437 * A JavaScript value representing a 32-bit signed integer. | 1434 * A JavaScript value representing a 32-bit signed integer. |
| 1438 */ | 1435 */ |
| 1439 class Int32 : public Integer { | 1436 class V8EXPORT Int32 : public Integer { |
| 1440 public: | 1437 public: |
| 1441 V8EXPORT int32_t Value() const; | 1438 int32_t Value() const; |
| 1442 private: | 1439 private: |
| 1443 V8EXPORT Int32(); | 1440 Int32(); |
| 1444 }; | 1441 }; |
| 1445 | 1442 |
| 1446 | 1443 |
| 1447 /** | 1444 /** |
| 1448 * A JavaScript value representing a 32-bit unsigned integer. | 1445 * A JavaScript value representing a 32-bit unsigned integer. |
| 1449 */ | 1446 */ |
| 1450 class Uint32 : public Integer { | 1447 class V8EXPORT Uint32 : public Integer { |
| 1451 public: | 1448 public: |
| 1452 V8EXPORT uint32_t Value() const; | 1449 uint32_t Value() const; |
| 1453 private: | 1450 private: |
| 1454 V8EXPORT Uint32(); | 1451 Uint32(); |
| 1455 }; | 1452 }; |
| 1456 | 1453 |
| 1457 | 1454 |
| 1458 enum PropertyAttribute { | 1455 enum PropertyAttribute { |
| 1459 None = 0, | 1456 None = 0, |
| 1460 ReadOnly = 1 << 0, | 1457 ReadOnly = 1 << 0, |
| 1461 DontEnum = 1 << 1, | 1458 DontEnum = 1 << 1, |
| 1462 DontDelete = 1 << 2 | 1459 DontDelete = 1 << 2 |
| 1463 }; | 1460 }; |
| 1464 | 1461 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1505 DEFAULT = 0, | 1502 DEFAULT = 0, |
| 1506 ALL_CAN_READ = 1, | 1503 ALL_CAN_READ = 1, |
| 1507 ALL_CAN_WRITE = 1 << 1, | 1504 ALL_CAN_WRITE = 1 << 1, |
| 1508 PROHIBITS_OVERWRITING = 1 << 2 | 1505 PROHIBITS_OVERWRITING = 1 << 2 |
| 1509 }; | 1506 }; |
| 1510 | 1507 |
| 1511 | 1508 |
| 1512 /** | 1509 /** |
| 1513 * A JavaScript object (ECMA-262, 4.3.3) | 1510 * A JavaScript object (ECMA-262, 4.3.3) |
| 1514 */ | 1511 */ |
| 1515 class Object : public Value { | 1512 class V8EXPORT Object : public Value { |
| 1516 public: | 1513 public: |
| 1517 V8EXPORT bool Set(Handle<Value> key, | 1514 bool Set(Handle<Value> key, |
| 1518 Handle<Value> value, | 1515 Handle<Value> value, |
| 1519 PropertyAttribute attribs = None); | 1516 PropertyAttribute attribs = None); |
| 1520 | 1517 |
| 1521 V8EXPORT bool Set(uint32_t index, | 1518 bool Set(uint32_t index, Handle<Value> value); |
| 1522 Handle<Value> value); | |
| 1523 | 1519 |
| 1524 // Sets a local property on this object bypassing interceptors and | 1520 // Sets a local property on this object bypassing interceptors and |
| 1525 // overriding accessors or read-only properties. | 1521 // overriding accessors or read-only properties. |
| 1526 // | 1522 // |
| 1527 // Note that if the object has an interceptor the property will be set | 1523 // Note that if the object has an interceptor the property will be set |
| 1528 // locally, but since the interceptor takes precedence the local property | 1524 // locally, but since the interceptor takes precedence the local property |
| 1529 // will only be returned if the interceptor doesn't return a value. | 1525 // will only be returned if the interceptor doesn't return a value. |
| 1530 // | 1526 // |
| 1531 // Note also that this only works for named properties. | 1527 // Note also that this only works for named properties. |
| 1532 V8EXPORT bool ForceSet(Handle<Value> key, | 1528 bool ForceSet(Handle<Value> key, |
| 1533 Handle<Value> value, | 1529 Handle<Value> value, |
| 1534 PropertyAttribute attribs = None); | 1530 PropertyAttribute attribs = None); |
| 1535 | 1531 |
| 1536 V8EXPORT Local<Value> Get(Handle<Value> key); | 1532 Local<Value> Get(Handle<Value> key); |
| 1537 | 1533 |
| 1538 V8EXPORT Local<Value> Get(uint32_t index); | 1534 Local<Value> Get(uint32_t index); |
| 1539 | 1535 |
| 1540 /** | 1536 /** |
| 1541 * Gets the property attributes of a property which can be None or | 1537 * Gets the property attributes of a property which can be None or |
| 1542 * any combination of ReadOnly, DontEnum and DontDelete. Returns | 1538 * any combination of ReadOnly, DontEnum and DontDelete. Returns |
| 1543 * None when the property doesn't exist. | 1539 * None when the property doesn't exist. |
| 1544 */ | 1540 */ |
| 1545 V8EXPORT PropertyAttribute GetPropertyAttributes(Handle<Value> key); | 1541 PropertyAttribute GetPropertyAttributes(Handle<Value> key); |
| 1546 | 1542 |
| 1547 // TODO(1245389): Replace the type-specific versions of these | 1543 // TODO(1245389): Replace the type-specific versions of these |
| 1548 // functions with generic ones that accept a Handle<Value> key. | 1544 // functions with generic ones that accept a Handle<Value> key. |
| 1549 V8EXPORT bool Has(Handle<String> key); | 1545 bool Has(Handle<String> key); |
| 1550 | 1546 |
| 1551 V8EXPORT bool Delete(Handle<String> key); | 1547 bool Delete(Handle<String> key); |
| 1552 | 1548 |
| 1553 // Delete a property on this object bypassing interceptors and | 1549 // Delete a property on this object bypassing interceptors and |
| 1554 // ignoring dont-delete attributes. | 1550 // ignoring dont-delete attributes. |
| 1555 V8EXPORT bool ForceDelete(Handle<Value> key); | 1551 bool ForceDelete(Handle<Value> key); |
| 1556 | 1552 |
| 1557 V8EXPORT bool Has(uint32_t index); | 1553 bool Has(uint32_t index); |
| 1558 | 1554 |
| 1559 V8EXPORT bool Delete(uint32_t index); | 1555 bool Delete(uint32_t index); |
| 1560 | 1556 |
| 1561 V8EXPORT bool SetAccessor(Handle<String> name, | 1557 bool SetAccessor(Handle<String> name, |
| 1562 AccessorGetter getter, | 1558 AccessorGetter getter, |
| 1563 AccessorSetter setter = 0, | 1559 AccessorSetter setter = 0, |
| 1564 Handle<Value> data = Handle<Value>(), | 1560 Handle<Value> data = Handle<Value>(), |
| 1565 AccessControl settings = DEFAULT, | 1561 AccessControl settings = DEFAULT, |
| 1566 PropertyAttribute attribute = None); | 1562 PropertyAttribute attribute = None); |
| 1567 | 1563 |
| 1568 /** | 1564 /** |
| 1569 * Returns an array containing the names of the enumerable properties | 1565 * Returns an array containing the names of the enumerable properties |
| 1570 * of this object, including properties from prototype objects. The | 1566 * of this object, including properties from prototype objects. The |
| 1571 * array returned by this method contains the same values as would | 1567 * array returned by this method contains the same values as would |
| 1572 * be enumerated by a for-in statement over this object. | 1568 * be enumerated by a for-in statement over this object. |
| 1573 */ | 1569 */ |
| 1574 V8EXPORT Local<Array> GetPropertyNames(); | 1570 Local<Array> GetPropertyNames(); |
| 1575 | 1571 |
| 1576 /** | 1572 /** |
| 1577 * This function has the same functionality as GetPropertyNames but | 1573 * This function has the same functionality as GetPropertyNames but |
| 1578 * the returned array doesn't contain the names of properties from | 1574 * the returned array doesn't contain the names of properties from |
| 1579 * prototype objects. | 1575 * prototype objects. |
| 1580 */ | 1576 */ |
| 1581 V8EXPORT Local<Array> GetOwnPropertyNames(); | 1577 Local<Array> GetOwnPropertyNames(); |
| 1582 | 1578 |
| 1583 /** | 1579 /** |
| 1584 * Get the prototype object. This does not skip objects marked to | 1580 * Get the prototype object. This does not skip objects marked to |
| 1585 * be skipped by __proto__ and it does not consult the security | 1581 * be skipped by __proto__ and it does not consult the security |
| 1586 * handler. | 1582 * handler. |
| 1587 */ | 1583 */ |
| 1588 V8EXPORT Local<Value> GetPrototype(); | 1584 Local<Value> GetPrototype(); |
| 1589 | 1585 |
| 1590 /** | 1586 /** |
| 1591 * Set the prototype object. This does not skip objects marked to | 1587 * Set the prototype object. This does not skip objects marked to |
| 1592 * be skipped by __proto__ and it does not consult the security | 1588 * be skipped by __proto__ and it does not consult the security |
| 1593 * handler. | 1589 * handler. |
| 1594 */ | 1590 */ |
| 1595 V8EXPORT bool SetPrototype(Handle<Value> prototype); | 1591 bool SetPrototype(Handle<Value> prototype); |
| 1596 | 1592 |
| 1597 /** | 1593 /** |
| 1598 * Finds an instance of the given function template in the prototype | 1594 * Finds an instance of the given function template in the prototype |
| 1599 * chain. | 1595 * chain. |
| 1600 */ | 1596 */ |
| 1601 V8EXPORT Local<Object> FindInstanceInPrototypeChain( | 1597 Local<Object> FindInstanceInPrototypeChain(Handle<FunctionTemplate> tmpl); |
| 1602 Handle<FunctionTemplate> tmpl); | |
| 1603 | 1598 |
| 1604 /** | 1599 /** |
| 1605 * Call builtin Object.prototype.toString on this object. | 1600 * Call builtin Object.prototype.toString on this object. |
| 1606 * This is different from Value::ToString() that may call | 1601 * This is different from Value::ToString() that may call |
| 1607 * user-defined toString function. This one does not. | 1602 * user-defined toString function. This one does not. |
| 1608 */ | 1603 */ |
| 1609 V8EXPORT Local<String> ObjectProtoToString(); | 1604 Local<String> ObjectProtoToString(); |
| 1610 | 1605 |
| 1611 /** | 1606 /** |
| 1612 * Returns the function invoked as a constructor for this object. | 1607 * Returns the function invoked as a constructor for this object. |
| 1613 * May be the null value. | 1608 * May be the null value. |
| 1614 */ | 1609 */ |
| 1615 V8EXPORT Local<Value> GetConstructor(); | 1610 Local<Value> GetConstructor(); |
| 1616 | 1611 |
| 1617 /** | 1612 /** |
| 1618 * Returns the name of the function invoked as a constructor for this object. | 1613 * Returns the name of the function invoked as a constructor for this object. |
| 1619 */ | 1614 */ |
| 1620 V8EXPORT Local<String> GetConstructorName(); | 1615 Local<String> GetConstructorName(); |
| 1621 | 1616 |
| 1622 /** Gets the number of internal fields for this Object. */ | 1617 /** Gets the number of internal fields for this Object. */ |
| 1623 V8EXPORT int InternalFieldCount(); | 1618 int InternalFieldCount(); |
| 1624 | 1619 |
| 1625 /** Gets the value from an internal field. */ | 1620 /** Gets the value from an internal field. */ |
| 1626 V8_INLINE(Local<Value> GetInternalField(int index)); | 1621 V8_INLINE(Local<Value> GetInternalField(int index)); |
| 1627 | 1622 |
| 1628 /** Sets the value in an internal field. */ | 1623 /** Sets the value in an internal field. */ |
| 1629 V8EXPORT void SetInternalField(int index, Handle<Value> value); | 1624 void SetInternalField(int index, Handle<Value> value); |
| 1630 | 1625 |
| 1631 /** | 1626 /** |
| 1632 * Gets a native pointer from an internal field. Deprecated. If the pointer is | 1627 * Gets a native pointer from an internal field. Deprecated. If the pointer is |
| 1633 * always 2-byte-aligned, use GetAlignedPointerFromInternalField instead, | 1628 * always 2-byte-aligned, use GetAlignedPointerFromInternalField instead, |
| 1634 * otherwise use a combination of GetInternalField, External::Cast and | 1629 * otherwise use a combination of GetInternalField, External::Cast and |
| 1635 * External::Value. | 1630 * External::Value. |
| 1636 */ | 1631 */ |
| 1637 V8EXPORT V8_DEPRECATED(void* GetPointerFromInternalField(int index)); | 1632 V8_DEPRECATED(void* GetPointerFromInternalField(int index)); |
| 1638 | 1633 |
| 1639 /** | 1634 /** |
| 1640 * Sets a native pointer in an internal field. Deprecated. If the pointer is | 1635 * Sets a native pointer in an internal field. Deprecated. If the pointer is |
| 1641 * always 2-byte aligned, use SetAlignedPointerInInternalField instead, | 1636 * always 2-byte aligned, use SetAlignedPointerInInternalField instead, |
| 1642 * otherwise use a combination of External::New and SetInternalField. | 1637 * otherwise use a combination of External::New and SetInternalField. |
| 1643 */ | 1638 */ |
| 1644 V8_DEPRECATED(V8_INLINE(void SetPointerInInternalField(int index, | 1639 V8_DEPRECATED(V8_INLINE(void SetPointerInInternalField(int index, |
| 1645 void* value))); | 1640 void* value))); |
| 1646 | 1641 |
| 1647 /** | 1642 /** |
| 1648 * Gets a 2-byte-aligned native pointer from an internal field. This field | 1643 * Gets a 2-byte-aligned native pointer from an internal field. This field |
| 1649 * must have been set by SetAlignedPointerInInternalField, everything else | 1644 * must have been set by SetAlignedPointerInInternalField, everything else |
| 1650 * leads to undefined behavior. | 1645 * leads to undefined behavior. |
| 1651 */ | 1646 */ |
| 1652 V8_INLINE(void* GetAlignedPointerFromInternalField(int index)); | 1647 V8_INLINE(void* GetAlignedPointerFromInternalField(int index)); |
| 1653 | 1648 |
| 1654 /** | 1649 /** |
| 1655 * Sets a 2-byte-aligned native pointer in an internal field. To retrieve such | 1650 * Sets a 2-byte-aligned native pointer in an internal field. To retrieve such |
| 1656 * a field, GetAlignedPointerFromInternalField must be used, everything else | 1651 * a field, GetAlignedPointerFromInternalField must be used, everything else |
| 1657 * leads to undefined behavior. | 1652 * leads to undefined behavior. |
| 1658 */ | 1653 */ |
| 1659 V8EXPORT void SetAlignedPointerInInternalField(int index, void* value); | 1654 void SetAlignedPointerInInternalField(int index, void* value); |
| 1660 | 1655 |
| 1661 // Testers for local properties. | 1656 // Testers for local properties. |
| 1662 V8EXPORT bool HasOwnProperty(Handle<String> key); | 1657 bool HasOwnProperty(Handle<String> key); |
| 1663 V8EXPORT bool HasRealNamedProperty(Handle<String> key); | 1658 bool HasRealNamedProperty(Handle<String> key); |
| 1664 V8EXPORT bool HasRealIndexedProperty(uint32_t index); | 1659 bool HasRealIndexedProperty(uint32_t index); |
| 1665 V8EXPORT bool HasRealNamedCallbackProperty(Handle<String> key); | 1660 bool HasRealNamedCallbackProperty(Handle<String> key); |
| 1666 | 1661 |
| 1667 /** | 1662 /** |
| 1668 * If result.IsEmpty() no real property was located in the prototype chain. | 1663 * If result.IsEmpty() no real property was located in the prototype chain. |
| 1669 * This means interceptors in the prototype chain are not called. | 1664 * This means interceptors in the prototype chain are not called. |
| 1670 */ | 1665 */ |
| 1671 V8EXPORT Local<Value> GetRealNamedPropertyInPrototypeChain( | 1666 Local<Value> GetRealNamedPropertyInPrototypeChain(Handle<String> key); |
| 1672 Handle<String> key); | |
| 1673 | 1667 |
| 1674 /** | 1668 /** |
| 1675 * If result.IsEmpty() no real property was located on the object or | 1669 * If result.IsEmpty() no real property was located on the object or |
| 1676 * in the prototype chain. | 1670 * in the prototype chain. |
| 1677 * This means interceptors in the prototype chain are not called. | 1671 * This means interceptors in the prototype chain are not called. |
| 1678 */ | 1672 */ |
| 1679 V8EXPORT Local<Value> GetRealNamedProperty(Handle<String> key); | 1673 Local<Value> GetRealNamedProperty(Handle<String> key); |
| 1680 | 1674 |
| 1681 /** Tests for a named lookup interceptor.*/ | 1675 /** Tests for a named lookup interceptor.*/ |
| 1682 V8EXPORT bool HasNamedLookupInterceptor(); | 1676 bool HasNamedLookupInterceptor(); |
| 1683 | 1677 |
| 1684 /** Tests for an index lookup interceptor.*/ | 1678 /** Tests for an index lookup interceptor.*/ |
| 1685 V8EXPORT bool HasIndexedLookupInterceptor(); | 1679 bool HasIndexedLookupInterceptor(); |
| 1686 | 1680 |
| 1687 /** | 1681 /** |
| 1688 * Turns on access check on the object if the object is an instance of | 1682 * 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 | 1683 * a template that has access check callbacks. If an object has no |
| 1690 * access check info, the object cannot be accessed by anyone. | 1684 * access check info, the object cannot be accessed by anyone. |
| 1691 */ | 1685 */ |
| 1692 V8EXPORT void TurnOnAccessCheck(); | 1686 void TurnOnAccessCheck(); |
| 1693 | 1687 |
| 1694 /** | 1688 /** |
| 1695 * Returns the identity hash for this object. The current implementation | 1689 * Returns the identity hash for this object. The current implementation |
| 1696 * uses a hidden property on the object to store the identity hash. | 1690 * uses a hidden property on the object to store the identity hash. |
| 1697 * | 1691 * |
| 1698 * The return value will never be 0. Also, it is not guaranteed to be | 1692 * The return value will never be 0. Also, it is not guaranteed to be |
| 1699 * unique. | 1693 * unique. |
| 1700 */ | 1694 */ |
| 1701 V8EXPORT int GetIdentityHash(); | 1695 int GetIdentityHash(); |
| 1702 | 1696 |
| 1703 /** | 1697 /** |
| 1704 * Access hidden properties on JavaScript objects. These properties are | 1698 * Access hidden properties on JavaScript objects. These properties are |
| 1705 * hidden from the executing JavaScript and only accessible through the V8 | 1699 * hidden from the executing JavaScript and only accessible through the V8 |
| 1706 * C++ API. Hidden properties introduced by V8 internally (for example the | 1700 * C++ API. Hidden properties introduced by V8 internally (for example the |
| 1707 * identity hash) are prefixed with "v8::". | 1701 * identity hash) are prefixed with "v8::". |
| 1708 */ | 1702 */ |
| 1709 V8EXPORT bool SetHiddenValue(Handle<String> key, Handle<Value> value); | 1703 bool SetHiddenValue(Handle<String> key, Handle<Value> value); |
| 1710 V8EXPORT Local<Value> GetHiddenValue(Handle<String> key); | 1704 Local<Value> GetHiddenValue(Handle<String> key); |
| 1711 V8EXPORT bool DeleteHiddenValue(Handle<String> key); | 1705 bool DeleteHiddenValue(Handle<String> key); |
| 1712 | 1706 |
| 1713 /** | 1707 /** |
| 1714 * Returns true if this is an instance of an api function (one | 1708 * Returns true if this is an instance of an api function (one |
| 1715 * created from a function created from a function template) and has | 1709 * created from a function created from a function template) and has |
| 1716 * been modified since it was created. Note that this method is | 1710 * been modified since it was created. Note that this method is |
| 1717 * conservative and may return true for objects that haven't actually | 1711 * conservative and may return true for objects that haven't actually |
| 1718 * been modified. | 1712 * been modified. |
| 1719 */ | 1713 */ |
| 1720 V8EXPORT bool IsDirty(); | 1714 bool IsDirty(); |
| 1721 | 1715 |
| 1722 /** | 1716 /** |
| 1723 * Clone this object with a fast but shallow copy. Values will point | 1717 * Clone this object with a fast but shallow copy. Values will point |
| 1724 * to the same values as the original object. | 1718 * to the same values as the original object. |
| 1725 */ | 1719 */ |
| 1726 V8EXPORT Local<Object> Clone(); | 1720 Local<Object> Clone(); |
| 1727 | 1721 |
| 1728 /** | 1722 /** |
| 1729 * Returns the context in which the object was created. | 1723 * Returns the context in which the object was created. |
| 1730 */ | 1724 */ |
| 1731 V8EXPORT Local<Context> CreationContext(); | 1725 Local<Context> CreationContext(); |
| 1732 | 1726 |
| 1733 /** | 1727 /** |
| 1734 * Set the backing store of the indexed properties to be managed by the | 1728 * 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 | 1729 * embedding layer. Access to the indexed properties will follow the rules |
| 1736 * spelled out in CanvasPixelArray. | 1730 * spelled out in CanvasPixelArray. |
| 1737 * Note: The embedding program still owns the data and needs to ensure that | 1731 * Note: The embedding program still owns the data and needs to ensure that |
| 1738 * the backing store is preserved while V8 has a reference. | 1732 * the backing store is preserved while V8 has a reference. |
| 1739 */ | 1733 */ |
| 1740 V8EXPORT void SetIndexedPropertiesToPixelData(uint8_t* data, int length); | 1734 void SetIndexedPropertiesToPixelData(uint8_t* data, int length); |
| 1741 V8EXPORT bool HasIndexedPropertiesInPixelData(); | 1735 bool HasIndexedPropertiesInPixelData(); |
| 1742 V8EXPORT uint8_t* GetIndexedPropertiesPixelData(); | 1736 uint8_t* GetIndexedPropertiesPixelData(); |
| 1743 V8EXPORT int GetIndexedPropertiesPixelDataLength(); | 1737 int GetIndexedPropertiesPixelDataLength(); |
| 1744 | 1738 |
| 1745 /** | 1739 /** |
| 1746 * Set the backing store of the indexed properties to be managed by the | 1740 * 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 | 1741 * embedding layer. Access to the indexed properties will follow the rules |
| 1748 * spelled out for the CanvasArray subtypes in the WebGL specification. | 1742 * spelled out for the CanvasArray subtypes in the WebGL specification. |
| 1749 * Note: The embedding program still owns the data and needs to ensure that | 1743 * Note: The embedding program still owns the data and needs to ensure that |
| 1750 * the backing store is preserved while V8 has a reference. | 1744 * the backing store is preserved while V8 has a reference. |
| 1751 */ | 1745 */ |
| 1752 V8EXPORT void SetIndexedPropertiesToExternalArrayData( | 1746 void SetIndexedPropertiesToExternalArrayData(void* data, |
| 1753 void* data, | 1747 ExternalArrayType array_type, |
| 1754 ExternalArrayType array_type, | 1748 int number_of_elements); |
| 1755 int number_of_elements); | 1749 bool HasIndexedPropertiesInExternalArrayData(); |
| 1756 V8EXPORT bool HasIndexedPropertiesInExternalArrayData(); | 1750 void* GetIndexedPropertiesExternalArrayData(); |
| 1757 V8EXPORT void* GetIndexedPropertiesExternalArrayData(); | 1751 ExternalArrayType GetIndexedPropertiesExternalArrayDataType(); |
| 1758 V8EXPORT ExternalArrayType GetIndexedPropertiesExternalArrayDataType(); | 1752 int GetIndexedPropertiesExternalArrayDataLength(); |
| 1759 V8EXPORT int GetIndexedPropertiesExternalArrayDataLength(); | |
| 1760 | 1753 |
| 1761 /** | 1754 /** |
| 1762 * Checks whether a callback is set by the | 1755 * Checks whether a callback is set by the |
| 1763 * ObjectTemplate::SetCallAsFunctionHandler method. | 1756 * ObjectTemplate::SetCallAsFunctionHandler method. |
| 1764 * When an Object is callable this method returns true. | 1757 * When an Object is callable this method returns true. |
| 1765 */ | 1758 */ |
| 1766 V8EXPORT bool IsCallable(); | 1759 bool IsCallable(); |
| 1767 | 1760 |
| 1768 /** | 1761 /** |
| 1769 * Call an Object as a function if a callback is set by the | 1762 * Call an Object as a function if a callback is set by the |
| 1770 * ObjectTemplate::SetCallAsFunctionHandler method. | 1763 * ObjectTemplate::SetCallAsFunctionHandler method. |
| 1771 */ | 1764 */ |
| 1772 V8EXPORT Local<Value> CallAsFunction(Handle<Object> recv, | 1765 Local<Value> CallAsFunction(Handle<Object> recv, |
| 1773 int argc, | 1766 int argc, |
| 1774 Handle<Value> argv[]); | 1767 Handle<Value> argv[]); |
| 1775 | 1768 |
| 1776 /** | 1769 /** |
| 1777 * Call an Object as a constructor if a callback is set by the | 1770 * Call an Object as a constructor if a callback is set by the |
| 1778 * ObjectTemplate::SetCallAsFunctionHandler method. | 1771 * ObjectTemplate::SetCallAsFunctionHandler method. |
| 1779 * Note: This method behaves like the Function::NewInstance method. | 1772 * Note: This method behaves like the Function::NewInstance method. |
| 1780 */ | 1773 */ |
| 1781 V8EXPORT Local<Value> CallAsConstructor(int argc, | 1774 Local<Value> CallAsConstructor(int argc, Handle<Value> argv[]); |
| 1782 Handle<Value> argv[]); | |
| 1783 | 1775 |
| 1784 V8EXPORT static Local<Object> New(); | 1776 static Local<Object> New(); |
| 1785 V8_INLINE(static Object* Cast(Value* obj)); | 1777 V8_INLINE(static Object* Cast(Value* obj)); |
| 1786 | 1778 |
| 1787 private: | 1779 private: |
| 1788 V8EXPORT Object(); | 1780 Object(); |
| 1789 V8EXPORT static void CheckCast(Value* obj); | 1781 static void CheckCast(Value* obj); |
| 1790 V8EXPORT Local<Value> SlowGetInternalField(int index); | 1782 Local<Value> SlowGetInternalField(int index); |
| 1791 V8EXPORT void* SlowGetAlignedPointerFromInternalField(int index); | 1783 void* SlowGetAlignedPointerFromInternalField(int index); |
| 1792 }; | 1784 }; |
| 1793 | 1785 |
| 1794 | 1786 |
| 1795 /** | 1787 /** |
| 1796 * An instance of the built-in array constructor (ECMA-262, 15.4.2). | 1788 * An instance of the built-in array constructor (ECMA-262, 15.4.2). |
| 1797 */ | 1789 */ |
| 1798 class Array : public Object { | 1790 class V8EXPORT Array : public Object { |
| 1799 public: | 1791 public: |
| 1800 V8EXPORT uint32_t Length() const; | 1792 uint32_t Length() const; |
| 1801 | 1793 |
| 1802 /** | 1794 /** |
| 1803 * Clones an element at index |index|. Returns an empty | 1795 * Clones an element at index |index|. Returns an empty |
| 1804 * handle if cloning fails (for any reason). | 1796 * handle if cloning fails (for any reason). |
| 1805 */ | 1797 */ |
| 1806 V8EXPORT Local<Object> CloneElementAt(uint32_t index); | 1798 Local<Object> CloneElementAt(uint32_t index); |
| 1807 | 1799 |
| 1808 /** | 1800 /** |
| 1809 * Creates a JavaScript array with the given length. If the length | 1801 * Creates a JavaScript array with the given length. If the length |
| 1810 * is negative the returned array will have length 0. | 1802 * is negative the returned array will have length 0. |
| 1811 */ | 1803 */ |
| 1812 V8EXPORT static Local<Array> New(int length = 0); | 1804 static Local<Array> New(int length = 0); |
| 1813 | 1805 |
| 1814 V8_INLINE(static Array* Cast(Value* obj)); | 1806 V8_INLINE(static Array* Cast(Value* obj)); |
| 1815 private: | 1807 private: |
| 1816 V8EXPORT Array(); | 1808 Array(); |
| 1817 V8EXPORT static void CheckCast(Value* obj); | 1809 static void CheckCast(Value* obj); |
| 1818 }; | 1810 }; |
| 1819 | 1811 |
| 1820 | 1812 |
| 1821 /** | 1813 /** |
| 1822 * A JavaScript function object (ECMA-262, 15.3). | 1814 * A JavaScript function object (ECMA-262, 15.3). |
| 1823 */ | 1815 */ |
| 1824 class Function : public Object { | 1816 class V8EXPORT Function : public Object { |
| 1825 public: | 1817 public: |
| 1826 V8EXPORT Local<Object> NewInstance() const; | 1818 Local<Object> NewInstance() const; |
| 1827 V8EXPORT Local<Object> NewInstance(int argc, Handle<Value> argv[]) const; | 1819 Local<Object> NewInstance(int argc, Handle<Value> argv[]) const; |
| 1828 V8EXPORT Local<Value> Call(Handle<Object> recv, | 1820 Local<Value> Call(Handle<Object> recv, int argc, Handle<Value> argv[]); |
| 1829 int argc, | 1821 void SetName(Handle<String> name); |
| 1830 Handle<Value> argv[]); | 1822 Handle<Value> GetName() const; |
| 1831 V8EXPORT void SetName(Handle<String> name); | |
| 1832 V8EXPORT Handle<Value> GetName() const; | |
| 1833 | 1823 |
| 1834 /** | 1824 /** |
| 1835 * Name inferred from variable or property assignment of this function. | 1825 * Name inferred from variable or property assignment of this function. |
| 1836 * Used to facilitate debugging and profiling of JavaScript code written | 1826 * Used to facilitate debugging and profiling of JavaScript code written |
| 1837 * in an OO style, where many functions are anonymous but are assigned | 1827 * in an OO style, where many functions are anonymous but are assigned |
| 1838 * to object properties. | 1828 * to object properties. |
| 1839 */ | 1829 */ |
| 1840 V8EXPORT Handle<Value> GetInferredName() const; | 1830 Handle<Value> GetInferredName() const; |
| 1841 | 1831 |
| 1842 /** | 1832 /** |
| 1843 * Returns zero based line number of function body and | 1833 * Returns zero based line number of function body and |
| 1844 * kLineOffsetNotFound if no information available. | 1834 * kLineOffsetNotFound if no information available. |
| 1845 */ | 1835 */ |
| 1846 V8EXPORT int GetScriptLineNumber() const; | 1836 int GetScriptLineNumber() const; |
| 1847 /** | 1837 /** |
| 1848 * Returns zero based column number of function body and | 1838 * Returns zero based column number of function body and |
| 1849 * kLineOffsetNotFound if no information available. | 1839 * kLineOffsetNotFound if no information available. |
| 1850 */ | 1840 */ |
| 1851 V8EXPORT int GetScriptColumnNumber() const; | 1841 int GetScriptColumnNumber() const; |
| 1852 V8EXPORT Handle<Value> GetScriptId() const; | 1842 Handle<Value> GetScriptId() const; |
| 1853 V8EXPORT ScriptOrigin GetScriptOrigin() const; | 1843 ScriptOrigin GetScriptOrigin() const; |
| 1854 V8_INLINE(static Function* Cast(Value* obj)); | 1844 V8_INLINE(static Function* Cast(Value* obj)); |
| 1855 V8EXPORT static const int kLineOffsetNotFound; | 1845 static const int kLineOffsetNotFound; |
| 1856 | 1846 |
| 1857 private: | 1847 private: |
| 1858 V8EXPORT Function(); | 1848 Function(); |
| 1859 V8EXPORT static void CheckCast(Value* obj); | 1849 static void CheckCast(Value* obj); |
| 1860 }; | 1850 }; |
| 1861 | 1851 |
| 1862 | 1852 |
| 1863 /** | 1853 /** |
| 1864 * An instance of the built-in Date constructor (ECMA-262, 15.9). | 1854 * An instance of the built-in Date constructor (ECMA-262, 15.9). |
| 1865 */ | 1855 */ |
| 1866 class Date : public Object { | 1856 class V8EXPORT Date : public Object { |
| 1867 public: | 1857 public: |
| 1868 V8EXPORT static Local<Value> New(double time); | 1858 static Local<Value> New(double time); |
| 1869 | 1859 |
| 1870 /** | 1860 /** |
| 1871 * A specialization of Value::NumberValue that is more efficient | 1861 * A specialization of Value::NumberValue that is more efficient |
| 1872 * because we know the structure of this object. | 1862 * because we know the structure of this object. |
| 1873 */ | 1863 */ |
| 1874 V8EXPORT double NumberValue() const; | 1864 double NumberValue() const; |
| 1875 | 1865 |
| 1876 V8_INLINE(static Date* Cast(v8::Value* obj)); | 1866 V8_INLINE(static Date* Cast(v8::Value* obj)); |
| 1877 | 1867 |
| 1878 /** | 1868 /** |
| 1879 * Notification that the embedder has changed the time zone, | 1869 * Notification that the embedder has changed the time zone, |
| 1880 * daylight savings time, or other date / time configuration | 1870 * daylight savings time, or other date / time configuration |
| 1881 * parameters. V8 keeps a cache of various values used for | 1871 * parameters. V8 keeps a cache of various values used for |
| 1882 * date / time computation. This notification will reset | 1872 * date / time computation. This notification will reset |
| 1883 * those cached values for the current context so that date / | 1873 * those cached values for the current context so that date / |
| 1884 * time configuration changes would be reflected in the Date | 1874 * time configuration changes would be reflected in the Date |
| 1885 * object. | 1875 * object. |
| 1886 * | 1876 * |
| 1887 * This API should not be called more than needed as it will | 1877 * This API should not be called more than needed as it will |
| 1888 * negatively impact the performance of date operations. | 1878 * negatively impact the performance of date operations. |
| 1889 */ | 1879 */ |
| 1890 V8EXPORT static void DateTimeConfigurationChangeNotification(); | 1880 static void DateTimeConfigurationChangeNotification(); |
| 1891 | 1881 |
| 1892 private: | 1882 private: |
| 1893 V8EXPORT static void CheckCast(v8::Value* obj); | 1883 static void CheckCast(v8::Value* obj); |
| 1894 }; | 1884 }; |
| 1895 | 1885 |
| 1896 | 1886 |
| 1897 /** | 1887 /** |
| 1898 * A Number object (ECMA-262, 4.3.21). | 1888 * A Number object (ECMA-262, 4.3.21). |
| 1899 */ | 1889 */ |
| 1900 class NumberObject : public Object { | 1890 class V8EXPORT NumberObject : public Object { |
| 1901 public: | 1891 public: |
| 1902 V8EXPORT static Local<Value> New(double value); | 1892 static Local<Value> New(double value); |
| 1903 | 1893 |
| 1904 /** | 1894 /** |
| 1905 * Returns the Number held by the object. | 1895 * Returns the Number held by the object. |
| 1906 */ | 1896 */ |
| 1907 V8EXPORT double NumberValue() const; | 1897 double NumberValue() const; |
| 1908 | 1898 |
| 1909 V8_INLINE(static NumberObject* Cast(v8::Value* obj)); | 1899 V8_INLINE(static NumberObject* Cast(v8::Value* obj)); |
| 1910 | 1900 |
| 1911 private: | 1901 private: |
| 1912 V8EXPORT static void CheckCast(v8::Value* obj); | 1902 static void CheckCast(v8::Value* obj); |
| 1913 }; | 1903 }; |
| 1914 | 1904 |
| 1915 | 1905 |
| 1916 /** | 1906 /** |
| 1917 * A Boolean object (ECMA-262, 4.3.15). | 1907 * A Boolean object (ECMA-262, 4.3.15). |
| 1918 */ | 1908 */ |
| 1919 class BooleanObject : public Object { | 1909 class V8EXPORT BooleanObject : public Object { |
| 1920 public: | 1910 public: |
| 1921 V8EXPORT static Local<Value> New(bool value); | 1911 static Local<Value> New(bool value); |
| 1922 | 1912 |
| 1923 /** | 1913 /** |
| 1924 * Returns the Boolean held by the object. | 1914 * Returns the Boolean held by the object. |
| 1925 */ | 1915 */ |
| 1926 V8EXPORT bool BooleanValue() const; | 1916 bool BooleanValue() const; |
| 1927 | 1917 |
| 1928 V8_INLINE(static BooleanObject* Cast(v8::Value* obj)); | 1918 V8_INLINE(static BooleanObject* Cast(v8::Value* obj)); |
| 1929 | 1919 |
| 1930 private: | 1920 private: |
| 1931 V8EXPORT static void CheckCast(v8::Value* obj); | 1921 static void CheckCast(v8::Value* obj); |
| 1932 }; | 1922 }; |
| 1933 | 1923 |
| 1934 | 1924 |
| 1935 /** | 1925 /** |
| 1936 * A String object (ECMA-262, 4.3.18). | 1926 * A String object (ECMA-262, 4.3.18). |
| 1937 */ | 1927 */ |
| 1938 class StringObject : public Object { | 1928 class V8EXPORT StringObject : public Object { |
| 1939 public: | 1929 public: |
| 1940 V8EXPORT static Local<Value> New(Handle<String> value); | 1930 static Local<Value> New(Handle<String> value); |
| 1941 | 1931 |
| 1942 /** | 1932 /** |
| 1943 * Returns the String held by the object. | 1933 * Returns the String held by the object. |
| 1944 */ | 1934 */ |
| 1945 V8EXPORT Local<String> StringValue() const; | 1935 Local<String> StringValue() const; |
| 1946 | 1936 |
| 1947 V8_INLINE(static StringObject* Cast(v8::Value* obj)); | 1937 V8_INLINE(static StringObject* Cast(v8::Value* obj)); |
| 1948 | 1938 |
| 1949 private: | 1939 private: |
| 1950 V8EXPORT static void CheckCast(v8::Value* obj); | 1940 static void CheckCast(v8::Value* obj); |
| 1951 }; | 1941 }; |
| 1952 | 1942 |
| 1953 | 1943 |
| 1954 /** | 1944 /** |
| 1955 * An instance of the built-in RegExp constructor (ECMA-262, 15.10). | 1945 * An instance of the built-in RegExp constructor (ECMA-262, 15.10). |
| 1956 */ | 1946 */ |
| 1957 class RegExp : public Object { | 1947 class V8EXPORT RegExp : public Object { |
| 1958 public: | 1948 public: |
| 1959 /** | 1949 /** |
| 1960 * Regular expression flag bits. They can be or'ed to enable a set | 1950 * Regular expression flag bits. They can be or'ed to enable a set |
| 1961 * of flags. | 1951 * of flags. |
| 1962 */ | 1952 */ |
| 1963 enum Flags { | 1953 enum Flags { |
| 1964 kNone = 0, | 1954 kNone = 0, |
| 1965 kGlobal = 1, | 1955 kGlobal = 1, |
| 1966 kIgnoreCase = 2, | 1956 kIgnoreCase = 2, |
| 1967 kMultiline = 4 | 1957 kMultiline = 4 |
| 1968 }; | 1958 }; |
| 1969 | 1959 |
| 1970 /** | 1960 /** |
| 1971 * Creates a regular expression from the given pattern string and | 1961 * Creates a regular expression from the given pattern string and |
| 1972 * the flags bit field. May throw a JavaScript exception as | 1962 * the flags bit field. May throw a JavaScript exception as |
| 1973 * described in ECMA-262, 15.10.4.1. | 1963 * described in ECMA-262, 15.10.4.1. |
| 1974 * | 1964 * |
| 1975 * For example, | 1965 * For example, |
| 1976 * RegExp::New(v8::String::New("foo"), | 1966 * RegExp::New(v8::String::New("foo"), |
| 1977 * static_cast<RegExp::Flags>(kGlobal | kMultiline)) | 1967 * static_cast<RegExp::Flags>(kGlobal | kMultiline)) |
| 1978 * is equivalent to evaluating "/foo/gm". | 1968 * is equivalent to evaluating "/foo/gm". |
| 1979 */ | 1969 */ |
| 1980 V8EXPORT static Local<RegExp> New(Handle<String> pattern, | 1970 static Local<RegExp> New(Handle<String> pattern, Flags flags); |
| 1981 Flags flags); | |
| 1982 | 1971 |
| 1983 /** | 1972 /** |
| 1984 * Returns the value of the source property: a string representing | 1973 * Returns the value of the source property: a string representing |
| 1985 * the regular expression. | 1974 * the regular expression. |
| 1986 */ | 1975 */ |
| 1987 V8EXPORT Local<String> GetSource() const; | 1976 Local<String> GetSource() const; |
| 1988 | 1977 |
| 1989 /** | 1978 /** |
| 1990 * Returns the flags bit field. | 1979 * Returns the flags bit field. |
| 1991 */ | 1980 */ |
| 1992 V8EXPORT Flags GetFlags() const; | 1981 Flags GetFlags() const; |
| 1993 | 1982 |
| 1994 V8_INLINE(static RegExp* Cast(v8::Value* obj)); | 1983 V8_INLINE(static RegExp* Cast(v8::Value* obj)); |
| 1995 | 1984 |
| 1996 private: | 1985 private: |
| 1997 V8EXPORT static void CheckCast(v8::Value* obj); | 1986 static void CheckCast(v8::Value* obj); |
| 1998 }; | 1987 }; |
| 1999 | 1988 |
| 2000 | 1989 |
| 2001 /** | 1990 /** |
| 2002 * A JavaScript value that wraps a C++ void*. This type of value is mainly used | 1991 * A JavaScript value that wraps a C++ void*. This type of value is mainly used |
| 2003 * to associate C++ data structures with JavaScript objects. | 1992 * to associate C++ data structures with JavaScript objects. |
| 2004 */ | 1993 */ |
| 2005 class External : public Value { | 1994 class V8EXPORT External : public Value { |
| 2006 public: | 1995 public: |
| 2007 /** Deprecated, use New instead. */ | 1996 /** Deprecated, use New instead. */ |
| 2008 V8_DEPRECATED(V8_INLINE(static Local<Value> Wrap(void* value))); | 1997 V8_DEPRECATED(V8_INLINE(static Local<Value> Wrap(void* value))); |
| 2009 | 1998 |
| 2010 /** Deprecated, use a combination of Cast and Value instead. */ | 1999 /** Deprecated, use a combination of Cast and Value instead. */ |
| 2011 V8_DEPRECATED(V8_INLINE(static void* Unwrap(Handle<Value> obj))); | 2000 V8_DEPRECATED(V8_INLINE(static void* Unwrap(Handle<Value> obj))); |
| 2012 | 2001 |
| 2013 V8EXPORT static Local<External> New(void* value); | 2002 static Local<External> New(void* value); |
| 2014 V8_INLINE(static External* Cast(Value* obj)); | 2003 V8_INLINE(static External* Cast(Value* obj)); |
| 2015 V8EXPORT void* Value() const; | 2004 void* Value() const; |
| 2016 private: | 2005 private: |
| 2017 V8EXPORT static void CheckCast(v8::Value* obj); | 2006 static void CheckCast(v8::Value* obj); |
| 2018 }; | 2007 }; |
| 2019 | 2008 |
| 2020 | 2009 |
| 2021 // --- Templates --- | 2010 // --- Templates --- |
| 2022 | 2011 |
| 2023 | 2012 |
| 2024 /** | 2013 /** |
| 2025 * The superclass of object and function templates. | 2014 * The superclass of object and function templates. |
| 2026 */ | 2015 */ |
| 2027 class V8EXPORT Template : public Data { | 2016 class V8EXPORT Template : public Data { |
| 2028 public: | 2017 public: |
| 2029 /** Adds a property to each instance created by this template.*/ | 2018 /** Adds a property to each instance created by this template.*/ |
| 2030 void Set(Handle<String> name, Handle<Data> value, | 2019 void Set(Handle<String> name, Handle<Data> value, |
| 2031 PropertyAttribute attributes = None); | 2020 PropertyAttribute attributes = None); |
| 2032 V8_INLINE(void Set(const char* name, Handle<Data> value)); | 2021 V8_INLINE(void Set(const char* name, Handle<Data> value)); |
| 2033 private: | 2022 private: |
| 2034 Template(); | 2023 Template(); |
| 2035 | 2024 |
| 2036 friend class ObjectTemplate; | 2025 friend class ObjectTemplate; |
| 2037 friend class FunctionTemplate; | 2026 friend class FunctionTemplate; |
| 2038 }; | 2027 }; |
| 2039 | 2028 |
| 2040 | 2029 |
| 2041 /** | 2030 /** |
| 2042 * The argument information given to function call callbacks. This | 2031 * The argument information given to function call callbacks. This |
| 2043 * class provides access to information about the context of the call, | 2032 * class provides access to information about the context of the call, |
| 2044 * including the receiver, the number and values of arguments, and | 2033 * including the receiver, the number and values of arguments, and |
| 2045 * the holder of the function. | 2034 * the holder of the function. |
| 2046 */ | 2035 */ |
| 2047 class Arguments { | 2036 class V8EXPORT Arguments { |
| 2048 public: | 2037 public: |
| 2049 V8_INLINE(int Length() const); | 2038 V8_INLINE(int Length() const); |
| 2050 V8_INLINE(Local<Value> operator[](int i) const); | 2039 V8_INLINE(Local<Value> operator[](int i) const); |
| 2051 V8_INLINE(Local<Function> Callee() const); | 2040 V8_INLINE(Local<Function> Callee() const); |
| 2052 V8_INLINE(Local<Object> This() const); | 2041 V8_INLINE(Local<Object> This() const); |
| 2053 V8_INLINE(Local<Object> Holder() const); | 2042 V8_INLINE(Local<Object> Holder() const); |
| 2054 V8_INLINE(bool IsConstructCall() const); | 2043 V8_INLINE(bool IsConstructCall() const); |
| 2055 V8_INLINE(Local<Value> Data() const); | 2044 V8_INLINE(Local<Value> Data() const); |
| 2056 V8_INLINE(Isolate* GetIsolate() const); | 2045 V8_INLINE(Isolate* GetIsolate() const); |
| 2057 | 2046 |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2937 private: | 2926 private: |
| 2938 Isolate(); | 2927 Isolate(); |
| 2939 Isolate(const Isolate&); | 2928 Isolate(const Isolate&); |
| 2940 ~Isolate(); | 2929 ~Isolate(); |
| 2941 Isolate& operator=(const Isolate&); | 2930 Isolate& operator=(const Isolate&); |
| 2942 void* operator new(size_t size); | 2931 void* operator new(size_t size); |
| 2943 void operator delete(void*, size_t); | 2932 void operator delete(void*, size_t); |
| 2944 }; | 2933 }; |
| 2945 | 2934 |
| 2946 | 2935 |
| 2947 class StartupData { | 2936 class V8EXPORT StartupData { |
| 2948 public: | 2937 public: |
| 2949 enum CompressionAlgorithm { | 2938 enum CompressionAlgorithm { |
| 2950 kUncompressed, | 2939 kUncompressed, |
| 2951 kBZip2 | 2940 kBZip2 |
| 2952 }; | 2941 }; |
| 2953 | 2942 |
| 2954 const char* data; | 2943 const char* data; |
| 2955 int compressed_size; | 2944 int compressed_size; |
| 2956 int raw_size; | 2945 int raw_size; |
| 2957 }; | 2946 }; |
| (...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4156 | 4145 |
| 4157 typedef SmiTagging<kApiPointerSize> PlatformSmiTagging; | 4146 typedef SmiTagging<kApiPointerSize> PlatformSmiTagging; |
| 4158 const int kSmiShiftSize = PlatformSmiTagging::kSmiShiftSize; | 4147 const int kSmiShiftSize = PlatformSmiTagging::kSmiShiftSize; |
| 4159 const int kSmiValueSize = PlatformSmiTagging::kSmiValueSize; | 4148 const int kSmiValueSize = PlatformSmiTagging::kSmiValueSize; |
| 4160 | 4149 |
| 4161 /** | 4150 /** |
| 4162 * This class exports constants and functionality from within v8 that | 4151 * This class exports constants and functionality from within v8 that |
| 4163 * is necessary to implement inline functions in the v8 api. Don't | 4152 * is necessary to implement inline functions in the v8 api. Don't |
| 4164 * depend on functions and constants defined here. | 4153 * depend on functions and constants defined here. |
| 4165 */ | 4154 */ |
| 4166 class Internals { | 4155 class V8EXPORT Internals { |
|
Michael Starzinger
2013/01/11 14:06:33
This class should not be exported since it should
Sven Panne
2013/01/14 07:35:54
Done.
| |
| 4167 public: | 4156 public: |
| 4168 // These values match non-compiler-dependent values defined within | 4157 // These values match non-compiler-dependent values defined within |
| 4169 // the implementation of v8. | 4158 // the implementation of v8. |
| 4170 static const int kHeapObjectMapOffset = 0; | 4159 static const int kHeapObjectMapOffset = 0; |
| 4171 static const int kMapInstanceTypeOffset = 1 * kApiPointerSize + kApiIntSize; | 4160 static const int kMapInstanceTypeOffset = 1 * kApiPointerSize + kApiIntSize; |
| 4172 static const int kStringResourceOffset = 3 * kApiPointerSize; | 4161 static const int kStringResourceOffset = 3 * kApiPointerSize; |
| 4173 | 4162 |
| 4174 static const int kOddballKindOffset = 3 * kApiPointerSize; | 4163 static const int kOddballKindOffset = 3 * kApiPointerSize; |
| 4175 static const int kForeignAddressOffset = kApiPointerSize; | 4164 static const int kForeignAddressOffset = kApiPointerSize; |
| 4176 static const int kJSObjectHeaderSize = 3 * kApiPointerSize; | 4165 static const int kJSObjectHeaderSize = 3 * kApiPointerSize; |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4862 | 4851 |
| 4863 | 4852 |
| 4864 } // namespace v8 | 4853 } // namespace v8 |
| 4865 | 4854 |
| 4866 | 4855 |
| 4867 #undef V8EXPORT | 4856 #undef V8EXPORT |
| 4868 #undef TYPE_CHECK | 4857 #undef TYPE_CHECK |
| 4869 | 4858 |
| 4870 | 4859 |
| 4871 #endif // V8_H_ | 4860 #endif // V8_H_ |
| OLD | NEW |