Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 448 private: | 448 private: |
| 449 friend class internal::GlobalHandles; | 449 friend class internal::GlobalHandles; |
| 450 WeakCallbackData(Isolate* isolate, Local<T> handle, P* parameter) | 450 WeakCallbackData(Isolate* isolate, Local<T> handle, P* parameter) |
| 451 : isolate_(isolate), handle_(handle), parameter_(parameter) { } | 451 : isolate_(isolate), handle_(handle), parameter_(parameter) { } |
| 452 Isolate* isolate_; | 452 Isolate* isolate_; |
| 453 Local<T> handle_; | 453 Local<T> handle_; |
| 454 P* parameter_; | 454 P* parameter_; |
| 455 }; | 455 }; |
| 456 | 456 |
| 457 | 457 |
| 458 // TODO(dcarney): Remove this class. | |
| 459 template<typename T, | |
| 460 typename P, | |
| 461 typename M = NonCopyablePersistentTraits<T> > | |
| 462 class WeakReferenceCallbacks { | |
| 463 public: | |
| 464 typedef void (*Revivable)(Isolate* isolate, | |
| 465 Persistent<T, M>* object, | |
| 466 P* parameter); | |
| 467 }; | |
| 468 | |
| 469 | |
| 470 /** | 458 /** |
| 471 * An object reference that is independent of any handle scope. Where | 459 * An object reference that is independent of any handle scope. Where |
| 472 * a Local handle only lives as long as the HandleScope in which it was | 460 * a Local handle only lives as long as the HandleScope in which it was |
| 473 * allocated, a PersistentBase handle remains valid until it is explicitly | 461 * allocated, a PersistentBase handle remains valid until it is explicitly |
| 474 * disposed. | 462 * disposed. |
| 475 * | 463 * |
| 476 * A persistent handle contains a reference to a storage cell within | 464 * A persistent handle contains a reference to a storage cell within |
| 477 * the v8 engine which holds an object value and which is updated by | 465 * the v8 engine which holds an object value and which is updated by |
| 478 * the garbage collector whenever the object is moved. A new storage | 466 * the garbage collector whenever the object is moved. A new storage |
| 479 * cell can be created using the constructor or PersistentBase::Reset and | 467 * cell can be created using the constructor or PersistentBase::Reset and |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 694 } | 682 } |
| 695 /** | 683 /** |
| 696 * The destructor will dispose the Persistent based on the | 684 * The destructor will dispose the Persistent based on the |
| 697 * kResetInDestructor flags in the traits class. Since not calling dispose | 685 * kResetInDestructor flags in the traits class. Since not calling dispose |
| 698 * can result in a memory leak, it is recommended to always set this flag. | 686 * can result in a memory leak, it is recommended to always set this flag. |
| 699 */ | 687 */ |
| 700 V8_INLINE ~Persistent() { | 688 V8_INLINE ~Persistent() { |
| 701 if (M::kResetInDestructor) this->Reset(); | 689 if (M::kResetInDestructor) this->Reset(); |
| 702 } | 690 } |
| 703 | 691 |
| 704 V8_DEPRECATED("Use Reset instead", | |
| 705 V8_INLINE void Dispose()) { this->Reset(); } | |
| 706 | |
| 707 // TODO(dcarney): this is pretty useless, fix or remove | 692 // TODO(dcarney): this is pretty useless, fix or remove |
| 708 template <class S> | 693 template <class S> |
| 709 V8_INLINE static Persistent<T>& Cast(Persistent<S>& that) { // NOLINT | 694 V8_INLINE static Persistent<T>& Cast(Persistent<S>& that) { // NOLINT |
| 710 #ifdef V8_ENABLE_CHECKS | 695 #ifdef V8_ENABLE_CHECKS |
| 711 // If we're going to perform the type check then we have to check | 696 // If we're going to perform the type check then we have to check |
| 712 // that the handle isn't empty before doing the checked cast. | 697 // that the handle isn't empty before doing the checked cast. |
| 713 if (!that.IsEmpty()) T::Cast(*that); | 698 if (!that.IsEmpty()) T::Cast(*that); |
| 714 #endif | 699 #endif |
| 715 return reinterpret_cast<Persistent<T>&>(that); | 700 return reinterpret_cast<Persistent<T>&>(that); |
| 716 } | 701 } |
| 717 | 702 |
| 718 // TODO(dcarney): this is pretty useless, fix or remove | 703 // TODO(dcarney): this is pretty useless, fix or remove |
| 719 template <class S> V8_INLINE Persistent<S>& As() { // NOLINT | 704 template <class S> V8_INLINE Persistent<S>& As() { // NOLINT |
| 720 return Persistent<S>::Cast(*this); | 705 return Persistent<S>::Cast(*this); |
| 721 } | 706 } |
| 722 | 707 |
| 723 template<typename S, typename P> | |
| 724 V8_DEPRECATED( | |
| 725 "Use SetWeak instead", | |
| 726 V8_INLINE void MakeWeak( | |
| 727 P* parameter, | |
| 728 typename WeakReferenceCallbacks<S, P>::Revivable callback)); | |
| 729 | |
| 730 template<typename P> | |
| 731 V8_DEPRECATED( | |
| 732 "Use SetWeak instead", | |
| 733 V8_INLINE void MakeWeak( | |
| 734 P* parameter, | |
| 735 typename WeakReferenceCallbacks<T, P>::Revivable callback)); | |
| 736 | |
| 737 // This will be removed. | 708 // This will be removed. |
| 738 V8_INLINE T* ClearAndLeak(); | 709 V8_INLINE T* ClearAndLeak(); |
| 739 | 710 |
| 740 V8_DEPRECATED("This will be removed", | |
| 741 V8_INLINE void Clear()) { this->val_ = 0; } | |
| 742 | |
| 743 // TODO(dcarney): remove | 711 // TODO(dcarney): remove |
| 744 #ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR | 712 #ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR |
| 745 | 713 |
| 746 private: | 714 private: |
| 747 #endif | 715 #endif |
| 748 template <class S> V8_INLINE Persistent(S* that) : PersistentBase<T>(that) { } | 716 template <class S> V8_INLINE Persistent(S* that) : PersistentBase<T>(that) { } |
| 749 | 717 |
| 750 V8_INLINE T* operator*() const { return this->val_; } | 718 V8_INLINE T* operator*() const { return this->val_; } |
| 751 | 719 |
| 752 private: | 720 private: |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 845 * garbage collector will no longer track the object stored in the | 813 * garbage collector will no longer track the object stored in the |
| 846 * handle and may deallocate it. The behavior of accessing a handle | 814 * handle and may deallocate it. The behavior of accessing a handle |
| 847 * for which the handle scope has been deleted is undefined. | 815 * for which the handle scope has been deleted is undefined. |
| 848 */ | 816 */ |
| 849 class V8_EXPORT HandleScope { | 817 class V8_EXPORT HandleScope { |
| 850 public: | 818 public: |
| 851 HandleScope(Isolate* isolate); | 819 HandleScope(Isolate* isolate); |
| 852 | 820 |
| 853 ~HandleScope(); | 821 ~HandleScope(); |
| 854 | 822 |
| 855 template <class T> | |
| 856 V8_DEPRECATED("Use EscapableHandleScope::Escape instead", | |
| 857 Local<T> Close(Handle<T> value)); | |
| 858 | |
| 859 /** | 823 /** |
| 860 * Counts the number of allocated handles. | 824 * Counts the number of allocated handles. |
| 861 */ | 825 */ |
| 862 static int NumberOfHandles(); | 826 static int NumberOfHandles(); |
| 863 | 827 |
| 864 private: | 828 private: |
| 865 /** | 829 /** |
| 866 * Creates a new handle with the given value. | 830 * Creates a new handle with the given value. |
| 867 */ | 831 */ |
| 868 static internal::Object** CreateHandle(internal::Isolate* isolate, | 832 static internal::Object** CreateHandle(internal::Isolate* isolate, |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 887 public: | 851 public: |
| 888 internal::Object** next; | 852 internal::Object** next; |
| 889 internal::Object** limit; | 853 internal::Object** limit; |
| 890 int level; | 854 int level; |
| 891 V8_INLINE void Initialize() { | 855 V8_INLINE void Initialize() { |
| 892 next = limit = NULL; | 856 next = limit = NULL; |
| 893 level = 0; | 857 level = 0; |
| 894 } | 858 } |
| 895 }; | 859 }; |
| 896 | 860 |
| 897 void Leave(); | |
| 898 | |
| 899 internal::Isolate* isolate_; | 861 internal::Isolate* isolate_; |
| 900 internal::Object** prev_next_; | 862 internal::Object** prev_next_; |
| 901 internal::Object** prev_limit_; | 863 internal::Object** prev_limit_; |
| 902 | 864 |
| 903 // TODO(dcarney): remove this field | |
| 904 // Allow for the active closing of HandleScopes which allows to pass a handle | |
| 905 // from the HandleScope being closed to the next top most HandleScope. | |
| 906 bool is_closed_; | |
| 907 internal::Object** RawClose(internal::Object** value); | |
| 908 | |
| 909 friend class ImplementationUtilities; | 865 friend class ImplementationUtilities; |
| 910 friend class EscapableHandleScope; | 866 friend class EscapableHandleScope; |
| 911 template<class F> friend class Handle; | 867 template<class F> friend class Handle; |
| 912 template<class F> friend class Local; | 868 template<class F> friend class Local; |
| 913 friend class Object; | 869 friend class Object; |
| 914 friend class Context; | 870 friend class Context; |
| 915 }; | 871 }; |
| 916 | 872 |
| 917 | 873 |
| 918 /** | 874 /** |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1138 /** | 1094 /** |
| 1139 * Runs the script returning the resulting value. If the script is | 1095 * Runs the script returning the resulting value. If the script is |
| 1140 * context independent (created using ::New) it will be run in the | 1096 * context independent (created using ::New) it will be run in the |
| 1141 * currently entered context. If it is context specific (created | 1097 * currently entered context. If it is context specific (created |
| 1142 * using ::Compile) it will be run in the context in which it was | 1098 * using ::Compile) it will be run in the context in which it was |
| 1143 * compiled. | 1099 * compiled. |
| 1144 */ | 1100 */ |
| 1145 Local<Value> Run(); | 1101 Local<Value> Run(); |
| 1146 | 1102 |
| 1147 /** | 1103 /** |
| 1148 * Returns the script id value. | |
| 1149 */ | |
| 1150 V8_DEPRECATED("Use GetId instead", Local<Value> Id()); | |
| 1151 | |
| 1152 /** | |
| 1153 * Returns the script id. | 1104 * Returns the script id. |
| 1154 */ | 1105 */ |
| 1155 int GetId(); | 1106 int GetId(); |
| 1156 | 1107 |
| 1157 /** | 1108 /** |
| 1158 * Associate an additional data object with the script. This is mainly used | 1109 * Associate an additional data object with the script. This is mainly used |
| 1159 * with the debugger as this data object is only available through the | 1110 * with the debugger as this data object is only available through the |
| 1160 * debugger API. | 1111 * debugger API. |
| 1161 */ | 1112 */ |
| 1162 void SetData(Handle<String> data); | 1113 void SetData(Handle<String> data); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1233 int GetEndColumn() const; | 1184 int GetEndColumn() const; |
| 1234 | 1185 |
| 1235 /** | 1186 /** |
| 1236 * Passes on the value set by the embedder when it fed the script from which | 1187 * Passes on the value set by the embedder when it fed the script from which |
| 1237 * this Message was generated to V8. | 1188 * this Message was generated to V8. |
| 1238 */ | 1189 */ |
| 1239 bool IsSharedCrossOrigin() const; | 1190 bool IsSharedCrossOrigin() const; |
| 1240 | 1191 |
| 1241 // TODO(1245381): Print to a string instead of on a FILE. | 1192 // TODO(1245381): Print to a string instead of on a FILE. |
| 1242 static void PrintCurrentStackTrace(Isolate* isolate, FILE* out); | 1193 static void PrintCurrentStackTrace(Isolate* isolate, FILE* out); |
| 1243 V8_DEPRECATED("Will be removed", | |
| 1244 static void PrintCurrentStackTrace(FILE* out)); | |
| 1245 | 1194 |
| 1246 static const int kNoLineNumberInfo = 0; | 1195 static const int kNoLineNumberInfo = 0; |
| 1247 static const int kNoColumnInfo = 0; | 1196 static const int kNoColumnInfo = 0; |
| 1248 static const int kNoScriptIdInfo = 0; | 1197 static const int kNoScriptIdInfo = 0; |
| 1249 }; | 1198 }; |
| 1250 | 1199 |
| 1251 | 1200 |
| 1252 /** | 1201 /** |
| 1253 * Representation of a JavaScript stack trace. The information collected is a | 1202 * Representation of a JavaScript stack trace. The information collected is a |
| 1254 * snapshot of the execution stack and the information remains valid after | 1203 * snapshot of the execution stack and the information remains valid after |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1292 * Grab a snapshot of the current JavaScript execution stack. | 1241 * Grab a snapshot of the current JavaScript execution stack. |
| 1293 * | 1242 * |
| 1294 * \param frame_limit The maximum number of stack frames we want to capture. | 1243 * \param frame_limit The maximum number of stack frames we want to capture. |
| 1295 * \param options Enumerates the set of things we will capture for each | 1244 * \param options Enumerates the set of things we will capture for each |
| 1296 * StackFrame. | 1245 * StackFrame. |
| 1297 */ | 1246 */ |
| 1298 static Local<StackTrace> CurrentStackTrace( | 1247 static Local<StackTrace> CurrentStackTrace( |
| 1299 Isolate* isolate, | 1248 Isolate* isolate, |
| 1300 int frame_limit, | 1249 int frame_limit, |
| 1301 StackTraceOptions options = kOverview); | 1250 StackTraceOptions options = kOverview); |
| 1302 V8_DEPRECATED("Will be removed", | |
| 1303 static Local<StackTrace> CurrentStackTrace( | |
| 1304 int frame_limit, StackTraceOptions options = kOverview)); | |
| 1305 }; | 1251 }; |
| 1306 | 1252 |
| 1307 | 1253 |
| 1308 /** | 1254 /** |
| 1309 * A single JavaScript stack frame. | 1255 * A single JavaScript stack frame. |
| 1310 */ | 1256 */ |
| 1311 class V8_EXPORT StackFrame { | 1257 class V8_EXPORT StackFrame { |
| 1312 public: | 1258 public: |
| 1313 /** | 1259 /** |
| 1314 * Returns the number, 1-based, of the line for the associate function call. | 1260 * Returns the number, 1-based, of the line for the associate function call. |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1626 | 1572 |
| 1627 | 1573 |
| 1628 /** | 1574 /** |
| 1629 * A primitive boolean value (ECMA-262, 4.3.14). Either the true | 1575 * A primitive boolean value (ECMA-262, 4.3.14). Either the true |
| 1630 * or false value. | 1576 * or false value. |
| 1631 */ | 1577 */ |
| 1632 class V8_EXPORT Boolean : public Primitive { | 1578 class V8_EXPORT Boolean : public Primitive { |
| 1633 public: | 1579 public: |
| 1634 bool Value() const; | 1580 bool Value() const; |
| 1635 V8_INLINE static Handle<Boolean> New(Isolate* isolate, bool value); | 1581 V8_INLINE static Handle<Boolean> New(Isolate* isolate, bool value); |
| 1636 V8_DEPRECATED("Will be removed", | |
| 1637 V8_INLINE static Handle<Boolean> New(bool value)); | |
| 1638 }; | 1582 }; |
| 1639 | 1583 |
| 1640 | 1584 |
| 1641 /** | 1585 /** |
| 1642 * A JavaScript string value (ECMA-262, 4.3.17). | 1586 * A JavaScript string value (ECMA-262, 4.3.17). |
| 1643 */ | 1587 */ |
| 1644 class V8_EXPORT String : public Primitive { | 1588 class V8_EXPORT String : public Primitive { |
| 1645 public: | 1589 public: |
| 1646 enum Encoding { | 1590 enum Encoding { |
| 1647 UNKNOWN_ENCODING = 0x1, | 1591 UNKNOWN_ENCODING = 0x1, |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1833 V8_INLINE ExternalStringResource* GetExternalStringResource() const; | 1777 V8_INLINE ExternalStringResource* GetExternalStringResource() const; |
| 1834 | 1778 |
| 1835 /** | 1779 /** |
| 1836 * Get the ExternalAsciiStringResource for an external ASCII string. | 1780 * Get the ExternalAsciiStringResource for an external ASCII string. |
| 1837 * Returns NULL if IsExternalAscii() doesn't return true. | 1781 * Returns NULL if IsExternalAscii() doesn't return true. |
| 1838 */ | 1782 */ |
| 1839 const ExternalAsciiStringResource* GetExternalAsciiStringResource() const; | 1783 const ExternalAsciiStringResource* GetExternalAsciiStringResource() const; |
| 1840 | 1784 |
| 1841 V8_INLINE static String* Cast(v8::Value* obj); | 1785 V8_INLINE static String* Cast(v8::Value* obj); |
| 1842 | 1786 |
| 1843 /** | |
| 1844 * Allocates a new string from either UTF-8 encoded or ASCII data. | |
| 1845 * The second parameter 'length' gives the buffer length. If omitted, | |
| 1846 * the function calls 'strlen' to determine the buffer length. | |
| 1847 */ | |
| 1848 V8_DEPRECATED( | |
| 1849 "Use NewFromUtf8 instead", | |
| 1850 V8_INLINE static Local<String> New(const char* data, int length = -1)); | |
| 1851 | |
| 1852 /** Allocates a new string from 16-bit character codes.*/ | |
| 1853 V8_DEPRECATED( | |
| 1854 "Use NewFromTwoByte instead", | |
| 1855 V8_INLINE static Local<String> New( | |
| 1856 const uint16_t* data, int length = -1)); | |
| 1857 | |
| 1858 /** | |
| 1859 * Creates an internalized string (historically called a "symbol", | |
| 1860 * not to be confused with ES6 symbols). Returns one if it exists already. | |
| 1861 */ | |
| 1862 V8_DEPRECATED( | |
| 1863 "Use NewFromUtf8 instead", | |
| 1864 V8_INLINE static Local<String> NewSymbol( | |
| 1865 const char* data, int length = -1)); | |
| 1866 | |
| 1867 enum NewStringType { | 1787 enum NewStringType { |
| 1868 kNormalString, kInternalizedString, kUndetectableString | 1788 kNormalString, kInternalizedString, kUndetectableString |
| 1869 }; | 1789 }; |
| 1870 | 1790 |
| 1871 /** Allocates a new string from UTF-8 data.*/ | 1791 /** Allocates a new string from UTF-8 data.*/ |
| 1872 static Local<String> NewFromUtf8(Isolate* isolate, | 1792 static Local<String> NewFromUtf8(Isolate* isolate, |
| 1873 const char* data, | 1793 const char* data, |
| 1874 NewStringType type = kNormalString, | 1794 NewStringType type = kNormalString, |
| 1875 int length = -1); | 1795 int length = -1); |
| 1876 | 1796 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 1897 /** | 1817 /** |
| 1898 * Creates a new external string using the data defined in the given | 1818 * Creates a new external string using the data defined in the given |
| 1899 * resource. When the external string is no longer live on V8's heap the | 1819 * resource. When the external string is no longer live on V8's heap the |
| 1900 * resource will be disposed by calling its Dispose method. The caller of | 1820 * resource will be disposed by calling its Dispose method. The caller of |
| 1901 * this function should not otherwise delete or modify the resource. Neither | 1821 * this function should not otherwise delete or modify the resource. Neither |
| 1902 * should the underlying buffer be deallocated or modified except through the | 1822 * should the underlying buffer be deallocated or modified except through the |
| 1903 * destructor of the external string resource. | 1823 * destructor of the external string resource. |
| 1904 */ | 1824 */ |
| 1905 static Local<String> NewExternal(Isolate* isolate, | 1825 static Local<String> NewExternal(Isolate* isolate, |
| 1906 ExternalStringResource* resource); | 1826 ExternalStringResource* resource); |
| 1907 V8_DEPRECATED("Will be removed", static Local<String> NewExternal( | |
| 1908 ExternalStringResource* resource)); | |
| 1909 | 1827 |
| 1910 /** | 1828 /** |
| 1911 * Associate an external string resource with this string by transforming it | 1829 * Associate an external string resource with this string by transforming it |
| 1912 * in place so that existing references to this string in the JavaScript heap | 1830 * in place so that existing references to this string in the JavaScript heap |
| 1913 * will use the external string resource. The external string resource's | 1831 * will use the external string resource. The external string resource's |
| 1914 * character contents need to be equivalent to this string. | 1832 * character contents need to be equivalent to this string. |
| 1915 * Returns true if the string has been changed to be an external string. | 1833 * Returns true if the string has been changed to be an external string. |
| 1916 * The string is not modified if the operation fails. See NewExternal for | 1834 * The string is not modified if the operation fails. See NewExternal for |
| 1917 * information on the lifetime of the resource. | 1835 * information on the lifetime of the resource. |
| 1918 */ | 1836 */ |
| 1919 bool MakeExternal(ExternalStringResource* resource); | 1837 bool MakeExternal(ExternalStringResource* resource); |
| 1920 | 1838 |
| 1921 /** | 1839 /** |
| 1922 * Creates a new external string using the ASCII data defined in the given | 1840 * Creates a new external string using the ASCII data defined in the given |
| 1923 * resource. When the external string is no longer live on V8's heap the | 1841 * resource. When the external string is no longer live on V8's heap the |
| 1924 * resource will be disposed by calling its Dispose method. The caller of | 1842 * resource will be disposed by calling its Dispose method. The caller of |
| 1925 * this function should not otherwise delete or modify the resource. Neither | 1843 * this function should not otherwise delete or modify the resource. Neither |
| 1926 * should the underlying buffer be deallocated or modified except through the | 1844 * should the underlying buffer be deallocated or modified except through the |
| 1927 * destructor of the external string resource. | 1845 * destructor of the external string resource. |
| 1928 */ | 1846 */ |
| 1929 static Local<String> NewExternal(Isolate* isolate, | 1847 static Local<String> NewExternal(Isolate* isolate, |
| 1930 ExternalAsciiStringResource* resource); | 1848 ExternalAsciiStringResource* resource); |
| 1931 V8_DEPRECATED("Will be removed", static Local<String> NewExternal( | |
| 1932 ExternalAsciiStringResource* resource)); | |
| 1933 | 1849 |
| 1934 /** | 1850 /** |
| 1935 * Associate an external string resource with this string by transforming it | 1851 * Associate an external string resource with this string by transforming it |
| 1936 * in place so that existing references to this string in the JavaScript heap | 1852 * in place so that existing references to this string in the JavaScript heap |
| 1937 * will use the external string resource. The external string resource's | 1853 * will use the external string resource. The external string resource's |
| 1938 * character contents need to be equivalent to this string. | 1854 * character contents need to be equivalent to this string. |
| 1939 * Returns true if the string has been changed to be an external string. | 1855 * Returns true if the string has been changed to be an external string. |
| 1940 * The string is not modified if the operation fails. See NewExternal for | 1856 * The string is not modified if the operation fails. See NewExternal for |
| 1941 * information on the lifetime of the resource. | 1857 * information on the lifetime of the resource. |
| 1942 */ | 1858 */ |
| 1943 bool MakeExternal(ExternalAsciiStringResource* resource); | 1859 bool MakeExternal(ExternalAsciiStringResource* resource); |
| 1944 | 1860 |
| 1945 /** | 1861 /** |
| 1946 * Returns true if this string can be made external. | 1862 * Returns true if this string can be made external. |
| 1947 */ | 1863 */ |
| 1948 bool CanMakeExternal(); | 1864 bool CanMakeExternal(); |
| 1949 | 1865 |
| 1950 /** Creates an undetectable string from the supplied ASCII or UTF-8 data.*/ | |
| 1951 V8_DEPRECATED( | |
| 1952 "Use NewFromUtf8 instead", | |
| 1953 V8_INLINE static Local<String> NewUndetectable(const char* data, | |
| 1954 int length = -1)); | |
| 1955 | |
| 1956 /** Creates an undetectable string from the supplied 16-bit character codes.*/ | |
| 1957 V8_DEPRECATED( | |
| 1958 "Use NewFromTwoByte instead", | |
| 1959 V8_INLINE static Local<String> NewUndetectable(const uint16_t* data, | |
| 1960 int length = -1)); | |
| 1961 | |
| 1962 /** | 1866 /** |
| 1963 * Converts an object to a UTF-8-encoded character array. Useful if | 1867 * Converts an object to a UTF-8-encoded character array. Useful if |
| 1964 * you want to print the object. If conversion to a string fails | 1868 * you want to print the object. If conversion to a string fails |
| 1965 * (e.g. due to an exception in the toString() method of the object) | 1869 * (e.g. due to an exception in the toString() method of the object) |
| 1966 * then the length() method returns 0 and the * operator returns | 1870 * then the length() method returns 0 and the * operator returns |
| 1967 * NULL. | 1871 * NULL. |
| 1968 */ | 1872 */ |
| 1969 class V8_EXPORT Utf8Value { | 1873 class V8_EXPORT Utf8Value { |
| 1970 public: | 1874 public: |
| 1971 explicit Utf8Value(Handle<v8::Value> obj); | 1875 explicit Utf8Value(Handle<v8::Value> obj); |
| 1972 ~Utf8Value(); | 1876 ~Utf8Value(); |
| 1973 char* operator*() { return str_; } | 1877 char* operator*() { return str_; } |
| 1974 const char* operator*() const { return str_; } | 1878 const char* operator*() const { return str_; } |
| 1975 int length() const { return length_; } | 1879 int length() const { return length_; } |
| 1976 private: | 1880 private: |
| 1977 char* str_; | 1881 char* str_; |
| 1978 int length_; | 1882 int length_; |
| 1979 | 1883 |
| 1980 // Disallow copying and assigning. | 1884 // Disallow copying and assigning. |
| 1981 Utf8Value(const Utf8Value&); | 1885 Utf8Value(const Utf8Value&); |
| 1982 void operator=(const Utf8Value&); | 1886 void operator=(const Utf8Value&); |
| 1983 }; | 1887 }; |
| 1984 | 1888 |
| 1985 /** | 1889 /** |
| 1986 * Converts an object to an ASCII string. | |
| 1987 * Useful if you want to print the object. | |
| 1988 * If conversion to a string fails (eg. due to an exception in the toString() | |
| 1989 * method of the object) then the length() method returns 0 and the * operator | |
| 1990 * returns NULL. | |
| 1991 */ | |
| 1992 class V8_EXPORT AsciiValue { | |
| 1993 public: | |
| 1994 V8_DEPRECATED("Use Utf8Value instead", | |
| 1995 explicit AsciiValue(Handle<v8::Value> obj)); | |
| 1996 ~AsciiValue(); | |
| 1997 char* operator*() { return str_; } | |
| 1998 const char* operator*() const { return str_; } | |
| 1999 int length() const { return length_; } | |
| 2000 private: | |
| 2001 char* str_; | |
| 2002 int length_; | |
| 2003 | |
| 2004 // Disallow copying and assigning. | |
| 2005 AsciiValue(const AsciiValue&); | |
| 2006 void operator=(const AsciiValue&); | |
| 2007 }; | |
| 2008 | |
| 2009 /** | |
| 2010 * Converts an object to a two-byte string. | 1890 * Converts an object to a two-byte string. |
| 2011 * If conversion to a string fails (eg. due to an exception in the toString() | 1891 * If conversion to a string fails (eg. due to an exception in the toString() |
| 2012 * method of the object) then the length() method returns 0 and the * operator | 1892 * method of the object) then the length() method returns 0 and the * operator |
| 2013 * returns NULL. | 1893 * returns NULL. |
| 2014 */ | 1894 */ |
| 2015 class V8_EXPORT Value { | 1895 class V8_EXPORT Value { |
| 2016 public: | 1896 public: |
| 2017 explicit Value(Handle<v8::Value> obj); | 1897 explicit Value(Handle<v8::Value> obj); |
| 2018 ~Value(); | 1898 ~Value(); |
| 2019 uint16_t* operator*() { return str_; } | 1899 uint16_t* operator*() { return str_; } |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2480 * Clones an element at index |index|. Returns an empty | 2360 * Clones an element at index |index|. Returns an empty |
| 2481 * handle if cloning fails (for any reason). | 2361 * handle if cloning fails (for any reason). |
| 2482 */ | 2362 */ |
| 2483 Local<Object> CloneElementAt(uint32_t index); | 2363 Local<Object> CloneElementAt(uint32_t index); |
| 2484 | 2364 |
| 2485 /** | 2365 /** |
| 2486 * Creates a JavaScript array with the given length. If the length | 2366 * Creates a JavaScript array with the given length. If the length |
| 2487 * is negative the returned array will have length 0. | 2367 * is negative the returned array will have length 0. |
| 2488 */ | 2368 */ |
| 2489 static Local<Array> New(Isolate* isolate, int length = 0); | 2369 static Local<Array> New(Isolate* isolate, int length = 0); |
| 2490 V8_DEPRECATED("Will be removed", static Local<Array> New(int length = 0)); | |
| 2491 | 2370 |
| 2492 V8_INLINE static Array* Cast(Value* obj); | 2371 V8_INLINE static Array* Cast(Value* obj); |
| 2493 private: | 2372 private: |
| 2494 Array(); | 2373 Array(); |
| 2495 static void CheckCast(Value* obj); | 2374 static void CheckCast(Value* obj); |
| 2496 }; | 2375 }; |
| 2497 | 2376 |
| 2498 | 2377 |
| 2499 template<typename T> | 2378 template<typename T> |
| 2500 class ReturnValue { | 2379 class ReturnValue { |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2649 * kLineOffsetNotFound if no information available. | 2528 * kLineOffsetNotFound if no information available. |
| 2650 */ | 2529 */ |
| 2651 int GetScriptColumnNumber() const; | 2530 int GetScriptColumnNumber() const; |
| 2652 | 2531 |
| 2653 /** | 2532 /** |
| 2654 * Tells whether this function is builtin. | 2533 * Tells whether this function is builtin. |
| 2655 */ | 2534 */ |
| 2656 bool IsBuiltin() const; | 2535 bool IsBuiltin() const; |
| 2657 | 2536 |
| 2658 /** | 2537 /** |
| 2659 * Returns scriptId object. | |
| 2660 */ | |
| 2661 V8_DEPRECATED("Use ScriptId instead", Handle<Value> GetScriptId() const); | |
| 2662 | |
| 2663 /** | |
| 2664 * Returns scriptId. | 2538 * Returns scriptId. |
| 2665 */ | 2539 */ |
| 2666 int ScriptId() const; | 2540 int ScriptId() const; |
| 2667 | 2541 |
| 2668 ScriptOrigin GetScriptOrigin() const; | 2542 ScriptOrigin GetScriptOrigin() const; |
| 2669 V8_INLINE static Function* Cast(Value* obj); | 2543 V8_INLINE static Function* Cast(Value* obj); |
| 2670 static const int kLineOffsetNotFound; | 2544 static const int kLineOffsetNotFound; |
| 2671 | 2545 |
| 2672 private: | 2546 private: |
| 2673 Function(); | 2547 Function(); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2744 */ | 2618 */ |
| 2745 size_t ByteLength() const; | 2619 size_t ByteLength() const; |
| 2746 | 2620 |
| 2747 /** | 2621 /** |
| 2748 * Create a new ArrayBuffer. Allocate |byte_length| bytes. | 2622 * Create a new ArrayBuffer. Allocate |byte_length| bytes. |
| 2749 * Allocated memory will be owned by a created ArrayBuffer and | 2623 * Allocated memory will be owned by a created ArrayBuffer and |
| 2750 * will be deallocated when it is garbage-collected, | 2624 * will be deallocated when it is garbage-collected, |
| 2751 * unless the object is externalized. | 2625 * unless the object is externalized. |
| 2752 */ | 2626 */ |
| 2753 static Local<ArrayBuffer> New(Isolate* isolate, size_t byte_length); | 2627 static Local<ArrayBuffer> New(Isolate* isolate, size_t byte_length); |
| 2754 V8_DEPRECATED("Will be removed", | |
| 2755 static Local<ArrayBuffer> New(size_t byte_length)); | |
| 2756 | 2628 |
| 2757 /** | 2629 /** |
| 2758 * Create a new ArrayBuffer over an existing memory block. | 2630 * Create a new ArrayBuffer over an existing memory block. |
| 2759 * The created array buffer is immediately in externalized state. | 2631 * The created array buffer is immediately in externalized state. |
| 2760 * The memory block will not be reclaimed when a created ArrayBuffer | 2632 * The memory block will not be reclaimed when a created ArrayBuffer |
| 2761 * is garbage-collected. | 2633 * is garbage-collected. |
| 2762 */ | 2634 */ |
| 2763 static Local<ArrayBuffer> New(Isolate* isolate, void* data, | 2635 static Local<ArrayBuffer> New(Isolate* isolate, void* data, |
| 2764 size_t byte_length); | 2636 size_t byte_length); |
| 2765 V8_DEPRECATED("Will be removed", | |
| 2766 static Local<ArrayBuffer> New(void* data, size_t byte_length)); | |
| 2767 | 2637 |
| 2768 /** | 2638 /** |
| 2769 * Returns true if ArrayBuffer is extrenalized, that is, does not | 2639 * Returns true if ArrayBuffer is extrenalized, that is, does not |
| 2770 * own its memory block. | 2640 * own its memory block. |
| 2771 */ | 2641 */ |
| 2772 bool IsExternal() const; | 2642 bool IsExternal() const; |
| 2773 | 2643 |
| 2774 /** | 2644 /** |
| 2775 * Neuters this ArrayBuffer and all its views (typed arrays). | 2645 * Neuters this ArrayBuffer and all its views (typed arrays). |
| 2776 * Neutering sets the byte length of the buffer and all typed arrays to zero, | 2646 * Neutering sets the byte length of the buffer and all typed arrays to zero, |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3017 static void CheckCast(Value* obj); | 2887 static void CheckCast(Value* obj); |
| 3018 }; | 2888 }; |
| 3019 | 2889 |
| 3020 | 2890 |
| 3021 /** | 2891 /** |
| 3022 * An instance of the built-in Date constructor (ECMA-262, 15.9). | 2892 * An instance of the built-in Date constructor (ECMA-262, 15.9). |
| 3023 */ | 2893 */ |
| 3024 class V8_EXPORT Date : public Object { | 2894 class V8_EXPORT Date : public Object { |
| 3025 public: | 2895 public: |
| 3026 static Local<Value> New(Isolate* isolate, double time); | 2896 static Local<Value> New(Isolate* isolate, double time); |
| 3027 V8_DEPRECATED("Will be removed", static Local<Value> New(double time)); | |
| 3028 | |
| 3029 V8_DEPRECATED( | |
| 3030 "Use ValueOf instead", | |
| 3031 double NumberValue() const) { return ValueOf(); } | |
| 3032 | 2897 |
| 3033 /** | 2898 /** |
| 3034 * A specialization of Value::NumberValue that is more efficient | 2899 * A specialization of Value::NumberValue that is more efficient |
| 3035 * because we know the structure of this object. | 2900 * because we know the structure of this object. |
| 3036 */ | 2901 */ |
| 3037 double ValueOf() const; | 2902 double ValueOf() const; |
| 3038 | 2903 |
| 3039 V8_INLINE static Date* Cast(v8::Value* obj); | 2904 V8_INLINE static Date* Cast(v8::Value* obj); |
| 3040 | 2905 |
| 3041 /** | 2906 /** |
| 3042 * Notification that the embedder has changed the time zone, | 2907 * Notification that the embedder has changed the time zone, |
| 3043 * daylight savings time, or other date / time configuration | 2908 * daylight savings time, or other date / time configuration |
| 3044 * parameters. V8 keeps a cache of various values used for | 2909 * parameters. V8 keeps a cache of various values used for |
| 3045 * date / time computation. This notification will reset | 2910 * date / time computation. This notification will reset |
| 3046 * those cached values for the current context so that date / | 2911 * those cached values for the current context so that date / |
| 3047 * time configuration changes would be reflected in the Date | 2912 * time configuration changes would be reflected in the Date |
| 3048 * object. | 2913 * object. |
| 3049 * | 2914 * |
| 3050 * This API should not be called more than needed as it will | 2915 * This API should not be called more than needed as it will |
| 3051 * negatively impact the performance of date operations. | 2916 * negatively impact the performance of date operations. |
| 3052 */ | 2917 */ |
| 3053 static void DateTimeConfigurationChangeNotification(Isolate* isolate); | 2918 static void DateTimeConfigurationChangeNotification(Isolate* isolate); |
| 3054 V8_DEPRECATED("Will be removed", | |
| 3055 static void DateTimeConfigurationChangeNotification()); | |
| 3056 | 2919 |
| 3057 private: | 2920 private: |
| 3058 static void CheckCast(v8::Value* obj); | 2921 static void CheckCast(v8::Value* obj); |
| 3059 }; | 2922 }; |
| 3060 | 2923 |
| 3061 | 2924 |
| 3062 /** | 2925 /** |
| 3063 * A Number object (ECMA-262, 4.3.21). | 2926 * A Number object (ECMA-262, 4.3.21). |
| 3064 */ | 2927 */ |
| 3065 class V8_EXPORT NumberObject : public Object { | 2928 class V8_EXPORT NumberObject : public Object { |
| 3066 public: | 2929 public: |
| 3067 static Local<Value> New(Isolate* isolate, double value); | 2930 static Local<Value> New(Isolate* isolate, double value); |
| 3068 V8_DEPRECATED("Will be removed", static Local<Value> New(double value)); | |
| 3069 | 2931 |
| 3070 V8_DEPRECATED( | |
| 3071 "Use ValueOf instead", | |
| 3072 double NumberValue() const) { return ValueOf(); } | |
| 3073 | |
| 3074 /** | |
| 3075 * Returns the Number held by the object. | |
| 3076 */ | |
| 3077 double ValueOf() const; | 2932 double ValueOf() const; |
| 3078 | 2933 |
| 3079 V8_INLINE static NumberObject* Cast(v8::Value* obj); | 2934 V8_INLINE static NumberObject* Cast(v8::Value* obj); |
| 3080 | 2935 |
| 3081 private: | 2936 private: |
| 3082 static void CheckCast(v8::Value* obj); | 2937 static void CheckCast(v8::Value* obj); |
| 3083 }; | 2938 }; |
| 3084 | 2939 |
| 3085 | 2940 |
| 3086 /** | 2941 /** |
| 3087 * A Boolean object (ECMA-262, 4.3.15). | 2942 * A Boolean object (ECMA-262, 4.3.15). |
| 3088 */ | 2943 */ |
| 3089 class V8_EXPORT BooleanObject : public Object { | 2944 class V8_EXPORT BooleanObject : public Object { |
| 3090 public: | 2945 public: |
| 3091 static Local<Value> New(bool value); | 2946 static Local<Value> New(bool value); |
| 3092 | 2947 |
| 3093 V8_DEPRECATED( | |
| 3094 "Use ValueOf instead", | |
| 3095 bool BooleanValue() const) { return ValueOf(); } | |
| 3096 | |
| 3097 /** | |
| 3098 * Returns the Boolean held by the object. | |
| 3099 */ | |
| 3100 bool ValueOf() const; | 2948 bool ValueOf() const; |
| 3101 | 2949 |
| 3102 V8_INLINE static BooleanObject* Cast(v8::Value* obj); | 2950 V8_INLINE static BooleanObject* Cast(v8::Value* obj); |
| 3103 | 2951 |
| 3104 private: | 2952 private: |
| 3105 static void CheckCast(v8::Value* obj); | 2953 static void CheckCast(v8::Value* obj); |
| 3106 }; | 2954 }; |
| 3107 | 2955 |
| 3108 | 2956 |
| 3109 /** | 2957 /** |
| 3110 * A String object (ECMA-262, 4.3.18). | 2958 * A String object (ECMA-262, 4.3.18). |
| 3111 */ | 2959 */ |
| 3112 class V8_EXPORT StringObject : public Object { | 2960 class V8_EXPORT StringObject : public Object { |
| 3113 public: | 2961 public: |
| 3114 static Local<Value> New(Handle<String> value); | 2962 static Local<Value> New(Handle<String> value); |
| 3115 | 2963 |
| 3116 V8_DEPRECATED( | |
| 3117 "Use ValueOf instead", | |
| 3118 Local<String> StringValue() const) { return ValueOf(); } | |
| 3119 | |
| 3120 /** | |
| 3121 * Returns the String held by the object. | |
| 3122 */ | |
| 3123 Local<String> ValueOf() const; | 2964 Local<String> ValueOf() const; |
| 3124 | 2965 |
| 3125 V8_INLINE static StringObject* Cast(v8::Value* obj); | 2966 V8_INLINE static StringObject* Cast(v8::Value* obj); |
| 3126 | 2967 |
| 3127 private: | 2968 private: |
| 3128 static void CheckCast(v8::Value* obj); | 2969 static void CheckCast(v8::Value* obj); |
| 3129 }; | 2970 }; |
| 3130 | 2971 |
| 3131 | 2972 |
| 3132 /** | 2973 /** |
| 3133 * A Symbol object (ECMA-262 edition 6). | 2974 * A Symbol object (ECMA-262 edition 6). |
| 3134 * | 2975 * |
| 3135 * This is an experimental feature. Use at your own risk. | 2976 * This is an experimental feature. Use at your own risk. |
| 3136 */ | 2977 */ |
| 3137 class V8_EXPORT SymbolObject : public Object { | 2978 class V8_EXPORT SymbolObject : public Object { |
| 3138 public: | 2979 public: |
| 3139 static Local<Value> New(Isolate* isolate, Handle<Symbol> value); | 2980 static Local<Value> New(Isolate* isolate, Handle<Symbol> value); |
| 3140 | 2981 |
| 3141 V8_DEPRECATED( | |
| 3142 "Use ValueOf instead", | |
| 3143 Local<Symbol> SymbolValue() const) { return ValueOf(); } | |
| 3144 | |
| 3145 /** | |
| 3146 * Returns the Symbol held by the object. | |
| 3147 */ | |
| 3148 Local<Symbol> ValueOf() const; | 2982 Local<Symbol> ValueOf() const; |
| 3149 | 2983 |
| 3150 V8_INLINE static SymbolObject* Cast(v8::Value* obj); | 2984 V8_INLINE static SymbolObject* Cast(v8::Value* obj); |
| 3151 | 2985 |
| 3152 private: | 2986 private: |
| 3153 static void CheckCast(v8::Value* obj); | 2987 static void CheckCast(v8::Value* obj); |
| 3154 }; | 2988 }; |
| 3155 | 2989 |
| 3156 | 2990 |
| 3157 /** | 2991 /** |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3200 }; | 3034 }; |
| 3201 | 3035 |
| 3202 | 3036 |
| 3203 /** | 3037 /** |
| 3204 * A JavaScript value that wraps a C++ void*. This type of value is mainly used | 3038 * A JavaScript value that wraps a C++ void*. This type of value is mainly used |
| 3205 * to associate C++ data structures with JavaScript objects. | 3039 * to associate C++ data structures with JavaScript objects. |
| 3206 */ | 3040 */ |
| 3207 class V8_EXPORT External : public Value { | 3041 class V8_EXPORT External : public Value { |
| 3208 public: | 3042 public: |
| 3209 static Local<External> New(Isolate* isolate, void* value); | 3043 static Local<External> New(Isolate* isolate, void* value); |
| 3210 V8_DEPRECATED("Will be removed", static Local<External> New(void *value)); | |
| 3211 V8_INLINE static External* Cast(Value* obj); | 3044 V8_INLINE static External* Cast(Value* obj); |
| 3212 void* Value() const; | 3045 void* Value() const; |
| 3213 private: | 3046 private: |
| 3214 static void CheckCast(v8::Value* obj); | 3047 static void CheckCast(v8::Value* obj); |
| 3215 }; | 3048 }; |
| 3216 | 3049 |
| 3217 | 3050 |
| 3218 // --- Templates --- | 3051 // --- Templates --- |
| 3219 | 3052 |
| 3220 | 3053 |
| 3221 /** | 3054 /** |
| 3222 * The superclass of object and function templates. | 3055 * The superclass of object and function templates. |
| 3223 */ | 3056 */ |
| 3224 class V8_EXPORT Template : public Data { | 3057 class V8_EXPORT Template : public Data { |
| 3225 public: | 3058 public: |
| 3226 /** Adds a property to each instance created by this template.*/ | 3059 /** Adds a property to each instance created by this template.*/ |
| 3227 void Set(Handle<String> name, Handle<Data> value, | 3060 void Set(Handle<String> name, Handle<Data> value, |
| 3228 PropertyAttribute attributes = None); | 3061 PropertyAttribute attributes = None); |
| 3229 V8_INLINE void Set(Isolate* isolate, const char* name, Handle<Data> value); | 3062 V8_INLINE void Set(Isolate* isolate, const char* name, Handle<Data> value); |
| 3230 V8_DEPRECATED("Will be removed", | |
| 3231 V8_INLINE void Set(const char* name, Handle<Data> value)); | |
| 3232 | 3063 |
| 3233 void SetAccessorProperty( | 3064 void SetAccessorProperty( |
| 3234 Local<String> name, | 3065 Local<String> name, |
| 3235 Local<FunctionTemplate> getter = Local<FunctionTemplate>(), | 3066 Local<FunctionTemplate> getter = Local<FunctionTemplate>(), |
| 3236 Local<FunctionTemplate> setter = Local<FunctionTemplate>(), | 3067 Local<FunctionTemplate> setter = Local<FunctionTemplate>(), |
| 3237 PropertyAttribute attribute = None, | 3068 PropertyAttribute attribute = None, |
| 3238 AccessControl settings = DEFAULT); | 3069 AccessControl settings = DEFAULT); |
| 3239 | 3070 |
| 3240 /** | 3071 /** |
| 3241 * Whenever the property with the given name is accessed on objects | 3072 * Whenever the property with the given name is accessed on objects |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3757 * A Signature specifies which receivers and arguments are valid | 3588 * A Signature specifies which receivers and arguments are valid |
| 3758 * parameters to a function. | 3589 * parameters to a function. |
| 3759 */ | 3590 */ |
| 3760 class V8_EXPORT Signature : public Data { | 3591 class V8_EXPORT Signature : public Data { |
| 3761 public: | 3592 public: |
| 3762 static Local<Signature> New(Isolate* isolate, | 3593 static Local<Signature> New(Isolate* isolate, |
| 3763 Handle<FunctionTemplate> receiver = | 3594 Handle<FunctionTemplate> receiver = |
| 3764 Handle<FunctionTemplate>(), | 3595 Handle<FunctionTemplate>(), |
| 3765 int argc = 0, | 3596 int argc = 0, |
| 3766 Handle<FunctionTemplate> argv[] = 0); | 3597 Handle<FunctionTemplate> argv[] = 0); |
| 3767 V8_DEPRECATED("Will be removed", | |
| 3768 static Local<Signature> New(Handle<FunctionTemplate> receiver = | |
| 3769 Handle<FunctionTemplate>(), | |
| 3770 int argc = 0, | |
| 3771 Handle<FunctionTemplate> argv[] = | |
| 3772 0)); | |
| 3773 | 3598 |
| 3774 private: | 3599 private: |
| 3775 Signature(); | 3600 Signature(); |
| 3776 }; | 3601 }; |
| 3777 | 3602 |
| 3778 | 3603 |
| 3779 /** | 3604 /** |
| 3780 * An AccessorSignature specifies which receivers are valid parameters | 3605 * An AccessorSignature specifies which receivers are valid parameters |
| 3781 * to an accessor callback. | 3606 * to an accessor callback. |
| 3782 */ | 3607 */ |
| 3783 class V8_EXPORT AccessorSignature : public Data { | 3608 class V8_EXPORT AccessorSignature : public Data { |
| 3784 public: | 3609 public: |
| 3785 static Local<AccessorSignature> New(Isolate* isolate, | 3610 static Local<AccessorSignature> New(Isolate* isolate, |
| 3786 Handle<FunctionTemplate> receiver = | 3611 Handle<FunctionTemplate> receiver = |
| 3787 Handle<FunctionTemplate>()); | 3612 Handle<FunctionTemplate>()); |
| 3788 V8_DEPRECATED("Will be removed", static Local<AccessorSignature> New( | |
| 3789 Handle<FunctionTemplate> receiver = | |
| 3790 Handle<FunctionTemplate>())); | |
| 3791 | 3613 |
| 3792 private: | 3614 private: |
| 3793 AccessorSignature(); | 3615 AccessorSignature(); |
| 3794 }; | 3616 }; |
| 3795 | 3617 |
| 3796 | 3618 |
| 3797 class V8_EXPORT DeclaredAccessorDescriptor : public Data { | 3619 class V8_EXPORT DeclaredAccessorDescriptor : public Data { |
| 3798 private: | 3620 private: |
| 3799 DeclaredAccessorDescriptor(); | 3621 DeclaredAccessorDescriptor(); |
| 3800 }; | 3622 }; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3890 const char* source = 0, | 3712 const char* source = 0, |
| 3891 int dep_count = 0, | 3713 int dep_count = 0, |
| 3892 const char** deps = 0, | 3714 const char** deps = 0, |
| 3893 int source_length = -1); | 3715 int source_length = -1); |
| 3894 virtual ~Extension() { } | 3716 virtual ~Extension() { } |
| 3895 virtual v8::Handle<v8::FunctionTemplate> GetNativeFunctionTemplate( | 3717 virtual v8::Handle<v8::FunctionTemplate> GetNativeFunctionTemplate( |
| 3896 v8::Isolate* isolate, v8::Handle<v8::String> name) { | 3718 v8::Isolate* isolate, v8::Handle<v8::String> name) { |
| 3897 #if defined(V8_DEPRECATION_WARNINGS) | 3719 #if defined(V8_DEPRECATION_WARNINGS) |
| 3898 return v8::Handle<v8::FunctionTemplate>(); | 3720 return v8::Handle<v8::FunctionTemplate>(); |
| 3899 #else | 3721 #else |
| 3900 return GetNativeFunction(name); | 3722 return GetNativeFunction(name); |
|
jochen (gone - plz use gerrit)
2013/12/05 14:48:01
plz remove this
Sven Panne
2013/12/06 08:04:37
Done.
| |
| 3901 #endif | 3723 #endif |
| 3902 } | 3724 } |
| 3903 | 3725 |
| 3904 V8_DEPRECATED("Will be removed", | |
| 3905 virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction( | |
| 3906 v8::Handle<v8::String> name)) { | |
| 3907 return v8::Handle<v8::FunctionTemplate>(); | |
| 3908 } | |
| 3909 | |
| 3910 const char* name() const { return name_; } | 3726 const char* name() const { return name_; } |
| 3911 size_t source_length() const { return source_length_; } | 3727 size_t source_length() const { return source_length_; } |
| 3912 const String::ExternalAsciiStringResource* source() const { | 3728 const String::ExternalAsciiStringResource* source() const { |
| 3913 return &source_; } | 3729 return &source_; } |
| 3914 int dependency_count() { return dep_count_; } | 3730 int dependency_count() { return dep_count_; } |
| 3915 const char** dependencies() { return deps_; } | 3731 const char** dependencies() { return deps_; } |
| 3916 void set_auto_enable(bool value) { auto_enable_ = value; } | 3732 void set_auto_enable(bool value) { auto_enable_ = value; } |
| 3917 bool auto_enable() { return auto_enable_; } | 3733 bool auto_enable() { return auto_enable_; } |
| 3918 | 3734 |
| 3919 private: | 3735 private: |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 3944 }; | 3760 }; |
| 3945 | 3761 |
| 3946 | 3762 |
| 3947 // --- Statics --- | 3763 // --- Statics --- |
| 3948 | 3764 |
| 3949 V8_INLINE Handle<Primitive> Undefined(Isolate* isolate); | 3765 V8_INLINE Handle<Primitive> Undefined(Isolate* isolate); |
| 3950 V8_INLINE Handle<Primitive> Null(Isolate* isolate); | 3766 V8_INLINE Handle<Primitive> Null(Isolate* isolate); |
| 3951 V8_INLINE Handle<Boolean> True(Isolate* isolate); | 3767 V8_INLINE Handle<Boolean> True(Isolate* isolate); |
| 3952 V8_INLINE Handle<Boolean> False(Isolate* isolate); | 3768 V8_INLINE Handle<Boolean> False(Isolate* isolate); |
| 3953 | 3769 |
| 3954 V8_DEPRECATED("Will be removed", Handle<Primitive> V8_EXPORT Undefined()); | |
| 3955 V8_DEPRECATED("Will be removed", Handle<Primitive> V8_EXPORT Null()); | |
| 3956 V8_DEPRECATED("Will be removed", Handle<Boolean> V8_EXPORT True()); | |
| 3957 V8_DEPRECATED("Will be removed", Handle<Boolean> V8_EXPORT False()); | |
| 3958 | |
| 3959 | 3770 |
| 3960 /** | 3771 /** |
| 3961 * A set of constraints that specifies the limits of the runtime's memory use. | 3772 * A set of constraints that specifies the limits of the runtime's memory use. |
| 3962 * You must set the heap size before initializing the VM - the size cannot be | 3773 * You must set the heap size before initializing the VM - the size cannot be |
| 3963 * adjusted after the VM is initialized. | 3774 * adjusted after the VM is initialized. |
| 3964 * | 3775 * |
| 3965 * If you are using threads then you should hold the V8::Locker lock while | 3776 * If you are using threads then you should hold the V8::Locker lock while |
| 3966 * setting the stack limit and you must set a non-default stack limit separately | 3777 * setting the stack limit and you must set a non-default stack limit separately |
| 3967 * for each thread. | 3778 * for each thread. |
| 3968 */ | 3779 */ |
| 3969 class V8_EXPORT ResourceConstraints { | 3780 class V8_EXPORT ResourceConstraints { |
| 3970 public: | 3781 public: |
| 3971 ResourceConstraints(); | 3782 ResourceConstraints(); |
| 3972 | 3783 |
| 3973 /** | 3784 /** |
| 3974 * Configures the constraints with reasonable default values based on the | 3785 * Configures the constraints with reasonable default values based on the |
| 3975 * capabilities of the current device the VM is running on. | 3786 * capabilities of the current device the VM is running on. |
| 3976 * | 3787 * |
| 3977 * \param physical_memory The total amount of physical memory on the current | 3788 * \param physical_memory The total amount of physical memory on the current |
| 3978 * device, in bytes. | 3789 * device, in bytes. |
| 3979 * \param number_of_processors The number of CPUs available on the current | 3790 * \param number_of_processors The number of CPUs available on the current |
| 3980 * device. | 3791 * device. |
| 3981 */ | 3792 */ |
| 3982 void ConfigureDefaults(uint64_t physical_memory, | 3793 void ConfigureDefaults(uint64_t physical_memory, |
| 3983 uint32_t number_of_processors); | 3794 uint32_t number_of_processors); |
| 3984 V8_DEPRECATED("Will be removed", | |
| 3985 void ConfigureDefaults(uint64_t physical_memory)); | |
| 3986 | 3795 |
| 3987 int max_young_space_size() const { return max_young_space_size_; } | 3796 int max_young_space_size() const { return max_young_space_size_; } |
| 3988 void set_max_young_space_size(int value) { max_young_space_size_ = value; } | 3797 void set_max_young_space_size(int value) { max_young_space_size_ = value; } |
| 3989 int max_old_space_size() const { return max_old_space_size_; } | 3798 int max_old_space_size() const { return max_old_space_size_; } |
| 3990 void set_max_old_space_size(int value) { max_old_space_size_ = value; } | 3799 void set_max_old_space_size(int value) { max_old_space_size_ = value; } |
| 3991 int max_executable_size() const { return max_executable_size_; } | 3800 int max_executable_size() const { return max_executable_size_; } |
| 3992 void set_max_executable_size(int value) { max_executable_size_ = value; } | 3801 void set_max_executable_size(int value) { max_executable_size_ = value; } |
| 3993 uint32_t* stack_limit() const { return stack_limit_; } | 3802 uint32_t* stack_limit() const { return stack_limit_; } |
| 3994 // Sets an address beyond which the VM's stack may not grow. | 3803 // Sets an address beyond which the VM's stack may not grow. |
| 3995 void set_stack_limit(uint32_t* value) { stack_limit_ = value; } | 3804 void set_stack_limit(uint32_t* value) { stack_limit_ = value; } |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 4017 | 3826 |
| 4018 // --- Exceptions --- | 3827 // --- Exceptions --- |
| 4019 | 3828 |
| 4020 | 3829 |
| 4021 typedef void (*FatalErrorCallback)(const char* location, const char* message); | 3830 typedef void (*FatalErrorCallback)(const char* location, const char* message); |
| 4022 | 3831 |
| 4023 | 3832 |
| 4024 typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> error); | 3833 typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> error); |
| 4025 | 3834 |
| 4026 | 3835 |
| 4027 V8_DEPRECATED( | |
| 4028 "Use Isolate::ThrowException instead", | |
| 4029 Handle<Value> V8_EXPORT ThrowException(Handle<Value> exception)); | |
| 4030 | |
| 4031 /** | 3836 /** |
| 4032 * Create new error objects by calling the corresponding error object | 3837 * Create new error objects by calling the corresponding error object |
| 4033 * constructor with the message. | 3838 * constructor with the message. |
| 4034 */ | 3839 */ |
| 4035 class V8_EXPORT Exception { | 3840 class V8_EXPORT Exception { |
| 4036 public: | 3841 public: |
| 4037 static Local<Value> RangeError(Handle<String> message); | 3842 static Local<Value> RangeError(Handle<String> message); |
| 4038 static Local<Value> ReferenceError(Handle<String> message); | 3843 static Local<Value> ReferenceError(Handle<String> message); |
| 4039 static Local<Value> SyntaxError(Handle<String> message); | 3844 static Local<Value> SyntaxError(Handle<String> message); |
| 4040 static Local<Value> TypeError(Handle<String> message); | 3845 static Local<Value> TypeError(Handle<String> message); |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4213 * Requires: this == Isolate::GetCurrent(). | 4018 * Requires: this == Isolate::GetCurrent(). |
| 4214 */ | 4019 */ |
| 4215 void Exit(); | 4020 void Exit(); |
| 4216 | 4021 |
| 4217 /** | 4022 /** |
| 4218 * Disposes the isolate. The isolate must not be entered by any | 4023 * Disposes the isolate. The isolate must not be entered by any |
| 4219 * thread to be disposable. | 4024 * thread to be disposable. |
| 4220 */ | 4025 */ |
| 4221 void Dispose(); | 4026 void Dispose(); |
| 4222 | 4027 |
| 4223 V8_DEPRECATED("Use SetData(0, data) instead.", | |
| 4224 V8_INLINE void SetData(void* data)); | |
| 4225 V8_DEPRECATED("Use GetData(0) instead.", V8_INLINE void* GetData()); | |
| 4226 | |
| 4227 /** | 4028 /** |
| 4228 * Associate embedder-specific data with the isolate. |slot| has to be | 4029 * Associate embedder-specific data with the isolate. |slot| has to be |
| 4229 * between 0 and GetNumberOfDataSlots() - 1. | 4030 * between 0 and GetNumberOfDataSlots() - 1. |
| 4230 */ | 4031 */ |
| 4231 V8_INLINE void SetData(uint32_t slot, void* data); | 4032 V8_INLINE void SetData(uint32_t slot, void* data); |
| 4232 | 4033 |
| 4233 /** | 4034 /** |
| 4234 * Retrieve embedder-specific data from the isolate. | 4035 * Retrieve embedder-specific data from the isolate. |
| 4235 * Returns NULL if SetData has never been called for the given |slot|. | 4036 * Returns NULL if SetData has never been called for the given |slot|. |
| 4236 */ | 4037 */ |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4834 * are not guaranteed to live past each call. The \p event_handler must | 4635 * are not guaranteed to live past each call. The \p event_handler must |
| 4835 * copy strings and other parameters it needs to keep around. | 4636 * copy strings and other parameters it needs to keep around. |
| 4836 * \note the set of events declared in JitCodeEvent::EventType is expected to | 4637 * \note the set of events declared in JitCodeEvent::EventType is expected to |
| 4837 * grow over time, and the JitCodeEvent structure is expected to accrue | 4638 * grow over time, and the JitCodeEvent structure is expected to accrue |
| 4838 * new members. The \p event_handler function must ignore event codes | 4639 * new members. The \p event_handler function must ignore event codes |
| 4839 * it does not recognize to maintain future compatibility. | 4640 * it does not recognize to maintain future compatibility. |
| 4840 */ | 4641 */ |
| 4841 static void SetJitCodeEventHandler(JitCodeEventOptions options, | 4642 static void SetJitCodeEventHandler(JitCodeEventOptions options, |
| 4842 JitCodeEventHandler event_handler); | 4643 JitCodeEventHandler event_handler); |
| 4843 | 4644 |
| 4844 V8_DEPRECATED( | |
| 4845 "Use Isolate::AdjustAmountOfExternalAllocatedMemory instead", | |
| 4846 static int64_t AdjustAmountOfExternalAllocatedMemory( | |
| 4847 int64_t change_in_bytes)); | |
| 4848 | |
| 4849 /** | 4645 /** |
| 4850 * Forcefully terminate the current thread of JavaScript execution | 4646 * Forcefully terminate the current thread of JavaScript execution |
| 4851 * in the given isolate. If no isolate is provided, the default | 4647 * in the given isolate. If no isolate is provided, the default |
| 4852 * isolate is used. | 4648 * isolate is used. |
| 4853 * | 4649 * |
| 4854 * This method can be used by any thread even if that thread has not | 4650 * This method can be used by any thread even if that thread has not |
| 4855 * acquired the V8 lock with a Locker object. | 4651 * acquired the V8 lock with a Locker object. |
| 4856 * | 4652 * |
| 4857 * \param isolate The isolate in which to terminate the current JS execution. | 4653 * \param isolate The isolate in which to terminate the current JS execution. |
| 4858 */ | 4654 */ |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4968 */ | 4764 */ |
| 4969 static void ShutdownPlatform(); | 4765 static void ShutdownPlatform(); |
| 4970 | 4766 |
| 4971 private: | 4767 private: |
| 4972 V8(); | 4768 V8(); |
| 4973 | 4769 |
| 4974 static internal::Object** GlobalizeReference(internal::Isolate* isolate, | 4770 static internal::Object** GlobalizeReference(internal::Isolate* isolate, |
| 4975 internal::Object** handle); | 4771 internal::Object** handle); |
| 4976 static internal::Object** CopyPersistent(internal::Object** handle); | 4772 static internal::Object** CopyPersistent(internal::Object** handle); |
| 4977 static void DisposeGlobal(internal::Object** global_handle); | 4773 static void DisposeGlobal(internal::Object** global_handle); |
| 4978 typedef WeakReferenceCallbacks<Value, void>::Revivable RevivableCallback; | |
| 4979 typedef WeakCallbackData<Value, void>::Callback WeakCallback; | 4774 typedef WeakCallbackData<Value, void>::Callback WeakCallback; |
| 4980 static void MakeWeak(internal::Object** global_handle, | 4775 static void MakeWeak(internal::Object** global_handle, |
| 4981 void* data, | 4776 void* data, |
| 4982 WeakCallback weak_callback, | 4777 WeakCallback weak_callback); |
| 4983 RevivableCallback weak_reference_callback); | |
| 4984 static void ClearWeak(internal::Object** global_handle); | 4778 static void ClearWeak(internal::Object** global_handle); |
| 4985 static void Eternalize(Isolate* isolate, | 4779 static void Eternalize(Isolate* isolate, |
| 4986 Value* handle, | 4780 Value* handle, |
| 4987 int* index); | 4781 int* index); |
| 4988 static Local<Value> GetEternal(Isolate* isolate, int index); | 4782 static Local<Value> GetEternal(Isolate* isolate, int index); |
| 4989 | 4783 |
| 4990 template <class T> friend class Handle; | 4784 template <class T> friend class Handle; |
| 4991 template <class T> friend class Local; | 4785 template <class T> friend class Local; |
| 4992 template <class T> friend class Eternal; | 4786 template <class T> friend class Eternal; |
| 4993 template <class T> friend class PersistentBase; | 4787 template <class T> friend class PersistentBase; |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5202 * created by a previous call to Context::New with the same global | 4996 * created by a previous call to Context::New with the same global |
| 5203 * template. The state of the global object will be completely reset | 4997 * template. The state of the global object will be completely reset |
| 5204 * and only object identify will remain. | 4998 * and only object identify will remain. |
| 5205 */ | 4999 */ |
| 5206 static Local<Context> New( | 5000 static Local<Context> New( |
| 5207 Isolate* isolate, | 5001 Isolate* isolate, |
| 5208 ExtensionConfiguration* extensions = NULL, | 5002 ExtensionConfiguration* extensions = NULL, |
| 5209 Handle<ObjectTemplate> global_template = Handle<ObjectTemplate>(), | 5003 Handle<ObjectTemplate> global_template = Handle<ObjectTemplate>(), |
| 5210 Handle<Value> global_object = Handle<Value>()); | 5004 Handle<Value> global_object = Handle<Value>()); |
| 5211 | 5005 |
| 5212 V8_DEPRECATED("Use Isolate::GetEnteredContext instead", | |
| 5213 static Local<Context> GetEntered()); | |
| 5214 | |
| 5215 V8_DEPRECATED("Use Isolate::GetCurrentContext instead", | |
| 5216 static Local<Context> GetCurrent()); | |
| 5217 | |
| 5218 V8_DEPRECATED("Use Isolate::GetCallingContext instead", | |
| 5219 static Local<Context> GetCalling()); | |
| 5220 | |
| 5221 /** | 5006 /** |
| 5222 * Sets the security token for the context. To access an object in | 5007 * Sets the security token for the context. To access an object in |
| 5223 * another context, the security tokens must match. | 5008 * another context, the security tokens must match. |
| 5224 */ | 5009 */ |
| 5225 void SetSecurityToken(Handle<Value> token); | 5010 void SetSecurityToken(Handle<Value> token); |
| 5226 | 5011 |
| 5227 /** Restores the security token to the default value. */ | 5012 /** Restores the security token to the default value. */ |
| 5228 void UseDefaultSecurityToken(); | 5013 void UseDefaultSecurityToken(); |
| 5229 | 5014 |
| 5230 /** Returns the security token of this context.*/ | 5015 /** Returns the security token of this context.*/ |
| 5231 Handle<Value> GetSecurityToken(); | 5016 Handle<Value> GetSecurityToken(); |
| 5232 | 5017 |
| 5233 /** | 5018 /** |
| 5234 * Enter this context. After entering a context, all code compiled | 5019 * Enter this context. After entering a context, all code compiled |
| 5235 * and run is compiled and run in this context. If another context | 5020 * and run is compiled and run in this context. If another context |
| 5236 * is already entered, this old context is saved so it can be | 5021 * is already entered, this old context is saved so it can be |
| 5237 * restored when the new context is exited. | 5022 * restored when the new context is exited. |
| 5238 */ | 5023 */ |
| 5239 void Enter(); | 5024 void Enter(); |
| 5240 | 5025 |
| 5241 /** | 5026 /** |
| 5242 * Exit this context. Exiting the current context restores the | 5027 * Exit this context. Exiting the current context restores the |
| 5243 * context that was in place when entering the current context. | 5028 * context that was in place when entering the current context. |
| 5244 */ | 5029 */ |
| 5245 void Exit(); | 5030 void Exit(); |
| 5246 | 5031 |
| 5247 /** Returns true if the context has experienced an out of memory situation. */ | 5032 /** Returns true if the context has experienced an out of memory situation. */ |
| 5248 bool HasOutOfMemoryException(); | 5033 bool HasOutOfMemoryException(); |
| 5249 | 5034 |
| 5250 V8_DEPRECATED("Use Isolate::InContext instead", | |
| 5251 static bool InContext()); | |
| 5252 | |
| 5253 /** Returns an isolate associated with a current context. */ | 5035 /** Returns an isolate associated with a current context. */ |
| 5254 v8::Isolate* GetIsolate(); | 5036 v8::Isolate* GetIsolate(); |
| 5255 | 5037 |
| 5256 /** | 5038 /** |
| 5257 * Gets the embedder data with the given index, which must have been set by a | 5039 * Gets the embedder data with the given index, which must have been set by a |
| 5258 * previous call to SetEmbedderData with the same index. Note that index 0 | 5040 * previous call to SetEmbedderData with the same index. Note that index 0 |
| 5259 * currently has a special meaning for Chrome's debugger. | 5041 * currently has a special meaning for Chrome's debugger. |
| 5260 */ | 5042 */ |
| 5261 V8_INLINE Local<Value> GetEmbedderData(int index); | 5043 V8_INLINE Local<Value> GetEmbedderData(int index); |
| 5262 | 5044 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5312 | 5094 |
| 5313 /** | 5095 /** |
| 5314 * Stack-allocated class which sets the execution context for all | 5096 * Stack-allocated class which sets the execution context for all |
| 5315 * operations executed within a local scope. | 5097 * operations executed within a local scope. |
| 5316 */ | 5098 */ |
| 5317 class Scope { | 5099 class Scope { |
| 5318 public: | 5100 public: |
| 5319 explicit V8_INLINE Scope(Handle<Context> context) : context_(context) { | 5101 explicit V8_INLINE Scope(Handle<Context> context) : context_(context) { |
| 5320 context_->Enter(); | 5102 context_->Enter(); |
| 5321 } | 5103 } |
| 5322 V8_DEPRECATED( | |
| 5323 "Use Handle version instead", | |
| 5324 V8_INLINE Scope(Isolate* isolate, Persistent<Context>& context)) // NOLI NT | |
| 5325 : context_(Handle<Context>::New(isolate, context)) { | |
| 5326 context_->Enter(); | |
| 5327 } | |
| 5328 V8_INLINE ~Scope() { context_->Exit(); } | 5104 V8_INLINE ~Scope() { context_->Exit(); } |
| 5329 | 5105 |
| 5330 private: | 5106 private: |
| 5331 Handle<Context> context_; | 5107 Handle<Context> context_; |
| 5332 }; | 5108 }; |
| 5333 | 5109 |
| 5334 private: | 5110 private: |
| 5335 friend class Value; | 5111 friend class Value; |
| 5336 friend class Script; | 5112 friend class Script; |
| 5337 friend class Object; | 5113 friend class Object; |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5903 | 5679 |
| 5904 template <class T> | 5680 template <class T> |
| 5905 template <typename S, typename P> | 5681 template <typename S, typename P> |
| 5906 void PersistentBase<T>::SetWeak( | 5682 void PersistentBase<T>::SetWeak( |
| 5907 P* parameter, | 5683 P* parameter, |
| 5908 typename WeakCallbackData<S, P>::Callback callback) { | 5684 typename WeakCallbackData<S, P>::Callback callback) { |
| 5909 TYPE_CHECK(S, T); | 5685 TYPE_CHECK(S, T); |
| 5910 typedef typename WeakCallbackData<Value, void>::Callback Callback; | 5686 typedef typename WeakCallbackData<Value, void>::Callback Callback; |
| 5911 V8::MakeWeak(reinterpret_cast<internal::Object**>(this->val_), | 5687 V8::MakeWeak(reinterpret_cast<internal::Object**>(this->val_), |
| 5912 parameter, | 5688 parameter, |
| 5913 reinterpret_cast<Callback>(callback), | 5689 reinterpret_cast<Callback>(callback)); |
| 5914 NULL); | |
| 5915 } | 5690 } |
| 5916 | 5691 |
| 5917 | 5692 |
| 5918 template <class T> | 5693 template <class T> |
| 5919 template <typename P> | 5694 template <typename P> |
| 5920 void PersistentBase<T>::SetWeak( | 5695 void PersistentBase<T>::SetWeak( |
| 5921 P* parameter, | 5696 P* parameter, |
| 5922 typename WeakCallbackData<T, P>::Callback callback) { | 5697 typename WeakCallbackData<T, P>::Callback callback) { |
| 5923 SetWeak<T, P>(parameter, callback); | 5698 SetWeak<T, P>(parameter, callback); |
| 5924 } | 5699 } |
| 5925 | 5700 |
| 5926 | 5701 |
| 5927 template <class T, class M> | |
| 5928 template <typename S, typename P> | |
| 5929 void Persistent<T, M>::MakeWeak( | |
| 5930 P* parameters, | |
| 5931 typename WeakReferenceCallbacks<S, P>::Revivable callback) { | |
| 5932 TYPE_CHECK(S, T); | |
| 5933 typedef typename WeakReferenceCallbacks<Value, void>::Revivable Revivable; | |
| 5934 V8::MakeWeak(reinterpret_cast<internal::Object**>(this->val_), | |
| 5935 parameters, | |
| 5936 NULL, | |
| 5937 reinterpret_cast<Revivable>(callback)); | |
| 5938 } | |
| 5939 | |
| 5940 | |
| 5941 template <class T, class M> | |
| 5942 template <typename P> | |
| 5943 void Persistent<T, M>::MakeWeak( | |
| 5944 P* parameters, | |
| 5945 typename WeakReferenceCallbacks<T, P>::Revivable callback) { | |
| 5946 MakeWeak<T, P>(parameters, callback); | |
| 5947 } | |
| 5948 | |
| 5949 | |
| 5950 template <class T> | 5702 template <class T> |
| 5951 void PersistentBase<T>::ClearWeak() { | 5703 void PersistentBase<T>::ClearWeak() { |
| 5952 V8::ClearWeak(reinterpret_cast<internal::Object**>(this->val_)); | 5704 V8::ClearWeak(reinterpret_cast<internal::Object**>(this->val_)); |
| 5953 } | 5705 } |
| 5954 | 5706 |
| 5955 | 5707 |
| 5956 template <class T> | 5708 template <class T> |
| 5957 void PersistentBase<T>::MarkIndependent() { | 5709 void PersistentBase<T>::MarkIndependent() { |
| 5958 typedef internal::Internals I; | 5710 typedef internal::Internals I; |
| 5959 if (this->IsEmpty()) return; | 5711 if (this->IsEmpty()) return; |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6164 return is_construct_call_; | 5916 return is_construct_call_; |
| 6165 } | 5917 } |
| 6166 | 5918 |
| 6167 | 5919 |
| 6168 template<typename T> | 5920 template<typename T> |
| 6169 int FunctionCallbackInfo<T>::Length() const { | 5921 int FunctionCallbackInfo<T>::Length() const { |
| 6170 return length_; | 5922 return length_; |
| 6171 } | 5923 } |
| 6172 | 5924 |
| 6173 | 5925 |
| 6174 template <class T> | |
| 6175 Local<T> HandleScope::Close(Handle<T> value) { | |
| 6176 internal::Object** before = reinterpret_cast<internal::Object**>(*value); | |
| 6177 internal::Object** after = RawClose(before); | |
| 6178 return Local<T>(reinterpret_cast<T*>(after)); | |
| 6179 } | |
| 6180 | |
| 6181 Handle<Value> ScriptOrigin::ResourceName() const { | 5926 Handle<Value> ScriptOrigin::ResourceName() const { |
| 6182 return resource_name_; | 5927 return resource_name_; |
| 6183 } | 5928 } |
| 6184 | 5929 |
| 6185 | 5930 |
| 6186 Handle<Integer> ScriptOrigin::ResourceLineOffset() const { | 5931 Handle<Integer> ScriptOrigin::ResourceLineOffset() const { |
| 6187 return resource_line_offset_; | 5932 return resource_line_offset_; |
| 6188 } | 5933 } |
| 6189 | 5934 |
| 6190 | 5935 |
| 6191 Handle<Integer> ScriptOrigin::ResourceColumnOffset() const { | 5936 Handle<Integer> ScriptOrigin::ResourceColumnOffset() const { |
| 6192 return resource_column_offset_; | 5937 return resource_column_offset_; |
| 6193 } | 5938 } |
| 6194 | 5939 |
| 6195 Handle<Boolean> ScriptOrigin::ResourceIsSharedCrossOrigin() const { | 5940 Handle<Boolean> ScriptOrigin::ResourceIsSharedCrossOrigin() const { |
| 6196 return resource_is_shared_cross_origin_; | 5941 return resource_is_shared_cross_origin_; |
| 6197 } | 5942 } |
| 6198 | 5943 |
| 6199 | 5944 |
| 6200 Handle<Boolean> Boolean::New(Isolate* isolate, bool value) { | 5945 Handle<Boolean> Boolean::New(Isolate* isolate, bool value) { |
| 6201 return value ? True(isolate) : False(isolate); | 5946 return value ? True(isolate) : False(isolate); |
| 6202 } | 5947 } |
| 6203 | 5948 |
| 6204 | 5949 |
| 6205 Handle<Boolean> Boolean::New(bool value) { | |
| 6206 return Boolean::New(Isolate::GetCurrent(), value); | |
| 6207 } | |
| 6208 | |
| 6209 | |
| 6210 void Template::Set(Isolate* isolate, const char* name, v8::Handle<Data> value) { | 5950 void Template::Set(Isolate* isolate, const char* name, v8::Handle<Data> value) { |
| 6211 Set(v8::String::NewFromUtf8(isolate, name), value); | 5951 Set(v8::String::NewFromUtf8(isolate, name), value); |
| 6212 } | 5952 } |
| 6213 | 5953 |
| 6214 | 5954 |
| 6215 void Template::Set(const char* name, v8::Handle<Data> value) { | |
| 6216 Set(Isolate::GetCurrent(), name, value); | |
| 6217 } | |
| 6218 | |
| 6219 | |
| 6220 Local<Value> Object::GetInternalField(int index) { | 5955 Local<Value> Object::GetInternalField(int index) { |
| 6221 #ifndef V8_ENABLE_CHECKS | 5956 #ifndef V8_ENABLE_CHECKS |
| 6222 typedef internal::Object O; | 5957 typedef internal::Object O; |
| 6223 typedef internal::HeapObject HO; | 5958 typedef internal::HeapObject HO; |
| 6224 typedef internal::Internals I; | 5959 typedef internal::Internals I; |
| 6225 O* obj = *reinterpret_cast<O**>(this); | 5960 O* obj = *reinterpret_cast<O**>(this); |
| 6226 // Fast path: If the object is a plain JSObject, which is the common case, we | 5961 // Fast path: If the object is a plain JSObject, which is the common case, we |
| 6227 // know where to find the internal fields and can return the value directly. | 5962 // know where to find the internal fields and can return the value directly. |
| 6228 if (I::GetInstanceType(obj) == I::kJSObjectType) { | 5963 if (I::GetInstanceType(obj) == I::kJSObjectType) { |
| 6229 int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index); | 5964 int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6262 | 5997 |
| 6263 Local<String> String::Empty(Isolate* isolate) { | 5998 Local<String> String::Empty(Isolate* isolate) { |
| 6264 typedef internal::Object* S; | 5999 typedef internal::Object* S; |
| 6265 typedef internal::Internals I; | 6000 typedef internal::Internals I; |
| 6266 I::CheckInitialized(isolate); | 6001 I::CheckInitialized(isolate); |
| 6267 S* slot = I::GetRoot(isolate, I::kEmptyStringRootIndex); | 6002 S* slot = I::GetRoot(isolate, I::kEmptyStringRootIndex); |
| 6268 return Local<String>(reinterpret_cast<String*>(slot)); | 6003 return Local<String>(reinterpret_cast<String*>(slot)); |
| 6269 } | 6004 } |
| 6270 | 6005 |
| 6271 | 6006 |
| 6272 Local<String> String::New(const char* data, int length) { | |
| 6273 return NewFromUtf8(Isolate::GetCurrent(), data, kNormalString, length); | |
| 6274 } | |
| 6275 | |
| 6276 | |
| 6277 Local<String> String::New(const uint16_t* data, int length) { | |
| 6278 return NewFromTwoByte(Isolate::GetCurrent(), data, kNormalString, length); | |
| 6279 } | |
| 6280 | |
| 6281 | |
| 6282 Local<String> String::NewSymbol(const char* data, int length) { | |
| 6283 return NewFromUtf8(Isolate::GetCurrent(), data, kInternalizedString, length); | |
| 6284 } | |
| 6285 | |
| 6286 | |
| 6287 Local<String> String::NewUndetectable(const char* data, int length) { | |
| 6288 return NewFromUtf8(Isolate::GetCurrent(), data, kUndetectableString, length); | |
| 6289 } | |
| 6290 | |
| 6291 | |
| 6292 Local<String> String::NewUndetectable(const uint16_t* data, int length) { | |
| 6293 return NewFromTwoByte( | |
| 6294 Isolate::GetCurrent(), data, kUndetectableString, length); | |
| 6295 } | |
| 6296 | |
| 6297 | |
| 6298 String::ExternalStringResource* String::GetExternalStringResource() const { | 6007 String::ExternalStringResource* String::GetExternalStringResource() const { |
| 6299 typedef internal::Object O; | 6008 typedef internal::Object O; |
| 6300 typedef internal::Internals I; | 6009 typedef internal::Internals I; |
| 6301 O* obj = *reinterpret_cast<O**>(const_cast<String*>(this)); | 6010 O* obj = *reinterpret_cast<O**>(const_cast<String*>(this)); |
| 6302 String::ExternalStringResource* result; | 6011 String::ExternalStringResource* result; |
| 6303 if (I::IsExternalTwoByteString(I::GetInstanceType(obj))) { | 6012 if (I::IsExternalTwoByteString(I::GetInstanceType(obj))) { |
| 6304 void* value = I::ReadField<void*>(obj, I::kStringResourceOffset); | 6013 void* value = I::ReadField<void*>(obj, I::kStringResourceOffset); |
| 6305 result = reinterpret_cast<String::ExternalStringResource*>(value); | 6014 result = reinterpret_cast<String::ExternalStringResource*>(value); |
| 6306 } else { | 6015 } else { |
| 6307 result = NULL; | 6016 result = NULL; |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6658 | 6367 |
| 6659 Handle<Boolean> False(Isolate* isolate) { | 6368 Handle<Boolean> False(Isolate* isolate) { |
| 6660 typedef internal::Object* S; | 6369 typedef internal::Object* S; |
| 6661 typedef internal::Internals I; | 6370 typedef internal::Internals I; |
| 6662 I::CheckInitialized(isolate); | 6371 I::CheckInitialized(isolate); |
| 6663 S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex); | 6372 S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex); |
| 6664 return Handle<Boolean>(reinterpret_cast<Boolean*>(slot)); | 6373 return Handle<Boolean>(reinterpret_cast<Boolean*>(slot)); |
| 6665 } | 6374 } |
| 6666 | 6375 |
| 6667 | 6376 |
| 6668 void Isolate::SetData(void* data) { | |
| 6669 typedef internal::Internals I; | |
| 6670 I::SetEmbedderData(this, 0, data); | |
| 6671 } | |
| 6672 | |
| 6673 | |
| 6674 void* Isolate::GetData() { | |
| 6675 typedef internal::Internals I; | |
| 6676 return I::GetEmbedderData(this, 0); | |
| 6677 } | |
| 6678 | |
| 6679 | |
| 6680 void Isolate::SetData(uint32_t slot, void* data) { | 6377 void Isolate::SetData(uint32_t slot, void* data) { |
| 6681 typedef internal::Internals I; | 6378 typedef internal::Internals I; |
| 6682 I::SetEmbedderData(this, slot, data); | 6379 I::SetEmbedderData(this, slot, data); |
| 6683 } | 6380 } |
| 6684 | 6381 |
| 6685 | 6382 |
| 6686 void* Isolate::GetData(uint32_t slot) { | 6383 void* Isolate::GetData(uint32_t slot) { |
| 6687 typedef internal::Internals I; | 6384 typedef internal::Internals I; |
| 6688 return I::GetEmbedderData(this, slot); | 6385 return I::GetEmbedderData(this, slot); |
| 6689 } | 6386 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6759 */ | 6456 */ |
| 6760 | 6457 |
| 6761 | 6458 |
| 6762 } // namespace v8 | 6459 } // namespace v8 |
| 6763 | 6460 |
| 6764 | 6461 |
| 6765 #undef TYPE_CHECK | 6462 #undef TYPE_CHECK |
| 6766 | 6463 |
| 6767 | 6464 |
| 6768 #endif // V8_H_ | 6465 #endif // V8_H_ |
| OLD | NEW |