Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(320)

Side by Side Diff: include/v8.h

Issue 22715004: Version 3.20.15 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Add TypedArray API and correctness patches r16033 and r16084 Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « build/standalone.gypi ('k') | include/v8-debug.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 22 matching lines...) Expand all
33 * V8 header file, include/v8.h. 33 * V8 header file, include/v8.h.
34 * 34 *
35 * For other documentation see http://code.google.com/apis/v8/ 35 * For other documentation see http://code.google.com/apis/v8/
36 */ 36 */
37 37
38 #ifndef V8_H_ 38 #ifndef V8_H_
39 #define V8_H_ 39 #define V8_H_
40 40
41 #include "v8stdint.h" 41 #include "v8stdint.h"
42 42
43 // We reserve the V8_* prefix for macros defined in V8 public API and
44 // assume there are no name conflicts with the embedder's code.
45
46 #ifdef _WIN32 43 #ifdef _WIN32
47 44
48 // Setup for Windows DLL export/import. When building the V8 DLL the 45 // Setup for Windows DLL export/import. When building the V8 DLL the
49 // BUILDING_V8_SHARED needs to be defined. When building a program which uses 46 // BUILDING_V8_SHARED needs to be defined. When building a program which uses
50 // the V8 DLL USING_V8_SHARED needs to be defined. When either building the V8 47 // the V8 DLL USING_V8_SHARED needs to be defined. When either building the V8
51 // static library or building a program which uses the V8 static library neither 48 // static library or building a program which uses the V8 static library neither
52 // BUILDING_V8_SHARED nor USING_V8_SHARED should be defined. 49 // BUILDING_V8_SHARED nor USING_V8_SHARED should be defined.
53 #if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED) 50 #if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
54 #error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check the\ 51 #error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check the\
55 build configuration to ensure that at most one of these is set 52 build configuration to ensure that at most one of these is set
56 #endif 53 #endif
57 54
58 #ifdef BUILDING_V8_SHARED 55 #ifdef BUILDING_V8_SHARED
59 #define V8_EXPORT __declspec(dllexport) 56 #define V8EXPORT __declspec(dllexport)
60 #elif USING_V8_SHARED 57 #elif USING_V8_SHARED
61 #define V8_EXPORT __declspec(dllimport) 58 #define V8EXPORT __declspec(dllimport)
62 #else 59 #else
63 #define V8_EXPORT 60 #define V8EXPORT
64 #endif // BUILDING_V8_SHARED 61 #endif // BUILDING_V8_SHARED
65 62
66 #else // _WIN32 63 #else // _WIN32
67 64
68 // Setup for Linux shared library export. 65 // Setup for Linux shared library export.
69 #if defined(__GNUC__) && ((__GNUC__ >= 4) || \ 66 #if defined(__GNUC__) && ((__GNUC__ >= 4) || \
70 (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(V8_SHARED) 67 (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(V8_SHARED)
71 #ifdef BUILDING_V8_SHARED 68 #ifdef BUILDING_V8_SHARED
72 #define V8_EXPORT __attribute__ ((visibility("default"))) 69 #define V8EXPORT __attribute__ ((visibility("default")))
73 #else 70 #else
74 #define V8_EXPORT 71 #define V8EXPORT
75 #endif 72 #endif
76 #else 73 #else
77 #define V8_EXPORT 74 #define V8EXPORT
78 #endif 75 #endif
79 76
80 #endif // _WIN32 77 #endif // _WIN32
81 78
82 #if defined(__GNUC__) && !defined(DEBUG) 79 #if defined(__GNUC__) && !defined(DEBUG)
83 #define V8_INLINE(declarator) inline __attribute__((always_inline)) declarator 80 #define V8_INLINE(declarator) inline __attribute__((always_inline)) declarator
84 #elif defined(_MSC_VER) && !defined(DEBUG) 81 #elif defined(_MSC_VER) && !defined(DEBUG)
85 #define V8_INLINE(declarator) __forceinline declarator 82 #define V8_INLINE(declarator) __forceinline declarator
86 #else 83 #else
87 #define V8_INLINE(declarator) inline declarator 84 #define V8_INLINE(declarator) inline declarator
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 friend class HandleScope; 378 friend class HandleScope;
382 379
383 #ifndef V8_USE_UNSAFE_HANDLES 380 #ifndef V8_USE_UNSAFE_HANDLES
384 V8_INLINE(static Handle<T> New(Isolate* isolate, T* that)); 381 V8_INLINE(static Handle<T> New(Isolate* isolate, T* that));
385 #endif 382 #endif
386 383
387 T* val_; 384 T* val_;
388 }; 385 };
389 386
390 387
391 // A value which will never be returned by Local::Eternalize
392 // Useful for static initialization
393 const int kUninitializedEternalIndex = -1;
394
395
396 /** 388 /**
397 * A light-weight stack-allocated object handle. All operations 389 * A light-weight stack-allocated object handle. All operations
398 * that return objects from within v8 return them in local handles. They 390 * that return objects from within v8 return them in local handles. They
399 * are created within HandleScopes, and all local handles allocated within a 391 * are created within HandleScopes, and all local handles allocated within a
400 * handle scope are destroyed when the handle scope is destroyed. Hence it 392 * handle scope are destroyed when the handle scope is destroyed. Hence it
401 * is not necessary to explicitly deallocate local handles. 393 * is not necessary to explicitly deallocate local handles.
402 */ 394 */
403 // TODO(dcarney): deprecate entire class 395 // TODO(dcarney): deprecate entire class
404 template <class T> class Local : public Handle<T> { 396 template <class T> class Local : public Handle<T> {
405 public: 397 public:
(...skipping 25 matching lines...) Expand all
431 template <class S> V8_INLINE(Local(Handle<S> that)) 423 template <class S> V8_INLINE(Local(Handle<S> that))
432 : Handle<T>(reinterpret_cast<T*>(*that)) { 424 : Handle<T>(reinterpret_cast<T*>(*that)) {
433 TYPE_CHECK(T, S); 425 TYPE_CHECK(T, S);
434 } 426 }
435 #endif 427 #endif
436 428
437 template <class S> V8_INLINE(Local<S> As()) { 429 template <class S> V8_INLINE(Local<S> As()) {
438 return Local<S>::Cast(*this); 430 return Local<S>::Cast(*this);
439 } 431 }
440 432
441 // Keep this Local alive for the lifetime of the Isolate.
442 // It remains retrievable via the returned index,
443 V8_INLINE(int Eternalize(Isolate* isolate));
444 V8_INLINE(static Local<T> GetEternal(Isolate* isolate, int index));
445
446 /** 433 /**
447 * Create a local handle for the content of another handle. 434 * Create a local handle for the content of another handle.
448 * The referee is kept alive by the local handle even when 435 * The referee is kept alive by the local handle even when
449 * the original handle is destroyed/disposed. 436 * the original handle is destroyed/disposed.
450 */ 437 */
451 V8_INLINE(static Local<T> New(Handle<T> that)); 438 V8_INLINE(static Local<T> New(Handle<T> that));
452 V8_INLINE(static Local<T> New(Isolate* isolate, Handle<T> that)); 439 V8_INLINE(static Local<T> New(Isolate* isolate, Handle<T> that));
453 #ifndef V8_USE_UNSAFE_HANDLES 440 #ifndef V8_USE_UNSAFE_HANDLES
454 // TODO(dcarney): remove before cutover 441 // TODO(dcarney): remove before cutover
455 V8_INLINE(static Local<T> New(Isolate* isolate, const Persistent<T>& that)); 442 V8_INLINE(static Local<T> New(Isolate* isolate, const Persistent<T>& that));
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 * deleted or another handle scope is created. If there is already a 794 * deleted or another handle scope is created. If there is already a
808 * handle scope and a new one is created, all allocations will take 795 * handle scope and a new one is created, all allocations will take
809 * place in the new handle scope until it is deleted. After that, 796 * place in the new handle scope until it is deleted. After that,
810 * new handles will again be allocated in the original handle scope. 797 * new handles will again be allocated in the original handle scope.
811 * 798 *
812 * After the handle scope of a local handle has been deleted the 799 * After the handle scope of a local handle has been deleted the
813 * garbage collector will no longer track the object stored in the 800 * garbage collector will no longer track the object stored in the
814 * handle and may deallocate it. The behavior of accessing a handle 801 * handle and may deallocate it. The behavior of accessing a handle
815 * for which the handle scope has been deleted is undefined. 802 * for which the handle scope has been deleted is undefined.
816 */ 803 */
817 class V8_EXPORT HandleScope { 804 class V8EXPORT HandleScope {
818 public: 805 public:
819 // TODO(svenpanne) Deprecate me when Chrome is fixed! 806 // TODO(svenpanne) Deprecate me when Chrome is fixed!
820 HandleScope(); 807 HandleScope();
821 808
822 HandleScope(Isolate* isolate); 809 HandleScope(Isolate* isolate);
823 810
824 ~HandleScope(); 811 ~HandleScope();
825 812
826 /** 813 /**
827 * Closes the handle scope and returns the value as a handle in the 814 * Closes the handle scope and returns the value as a handle in the
(...skipping 18 matching lines...) Expand all
846 private: 833 private:
847 // Make it hard to create heap-allocated or illegal handle scopes by 834 // Make it hard to create heap-allocated or illegal handle scopes by
848 // disallowing certain operations. 835 // disallowing certain operations.
849 HandleScope(const HandleScope&); 836 HandleScope(const HandleScope&);
850 void operator=(const HandleScope&); 837 void operator=(const HandleScope&);
851 void* operator new(size_t size); 838 void* operator new(size_t size);
852 void operator delete(void*, size_t); 839 void operator delete(void*, size_t);
853 840
854 // This Data class is accessible internally as HandleScopeData through a 841 // This Data class is accessible internally as HandleScopeData through a
855 // typedef in the ImplementationUtilities class. 842 // typedef in the ImplementationUtilities class.
856 class V8_EXPORT Data { 843 class V8EXPORT Data {
857 public: 844 public:
858 internal::Object** next; 845 internal::Object** next;
859 internal::Object** limit; 846 internal::Object** limit;
860 int level; 847 int level;
861 V8_INLINE(void Initialize()) { 848 V8_INLINE(void Initialize()) {
862 next = limit = NULL; 849 next = limit = NULL;
863 level = 0; 850 level = 0;
864 } 851 }
865 }; 852 };
866 853
(...skipping 12 matching lines...) Expand all
879 friend class ImplementationUtilities; 866 friend class ImplementationUtilities;
880 }; 867 };
881 868
882 869
883 // --- Special objects --- 870 // --- Special objects ---
884 871
885 872
886 /** 873 /**
887 * The superclass of values and API object templates. 874 * The superclass of values and API object templates.
888 */ 875 */
889 class V8_EXPORT Data { 876 class V8EXPORT Data {
890 private: 877 private:
891 Data(); 878 Data();
892 }; 879 };
893 880
894 881
895 /** 882 /**
896 * Pre-compilation data that can be associated with a script. This 883 * Pre-compilation data that can be associated with a script. This
897 * data can be calculated for a script in advance of actually 884 * data can be calculated for a script in advance of actually
898 * compiling it, and can be stored between compilations. When script 885 * compiling it, and can be stored between compilations. When script
899 * data is given to the compile method compilation will be faster. 886 * data is given to the compile method compilation will be faster.
900 */ 887 */
901 class V8_EXPORT ScriptData { // NOLINT 888 class V8EXPORT ScriptData { // NOLINT
902 public: 889 public:
903 virtual ~ScriptData() { } 890 virtual ~ScriptData() { }
904 891
905 /** 892 /**
906 * Pre-compiles the specified script (context-independent). 893 * Pre-compiles the specified script (context-independent).
907 * 894 *
908 * \param input Pointer to UTF-8 script source code. 895 * \param input Pointer to UTF-8 script source code.
909 * \param length Length of UTF-8 script source code. 896 * \param length Length of UTF-8 script source code.
910 */ 897 */
911 static ScriptData* PreCompile(const char* input, int length); 898 static ScriptData* PreCompile(const char* input, int length);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 Handle<Value> resource_name_; 956 Handle<Value> resource_name_;
970 Handle<Integer> resource_line_offset_; 957 Handle<Integer> resource_line_offset_;
971 Handle<Integer> resource_column_offset_; 958 Handle<Integer> resource_column_offset_;
972 Handle<Boolean> resource_is_shared_cross_origin_; 959 Handle<Boolean> resource_is_shared_cross_origin_;
973 }; 960 };
974 961
975 962
976 /** 963 /**
977 * A compiled JavaScript script. 964 * A compiled JavaScript script.
978 */ 965 */
979 class V8_EXPORT Script { 966 class V8EXPORT Script {
980 public: 967 public:
981 /** 968 /**
982 * Compiles the specified script (context-independent). 969 * Compiles the specified script (context-independent).
983 * 970 *
984 * \param source Script source code. 971 * \param source Script source code.
985 * \param origin Script origin, owned by caller, no references are kept 972 * \param origin Script origin, owned by caller, no references are kept
986 * when New() returns 973 * when New() returns
987 * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile() 974 * \param pre_data Pre-parsing data, as obtained by ScriptData::PreCompile()
988 * using pre_data speeds compilation if it's done multiple times. 975 * using pre_data speeds compilation if it's done multiple times.
989 * Owned by caller, no references are kept when New() returns. 976 * Owned by caller, no references are kept when New() returns.
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1087 */ 1074 */
1088 int GetLineNumber(int code_pos); 1075 int GetLineNumber(int code_pos);
1089 1076
1090 static const int kNoScriptId = 0; 1077 static const int kNoScriptId = 0;
1091 }; 1078 };
1092 1079
1093 1080
1094 /** 1081 /**
1095 * An error message. 1082 * An error message.
1096 */ 1083 */
1097 class V8_EXPORT Message { 1084 class V8EXPORT Message {
1098 public: 1085 public:
1099 Local<String> Get() const; 1086 Local<String> Get() const;
1100 Local<String> GetSourceLine() const; 1087 Local<String> GetSourceLine() const;
1101 1088
1102 /** 1089 /**
1103 * Returns the resource name for the script from where the function causing 1090 * Returns the resource name for the script from where the function causing
1104 * the error originates. 1091 * the error originates.
1105 */ 1092 */
1106 Handle<Value> GetScriptResourceName() const; 1093 Handle<Value> GetScriptResourceName() const;
1107 1094
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 static const int kNoLineNumberInfo = 0; 1146 static const int kNoLineNumberInfo = 0;
1160 static const int kNoColumnInfo = 0; 1147 static const int kNoColumnInfo = 0;
1161 }; 1148 };
1162 1149
1163 1150
1164 /** 1151 /**
1165 * Representation of a JavaScript stack trace. The information collected is a 1152 * Representation of a JavaScript stack trace. The information collected is a
1166 * snapshot of the execution stack and the information remains valid after 1153 * snapshot of the execution stack and the information remains valid after
1167 * execution continues. 1154 * execution continues.
1168 */ 1155 */
1169 class V8_EXPORT StackTrace { 1156 class V8EXPORT StackTrace {
1170 public: 1157 public:
1171 /** 1158 /**
1172 * Flags that determine what information is placed captured for each 1159 * Flags that determine what information is placed captured for each
1173 * StackFrame when grabbing the current stack trace. 1160 * StackFrame when grabbing the current stack trace.
1174 */ 1161 */
1175 enum StackTraceOptions { 1162 enum StackTraceOptions {
1176 kLineNumber = 1, 1163 kLineNumber = 1,
1177 kColumnOffset = 1 << 1 | kLineNumber, 1164 kColumnOffset = 1 << 1 | kLineNumber,
1178 kScriptName = 1 << 2, 1165 kScriptName = 1 << 2,
1179 kFunctionName = 1 << 3, 1166 kFunctionName = 1 << 3,
(...skipping 28 matching lines...) Expand all
1208 */ 1195 */
1209 static Local<StackTrace> CurrentStackTrace( 1196 static Local<StackTrace> CurrentStackTrace(
1210 int frame_limit, 1197 int frame_limit,
1211 StackTraceOptions options = kOverview); 1198 StackTraceOptions options = kOverview);
1212 }; 1199 };
1213 1200
1214 1201
1215 /** 1202 /**
1216 * A single JavaScript stack frame. 1203 * A single JavaScript stack frame.
1217 */ 1204 */
1218 class V8_EXPORT StackFrame { 1205 class V8EXPORT StackFrame {
1219 public: 1206 public:
1220 /** 1207 /**
1221 * Returns the number, 1-based, of the line for the associate function call. 1208 * Returns the number, 1-based, of the line for the associate function call.
1222 * This method will return Message::kNoLineNumberInfo if it is unable to 1209 * This method will return Message::kNoLineNumberInfo if it is unable to
1223 * retrieve the line number, or if kLineNumber was not passed as an option 1210 * retrieve the line number, or if kLineNumber was not passed as an option
1224 * when capturing the StackTrace. 1211 * when capturing the StackTrace.
1225 */ 1212 */
1226 int GetLineNumber() const; 1213 int GetLineNumber() const;
1227 1214
1228 /** 1215 /**
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1260 bool IsEval() const; 1247 bool IsEval() const;
1261 1248
1262 /** 1249 /**
1263 * Returns whether or not the associated function is called as a 1250 * Returns whether or not the associated function is called as a
1264 * constructor via "new". 1251 * constructor via "new".
1265 */ 1252 */
1266 bool IsConstructor() const; 1253 bool IsConstructor() const;
1267 }; 1254 };
1268 1255
1269 1256
1270 /**
1271 * A JSON Parser.
1272 */
1273 class V8_EXPORT JSON {
1274 public:
1275 /**
1276 * Tries to parse the string |json_string| and returns it as object if
1277 * successful.
1278 *
1279 * \param json_string The string to parse.
1280 * \return The corresponding object if successfully parsed.
1281 */
1282 static Local<Object> Parse(Local<String> json_string);
1283 };
1284
1285
1286 // --- Value --- 1257 // --- Value ---
1287 1258
1288 1259
1289 /** 1260 /**
1290 * The superclass of all JavaScript values and objects. 1261 * The superclass of all JavaScript values and objects.
1291 */ 1262 */
1292 class V8_EXPORT Value : public Data { 1263 class V8EXPORT Value : public Data {
1293 public: 1264 public:
1294 /** 1265 /**
1295 * Returns true if this value is the undefined value. See ECMA-262 1266 * Returns true if this value is the undefined value. See ECMA-262
1296 * 4.3.10. 1267 * 4.3.10.
1297 */ 1268 */
1298 V8_INLINE(bool IsUndefined() const); 1269 V8_INLINE(bool IsUndefined() const);
1299 1270
1300 /** 1271 /**
1301 * Returns true if this value is the null value. See ECMA-262 1272 * Returns true if this value is the null value. See ECMA-262
1302 * 4.3.11. 1273 * 4.3.11.
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1513 V8_INLINE(bool QuickIsString() const); 1484 V8_INLINE(bool QuickIsString() const);
1514 bool FullIsUndefined() const; 1485 bool FullIsUndefined() const;
1515 bool FullIsNull() const; 1486 bool FullIsNull() const;
1516 bool FullIsString() const; 1487 bool FullIsString() const;
1517 }; 1488 };
1518 1489
1519 1490
1520 /** 1491 /**
1521 * The superclass of primitive values. See ECMA-262 4.3.2. 1492 * The superclass of primitive values. See ECMA-262 4.3.2.
1522 */ 1493 */
1523 class V8_EXPORT Primitive : public Value { }; 1494 class V8EXPORT Primitive : public Value { };
1524 1495
1525 1496
1526 /** 1497 /**
1527 * A primitive boolean value (ECMA-262, 4.3.14). Either the true 1498 * A primitive boolean value (ECMA-262, 4.3.14). Either the true
1528 * or false value. 1499 * or false value.
1529 */ 1500 */
1530 class V8_EXPORT Boolean : public Primitive { 1501 class V8EXPORT Boolean : public Primitive {
1531 public: 1502 public:
1532 bool Value() const; 1503 bool Value() const;
1533 V8_INLINE(static Handle<Boolean> New(bool value)); 1504 V8_INLINE(static Handle<Boolean> New(bool value));
1534 }; 1505 };
1535 1506
1536 1507
1537 /** 1508 /**
1538 * A JavaScript string value (ECMA-262, 4.3.17). 1509 * A JavaScript string value (ECMA-262, 4.3.17).
1539 */ 1510 */
1540 class V8_EXPORT String : public Primitive { 1511 class V8EXPORT String : public Primitive {
1541 public: 1512 public:
1542 enum Encoding { 1513 enum Encoding {
1543 UNKNOWN_ENCODING = 0x1, 1514 UNKNOWN_ENCODING = 0x1,
1544 TWO_BYTE_ENCODING = 0x0, 1515 TWO_BYTE_ENCODING = 0x0,
1545 ASCII_ENCODING = 0x4, 1516 ASCII_ENCODING = 0x4,
1546 ONE_BYTE_ENCODING = 0x4 1517 ONE_BYTE_ENCODING = 0x4
1547 }; 1518 };
1548 /** 1519 /**
1549 * Returns the number of characters in this string. 1520 * Returns the number of characters in this string.
1550 */ 1521 */
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1636 /** 1607 /**
1637 * Returns true if the string is external 1608 * Returns true if the string is external
1638 */ 1609 */
1639 bool IsExternal() const; 1610 bool IsExternal() const;
1640 1611
1641 /** 1612 /**
1642 * Returns true if the string is both external and ASCII 1613 * Returns true if the string is both external and ASCII
1643 */ 1614 */
1644 bool IsExternalAscii() const; 1615 bool IsExternalAscii() const;
1645 1616
1646 class V8_EXPORT ExternalStringResourceBase { // NOLINT 1617 class V8EXPORT ExternalStringResourceBase { // NOLINT
1647 public: 1618 public:
1648 virtual ~ExternalStringResourceBase() {} 1619 virtual ~ExternalStringResourceBase() {}
1649 1620
1650 protected: 1621 protected:
1651 ExternalStringResourceBase() {} 1622 ExternalStringResourceBase() {}
1652 1623
1653 /** 1624 /**
1654 * Internally V8 will call this Dispose method when the external string 1625 * Internally V8 will call this Dispose method when the external string
1655 * resource is no longer needed. The default implementation will use the 1626 * resource is no longer needed. The default implementation will use the
1656 * delete operator. This method can be overridden in subclasses to 1627 * delete operator. This method can be overridden in subclasses to
1657 * control how allocated external string resources are disposed. 1628 * control how allocated external string resources are disposed.
1658 */ 1629 */
1659 virtual void Dispose() { delete this; } 1630 virtual void Dispose() { delete this; }
1660 1631
1661 private: 1632 private:
1662 // Disallow copying and assigning. 1633 // Disallow copying and assigning.
1663 ExternalStringResourceBase(const ExternalStringResourceBase&); 1634 ExternalStringResourceBase(const ExternalStringResourceBase&);
1664 void operator=(const ExternalStringResourceBase&); 1635 void operator=(const ExternalStringResourceBase&);
1665 1636
1666 friend class v8::internal::Heap; 1637 friend class v8::internal::Heap;
1667 }; 1638 };
1668 1639
1669 /** 1640 /**
1670 * An ExternalStringResource is a wrapper around a two-byte string 1641 * An ExternalStringResource is a wrapper around a two-byte string
1671 * buffer that resides outside V8's heap. Implement an 1642 * buffer that resides outside V8's heap. Implement an
1672 * ExternalStringResource to manage the life cycle of the underlying 1643 * ExternalStringResource to manage the life cycle of the underlying
1673 * buffer. Note that the string data must be immutable. 1644 * buffer. Note that the string data must be immutable.
1674 */ 1645 */
1675 class V8_EXPORT ExternalStringResource 1646 class V8EXPORT ExternalStringResource
1676 : public ExternalStringResourceBase { 1647 : public ExternalStringResourceBase {
1677 public: 1648 public:
1678 /** 1649 /**
1679 * Override the destructor to manage the life cycle of the underlying 1650 * Override the destructor to manage the life cycle of the underlying
1680 * buffer. 1651 * buffer.
1681 */ 1652 */
1682 virtual ~ExternalStringResource() {} 1653 virtual ~ExternalStringResource() {}
1683 1654
1684 /** 1655 /**
1685 * The string data from the underlying buffer. 1656 * The string data from the underlying buffer.
(...skipping 13 matching lines...) Expand all
1699 * An ExternalAsciiStringResource is a wrapper around an ASCII 1670 * An ExternalAsciiStringResource is a wrapper around an ASCII
1700 * string buffer that resides outside V8's heap. Implement an 1671 * string buffer that resides outside V8's heap. Implement an
1701 * ExternalAsciiStringResource to manage the life cycle of the 1672 * ExternalAsciiStringResource to manage the life cycle of the
1702 * underlying buffer. Note that the string data must be immutable 1673 * underlying buffer. Note that the string data must be immutable
1703 * and that the data must be strict (7-bit) ASCII, not Latin-1 or 1674 * and that the data must be strict (7-bit) ASCII, not Latin-1 or
1704 * UTF-8, which would require special treatment internally in the 1675 * UTF-8, which would require special treatment internally in the
1705 * engine and, in the case of UTF-8, do not allow efficient indexing. 1676 * engine and, in the case of UTF-8, do not allow efficient indexing.
1706 * Use String::New or convert to 16 bit data for non-ASCII. 1677 * Use String::New or convert to 16 bit data for non-ASCII.
1707 */ 1678 */
1708 1679
1709 class V8_EXPORT ExternalAsciiStringResource 1680 class V8EXPORT ExternalAsciiStringResource
1710 : public ExternalStringResourceBase { 1681 : public ExternalStringResourceBase {
1711 public: 1682 public:
1712 /** 1683 /**
1713 * Override the destructor to manage the life cycle of the underlying 1684 * Override the destructor to manage the life cycle of the underlying
1714 * buffer. 1685 * buffer.
1715 */ 1686 */
1716 virtual ~ExternalAsciiStringResource() {} 1687 virtual ~ExternalAsciiStringResource() {}
1717 /** The string data from the underlying buffer.*/ 1688 /** The string data from the underlying buffer.*/
1718 virtual const char* data() const = 0; 1689 virtual const char* data() const = 0;
1719 /** The number of ASCII characters in the string.*/ 1690 /** The number of ASCII characters in the string.*/
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1852 V8_INLINE(static Local<String> NewUndetectable( 1823 V8_INLINE(static Local<String> NewUndetectable(
1853 const uint16_t* data, int length = -1)); 1824 const uint16_t* data, int length = -1));
1854 1825
1855 /** 1826 /**
1856 * Converts an object to a UTF-8-encoded character array. Useful if 1827 * Converts an object to a UTF-8-encoded character array. Useful if
1857 * you want to print the object. If conversion to a string fails 1828 * you want to print the object. If conversion to a string fails
1858 * (e.g. due to an exception in the toString() method of the object) 1829 * (e.g. due to an exception in the toString() method of the object)
1859 * then the length() method returns 0 and the * operator returns 1830 * then the length() method returns 0 and the * operator returns
1860 * NULL. 1831 * NULL.
1861 */ 1832 */
1862 class V8_EXPORT Utf8Value { 1833 class V8EXPORT Utf8Value {
1863 public: 1834 public:
1864 explicit Utf8Value(Handle<v8::Value> obj); 1835 explicit Utf8Value(Handle<v8::Value> obj);
1865 ~Utf8Value(); 1836 ~Utf8Value();
1866 char* operator*() { return str_; } 1837 char* operator*() { return str_; }
1867 const char* operator*() const { return str_; } 1838 const char* operator*() const { return str_; }
1868 int length() const { return length_; } 1839 int length() const { return length_; }
1869 private: 1840 private:
1870 char* str_; 1841 char* str_;
1871 int length_; 1842 int length_;
1872 1843
1873 // Disallow copying and assigning. 1844 // Disallow copying and assigning.
1874 Utf8Value(const Utf8Value&); 1845 Utf8Value(const Utf8Value&);
1875 void operator=(const Utf8Value&); 1846 void operator=(const Utf8Value&);
1876 }; 1847 };
1877 1848
1878 /** 1849 /**
1879 * Converts an object to an ASCII string. 1850 * Converts an object to an ASCII string.
1880 * Useful if you want to print the object. 1851 * Useful if you want to print the object.
1881 * If conversion to a string fails (eg. due to an exception in the toString() 1852 * If conversion to a string fails (eg. due to an exception in the toString()
1882 * method of the object) then the length() method returns 0 and the * operator 1853 * method of the object) then the length() method returns 0 and the * operator
1883 * returns NULL. 1854 * returns NULL.
1884 */ 1855 */
1885 class V8_EXPORT AsciiValue { 1856 class V8EXPORT AsciiValue {
1886 public: 1857 public:
1887 // TODO(dcarney): deprecate 1858 // TODO(dcarney): deprecate
1888 explicit AsciiValue(Handle<v8::Value> obj); 1859 explicit AsciiValue(Handle<v8::Value> obj);
1889 ~AsciiValue(); 1860 ~AsciiValue();
1890 char* operator*() { return str_; } 1861 char* operator*() { return str_; }
1891 const char* operator*() const { return str_; } 1862 const char* operator*() const { return str_; }
1892 int length() const { return length_; } 1863 int length() const { return length_; }
1893 private: 1864 private:
1894 char* str_; 1865 char* str_;
1895 int length_; 1866 int length_;
1896 1867
1897 // Disallow copying and assigning. 1868 // Disallow copying and assigning.
1898 AsciiValue(const AsciiValue&); 1869 AsciiValue(const AsciiValue&);
1899 void operator=(const AsciiValue&); 1870 void operator=(const AsciiValue&);
1900 }; 1871 };
1901 1872
1902 /** 1873 /**
1903 * Converts an object to a two-byte string. 1874 * Converts an object to a two-byte string.
1904 * If conversion to a string fails (eg. due to an exception in the toString() 1875 * If conversion to a string fails (eg. due to an exception in the toString()
1905 * method of the object) then the length() method returns 0 and the * operator 1876 * method of the object) then the length() method returns 0 and the * operator
1906 * returns NULL. 1877 * returns NULL.
1907 */ 1878 */
1908 class V8_EXPORT Value { 1879 class V8EXPORT Value {
1909 public: 1880 public:
1910 explicit Value(Handle<v8::Value> obj); 1881 explicit Value(Handle<v8::Value> obj);
1911 ~Value(); 1882 ~Value();
1912 uint16_t* operator*() { return str_; } 1883 uint16_t* operator*() { return str_; }
1913 const uint16_t* operator*() const { return str_; } 1884 const uint16_t* operator*() const { return str_; }
1914 int length() const { return length_; } 1885 int length() const { return length_; }
1915 private: 1886 private:
1916 uint16_t* str_; 1887 uint16_t* str_;
1917 int length_; 1888 int length_;
1918 1889
1919 // Disallow copying and assigning. 1890 // Disallow copying and assigning.
1920 Value(const Value&); 1891 Value(const Value&);
1921 void operator=(const Value&); 1892 void operator=(const Value&);
1922 }; 1893 };
1923 1894
1924 private: 1895 private:
1925 void VerifyExternalStringResourceBase(ExternalStringResourceBase* v, 1896 void VerifyExternalStringResourceBase(ExternalStringResourceBase* v,
1926 Encoding encoding) const; 1897 Encoding encoding) const;
1927 void VerifyExternalStringResource(ExternalStringResource* val) const; 1898 void VerifyExternalStringResource(ExternalStringResource* val) const;
1928 static void CheckCast(v8::Value* obj); 1899 static void CheckCast(v8::Value* obj);
1929 }; 1900 };
1930 1901
1931 1902
1932 /** 1903 /**
1933 * A JavaScript symbol (ECMA-262 edition 6) 1904 * A JavaScript symbol (ECMA-262 edition 6)
1934 * 1905 *
1935 * This is an experimental feature. Use at your own risk. 1906 * This is an experimental feature. Use at your own risk.
1936 */ 1907 */
1937 class V8_EXPORT Symbol : public Primitive { 1908 class V8EXPORT Symbol : public Primitive {
1938 public: 1909 public:
1939 // Returns the print name string of the symbol, or undefined if none. 1910 // Returns the print name string of the symbol, or undefined if none.
1940 Local<Value> Name() const; 1911 Local<Value> Name() const;
1941 1912
1942 // Create a symbol without a print name. 1913 // Create a symbol without a print name.
1943 static Local<Symbol> New(Isolate* isolate); 1914 static Local<Symbol> New(Isolate* isolate);
1944 1915
1945 // Create a symbol with a print name. 1916 // Create a symbol with a print name.
1946 static Local<Symbol> New(Isolate *isolate, const char* data, int length = -1); 1917 static Local<Symbol> New(Isolate *isolate, const char* data, int length = -1);
1947 1918
1948 V8_INLINE(static Symbol* Cast(v8::Value* obj)); 1919 V8_INLINE(static Symbol* Cast(v8::Value* obj));
1949 private: 1920 private:
1950 Symbol(); 1921 Symbol();
1951 static void CheckCast(v8::Value* obj); 1922 static void CheckCast(v8::Value* obj);
1952 }; 1923 };
1953 1924
1954 1925
1955 /** 1926 /**
1956 * A JavaScript number value (ECMA-262, 4.3.20) 1927 * A JavaScript number value (ECMA-262, 4.3.20)
1957 */ 1928 */
1958 class V8_EXPORT Number : public Primitive { 1929 class V8EXPORT Number : public Primitive {
1959 public: 1930 public:
1960 double Value() const; 1931 double Value() const;
1961 static Local<Number> New(double value); 1932 static Local<Number> New(double value);
1962 static Local<Number> New(Isolate* isolate, double value); 1933 static Local<Number> New(Isolate* isolate, double value);
1963 V8_INLINE(static Number* Cast(v8::Value* obj)); 1934 V8_INLINE(static Number* Cast(v8::Value* obj));
1964 private: 1935 private:
1965 Number(); 1936 Number();
1966 static void CheckCast(v8::Value* obj); 1937 static void CheckCast(v8::Value* obj);
1967 }; 1938 };
1968 1939
1969 1940
1970 /** 1941 /**
1971 * A JavaScript value representing a signed integer. 1942 * A JavaScript value representing a signed integer.
1972 */ 1943 */
1973 class V8_EXPORT Integer : public Number { 1944 class V8EXPORT Integer : public Number {
1974 public: 1945 public:
1975 static Local<Integer> New(int32_t value); 1946 static Local<Integer> New(int32_t value);
1976 static Local<Integer> NewFromUnsigned(uint32_t value); 1947 static Local<Integer> NewFromUnsigned(uint32_t value);
1977 static Local<Integer> New(int32_t value, Isolate*); 1948 static Local<Integer> New(int32_t value, Isolate*);
1978 static Local<Integer> NewFromUnsigned(uint32_t value, Isolate*); 1949 static Local<Integer> NewFromUnsigned(uint32_t value, Isolate*);
1979 int64_t Value() const; 1950 int64_t Value() const;
1980 V8_INLINE(static Integer* Cast(v8::Value* obj)); 1951 V8_INLINE(static Integer* Cast(v8::Value* obj));
1981 private: 1952 private:
1982 Integer(); 1953 Integer();
1983 static void CheckCast(v8::Value* obj); 1954 static void CheckCast(v8::Value* obj);
1984 }; 1955 };
1985 1956
1986 1957
1987 /** 1958 /**
1988 * A JavaScript value representing a 32-bit signed integer. 1959 * A JavaScript value representing a 32-bit signed integer.
1989 */ 1960 */
1990 class V8_EXPORT Int32 : public Integer { 1961 class V8EXPORT Int32 : public Integer {
1991 public: 1962 public:
1992 int32_t Value() const; 1963 int32_t Value() const;
1993 private: 1964 private:
1994 Int32(); 1965 Int32();
1995 }; 1966 };
1996 1967
1997 1968
1998 /** 1969 /**
1999 * A JavaScript value representing a 32-bit unsigned integer. 1970 * A JavaScript value representing a 32-bit unsigned integer.
2000 */ 1971 */
2001 class V8_EXPORT Uint32 : public Integer { 1972 class V8EXPORT Uint32 : public Integer {
2002 public: 1973 public:
2003 uint32_t Value() const; 1974 uint32_t Value() const;
2004 private: 1975 private:
2005 Uint32(); 1976 Uint32();
2006 }; 1977 };
2007 1978
2008 1979
2009 enum PropertyAttribute { 1980 enum PropertyAttribute {
2010 None = 0, 1981 None = 0,
2011 ReadOnly = 1 << 0, 1982 ReadOnly = 1 << 0,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2063 DEFAULT = 0, 2034 DEFAULT = 0,
2064 ALL_CAN_READ = 1, 2035 ALL_CAN_READ = 1,
2065 ALL_CAN_WRITE = 1 << 1, 2036 ALL_CAN_WRITE = 1 << 1,
2066 PROHIBITS_OVERWRITING = 1 << 2 2037 PROHIBITS_OVERWRITING = 1 << 2
2067 }; 2038 };
2068 2039
2069 2040
2070 /** 2041 /**
2071 * A JavaScript object (ECMA-262, 4.3.3) 2042 * A JavaScript object (ECMA-262, 4.3.3)
2072 */ 2043 */
2073 class V8_EXPORT Object : public Value { 2044 class V8EXPORT Object : public Value {
2074 public: 2045 public:
2075 bool Set(Handle<Value> key, 2046 bool Set(Handle<Value> key,
2076 Handle<Value> value, 2047 Handle<Value> value,
2077 PropertyAttribute attribs = None); 2048 PropertyAttribute attribs = None);
2078 2049
2079 bool Set(uint32_t index, Handle<Value> value); 2050 bool Set(uint32_t index, Handle<Value> value);
2080 2051
2081 // Sets a local property on this object bypassing interceptors and 2052 // Sets a local property on this object bypassing interceptors and
2082 // overriding accessors or read-only properties. 2053 // overriding accessors or read-only properties.
2083 // 2054 //
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
2335 Object(); 2306 Object();
2336 static void CheckCast(Value* obj); 2307 static void CheckCast(Value* obj);
2337 Local<Value> SlowGetInternalField(int index); 2308 Local<Value> SlowGetInternalField(int index);
2338 void* SlowGetAlignedPointerFromInternalField(int index); 2309 void* SlowGetAlignedPointerFromInternalField(int index);
2339 }; 2310 };
2340 2311
2341 2312
2342 /** 2313 /**
2343 * An instance of the built-in array constructor (ECMA-262, 15.4.2). 2314 * An instance of the built-in array constructor (ECMA-262, 15.4.2).
2344 */ 2315 */
2345 class V8_EXPORT Array : public Object { 2316 class V8EXPORT Array : public Object {
2346 public: 2317 public:
2347 uint32_t Length() const; 2318 uint32_t Length() const;
2348 2319
2349 /** 2320 /**
2350 * Clones an element at index |index|. Returns an empty 2321 * Clones an element at index |index|. Returns an empty
2351 * handle if cloning fails (for any reason). 2322 * handle if cloning fails (for any reason).
2352 */ 2323 */
2353 Local<Object> CloneElementAt(uint32_t index); 2324 Local<Object> CloneElementAt(uint32_t index);
2354 2325
2355 /** 2326 /**
2356 * Creates a JavaScript array with the given length. If the length 2327 * Creates a JavaScript array with the given length. If the length
2357 * is negative the returned array will have length 0. 2328 * is negative the returned array will have length 0.
2358 */ 2329 */
2359 static Local<Array> New(int length = 0); 2330 static Local<Array> New(int length = 0);
2360 2331
2361 V8_INLINE(static Array* Cast(Value* obj)); 2332 V8_INLINE(static Array* Cast(Value* obj));
2362 private: 2333 private:
2363 Array(); 2334 Array();
2364 static void CheckCast(Value* obj); 2335 static void CheckCast(Value* obj);
2365 }; 2336 };
2366 2337
2367 2338
2368 /** 2339 /**
2369 * A JavaScript function object (ECMA-262, 15.3). 2340 * A JavaScript function object (ECMA-262, 15.3).
2370 */ 2341 */
2371 class V8_EXPORT Function : public Object { 2342 class V8EXPORT Function : public Object {
2372 public: 2343 public:
2373 Local<Object> NewInstance() const; 2344 Local<Object> NewInstance() const;
2374 Local<Object> NewInstance(int argc, Handle<Value> argv[]) const; 2345 Local<Object> NewInstance(int argc, Handle<Value> argv[]) const;
2375 Local<Value> Call(Handle<Object> recv, int argc, Handle<Value> argv[]); 2346 Local<Value> Call(Handle<Object> recv, int argc, Handle<Value> argv[]);
2376 void SetName(Handle<String> name); 2347 void SetName(Handle<String> name);
2377 Handle<Value> GetName() const; 2348 Handle<Value> GetName() const;
2378 2349
2379 /** 2350 /**
2380 * Name inferred from variable or property assignment of this function. 2351 * Name inferred from variable or property assignment of this function.
2381 * Used to facilitate debugging and profiling of JavaScript code written 2352 * Used to facilitate debugging and profiling of JavaScript code written
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2417 2388
2418 #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2389 #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
2419 // The number of required internal fields can be defined by embedder. 2390 // The number of required internal fields can be defined by embedder.
2420 #define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2 2391 #define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2
2421 #endif 2392 #endif
2422 2393
2423 /** 2394 /**
2424 * An instance of the built-in ArrayBuffer constructor (ES6 draft 15.13.5). 2395 * An instance of the built-in ArrayBuffer constructor (ES6 draft 15.13.5).
2425 * This API is experimental and may change significantly. 2396 * This API is experimental and may change significantly.
2426 */ 2397 */
2427 class V8_EXPORT ArrayBuffer : public Object { 2398 class V8EXPORT ArrayBuffer : public Object {
2428 public: 2399 public:
2429 /** 2400 /**
2430 * Allocator that V8 uses to allocate |ArrayBuffer|'s memory. 2401 * Allocator that V8 uses to allocate |ArrayBuffer|'s memory.
2431 * The allocator is a global V8 setting. It should be set with 2402 * The allocator is a global V8 setting. It should be set with
2432 * V8::SetArrayBufferAllocator prior to creation of a first ArrayBuffer. 2403 * V8::SetArrayBufferAllocator prior to creation of a first ArrayBuffer.
2433 * 2404 *
2434 * This API is experimental and may change significantly. 2405 * This API is experimental and may change significantly.
2435 */ 2406 */
2436 class V8_EXPORT Allocator { // NOLINT 2407 class V8EXPORT Allocator { // NOLINT
2437 public: 2408 public:
2438 virtual ~Allocator() {} 2409 virtual ~Allocator() {}
2439 2410
2440 /** 2411 /**
2441 * Allocate |length| bytes. Return NULL if allocation is not successful. 2412 * Allocate |length| bytes. Return NULL if allocation is not successful.
2442 * Memory should be initialized to zeroes. 2413 * Memory should be initialized to zeroes.
2443 */ 2414 */
2444 virtual void* Allocate(size_t length) = 0; 2415 virtual void* Allocate(size_t length) = 0;
2445 2416
2446 /** 2417 /**
(...skipping 26 matching lines...) Expand all
2473 /** 2444 /**
2474 * The contents of an |ArrayBuffer|. Externalization of |ArrayBuffer| 2445 * The contents of an |ArrayBuffer|. Externalization of |ArrayBuffer|
2475 * returns an instance of this class, populated, with a pointer to data 2446 * returns an instance of this class, populated, with a pointer to data
2476 * and byte length. 2447 * and byte length.
2477 * 2448 *
2478 * The Data pointer of ArrayBuffer::Contents is always allocated with 2449 * The Data pointer of ArrayBuffer::Contents is always allocated with
2479 * Allocator::Allocate that is set with V8::SetArrayBufferAllocator. 2450 * Allocator::Allocate that is set with V8::SetArrayBufferAllocator.
2480 * 2451 *
2481 * This API is experimental and may change significantly. 2452 * This API is experimental and may change significantly.
2482 */ 2453 */
2483 class V8_EXPORT Contents { // NOLINT 2454 class V8EXPORT Contents { // NOLINT
2484 public: 2455 public:
2485 Contents() : data_(NULL), byte_length_(0) {} 2456 Contents() : data_(NULL), byte_length_(0) {}
2486 2457
2487 void* Data() const { return data_; } 2458 void* Data() const { return data_; }
2488 size_t ByteLength() const { return byte_length_; } 2459 size_t ByteLength() const { return byte_length_; }
2489 2460
2490 private: 2461 private:
2491 void* data_; 2462 void* data_;
2492 size_t byte_length_; 2463 size_t byte_length_;
2493 2464
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
2556 #define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT 2 2527 #define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT 2
2557 #endif 2528 #endif
2558 2529
2559 2530
2560 /** 2531 /**
2561 * A base class for an instance of one of "views" over ArrayBuffer, 2532 * A base class for an instance of one of "views" over ArrayBuffer,
2562 * including TypedArrays and DataView (ES6 draft 15.13). 2533 * including TypedArrays and DataView (ES6 draft 15.13).
2563 * 2534 *
2564 * This API is experimental and may change significantly. 2535 * This API is experimental and may change significantly.
2565 */ 2536 */
2566 class V8_EXPORT ArrayBufferView : public Object { 2537 class V8EXPORT ArrayBufferView : public Object {
2567 public: 2538 public:
2568 /** 2539 /**
2569 * Returns underlying ArrayBuffer. 2540 * Returns underlying ArrayBuffer.
2570 */ 2541 */
2571 Local<ArrayBuffer> Buffer(); 2542 Local<ArrayBuffer> Buffer();
2572 /** 2543 /**
2573 * Byte offset in |Buffer|. 2544 * Byte offset in |Buffer|.
2574 */ 2545 */
2575 size_t ByteOffset(); 2546 size_t ByteOffset();
2576 /** 2547 /**
(...skipping 14 matching lines...) Expand all
2591 ArrayBufferView(); 2562 ArrayBufferView();
2592 static void CheckCast(Value* obj); 2563 static void CheckCast(Value* obj);
2593 }; 2564 };
2594 2565
2595 2566
2596 /** 2567 /**
2597 * A base class for an instance of TypedArray series of constructors 2568 * A base class for an instance of TypedArray series of constructors
2598 * (ES6 draft 15.13.6). 2569 * (ES6 draft 15.13.6).
2599 * This API is experimental and may change significantly. 2570 * This API is experimental and may change significantly.
2600 */ 2571 */
2601 class V8_EXPORT TypedArray : public ArrayBufferView { 2572 class V8EXPORT TypedArray : public ArrayBufferView {
2602 public: 2573 public:
2603 /** 2574 /**
2604 * Number of elements in this typed array 2575 * Number of elements in this typed array
2605 * (e.g. for Int16Array, |ByteLength|/2). 2576 * (e.g. for Int16Array, |ByteLength|/2).
2606 */ 2577 */
2607 size_t Length(); 2578 size_t Length();
2608 2579
2609 V8_INLINE(static TypedArray* Cast(Value* obj)); 2580 V8_INLINE(static TypedArray* Cast(Value* obj));
2610 2581
2611 private: 2582 private:
2612 TypedArray(); 2583 TypedArray();
2613 static void CheckCast(Value* obj); 2584 static void CheckCast(Value* obj);
2614 }; 2585 };
2615 2586
2616 2587
2617 /** 2588 /**
2618 * An instance of Uint8Array constructor (ES6 draft 15.13.6). 2589 * An instance of Uint8Array constructor (ES6 draft 15.13.6).
2619 * This API is experimental and may change significantly. 2590 * This API is experimental and may change significantly.
2620 */ 2591 */
2621 class V8_EXPORT Uint8Array : public TypedArray { 2592 class V8EXPORT Uint8Array : public TypedArray {
2622 public: 2593 public:
2623 static Local<Uint8Array> New(Handle<ArrayBuffer> array_buffer, 2594 static Local<Uint8Array> New(Handle<ArrayBuffer> array_buffer,
2624 size_t byte_offset, size_t length); 2595 size_t byte_offset, size_t length);
2625 V8_INLINE(static Uint8Array* Cast(Value* obj)); 2596 V8_INLINE(static Uint8Array* Cast(Value* obj));
2626 2597
2627 private: 2598 private:
2628 Uint8Array(); 2599 Uint8Array();
2629 static void CheckCast(Value* obj); 2600 static void CheckCast(Value* obj);
2630 }; 2601 };
2631 2602
2632 2603
2633 /** 2604 /**
2634 * An instance of Uint8ClampedArray constructor (ES6 draft 15.13.6). 2605 * An instance of Uint8ClampedArray constructor (ES6 draft 15.13.6).
2635 * This API is experimental and may change significantly. 2606 * This API is experimental and may change significantly.
2636 */ 2607 */
2637 class V8_EXPORT Uint8ClampedArray : public TypedArray { 2608 class V8EXPORT Uint8ClampedArray : public TypedArray {
2638 public: 2609 public:
2639 static Local<Uint8ClampedArray> New(Handle<ArrayBuffer> array_buffer, 2610 static Local<Uint8ClampedArray> New(Handle<ArrayBuffer> array_buffer,
2640 size_t byte_offset, size_t length); 2611 size_t byte_offset, size_t length);
2641 V8_INLINE(static Uint8ClampedArray* Cast(Value* obj)); 2612 V8_INLINE(static Uint8ClampedArray* Cast(Value* obj));
2642 2613
2643 private: 2614 private:
2644 Uint8ClampedArray(); 2615 Uint8ClampedArray();
2645 static void CheckCast(Value* obj); 2616 static void CheckCast(Value* obj);
2646 }; 2617 };
2647 2618
2648 /** 2619 /**
2649 * An instance of Int8Array constructor (ES6 draft 15.13.6). 2620 * An instance of Int8Array constructor (ES6 draft 15.13.6).
2650 * This API is experimental and may change significantly. 2621 * This API is experimental and may change significantly.
2651 */ 2622 */
2652 class V8_EXPORT Int8Array : public TypedArray { 2623 class V8EXPORT Int8Array : public TypedArray {
2653 public: 2624 public:
2654 static Local<Int8Array> New(Handle<ArrayBuffer> array_buffer, 2625 static Local<Int8Array> New(Handle<ArrayBuffer> array_buffer,
2655 size_t byte_offset, size_t length); 2626 size_t byte_offset, size_t length);
2656 V8_INLINE(static Int8Array* Cast(Value* obj)); 2627 V8_INLINE(static Int8Array* Cast(Value* obj));
2657 2628
2658 private: 2629 private:
2659 Int8Array(); 2630 Int8Array();
2660 static void CheckCast(Value* obj); 2631 static void CheckCast(Value* obj);
2661 }; 2632 };
2662 2633
2663 2634
2664 /** 2635 /**
2665 * An instance of Uint16Array constructor (ES6 draft 15.13.6). 2636 * An instance of Uint16Array constructor (ES6 draft 15.13.6).
2666 * This API is experimental and may change significantly. 2637 * This API is experimental and may change significantly.
2667 */ 2638 */
2668 class V8_EXPORT Uint16Array : public TypedArray { 2639 class V8EXPORT Uint16Array : public TypedArray {
2669 public: 2640 public:
2670 static Local<Uint16Array> New(Handle<ArrayBuffer> array_buffer, 2641 static Local<Uint16Array> New(Handle<ArrayBuffer> array_buffer,
2671 size_t byte_offset, size_t length); 2642 size_t byte_offset, size_t length);
2672 V8_INLINE(static Uint16Array* Cast(Value* obj)); 2643 V8_INLINE(static Uint16Array* Cast(Value* obj));
2673 2644
2674 private: 2645 private:
2675 Uint16Array(); 2646 Uint16Array();
2676 static void CheckCast(Value* obj); 2647 static void CheckCast(Value* obj);
2677 }; 2648 };
2678 2649
2679 2650
2680 /** 2651 /**
2681 * An instance of Int16Array constructor (ES6 draft 15.13.6). 2652 * An instance of Int16Array constructor (ES6 draft 15.13.6).
2682 * This API is experimental and may change significantly. 2653 * This API is experimental and may change significantly.
2683 */ 2654 */
2684 class V8_EXPORT Int16Array : public TypedArray { 2655 class V8EXPORT Int16Array : public TypedArray {
2685 public: 2656 public:
2686 static Local<Int16Array> New(Handle<ArrayBuffer> array_buffer, 2657 static Local<Int16Array> New(Handle<ArrayBuffer> array_buffer,
2687 size_t byte_offset, size_t length); 2658 size_t byte_offset, size_t length);
2688 V8_INLINE(static Int16Array* Cast(Value* obj)); 2659 V8_INLINE(static Int16Array* Cast(Value* obj));
2689 2660
2690 private: 2661 private:
2691 Int16Array(); 2662 Int16Array();
2692 static void CheckCast(Value* obj); 2663 static void CheckCast(Value* obj);
2693 }; 2664 };
2694 2665
2695 2666
2696 /** 2667 /**
2697 * An instance of Uint32Array constructor (ES6 draft 15.13.6). 2668 * An instance of Uint32Array constructor (ES6 draft 15.13.6).
2698 * This API is experimental and may change significantly. 2669 * This API is experimental and may change significantly.
2699 */ 2670 */
2700 class V8_EXPORT Uint32Array : public TypedArray { 2671 class V8EXPORT Uint32Array : public TypedArray {
2701 public: 2672 public:
2702 static Local<Uint32Array> New(Handle<ArrayBuffer> array_buffer, 2673 static Local<Uint32Array> New(Handle<ArrayBuffer> array_buffer,
2703 size_t byte_offset, size_t length); 2674 size_t byte_offset, size_t length);
2704 V8_INLINE(static Uint32Array* Cast(Value* obj)); 2675 V8_INLINE(static Uint32Array* Cast(Value* obj));
2705 2676
2706 private: 2677 private:
2707 Uint32Array(); 2678 Uint32Array();
2708 static void CheckCast(Value* obj); 2679 static void CheckCast(Value* obj);
2709 }; 2680 };
2710 2681
2711 2682
2712 /** 2683 /**
2713 * An instance of Int32Array constructor (ES6 draft 15.13.6). 2684 * An instance of Int32Array constructor (ES6 draft 15.13.6).
2714 * This API is experimental and may change significantly. 2685 * This API is experimental and may change significantly.
2715 */ 2686 */
2716 class V8_EXPORT Int32Array : public TypedArray { 2687 class V8EXPORT Int32Array : public TypedArray {
2717 public: 2688 public:
2718 static Local<Int32Array> New(Handle<ArrayBuffer> array_buffer, 2689 static Local<Int32Array> New(Handle<ArrayBuffer> array_buffer,
2719 size_t byte_offset, size_t length); 2690 size_t byte_offset, size_t length);
2720 V8_INLINE(static Int32Array* Cast(Value* obj)); 2691 V8_INLINE(static Int32Array* Cast(Value* obj));
2721 2692
2722 private: 2693 private:
2723 Int32Array(); 2694 Int32Array();
2724 static void CheckCast(Value* obj); 2695 static void CheckCast(Value* obj);
2725 }; 2696 };
2726 2697
2727 2698
2728 /** 2699 /**
2729 * An instance of Float32Array constructor (ES6 draft 15.13.6). 2700 * An instance of Float32Array constructor (ES6 draft 15.13.6).
2730 * This API is experimental and may change significantly. 2701 * This API is experimental and may change significantly.
2731 */ 2702 */
2732 class V8_EXPORT Float32Array : public TypedArray { 2703 class V8EXPORT Float32Array : public TypedArray {
2733 public: 2704 public:
2734 static Local<Float32Array> New(Handle<ArrayBuffer> array_buffer, 2705 static Local<Float32Array> New(Handle<ArrayBuffer> array_buffer,
2735 size_t byte_offset, size_t length); 2706 size_t byte_offset, size_t length);
2736 V8_INLINE(static Float32Array* Cast(Value* obj)); 2707 V8_INLINE(static Float32Array* Cast(Value* obj));
2737 2708
2738 private: 2709 private:
2739 Float32Array(); 2710 Float32Array();
2740 static void CheckCast(Value* obj); 2711 static void CheckCast(Value* obj);
2741 }; 2712 };
2742 2713
2743 2714
2744 /** 2715 /**
2745 * An instance of Float64Array constructor (ES6 draft 15.13.6). 2716 * An instance of Float64Array constructor (ES6 draft 15.13.6).
2746 * This API is experimental and may change significantly. 2717 * This API is experimental and may change significantly.
2747 */ 2718 */
2748 class V8_EXPORT Float64Array : public TypedArray { 2719 class V8EXPORT Float64Array : public TypedArray {
2749 public: 2720 public:
2750 static Local<Float64Array> New(Handle<ArrayBuffer> array_buffer, 2721 static Local<Float64Array> New(Handle<ArrayBuffer> array_buffer,
2751 size_t byte_offset, size_t length); 2722 size_t byte_offset, size_t length);
2752 V8_INLINE(static Float64Array* Cast(Value* obj)); 2723 V8_INLINE(static Float64Array* Cast(Value* obj));
2753 2724
2754 private: 2725 private:
2755 Float64Array(); 2726 Float64Array();
2756 static void CheckCast(Value* obj); 2727 static void CheckCast(Value* obj);
2757 }; 2728 };
2758 2729
2759 2730
2760 /** 2731 /**
2761 * An instance of DataView constructor (ES6 draft 15.13.7). 2732 * An instance of DataView constructor (ES6 draft 15.13.7).
2762 * This API is experimental and may change significantly. 2733 * This API is experimental and may change significantly.
2763 */ 2734 */
2764 class V8_EXPORT DataView : public ArrayBufferView { 2735 class V8EXPORT DataView : public ArrayBufferView {
2765 public: 2736 public:
2766 static Local<DataView> New(Handle<ArrayBuffer> array_buffer, 2737 static Local<DataView> New(Handle<ArrayBuffer> array_buffer,
2767 size_t byte_offset, size_t length); 2738 size_t byte_offset, size_t length);
2768 V8_INLINE(static DataView* Cast(Value* obj)); 2739 V8_INLINE(static DataView* Cast(Value* obj));
2769 2740
2770 private: 2741 private:
2771 DataView(); 2742 DataView();
2772 static void CheckCast(Value* obj); 2743 static void CheckCast(Value* obj);
2773 }; 2744 };
2774 2745
2775 2746
2776 /** 2747 /**
2777 * An instance of the built-in Date constructor (ECMA-262, 15.9). 2748 * An instance of the built-in Date constructor (ECMA-262, 15.9).
2778 */ 2749 */
2779 class V8_EXPORT Date : public Object { 2750 class V8EXPORT Date : public Object {
2780 public: 2751 public:
2781 static Local<Value> New(double time); 2752 static Local<Value> New(double time);
2782 2753
2783 // Deprecated, use Date::ValueOf() instead. 2754 // Deprecated, use Date::ValueOf() instead.
2784 // TODO(svenpanne) Actually deprecate when Chrome is adapted. 2755 // TODO(svenpanne) Actually deprecate when Chrome is adapted.
2785 double NumberValue() const { return ValueOf(); } 2756 double NumberValue() const { return ValueOf(); }
2786 2757
2787 /** 2758 /**
2788 * A specialization of Value::NumberValue that is more efficient 2759 * A specialization of Value::NumberValue that is more efficient
2789 * because we know the structure of this object. 2760 * because we know the structure of this object.
(...skipping 17 matching lines...) Expand all
2807 static void DateTimeConfigurationChangeNotification(); 2778 static void DateTimeConfigurationChangeNotification();
2808 2779
2809 private: 2780 private:
2810 static void CheckCast(v8::Value* obj); 2781 static void CheckCast(v8::Value* obj);
2811 }; 2782 };
2812 2783
2813 2784
2814 /** 2785 /**
2815 * A Number object (ECMA-262, 4.3.21). 2786 * A Number object (ECMA-262, 4.3.21).
2816 */ 2787 */
2817 class V8_EXPORT NumberObject : public Object { 2788 class V8EXPORT NumberObject : public Object {
2818 public: 2789 public:
2819 static Local<Value> New(double value); 2790 static Local<Value> New(double value);
2820 2791
2821 // Deprecated, use NumberObject::ValueOf() instead. 2792 // Deprecated, use NumberObject::ValueOf() instead.
2822 // TODO(svenpanne) Actually deprecate when Chrome is adapted. 2793 // TODO(svenpanne) Actually deprecate when Chrome is adapted.
2823 double NumberValue() const { return ValueOf(); } 2794 double NumberValue() const { return ValueOf(); }
2824 2795
2825 /** 2796 /**
2826 * Returns the Number held by the object. 2797 * Returns the Number held by the object.
2827 */ 2798 */
2828 double ValueOf() const; 2799 double ValueOf() const;
2829 2800
2830 V8_INLINE(static NumberObject* Cast(v8::Value* obj)); 2801 V8_INLINE(static NumberObject* Cast(v8::Value* obj));
2831 2802
2832 private: 2803 private:
2833 static void CheckCast(v8::Value* obj); 2804 static void CheckCast(v8::Value* obj);
2834 }; 2805 };
2835 2806
2836 2807
2837 /** 2808 /**
2838 * A Boolean object (ECMA-262, 4.3.15). 2809 * A Boolean object (ECMA-262, 4.3.15).
2839 */ 2810 */
2840 class V8_EXPORT BooleanObject : public Object { 2811 class V8EXPORT BooleanObject : public Object {
2841 public: 2812 public:
2842 static Local<Value> New(bool value); 2813 static Local<Value> New(bool value);
2843 2814
2844 // Deprecated, use BooleanObject::ValueOf() instead. 2815 // Deprecated, use BooleanObject::ValueOf() instead.
2845 // TODO(svenpanne) Actually deprecate when Chrome is adapted. 2816 // TODO(svenpanne) Actually deprecate when Chrome is adapted.
2846 bool BooleanValue() const { return ValueOf(); } 2817 bool BooleanValue() const { return ValueOf(); }
2847 2818
2848 /** 2819 /**
2849 * Returns the Boolean held by the object. 2820 * Returns the Boolean held by the object.
2850 */ 2821 */
2851 bool ValueOf() const; 2822 bool ValueOf() const;
2852 2823
2853 V8_INLINE(static BooleanObject* Cast(v8::Value* obj)); 2824 V8_INLINE(static BooleanObject* Cast(v8::Value* obj));
2854 2825
2855 private: 2826 private:
2856 static void CheckCast(v8::Value* obj); 2827 static void CheckCast(v8::Value* obj);
2857 }; 2828 };
2858 2829
2859 2830
2860 /** 2831 /**
2861 * A String object (ECMA-262, 4.3.18). 2832 * A String object (ECMA-262, 4.3.18).
2862 */ 2833 */
2863 class V8_EXPORT StringObject : public Object { 2834 class V8EXPORT StringObject : public Object {
2864 public: 2835 public:
2865 static Local<Value> New(Handle<String> value); 2836 static Local<Value> New(Handle<String> value);
2866 2837
2867 // Deprecated, use StringObject::ValueOf() instead. 2838 // Deprecated, use StringObject::ValueOf() instead.
2868 // TODO(svenpanne) Actually deprecate when Chrome is adapted. 2839 // TODO(svenpanne) Actually deprecate when Chrome is adapted.
2869 Local<String> StringValue() const { return ValueOf(); } 2840 Local<String> StringValue() const { return ValueOf(); }
2870 2841
2871 /** 2842 /**
2872 * Returns the String held by the object. 2843 * Returns the String held by the object.
2873 */ 2844 */
2874 Local<String> ValueOf() const; 2845 Local<String> ValueOf() const;
2875 2846
2876 V8_INLINE(static StringObject* Cast(v8::Value* obj)); 2847 V8_INLINE(static StringObject* Cast(v8::Value* obj));
2877 2848
2878 private: 2849 private:
2879 static void CheckCast(v8::Value* obj); 2850 static void CheckCast(v8::Value* obj);
2880 }; 2851 };
2881 2852
2882 2853
2883 /** 2854 /**
2884 * A Symbol object (ECMA-262 edition 6). 2855 * A Symbol object (ECMA-262 edition 6).
2885 * 2856 *
2886 * This is an experimental feature. Use at your own risk. 2857 * This is an experimental feature. Use at your own risk.
2887 */ 2858 */
2888 class V8_EXPORT SymbolObject : public Object { 2859 class V8EXPORT SymbolObject : public Object {
2889 public: 2860 public:
2890 static Local<Value> New(Isolate* isolate, Handle<Symbol> value); 2861 static Local<Value> New(Isolate* isolate, Handle<Symbol> value);
2891 2862
2892 // Deprecated, use SymbolObject::ValueOf() instead. 2863 // Deprecated, use SymbolObject::ValueOf() instead.
2893 // TODO(svenpanne) Actually deprecate when Chrome is adapted. 2864 // TODO(svenpanne) Actually deprecate when Chrome is adapted.
2894 Local<Symbol> SymbolValue() const { return ValueOf(); } 2865 Local<Symbol> SymbolValue() const { return ValueOf(); }
2895 2866
2896 /** 2867 /**
2897 * Returns the Symbol held by the object. 2868 * Returns the Symbol held by the object.
2898 */ 2869 */
2899 Local<Symbol> ValueOf() const; 2870 Local<Symbol> ValueOf() const;
2900 2871
2901 V8_INLINE(static SymbolObject* Cast(v8::Value* obj)); 2872 V8_INLINE(static SymbolObject* Cast(v8::Value* obj));
2902 2873
2903 private: 2874 private:
2904 static void CheckCast(v8::Value* obj); 2875 static void CheckCast(v8::Value* obj);
2905 }; 2876 };
2906 2877
2907 2878
2908 /** 2879 /**
2909 * An instance of the built-in RegExp constructor (ECMA-262, 15.10). 2880 * An instance of the built-in RegExp constructor (ECMA-262, 15.10).
2910 */ 2881 */
2911 class V8_EXPORT RegExp : public Object { 2882 class V8EXPORT RegExp : public Object {
2912 public: 2883 public:
2913 /** 2884 /**
2914 * Regular expression flag bits. They can be or'ed to enable a set 2885 * Regular expression flag bits. They can be or'ed to enable a set
2915 * of flags. 2886 * of flags.
2916 */ 2887 */
2917 enum Flags { 2888 enum Flags {
2918 kNone = 0, 2889 kNone = 0,
2919 kGlobal = 1, 2890 kGlobal = 1,
2920 kIgnoreCase = 2, 2891 kIgnoreCase = 2,
2921 kMultiline = 4 2892 kMultiline = 4
(...skipping 26 matching lines...) Expand all
2948 2919
2949 private: 2920 private:
2950 static void CheckCast(v8::Value* obj); 2921 static void CheckCast(v8::Value* obj);
2951 }; 2922 };
2952 2923
2953 2924
2954 /** 2925 /**
2955 * A JavaScript value that wraps a C++ void*. This type of value is mainly used 2926 * A JavaScript value that wraps a C++ void*. This type of value is mainly used
2956 * to associate C++ data structures with JavaScript objects. 2927 * to associate C++ data structures with JavaScript objects.
2957 */ 2928 */
2958 class V8_EXPORT External : public Value { 2929 class V8EXPORT External : public Value {
2959 public: 2930 public:
2960 static Local<External> New(void* value); 2931 static Local<External> New(void* value);
2961 V8_INLINE(static External* Cast(Value* obj)); 2932 V8_INLINE(static External* Cast(Value* obj));
2962 void* Value() const; 2933 void* Value() const;
2963 private: 2934 private:
2964 static void CheckCast(v8::Value* obj); 2935 static void CheckCast(v8::Value* obj);
2965 }; 2936 };
2966 2937
2967 2938
2968 // --- Templates --- 2939 // --- Templates ---
2969 2940
2970 2941
2971 /** 2942 /**
2972 * The superclass of object and function templates. 2943 * The superclass of object and function templates.
2973 */ 2944 */
2974 class V8_EXPORT Template : public Data { 2945 class V8EXPORT Template : public Data {
2975 public: 2946 public:
2976 /** Adds a property to each instance created by this template.*/ 2947 /** Adds a property to each instance created by this template.*/
2977 void Set(Handle<String> name, Handle<Data> value, 2948 void Set(Handle<String> name, Handle<Data> value,
2978 PropertyAttribute attributes = None); 2949 PropertyAttribute attributes = None);
2979 V8_INLINE(void Set(const char* name, Handle<Data> value)); 2950 V8_INLINE(void Set(const char* name, Handle<Data> value));
2980 private: 2951 private:
2981 Template(); 2952 Template();
2982 2953
2983 friend class ObjectTemplate; 2954 friend class ObjectTemplate;
2984 friend class FunctionTemplate; 2955 friend class FunctionTemplate;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
3052 internal::Object** values, 3023 internal::Object** values,
3053 int length, 3024 int length,
3054 bool is_construct_call)); 3025 bool is_construct_call));
3055 internal::Object** implicit_args_; 3026 internal::Object** implicit_args_;
3056 internal::Object** values_; 3027 internal::Object** values_;
3057 int length_; 3028 int length_;
3058 bool is_construct_call_; 3029 bool is_construct_call_;
3059 }; 3030 };
3060 3031
3061 3032
3062 class V8_EXPORT Arguments : public FunctionCallbackInfo<Value> { 3033 class V8EXPORT Arguments : public FunctionCallbackInfo<Value> {
3063 private: 3034 private:
3064 friend class internal::FunctionCallbackArguments; 3035 friend class internal::FunctionCallbackArguments;
3065 V8_INLINE(Arguments(internal::Object** implicit_args, 3036 V8_INLINE(Arguments(internal::Object** implicit_args,
3066 internal::Object** values, 3037 internal::Object** values,
3067 int length, 3038 int length,
3068 bool is_construct_call)); 3039 bool is_construct_call));
3069 }; 3040 };
3070 3041
3071 /** 3042 /**
3072 * The information passed to a property callback about the context 3043 * The information passed to a property callback about the context
(...skipping 20 matching lines...) Expand all
3093 static const int kReturnValueIndex = -3; 3064 static const int kReturnValueIndex = -3;
3094 static const int kReturnValueDefaultValueIndex = -4; 3065 static const int kReturnValueDefaultValueIndex = -4;
3095 static const int kIsolateIndex = -5; 3066 static const int kIsolateIndex = -5;
3096 3067
3097 V8_INLINE(PropertyCallbackInfo(internal::Object** args)) 3068 V8_INLINE(PropertyCallbackInfo(internal::Object** args))
3098 : args_(args) { } 3069 : args_(args) { }
3099 internal::Object** args_; 3070 internal::Object** args_;
3100 }; 3071 };
3101 3072
3102 3073
3103 class V8_EXPORT AccessorInfo : public PropertyCallbackInfo<Value> { 3074 class V8EXPORT AccessorInfo : public PropertyCallbackInfo<Value> {
3104 private: 3075 private:
3105 friend class internal::PropertyCallbackArguments; 3076 friend class internal::PropertyCallbackArguments;
3106 V8_INLINE(AccessorInfo(internal::Object** args)) 3077 V8_INLINE(AccessorInfo(internal::Object** args))
3107 : PropertyCallbackInfo<Value>(args) { } 3078 : PropertyCallbackInfo<Value>(args) { }
3108 }; 3079 };
3109 3080
3110 3081
3111 typedef Handle<Value> (*InvocationCallback)(const Arguments& args); 3082 typedef Handle<Value> (*InvocationCallback)(const Arguments& args);
3112 typedef void (*FunctionCallback)(const FunctionCallbackInfo<Value>& info); 3083 typedef void (*FunctionCallback)(const FunctionCallbackInfo<Value>& info);
3113 3084
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
3341 * 3312 *
3342 * The Child function and Child instance will have the following 3313 * The Child function and Child instance will have the following
3343 * properties: 3314 * properties:
3344 * 3315 *
3345 * \code 3316 * \code
3346 * child_func.prototype.__proto__ == function.prototype; 3317 * child_func.prototype.__proto__ == function.prototype;
3347 * child_instance.instance_accessor calls 'InstanceAccessorCallback' 3318 * child_instance.instance_accessor calls 'InstanceAccessorCallback'
3348 * child_instance.instance_property == 3; 3319 * child_instance.instance_property == 3;
3349 * \endcode 3320 * \endcode
3350 */ 3321 */
3351 class V8_EXPORT FunctionTemplate : public Template { 3322 class V8EXPORT FunctionTemplate : public Template {
3352 public: 3323 public:
3353 /** Creates a function template.*/ 3324 /** Creates a function template.*/
3354 V8_DEPRECATED(static Local<FunctionTemplate> New( 3325 V8_DEPRECATED(static Local<FunctionTemplate> New(
3355 InvocationCallback callback, 3326 InvocationCallback callback,
3356 Handle<Value> data = Handle<Value>(), 3327 Handle<Value> data = Handle<Value>(),
3357 Handle<Signature> signature = Handle<Signature>(), 3328 Handle<Signature> signature = Handle<Signature>(),
3358 int length = 0)); 3329 int length = 0));
3359 static Local<FunctionTemplate> New( 3330 static Local<FunctionTemplate> New(
3360 FunctionCallback callback = 0, 3331 FunctionCallback callback = 0,
3361 Handle<Value> data = Handle<Value>(), 3332 Handle<Value> data = Handle<Value>(),
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
3432 friend class ObjectTemplate; 3403 friend class ObjectTemplate;
3433 }; 3404 };
3434 3405
3435 3406
3436 /** 3407 /**
3437 * An ObjectTemplate is used to create objects at runtime. 3408 * An ObjectTemplate is used to create objects at runtime.
3438 * 3409 *
3439 * Properties added to an ObjectTemplate are added to each object 3410 * Properties added to an ObjectTemplate are added to each object
3440 * created from the ObjectTemplate. 3411 * created from the ObjectTemplate.
3441 */ 3412 */
3442 class V8_EXPORT ObjectTemplate : public Template { 3413 class V8EXPORT ObjectTemplate : public Template {
3443 public: 3414 public:
3444 /** Creates an ObjectTemplate. */ 3415 /** Creates an ObjectTemplate. */
3445 static Local<ObjectTemplate> New(); 3416 static Local<ObjectTemplate> New();
3446 3417
3447 /** Creates a new instance of this template.*/ 3418 /** Creates a new instance of this template.*/
3448 Local<Object> NewInstance(); 3419 Local<Object> NewInstance();
3449 3420
3450 /** 3421 /**
3451 * Sets an accessor on the object template. 3422 * Sets an accessor on the object template.
3452 * 3423 *
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
3618 ObjectTemplate(); 3589 ObjectTemplate();
3619 static Local<ObjectTemplate> New(Handle<FunctionTemplate> constructor); 3590 static Local<ObjectTemplate> New(Handle<FunctionTemplate> constructor);
3620 friend class FunctionTemplate; 3591 friend class FunctionTemplate;
3621 }; 3592 };
3622 3593
3623 3594
3624 /** 3595 /**
3625 * A Signature specifies which receivers and arguments are valid 3596 * A Signature specifies which receivers and arguments are valid
3626 * parameters to a function. 3597 * parameters to a function.
3627 */ 3598 */
3628 class V8_EXPORT Signature : public Data { 3599 class V8EXPORT Signature : public Data {
3629 public: 3600 public:
3630 static Local<Signature> New(Handle<FunctionTemplate> receiver = 3601 static Local<Signature> New(Handle<FunctionTemplate> receiver =
3631 Handle<FunctionTemplate>(), 3602 Handle<FunctionTemplate>(),
3632 int argc = 0, 3603 int argc = 0,
3633 Handle<FunctionTemplate> argv[] = 0); 3604 Handle<FunctionTemplate> argv[] = 0);
3634 private: 3605 private:
3635 Signature(); 3606 Signature();
3636 }; 3607 };
3637 3608
3638 3609
3639 /** 3610 /**
3640 * An AccessorSignature specifies which receivers are valid parameters 3611 * An AccessorSignature specifies which receivers are valid parameters
3641 * to an accessor callback. 3612 * to an accessor callback.
3642 */ 3613 */
3643 class V8_EXPORT AccessorSignature : public Data { 3614 class V8EXPORT AccessorSignature : public Data {
3644 public: 3615 public:
3645 static Local<AccessorSignature> New(Handle<FunctionTemplate> receiver = 3616 static Local<AccessorSignature> New(Handle<FunctionTemplate> receiver =
3646 Handle<FunctionTemplate>()); 3617 Handle<FunctionTemplate>());
3647 private: 3618 private:
3648 AccessorSignature(); 3619 AccessorSignature();
3649 }; 3620 };
3650 3621
3651 3622
3652 class V8_EXPORT DeclaredAccessorDescriptor : public Data { 3623 class V8EXPORT DeclaredAccessorDescriptor : public Data {
3653 private: 3624 private:
3654 DeclaredAccessorDescriptor(); 3625 DeclaredAccessorDescriptor();
3655 }; 3626 };
3656 3627
3657 3628
3658 class V8_EXPORT ObjectOperationDescriptor : public Data { 3629 class V8EXPORT ObjectOperationDescriptor : public Data {
3659 public: 3630 public:
3660 // This function is not yet stable and should not be used at this time. 3631 // This function is not yet stable and should not be used at this time.
3661 static Local<RawOperationDescriptor> NewInternalFieldDereference( 3632 static Local<RawOperationDescriptor> NewInternalFieldDereference(
3662 Isolate* isolate, 3633 Isolate* isolate,
3663 int internal_field); 3634 int internal_field);
3664 private: 3635 private:
3665 ObjectOperationDescriptor(); 3636 ObjectOperationDescriptor();
3666 }; 3637 };
3667 3638
3668 3639
3669 enum DeclaredAccessorDescriptorDataType { 3640 enum DeclaredAccessorDescriptorDataType {
3670 kDescriptorBoolType, 3641 kDescriptorBoolType,
3671 kDescriptorInt8Type, kDescriptorUint8Type, 3642 kDescriptorInt8Type, kDescriptorUint8Type,
3672 kDescriptorInt16Type, kDescriptorUint16Type, 3643 kDescriptorInt16Type, kDescriptorUint16Type,
3673 kDescriptorInt32Type, kDescriptorUint32Type, 3644 kDescriptorInt32Type, kDescriptorUint32Type,
3674 kDescriptorFloatType, kDescriptorDoubleType 3645 kDescriptorFloatType, kDescriptorDoubleType
3675 }; 3646 };
3676 3647
3677 3648
3678 class V8_EXPORT RawOperationDescriptor : public Data { 3649 class V8EXPORT RawOperationDescriptor : public Data {
3679 public: 3650 public:
3680 Local<DeclaredAccessorDescriptor> NewHandleDereference(Isolate* isolate); 3651 Local<DeclaredAccessorDescriptor> NewHandleDereference(Isolate* isolate);
3681 Local<RawOperationDescriptor> NewRawDereference(Isolate* isolate); 3652 Local<RawOperationDescriptor> NewRawDereference(Isolate* isolate);
3682 Local<RawOperationDescriptor> NewRawShift(Isolate* isolate, 3653 Local<RawOperationDescriptor> NewRawShift(Isolate* isolate,
3683 int16_t byte_offset); 3654 int16_t byte_offset);
3684 Local<DeclaredAccessorDescriptor> NewPointerCompare(Isolate* isolate, 3655 Local<DeclaredAccessorDescriptor> NewPointerCompare(Isolate* isolate,
3685 void* compare_value); 3656 void* compare_value);
3686 Local<DeclaredAccessorDescriptor> NewPrimitiveValue( 3657 Local<DeclaredAccessorDescriptor> NewPrimitiveValue(
3687 Isolate* isolate, 3658 Isolate* isolate,
3688 DeclaredAccessorDescriptorDataType data_type, 3659 DeclaredAccessorDescriptorDataType data_type,
(...skipping 12 matching lines...) Expand all
3701 3672
3702 private: 3673 private:
3703 RawOperationDescriptor(); 3674 RawOperationDescriptor();
3704 }; 3675 };
3705 3676
3706 3677
3707 /** 3678 /**
3708 * A utility for determining the type of objects based on the template 3679 * A utility for determining the type of objects based on the template
3709 * they were constructed from. 3680 * they were constructed from.
3710 */ 3681 */
3711 class V8_EXPORT TypeSwitch : public Data { 3682 class V8EXPORT TypeSwitch : public Data {
3712 public: 3683 public:
3713 static Local<TypeSwitch> New(Handle<FunctionTemplate> type); 3684 static Local<TypeSwitch> New(Handle<FunctionTemplate> type);
3714 static Local<TypeSwitch> New(int argc, Handle<FunctionTemplate> types[]); 3685 static Local<TypeSwitch> New(int argc, Handle<FunctionTemplate> types[]);
3715 int match(Handle<Value> value); 3686 int match(Handle<Value> value);
3716 private: 3687 private:
3717 TypeSwitch(); 3688 TypeSwitch();
3718 }; 3689 };
3719 3690
3720 3691
3721 // --- Extensions --- 3692 // --- Extensions ---
3722 3693
3723 class V8_EXPORT ExternalAsciiStringResourceImpl 3694 class V8EXPORT ExternalAsciiStringResourceImpl
3724 : public String::ExternalAsciiStringResource { 3695 : public String::ExternalAsciiStringResource {
3725 public: 3696 public:
3726 ExternalAsciiStringResourceImpl() : data_(0), length_(0) {} 3697 ExternalAsciiStringResourceImpl() : data_(0), length_(0) {}
3727 ExternalAsciiStringResourceImpl(const char* data, size_t length) 3698 ExternalAsciiStringResourceImpl(const char* data, size_t length)
3728 : data_(data), length_(length) {} 3699 : data_(data), length_(length) {}
3729 const char* data() const { return data_; } 3700 const char* data() const { return data_; }
3730 size_t length() const { return length_; } 3701 size_t length() const { return length_; }
3731 3702
3732 private: 3703 private:
3733 const char* data_; 3704 const char* data_;
3734 size_t length_; 3705 size_t length_;
3735 }; 3706 };
3736 3707
3737 /** 3708 /**
3738 * Ignore 3709 * Ignore
3739 */ 3710 */
3740 class V8_EXPORT Extension { // NOLINT 3711 class V8EXPORT Extension { // NOLINT
3741 public: 3712 public:
3742 // Note that the strings passed into this constructor must live as long 3713 // Note that the strings passed into this constructor must live as long
3743 // as the Extension itself. 3714 // as the Extension itself.
3744 Extension(const char* name, 3715 Extension(const char* name,
3745 const char* source = 0, 3716 const char* source = 0,
3746 int dep_count = 0, 3717 int dep_count = 0,
3747 const char** deps = 0, 3718 const char** deps = 0,
3748 int source_length = -1); 3719 int source_length = -1);
3749 virtual ~Extension() { } 3720 virtual ~Extension() { }
3750 virtual v8::Handle<v8::FunctionTemplate> 3721 virtual v8::Handle<v8::FunctionTemplate>
(...skipping 17 matching lines...) Expand all
3768 int dep_count_; 3739 int dep_count_;
3769 const char** deps_; 3740 const char** deps_;
3770 bool auto_enable_; 3741 bool auto_enable_;
3771 3742
3772 // Disallow copying and assigning. 3743 // Disallow copying and assigning.
3773 Extension(const Extension&); 3744 Extension(const Extension&);
3774 void operator=(const Extension&); 3745 void operator=(const Extension&);
3775 }; 3746 };
3776 3747
3777 3748
3778 void V8_EXPORT RegisterExtension(Extension* extension); 3749 void V8EXPORT RegisterExtension(Extension* extension);
3779 3750
3780 3751
3781 /** 3752 /**
3782 * Ignore 3753 * Ignore
3783 */ 3754 */
3784 class V8_EXPORT DeclareExtension { 3755 class V8EXPORT DeclareExtension {
3785 public: 3756 public:
3786 V8_INLINE(DeclareExtension(Extension* extension)) { 3757 V8_INLINE(DeclareExtension(Extension* extension)) {
3787 RegisterExtension(extension); 3758 RegisterExtension(extension);
3788 } 3759 }
3789 }; 3760 };
3790 3761
3791 3762
3792 // --- Statics --- 3763 // --- Statics ---
3793 3764
3794 3765
3795 Handle<Primitive> V8_EXPORT Undefined(); 3766 Handle<Primitive> V8EXPORT Undefined();
3796 Handle<Primitive> V8_EXPORT Null(); 3767 Handle<Primitive> V8EXPORT Null();
3797 Handle<Boolean> V8_EXPORT True(); 3768 Handle<Boolean> V8EXPORT True();
3798 Handle<Boolean> V8_EXPORT False(); 3769 Handle<Boolean> V8EXPORT False();
3799 3770
3800 V8_INLINE(Handle<Primitive> Undefined(Isolate* isolate)); 3771 V8_INLINE(Handle<Primitive> Undefined(Isolate* isolate));
3801 V8_INLINE(Handle<Primitive> Null(Isolate* isolate)); 3772 V8_INLINE(Handle<Primitive> Null(Isolate* isolate));
3802 V8_INLINE(Handle<Boolean> True(Isolate* isolate)); 3773 V8_INLINE(Handle<Boolean> True(Isolate* isolate));
3803 V8_INLINE(Handle<Boolean> False(Isolate* isolate)); 3774 V8_INLINE(Handle<Boolean> False(Isolate* isolate));
3804 3775
3805 3776
3806 /** 3777 /**
3807 * A set of constraints that specifies the limits of the runtime's memory use. 3778 * A set of constraints that specifies the limits of the runtime's memory use.
3808 * You must set the heap size before initializing the VM - the size cannot be 3779 * You must set the heap size before initializing the VM - the size cannot be
3809 * adjusted after the VM is initialized. 3780 * adjusted after the VM is initialized.
3810 * 3781 *
3811 * If you are using threads then you should hold the V8::Locker lock while 3782 * If you are using threads then you should hold the V8::Locker lock while
3812 * setting the stack limit and you must set a non-default stack limit separately 3783 * setting the stack limit and you must set a non-default stack limit separately
3813 * for each thread. 3784 * for each thread.
3814 */ 3785 */
3815 class V8_EXPORT ResourceConstraints { 3786 class V8EXPORT ResourceConstraints {
3816 public: 3787 public:
3817 ResourceConstraints(); 3788 ResourceConstraints();
3818 int max_young_space_size() const { return max_young_space_size_; } 3789 int max_young_space_size() const { return max_young_space_size_; }
3819 void set_max_young_space_size(int value) { max_young_space_size_ = value; } 3790 void set_max_young_space_size(int value) { max_young_space_size_ = value; }
3820 int max_old_space_size() const { return max_old_space_size_; } 3791 int max_old_space_size() const { return max_old_space_size_; }
3821 void set_max_old_space_size(int value) { max_old_space_size_ = value; } 3792 void set_max_old_space_size(int value) { max_old_space_size_ = value; }
3822 int max_executable_size() { return max_executable_size_; } 3793 int max_executable_size() { return max_executable_size_; }
3823 void set_max_executable_size(int value) { max_executable_size_ = value; } 3794 void set_max_executable_size(int value) { max_executable_size_ = value; }
3824 uint32_t* stack_limit() const { return stack_limit_; } 3795 uint32_t* stack_limit() const { return stack_limit_; }
3825 // Sets an address beyond which the VM's stack may not grow. 3796 // Sets an address beyond which the VM's stack may not grow.
3826 void set_stack_limit(uint32_t* value) { stack_limit_ = value; } 3797 void set_stack_limit(uint32_t* value) { stack_limit_ = value; }
3827 private: 3798 private:
3828 int max_young_space_size_; 3799 int max_young_space_size_;
3829 int max_old_space_size_; 3800 int max_old_space_size_;
3830 int max_executable_size_; 3801 int max_executable_size_;
3831 uint32_t* stack_limit_; 3802 uint32_t* stack_limit_;
3832 }; 3803 };
3833 3804
3834 3805
3835 bool V8_EXPORT SetResourceConstraints(ResourceConstraints* constraints); 3806 bool V8EXPORT SetResourceConstraints(ResourceConstraints* constraints);
3836 3807
3837 3808
3838 // --- Exceptions --- 3809 // --- Exceptions ---
3839 3810
3840 3811
3841 typedef void (*FatalErrorCallback)(const char* location, const char* message); 3812 typedef void (*FatalErrorCallback)(const char* location, const char* message);
3842 3813
3843 3814
3844 typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> error); 3815 typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> error);
3845 3816
3846 3817
3847 /** 3818 /**
3848 * Schedules an exception to be thrown when returning to JavaScript. When an 3819 * Schedules an exception to be thrown when returning to JavaScript. When an
3849 * exception has been scheduled it is illegal to invoke any JavaScript 3820 * exception has been scheduled it is illegal to invoke any JavaScript
3850 * operation; the caller must return immediately and only after the exception 3821 * operation; the caller must return immediately and only after the exception
3851 * has been handled does it become legal to invoke JavaScript operations. 3822 * has been handled does it become legal to invoke JavaScript operations.
3852 */ 3823 */
3853 Handle<Value> V8_EXPORT ThrowException(Handle<Value> exception); 3824 Handle<Value> V8EXPORT ThrowException(Handle<Value> exception);
3854 3825
3855 /** 3826 /**
3856 * Create new error objects by calling the corresponding error object 3827 * Create new error objects by calling the corresponding error object
3857 * constructor with the message. 3828 * constructor with the message.
3858 */ 3829 */
3859 class V8_EXPORT Exception { 3830 class V8EXPORT Exception {
3860 public: 3831 public:
3861 static Local<Value> RangeError(Handle<String> message); 3832 static Local<Value> RangeError(Handle<String> message);
3862 static Local<Value> ReferenceError(Handle<String> message); 3833 static Local<Value> ReferenceError(Handle<String> message);
3863 static Local<Value> SyntaxError(Handle<String> message); 3834 static Local<Value> SyntaxError(Handle<String> message);
3864 static Local<Value> TypeError(Handle<String> message); 3835 static Local<Value> TypeError(Handle<String> message);
3865 static Local<Value> Error(Handle<String> message); 3836 static Local<Value> Error(Handle<String> message);
3866 }; 3837 };
3867 3838
3868 3839
3869 // --- Counters Callbacks --- 3840 // --- Counters Callbacks ---
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
3943 3914
3944 typedef void (*GCCallback)(); 3915 typedef void (*GCCallback)();
3945 3916
3946 3917
3947 /** 3918 /**
3948 * Collection of V8 heap information. 3919 * Collection of V8 heap information.
3949 * 3920 *
3950 * Instances of this class can be passed to v8::V8::HeapStatistics to 3921 * Instances of this class can be passed to v8::V8::HeapStatistics to
3951 * get heap statistics from V8. 3922 * get heap statistics from V8.
3952 */ 3923 */
3953 class V8_EXPORT HeapStatistics { 3924 class V8EXPORT HeapStatistics {
3954 public: 3925 public:
3955 HeapStatistics(); 3926 HeapStatistics();
3956 size_t total_heap_size() { return total_heap_size_; } 3927 size_t total_heap_size() { return total_heap_size_; }
3957 size_t total_heap_size_executable() { return total_heap_size_executable_; } 3928 size_t total_heap_size_executable() { return total_heap_size_executable_; }
3958 size_t total_physical_size() { return total_physical_size_; } 3929 size_t total_physical_size() { return total_physical_size_; }
3959 size_t used_heap_size() { return used_heap_size_; } 3930 size_t used_heap_size() { return used_heap_size_; }
3960 size_t heap_size_limit() { return heap_size_limit_; } 3931 size_t heap_size_limit() { return heap_size_limit_; }
3961 3932
3962 private: 3933 private:
3963 size_t total_heap_size_; 3934 size_t total_heap_size_;
(...skipping 11 matching lines...) Expand all
3975 3946
3976 /** 3947 /**
3977 * Isolate represents an isolated instance of the V8 engine. V8 3948 * Isolate represents an isolated instance of the V8 engine. V8
3978 * isolates have completely separate states. Objects from one isolate 3949 * isolates have completely separate states. Objects from one isolate
3979 * must not be used in other isolates. When V8 is initialized a 3950 * must not be used in other isolates. When V8 is initialized a
3980 * default isolate is implicitly created and entered. The embedder 3951 * default isolate is implicitly created and entered. The embedder
3981 * can create additional isolates and use them in parallel in multiple 3952 * can create additional isolates and use them in parallel in multiple
3982 * threads. An isolate can be entered by at most one thread at any 3953 * threads. An isolate can be entered by at most one thread at any
3983 * given time. The Locker/Unlocker API must be used to synchronize. 3954 * given time. The Locker/Unlocker API must be used to synchronize.
3984 */ 3955 */
3985 class V8_EXPORT Isolate { 3956 class V8EXPORT Isolate {
3986 public: 3957 public:
3987 /** 3958 /**
3988 * Stack-allocated class which sets the isolate for all operations 3959 * Stack-allocated class which sets the isolate for all operations
3989 * executed within a local scope. 3960 * executed within a local scope.
3990 */ 3961 */
3991 class V8_EXPORT Scope { 3962 class V8EXPORT Scope {
3992 public: 3963 public:
3993 explicit Scope(Isolate* isolate) : isolate_(isolate) { 3964 explicit Scope(Isolate* isolate) : isolate_(isolate) {
3994 isolate->Enter(); 3965 isolate->Enter();
3995 } 3966 }
3996 3967
3997 ~Scope() { isolate_->Exit(); } 3968 ~Scope() { isolate_->Exit(); }
3998 3969
3999 private: 3970 private:
4000 Isolate* const isolate_; 3971 Isolate* const isolate_;
4001 3972
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
4129 private: 4100 private:
4130 Isolate(); 4101 Isolate();
4131 Isolate(const Isolate&); 4102 Isolate(const Isolate&);
4132 ~Isolate(); 4103 ~Isolate();
4133 Isolate& operator=(const Isolate&); 4104 Isolate& operator=(const Isolate&);
4134 void* operator new(size_t size); 4105 void* operator new(size_t size);
4135 void operator delete(void*, size_t); 4106 void operator delete(void*, size_t);
4136 }; 4107 };
4137 4108
4138 4109
4139 class V8_EXPORT StartupData { 4110 class V8EXPORT StartupData {
4140 public: 4111 public:
4141 enum CompressionAlgorithm { 4112 enum CompressionAlgorithm {
4142 kUncompressed, 4113 kUncompressed,
4143 kBZip2 4114 kBZip2
4144 }; 4115 };
4145 4116
4146 const char* data; 4117 const char* data;
4147 int compressed_size; 4118 int compressed_size;
4148 int raw_size; 4119 int raw_size;
4149 }; 4120 };
4150 4121
4151 4122
4152 /** 4123 /**
4153 * A helper class for driving V8 startup data decompression. It is based on 4124 * A helper class for driving V8 startup data decompression. It is based on
4154 * "CompressedStartupData" API functions from the V8 class. It isn't mandatory 4125 * "CompressedStartupData" API functions from the V8 class. It isn't mandatory
4155 * for an embedder to use this class, instead, API functions can be used 4126 * for an embedder to use this class, instead, API functions can be used
4156 * directly. 4127 * directly.
4157 * 4128 *
4158 * For an example of the class usage, see the "shell.cc" sample application. 4129 * For an example of the class usage, see the "shell.cc" sample application.
4159 */ 4130 */
4160 class V8_EXPORT StartupDataDecompressor { // NOLINT 4131 class V8EXPORT StartupDataDecompressor { // NOLINT
4161 public: 4132 public:
4162 StartupDataDecompressor(); 4133 StartupDataDecompressor();
4163 virtual ~StartupDataDecompressor(); 4134 virtual ~StartupDataDecompressor();
4164 int Decompress(); 4135 int Decompress();
4165 4136
4166 protected: 4137 protected:
4167 virtual int DecompressData(char* raw_data, 4138 virtual int DecompressData(char* raw_data,
4168 int* raw_data_size, 4139 int* raw_data_size,
4169 const char* compressed_data, 4140 const char* compressed_data,
4170 int compressed_data_size) = 0; 4141 int compressed_data_size) = 0;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
4294 * Callback function passed to SetJitCodeEventHandler. 4265 * Callback function passed to SetJitCodeEventHandler.
4295 * 4266 *
4296 * \param event code add, move or removal event. 4267 * \param event code add, move or removal event.
4297 */ 4268 */
4298 typedef void (*JitCodeEventHandler)(const JitCodeEvent* event); 4269 typedef void (*JitCodeEventHandler)(const JitCodeEvent* event);
4299 4270
4300 4271
4301 /** 4272 /**
4302 * Interface for iterating through all external resources in the heap. 4273 * Interface for iterating through all external resources in the heap.
4303 */ 4274 */
4304 class V8_EXPORT ExternalResourceVisitor { // NOLINT 4275 class V8EXPORT ExternalResourceVisitor { // NOLINT
4305 public: 4276 public:
4306 virtual ~ExternalResourceVisitor() {} 4277 virtual ~ExternalResourceVisitor() {}
4307 virtual void VisitExternalString(Handle<String> string) {} 4278 virtual void VisitExternalString(Handle<String> string) {}
4308 }; 4279 };
4309 4280
4310 4281
4311 /** 4282 /**
4312 * Interface for iterating through all the persistent handles in the heap. 4283 * Interface for iterating through all the persistent handles in the heap.
4313 */ 4284 */
4314 class V8_EXPORT PersistentHandleVisitor { // NOLINT 4285 class V8EXPORT PersistentHandleVisitor { // NOLINT
4315 public: 4286 public:
4316 virtual ~PersistentHandleVisitor() {} 4287 virtual ~PersistentHandleVisitor() {}
4317 virtual void VisitPersistentHandle(Persistent<Value>* value, 4288 virtual void VisitPersistentHandle(Persistent<Value>* value,
4318 uint16_t class_id) {} 4289 uint16_t class_id) {}
4319 }; 4290 };
4320 4291
4321 4292
4322 /** 4293 /**
4323 * Asserts that no action is performed that could cause a handle's value 4294 * Asserts that no action is performed that could cause a handle's value
4324 * to be modified. Useful when otherwise unsafe handle operations need to 4295 * to be modified. Useful when otherwise unsafe handle operations need to
4325 * be performed. 4296 * be performed.
4326 */ 4297 */
4327 class V8_EXPORT AssertNoGCScope { 4298 class V8EXPORT AssertNoGCScope {
4328 #ifndef DEBUG 4299 #ifndef DEBUG
4329 // TODO(yangguo): remove isolate argument. 4300 // TODO(yangguo): remove isolate argument.
4330 V8_INLINE(AssertNoGCScope(Isolate* isolate)) { } 4301 V8_INLINE(AssertNoGCScope(Isolate* isolate)) { }
4331 #else 4302 #else
4332 AssertNoGCScope(Isolate* isolate); 4303 AssertNoGCScope(Isolate* isolate);
4333 ~AssertNoGCScope(); 4304 ~AssertNoGCScope();
4334 private: 4305 private:
4335 void* disallow_heap_allocation_; 4306 void* disallow_heap_allocation_;
4336 #endif 4307 #endif
4337 }; 4308 };
4338 4309
4339 4310
4340 /** 4311 /**
4341 * Container class for static utility functions. 4312 * Container class for static utility functions.
4342 */ 4313 */
4343 class V8_EXPORT V8 { 4314 class V8EXPORT V8 {
4344 public: 4315 public:
4345 /** Set the callback to invoke in case of fatal errors. */ 4316 /** Set the callback to invoke in case of fatal errors. */
4346 static void SetFatalErrorHandler(FatalErrorCallback that); 4317 static void SetFatalErrorHandler(FatalErrorCallback that);
4347 4318
4348 /** 4319 /**
4349 * Set the callback to invoke to check if code generation from 4320 * Set the callback to invoke to check if code generation from
4350 * strings should be allowed. 4321 * strings should be allowed.
4351 */ 4322 */
4352 static void SetAllowCodeGenerationFromStringsCallback( 4323 static void SetAllowCodeGenerationFromStringsCallback(
4353 AllowCodeGenerationFromStringsCallback that); 4324 AllowCodeGenerationFromStringsCallback that);
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
4790 V8(); 4761 V8();
4791 4762
4792 static internal::Object** GlobalizeReference(internal::Isolate* isolate, 4763 static internal::Object** GlobalizeReference(internal::Isolate* isolate,
4793 internal::Object** handle); 4764 internal::Object** handle);
4794 static void DisposeGlobal(internal::Object** global_handle); 4765 static void DisposeGlobal(internal::Object** global_handle);
4795 typedef WeakReferenceCallbacks<Value, void>::Revivable RevivableCallback; 4766 typedef WeakReferenceCallbacks<Value, void>::Revivable RevivableCallback;
4796 static void MakeWeak(internal::Object** global_handle, 4767 static void MakeWeak(internal::Object** global_handle,
4797 void* data, 4768 void* data,
4798 RevivableCallback weak_reference_callback); 4769 RevivableCallback weak_reference_callback);
4799 static void ClearWeak(internal::Object** global_handle); 4770 static void ClearWeak(internal::Object** global_handle);
4800 static int Eternalize(internal::Isolate* isolate,
4801 internal::Object** handle);
4802 static internal::Object** GetEternal(internal::Isolate* isolate, int index);
4803 4771
4804 template <class T> friend class Handle; 4772 template <class T> friend class Handle;
4805 template <class T> friend class Local; 4773 template <class T> friend class Local;
4806 template <class T> friend class Persistent; 4774 template <class T> friend class Persistent;
4807 friend class Context; 4775 friend class Context;
4808 }; 4776 };
4809 4777
4810 4778
4811 /** 4779 /**
4812 * An external exception handler. 4780 * An external exception handler.
4813 */ 4781 */
4814 class V8_EXPORT TryCatch { 4782 class V8EXPORT TryCatch {
4815 public: 4783 public:
4816 /** 4784 /**
4817 * Creates a new try/catch block and registers it with v8. Note that 4785 * Creates a new try/catch block and registers it with v8. Note that
4818 * all TryCatch blocks should be stack allocated because the memory 4786 * all TryCatch blocks should be stack allocated because the memory
4819 * location itself is compared against JavaScript try/catch blocks. 4787 * location itself is compared against JavaScript try/catch blocks.
4820 */ 4788 */
4821 TryCatch(); 4789 TryCatch();
4822 4790
4823 /** 4791 /**
4824 * Unregisters and deletes this try/catch block. 4792 * Unregisters and deletes this try/catch block.
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
4937 friend class v8::internal::Isolate; 4905 friend class v8::internal::Isolate;
4938 }; 4906 };
4939 4907
4940 4908
4941 // --- Context --- 4909 // --- Context ---
4942 4910
4943 4911
4944 /** 4912 /**
4945 * Ignore 4913 * Ignore
4946 */ 4914 */
4947 class V8_EXPORT ExtensionConfiguration { 4915 class V8EXPORT ExtensionConfiguration {
4948 public: 4916 public:
4949 ExtensionConfiguration(int name_count, const char* names[]) 4917 ExtensionConfiguration(int name_count, const char* names[])
4950 : name_count_(name_count), names_(names) { } 4918 : name_count_(name_count), names_(names) { }
4951 private: 4919 private:
4952 friend class ImplementationUtilities; 4920 friend class ImplementationUtilities;
4953 int name_count_; 4921 int name_count_;
4954 const char** names_; 4922 const char** names_;
4955 }; 4923 };
4956 4924
4957 4925
4958 /** 4926 /**
4959 * A sandboxed execution context with its own set of built-in objects 4927 * A sandboxed execution context with its own set of built-in objects
4960 * and functions. 4928 * and functions.
4961 */ 4929 */
4962 class V8_EXPORT Context { 4930 class V8EXPORT Context {
4963 public: 4931 public:
4964 /** 4932 /**
4965 * Returns the global proxy object or global object itself for 4933 * Returns the global proxy object or global object itself for
4966 * detached contexts. 4934 * detached contexts.
4967 * 4935 *
4968 * Global proxy object is a thin wrapper whose prototype points to 4936 * Global proxy object is a thin wrapper whose prototype points to
4969 * actual context's global object with the properties like Object, etc. 4937 * actual context's global object with the properties like Object, etc.
4970 * This is done that way for security reasons (for more details see 4938 * This is done that way for security reasons (for more details see
4971 * https://wiki.mozilla.org/Gecko:SplitWindow). 4939 * https://wiki.mozilla.org/Gecko:SplitWindow).
4972 * 4940 *
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
5237 * // V8 not locked. 5205 * // V8 not locked.
5238 * } 5206 * }
5239 * isolate->Enter(); 5207 * isolate->Enter();
5240 * // V8 locked again (2 levels). 5208 * // V8 locked again (2 levels).
5241 * } 5209 * }
5242 * // V8 still locked (1 level). 5210 * // V8 still locked (1 level).
5243 * } 5211 * }
5244 * // V8 Now no longer locked. 5212 * // V8 Now no longer locked.
5245 * \endcode 5213 * \endcode
5246 */ 5214 */
5247 class V8_EXPORT Unlocker { 5215 class V8EXPORT Unlocker {
5248 public: 5216 public:
5249 /** 5217 /**
5250 * Initialize Unlocker for a given Isolate. 5218 * Initialize Unlocker for a given Isolate.
5251 */ 5219 */
5252 V8_INLINE(explicit Unlocker(Isolate* isolate)) { Initialize(isolate); } 5220 V8_INLINE(explicit Unlocker(Isolate* isolate)) { Initialize(isolate); }
5253 5221
5254 /** Deprecated. Use Isolate version instead. */ 5222 /** Deprecated. Use Isolate version instead. */
5255 V8_DEPRECATED(Unlocker()); 5223 V8_DEPRECATED(Unlocker());
5256 5224
5257 ~Unlocker(); 5225 ~Unlocker();
5258 private: 5226 private:
5259 void Initialize(Isolate* isolate); 5227 void Initialize(Isolate* isolate);
5260 5228
5261 internal::Isolate* isolate_; 5229 internal::Isolate* isolate_;
5262 }; 5230 };
5263 5231
5264 5232
5265 class V8_EXPORT Locker { 5233 class V8EXPORT Locker {
5266 public: 5234 public:
5267 /** 5235 /**
5268 * Initialize Locker for a given Isolate. 5236 * Initialize Locker for a given Isolate.
5269 */ 5237 */
5270 V8_INLINE(explicit Locker(Isolate* isolate)) { Initialize(isolate); } 5238 V8_INLINE(explicit Locker(Isolate* isolate)) { Initialize(isolate); }
5271 5239
5272 /** Deprecated. Use Isolate version instead. */ 5240 /** Deprecated. Use Isolate version instead. */
5273 V8_DEPRECATED(Locker()); 5241 V8_DEPRECATED(Locker());
5274 5242
5275 ~Locker(); 5243 ~Locker();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
5316 5284
5317 /** 5285 /**
5318 * A struct for exporting HeapStats data from V8, using "push" model. 5286 * A struct for exporting HeapStats data from V8, using "push" model.
5319 */ 5287 */
5320 struct HeapStatsUpdate; 5288 struct HeapStatsUpdate;
5321 5289
5322 5290
5323 /** 5291 /**
5324 * An interface for exporting data from V8, using "push" model. 5292 * An interface for exporting data from V8, using "push" model.
5325 */ 5293 */
5326 class V8_EXPORT OutputStream { // NOLINT 5294 class V8EXPORT OutputStream { // NOLINT
5327 public: 5295 public:
5328 enum OutputEncoding { 5296 enum OutputEncoding {
5329 kAscii = 0 // 7-bit ASCII. 5297 kAscii = 0 // 7-bit ASCII.
5330 }; 5298 };
5331 enum WriteResult { 5299 enum WriteResult {
5332 kContinue = 0, 5300 kContinue = 0,
5333 kAbort = 1 5301 kAbort = 1
5334 }; 5302 };
5335 virtual ~OutputStream() {} 5303 virtual ~OutputStream() {}
5336 /** Notify about the end of stream. */ 5304 /** Notify about the end of stream. */
(...skipping 16 matching lines...) Expand all
5353 virtual WriteResult WriteHeapStatsChunk(HeapStatsUpdate* data, int count) { 5321 virtual WriteResult WriteHeapStatsChunk(HeapStatsUpdate* data, int count) {
5354 return kAbort; 5322 return kAbort;
5355 }; 5323 };
5356 }; 5324 };
5357 5325
5358 5326
5359 /** 5327 /**
5360 * An interface for reporting progress and controlling long-running 5328 * An interface for reporting progress and controlling long-running
5361 * activities. 5329 * activities.
5362 */ 5330 */
5363 class V8_EXPORT ActivityControl { // NOLINT 5331 class V8EXPORT ActivityControl { // NOLINT
5364 public: 5332 public:
5365 enum ControlOption { 5333 enum ControlOption {
5366 kContinue = 0, 5334 kContinue = 0,
5367 kAbort = 1 5335 kAbort = 1
5368 }; 5336 };
5369 virtual ~ActivityControl() {} 5337 virtual ~ActivityControl() {}
5370 /** 5338 /**
5371 * Notify about current progress. The activity can be stopped by 5339 * Notify about current progress. The activity can be stopped by
5372 * returning kAbort as the callback result. 5340 * returning kAbort as the callback result.
5373 */ 5341 */
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
5476 static const int kStringEncodingMask = 0x4; 5444 static const int kStringEncodingMask = 0x4;
5477 static const int kExternalTwoByteRepresentationTag = 0x02; 5445 static const int kExternalTwoByteRepresentationTag = 0x02;
5478 static const int kExternalAsciiRepresentationTag = 0x06; 5446 static const int kExternalAsciiRepresentationTag = 0x06;
5479 5447
5480 static const int kIsolateEmbedderDataOffset = 1 * kApiPointerSize; 5448 static const int kIsolateEmbedderDataOffset = 1 * kApiPointerSize;
5481 static const int kIsolateRootsOffset = 3 * kApiPointerSize; 5449 static const int kIsolateRootsOffset = 3 * kApiPointerSize;
5482 static const int kUndefinedValueRootIndex = 5; 5450 static const int kUndefinedValueRootIndex = 5;
5483 static const int kNullValueRootIndex = 7; 5451 static const int kNullValueRootIndex = 7;
5484 static const int kTrueValueRootIndex = 8; 5452 static const int kTrueValueRootIndex = 8;
5485 static const int kFalseValueRootIndex = 9; 5453 static const int kFalseValueRootIndex = 9;
5486 static const int kEmptyStringRootIndex = 133; 5454 static const int kEmptyStringRootIndex = 135;
5487 5455
5488 static const int kNodeClassIdOffset = 1 * kApiPointerSize; 5456 static const int kNodeClassIdOffset = 1 * kApiPointerSize;
5489 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; 5457 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3;
5490 static const int kNodeStateMask = 0xf; 5458 static const int kNodeStateMask = 0xf;
5491 static const int kNodeStateIsWeakValue = 2; 5459 static const int kNodeStateIsWeakValue = 2;
5492 static const int kNodeStateIsPendingValue = 3;
5493 static const int kNodeStateIsNearDeathValue = 4; 5460 static const int kNodeStateIsNearDeathValue = 4;
5494 static const int kNodeIsIndependentShift = 4; 5461 static const int kNodeIsIndependentShift = 4;
5495 static const int kNodeIsPartiallyDependentShift = 5; 5462 static const int kNodeIsPartiallyDependentShift = 5;
5496 5463
5497 static const int kJSObjectType = 0xb1; 5464 static const int kJSObjectType = 0xb1;
5498 static const int kFirstNonstringType = 0x80; 5465 static const int kFirstNonstringType = 0x80;
5499 static const int kOddballType = 0x83; 5466 static const int kOddballType = 0x83;
5500 static const int kForeignType = 0x87; 5467 static const int kForeignType = 0x87;
5501 5468
5502 static const int kUndefinedOddballKind = 5; 5469 static const int kUndefinedOddballKind = 5;
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
5656 template <class T> 5623 template <class T>
5657 Local<T> Local<T>::New(Isolate* isolate, T* that) { 5624 Local<T> Local<T>::New(Isolate* isolate, T* that) {
5658 if (that == NULL) return Local<T>(); 5625 if (that == NULL) return Local<T>();
5659 T* that_ptr = that; 5626 T* that_ptr = that;
5660 internal::Object** p = reinterpret_cast<internal::Object**>(that_ptr); 5627 internal::Object** p = reinterpret_cast<internal::Object**>(that_ptr);
5661 return Local<T>(reinterpret_cast<T*>(HandleScope::CreateHandle( 5628 return Local<T>(reinterpret_cast<T*>(HandleScope::CreateHandle(
5662 reinterpret_cast<internal::Isolate*>(isolate), *p))); 5629 reinterpret_cast<internal::Isolate*>(isolate), *p)));
5663 } 5630 }
5664 5631
5665 5632
5666 template<class T>
5667 int Local<T>::Eternalize(Isolate* isolate) {
5668 return V8::Eternalize(reinterpret_cast<internal::Isolate*>(isolate),
5669 reinterpret_cast<internal::Object**>(this->val_));
5670 }
5671
5672
5673 template<class T>
5674 Local<T> Local<T>::GetEternal(Isolate* isolate, int index) {
5675 internal::Object** handle =
5676 V8::GetEternal(reinterpret_cast<internal::Isolate*>(isolate), index);
5677 return Local<T>(T::Cast(reinterpret_cast<Value*>(handle)));
5678 }
5679
5680
5681 #ifdef V8_USE_UNSAFE_HANDLES 5633 #ifdef V8_USE_UNSAFE_HANDLES
5682 template <class T> 5634 template <class T>
5683 Persistent<T> Persistent<T>::New(Handle<T> that) { 5635 Persistent<T> Persistent<T>::New(Handle<T> that) {
5684 return New(Isolate::GetCurrent(), that.val_); 5636 return New(Isolate::GetCurrent(), that.val_);
5685 } 5637 }
5686 5638
5687 5639
5688 template <class T> 5640 template <class T>
5689 Persistent<T> Persistent<T>::New(Isolate* isolate, Handle<T> that) { 5641 Persistent<T> Persistent<T>::New(Isolate* isolate, Handle<T> that) {
5690 return New(Isolate::GetCurrent(), that.val_); 5642 return New(Isolate::GetCurrent(), that.val_);
(...skipping 22 matching lines...) Expand all
5713 if (this->IsEmpty()) return false; 5665 if (this->IsEmpty()) return false;
5714 return I::GetNodeFlag(reinterpret_cast<internal::Object**>(this->val_), 5666 return I::GetNodeFlag(reinterpret_cast<internal::Object**>(this->val_),
5715 I::kNodeIsIndependentShift); 5667 I::kNodeIsIndependentShift);
5716 } 5668 }
5717 5669
5718 5670
5719 template <class T> 5671 template <class T>
5720 bool Persistent<T>::IsNearDeath() const { 5672 bool Persistent<T>::IsNearDeath() const {
5721 typedef internal::Internals I; 5673 typedef internal::Internals I;
5722 if (this->IsEmpty()) return false; 5674 if (this->IsEmpty()) return false;
5723 uint8_t node_state = 5675 return I::GetNodeState(reinterpret_cast<internal::Object**>(this->val_)) ==
5724 I::GetNodeState(reinterpret_cast<internal::Object**>(this->val_)); 5676 I::kNodeStateIsNearDeathValue;
5725 return node_state == I::kNodeStateIsNearDeathValue ||
5726 node_state == I::kNodeStateIsPendingValue;
5727 } 5677 }
5728 5678
5729 5679
5730 template <class T> 5680 template <class T>
5731 bool Persistent<T>::IsWeak() const { 5681 bool Persistent<T>::IsWeak() const {
5732 typedef internal::Internals I; 5682 typedef internal::Internals I;
5733 if (this->IsEmpty()) return false; 5683 if (this->IsEmpty()) return false;
5734 return I::GetNodeState(reinterpret_cast<internal::Object**>(this->val_)) == 5684 return I::GetNodeState(reinterpret_cast<internal::Object**>(this->val_)) ==
5735 I::kNodeStateIsWeakValue; 5685 I::kNodeStateIsWeakValue;
5736 } 5686 }
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
6582 6532
6583 6533
6584 /** 6534 /**
6585 * \example process.cc 6535 * \example process.cc
6586 */ 6536 */
6587 6537
6588 6538
6589 } // namespace v8 6539 } // namespace v8
6590 6540
6591 6541
6542 #undef V8EXPORT
6592 #undef TYPE_CHECK 6543 #undef TYPE_CHECK
6593 6544
6594 6545
6595 #endif // V8_H_ 6546 #endif // V8_H_
OLDNEW
« no previous file with comments | « build/standalone.gypi ('k') | include/v8-debug.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698