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

Side by Side Diff: include/v8.h

Issue 99193002: Remove all stuff marked as V8_DEPRECATED. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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 | « no previous file | src/api.cc » ('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 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 } 694 }
695 /** 695 /**
696 * The destructor will dispose the Persistent based on the 696 * The destructor will dispose the Persistent based on the
697 * kResetInDestructor flags in the traits class. Since not calling dispose 697 * 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. 698 * can result in a memory leak, it is recommended to always set this flag.
699 */ 699 */
700 V8_INLINE ~Persistent() { 700 V8_INLINE ~Persistent() {
701 if (M::kResetInDestructor) this->Reset(); 701 if (M::kResetInDestructor) this->Reset();
702 } 702 }
703 703
704 V8_DEPRECATED("Use Reset instead",
705 V8_INLINE void Dispose()) { this->Reset(); }
706
707 // TODO(dcarney): this is pretty useless, fix or remove 704 // TODO(dcarney): this is pretty useless, fix or remove
708 template <class S> 705 template <class S>
709 V8_INLINE static Persistent<T>& Cast(Persistent<S>& that) { // NOLINT 706 V8_INLINE static Persistent<T>& Cast(Persistent<S>& that) { // NOLINT
710 #ifdef V8_ENABLE_CHECKS 707 #ifdef V8_ENABLE_CHECKS
711 // If we're going to perform the type check then we have to check 708 // 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. 709 // that the handle isn't empty before doing the checked cast.
713 if (!that.IsEmpty()) T::Cast(*that); 710 if (!that.IsEmpty()) T::Cast(*that);
714 #endif 711 #endif
715 return reinterpret_cast<Persistent<T>&>(that); 712 return reinterpret_cast<Persistent<T>&>(that);
716 } 713 }
717 714
718 // TODO(dcarney): this is pretty useless, fix or remove 715 // TODO(dcarney): this is pretty useless, fix or remove
719 template <class S> V8_INLINE Persistent<S>& As() { // NOLINT 716 template <class S> V8_INLINE Persistent<S>& As() { // NOLINT
720 return Persistent<S>::Cast(*this); 717 return Persistent<S>::Cast(*this);
721 } 718 }
722 719
720 // TODO(svenpanne): Used by d8.cc and test-api.cc.
723 template<typename S, typename P> 721 template<typename S, typename P>
724 V8_DEPRECATED( 722 V8_DEPRECATED(
725 "Use SetWeak instead", 723 "Use SetWeak instead",
726 V8_INLINE void MakeWeak( 724 V8_INLINE void MakeWeak(
727 P* parameter, 725 P* parameter,
728 typename WeakReferenceCallbacks<S, P>::Revivable callback)); 726 typename WeakReferenceCallbacks<S, P>::Revivable callback));
729 727
728 // TODO(svenpanne): Used by d8.cc and test-api.cc.
730 template<typename P> 729 template<typename P>
731 V8_DEPRECATED( 730 V8_DEPRECATED(
732 "Use SetWeak instead", 731 "Use SetWeak instead",
733 V8_INLINE void MakeWeak( 732 V8_INLINE void MakeWeak(
734 P* parameter, 733 P* parameter,
735 typename WeakReferenceCallbacks<T, P>::Revivable callback)); 734 typename WeakReferenceCallbacks<T, P>::Revivable callback));
736 735
737 // This will be removed. 736 // This will be removed.
738 V8_INLINE T* ClearAndLeak(); 737 V8_INLINE T* ClearAndLeak();
739 738
740 V8_DEPRECATED("This will be removed",
741 V8_INLINE void Clear()) { this->val_ = 0; }
742
743 // TODO(dcarney): remove 739 // TODO(dcarney): remove
744 #ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR 740 #ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR
745 741
746 private: 742 private:
747 #endif 743 #endif
748 template <class S> V8_INLINE Persistent(S* that) : PersistentBase<T>(that) { } 744 template <class S> V8_INLINE Persistent(S* that) : PersistentBase<T>(that) { }
749 745
750 V8_INLINE T* operator*() const { return this->val_; } 746 V8_INLINE T* operator*() const { return this->val_; }
751 747
752 private: 748 private:
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 * garbage collector will no longer track the object stored in the 841 * garbage collector will no longer track the object stored in the
846 * handle and may deallocate it. The behavior of accessing a handle 842 * handle and may deallocate it. The behavior of accessing a handle
847 * for which the handle scope has been deleted is undefined. 843 * for which the handle scope has been deleted is undefined.
848 */ 844 */
849 class V8_EXPORT HandleScope { 845 class V8_EXPORT HandleScope {
850 public: 846 public:
851 HandleScope(Isolate* isolate); 847 HandleScope(Isolate* isolate);
852 848
853 ~HandleScope(); 849 ~HandleScope();
854 850
851 // TODO(svenpanne): Used by HandleEscapeFrom.
855 template <class T> 852 template <class T>
856 V8_DEPRECATED("Use EscapableHandleScope::Escape instead", 853 V8_DEPRECATED("Use EscapableHandleScope::Escape instead",
857 Local<T> Close(Handle<T> value)); 854 Local<T> Close(Handle<T> value));
858 855
859 /** 856 /**
860 * Counts the number of allocated handles. 857 * Counts the number of allocated handles.
861 */ 858 */
862 static int NumberOfHandles(); 859 static int NumberOfHandles();
863 860
864 private: 861 private:
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 /** 1135 /**
1139 * Runs the script returning the resulting value. If the script is 1136 * Runs the script returning the resulting value. If the script is
1140 * context independent (created using ::New) it will be run in the 1137 * context independent (created using ::New) it will be run in the
1141 * currently entered context. If it is context specific (created 1138 * currently entered context. If it is context specific (created
1142 * using ::Compile) it will be run in the context in which it was 1139 * using ::Compile) it will be run in the context in which it was
1143 * compiled. 1140 * compiled.
1144 */ 1141 */
1145 Local<Value> Run(); 1142 Local<Value> Run();
1146 1143
1147 /** 1144 /**
1148 * Returns the script id value.
1149 */
1150 V8_DEPRECATED("Use GetId instead", Local<Value> Id());
1151
1152 /**
1153 * Returns the script id. 1145 * Returns the script id.
1154 */ 1146 */
1155 int GetId(); 1147 int GetId();
1156 1148
1157 /** 1149 /**
1158 * Associate an additional data object with the script. This is mainly used 1150 * 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 1151 * with the debugger as this data object is only available through the
1160 * debugger API. 1152 * debugger API.
1161 */ 1153 */
1162 void SetData(Handle<String> data); 1154 void SetData(Handle<String> data);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 int GetEndColumn() const; 1225 int GetEndColumn() const;
1234 1226
1235 /** 1227 /**
1236 * Passes on the value set by the embedder when it fed the script from which 1228 * Passes on the value set by the embedder when it fed the script from which
1237 * this Message was generated to V8. 1229 * this Message was generated to V8.
1238 */ 1230 */
1239 bool IsSharedCrossOrigin() const; 1231 bool IsSharedCrossOrigin() const;
1240 1232
1241 // TODO(1245381): Print to a string instead of on a FILE. 1233 // TODO(1245381): Print to a string instead of on a FILE.
1242 static void PrintCurrentStackTrace(Isolate* isolate, FILE* out); 1234 static void PrintCurrentStackTrace(Isolate* isolate, FILE* out);
1243 V8_DEPRECATED("Will be removed",
1244 static void PrintCurrentStackTrace(FILE* out));
1245 1235
1246 static const int kNoLineNumberInfo = 0; 1236 static const int kNoLineNumberInfo = 0;
1247 static const int kNoColumnInfo = 0; 1237 static const int kNoColumnInfo = 0;
1248 static const int kNoScriptIdInfo = 0; 1238 static const int kNoScriptIdInfo = 0;
1249 }; 1239 };
1250 1240
1251 1241
1252 /** 1242 /**
1253 * Representation of a JavaScript stack trace. The information collected is a 1243 * Representation of a JavaScript stack trace. The information collected is a
1254 * snapshot of the execution stack and the information remains valid after 1244 * snapshot of the execution stack and the information remains valid after
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 * Grab a snapshot of the current JavaScript execution stack. 1282 * Grab a snapshot of the current JavaScript execution stack.
1293 * 1283 *
1294 * \param frame_limit The maximum number of stack frames we want to capture. 1284 * \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 1285 * \param options Enumerates the set of things we will capture for each
1296 * StackFrame. 1286 * StackFrame.
1297 */ 1287 */
1298 static Local<StackTrace> CurrentStackTrace( 1288 static Local<StackTrace> CurrentStackTrace(
1299 Isolate* isolate, 1289 Isolate* isolate,
1300 int frame_limit, 1290 int frame_limit,
1301 StackTraceOptions options = kOverview); 1291 StackTraceOptions options = kOverview);
1302 V8_DEPRECATED("Will be removed",
1303 static Local<StackTrace> CurrentStackTrace(
1304 int frame_limit, StackTraceOptions options = kOverview));
1305 }; 1292 };
1306 1293
1307 1294
1308 /** 1295 /**
1309 * A single JavaScript stack frame. 1296 * A single JavaScript stack frame.
1310 */ 1297 */
1311 class V8_EXPORT StackFrame { 1298 class V8_EXPORT StackFrame {
1312 public: 1299 public:
1313 /** 1300 /**
1314 * Returns the number, 1-based, of the line for the associate function call. 1301 * 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
1626 1613
1627 1614
1628 /** 1615 /**
1629 * A primitive boolean value (ECMA-262, 4.3.14). Either the true 1616 * A primitive boolean value (ECMA-262, 4.3.14). Either the true
1630 * or false value. 1617 * or false value.
1631 */ 1618 */
1632 class V8_EXPORT Boolean : public Primitive { 1619 class V8_EXPORT Boolean : public Primitive {
1633 public: 1620 public:
1634 bool Value() const; 1621 bool Value() const;
1635 V8_INLINE static Handle<Boolean> New(Isolate* isolate, bool value); 1622 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 }; 1623 };
1639 1624
1640 1625
1641 /** 1626 /**
1642 * A JavaScript string value (ECMA-262, 4.3.17). 1627 * A JavaScript string value (ECMA-262, 4.3.17).
1643 */ 1628 */
1644 class V8_EXPORT String : public Primitive { 1629 class V8_EXPORT String : public Primitive {
1645 public: 1630 public:
1646 enum Encoding { 1631 enum Encoding {
1647 UNKNOWN_ENCODING = 0x1, 1632 UNKNOWN_ENCODING = 0x1,
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1833 V8_INLINE ExternalStringResource* GetExternalStringResource() const; 1818 V8_INLINE ExternalStringResource* GetExternalStringResource() const;
1834 1819
1835 /** 1820 /**
1836 * Get the ExternalAsciiStringResource for an external ASCII string. 1821 * Get the ExternalAsciiStringResource for an external ASCII string.
1837 * Returns NULL if IsExternalAscii() doesn't return true. 1822 * Returns NULL if IsExternalAscii() doesn't return true.
1838 */ 1823 */
1839 const ExternalAsciiStringResource* GetExternalAsciiStringResource() const; 1824 const ExternalAsciiStringResource* GetExternalAsciiStringResource() const;
1840 1825
1841 V8_INLINE static String* Cast(v8::Value* obj); 1826 V8_INLINE static String* Cast(v8::Value* obj);
1842 1827
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 { 1828 enum NewStringType {
1868 kNormalString, kInternalizedString, kUndetectableString 1829 kNormalString, kInternalizedString, kUndetectableString
1869 }; 1830 };
1870 1831
1871 /** Allocates a new string from UTF-8 data.*/ 1832 /** Allocates a new string from UTF-8 data.*/
1872 static Local<String> NewFromUtf8(Isolate* isolate, 1833 static Local<String> NewFromUtf8(Isolate* isolate,
1873 const char* data, 1834 const char* data,
1874 NewStringType type = kNormalString, 1835 NewStringType type = kNormalString,
1875 int length = -1); 1836 int length = -1);
1876 1837
(...skipping 20 matching lines...) Expand all
1897 /** 1858 /**
1898 * Creates a new external string using the data defined in the given 1859 * 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 1860 * 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 1861 * resource will be disposed by calling its Dispose method. The caller of
1901 * this function should not otherwise delete or modify the resource. Neither 1862 * this function should not otherwise delete or modify the resource. Neither
1902 * should the underlying buffer be deallocated or modified except through the 1863 * should the underlying buffer be deallocated or modified except through the
1903 * destructor of the external string resource. 1864 * destructor of the external string resource.
1904 */ 1865 */
1905 static Local<String> NewExternal(Isolate* isolate, 1866 static Local<String> NewExternal(Isolate* isolate,
1906 ExternalStringResource* resource); 1867 ExternalStringResource* resource);
1907 V8_DEPRECATED("Will be removed", static Local<String> NewExternal(
1908 ExternalStringResource* resource));
1909 1868
1910 /** 1869 /**
1911 * Associate an external string resource with this string by transforming it 1870 * 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 1871 * 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 1872 * will use the external string resource. The external string resource's
1914 * character contents need to be equivalent to this string. 1873 * character contents need to be equivalent to this string.
1915 * Returns true if the string has been changed to be an external string. 1874 * 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 1875 * The string is not modified if the operation fails. See NewExternal for
1917 * information on the lifetime of the resource. 1876 * information on the lifetime of the resource.
1918 */ 1877 */
1919 bool MakeExternal(ExternalStringResource* resource); 1878 bool MakeExternal(ExternalStringResource* resource);
1920 1879
1921 /** 1880 /**
1922 * Creates a new external string using the ASCII data defined in the given 1881 * 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 1882 * 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 1883 * resource will be disposed by calling its Dispose method. The caller of
1925 * this function should not otherwise delete or modify the resource. Neither 1884 * this function should not otherwise delete or modify the resource. Neither
1926 * should the underlying buffer be deallocated or modified except through the 1885 * should the underlying buffer be deallocated or modified except through the
1927 * destructor of the external string resource. 1886 * destructor of the external string resource.
1928 */ 1887 */
1929 static Local<String> NewExternal(Isolate* isolate, 1888 static Local<String> NewExternal(Isolate* isolate,
1930 ExternalAsciiStringResource* resource); 1889 ExternalAsciiStringResource* resource);
1931 V8_DEPRECATED("Will be removed", static Local<String> NewExternal(
1932 ExternalAsciiStringResource* resource));
1933 1890
1934 /** 1891 /**
1935 * Associate an external string resource with this string by transforming it 1892 * 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 1893 * 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 1894 * will use the external string resource. The external string resource's
1938 * character contents need to be equivalent to this string. 1895 * character contents need to be equivalent to this string.
1939 * Returns true if the string has been changed to be an external string. 1896 * 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 1897 * The string is not modified if the operation fails. See NewExternal for
1941 * information on the lifetime of the resource. 1898 * information on the lifetime of the resource.
1942 */ 1899 */
1943 bool MakeExternal(ExternalAsciiStringResource* resource); 1900 bool MakeExternal(ExternalAsciiStringResource* resource);
1944 1901
1945 /** 1902 /**
1946 * Returns true if this string can be made external. 1903 * Returns true if this string can be made external.
1947 */ 1904 */
1948 bool CanMakeExternal(); 1905 bool CanMakeExternal();
1949 1906
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 /** 1907 /**
1963 * Converts an object to a UTF-8-encoded character array. Useful if 1908 * 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 1909 * 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) 1910 * (e.g. due to an exception in the toString() method of the object)
1966 * then the length() method returns 0 and the * operator returns 1911 * then the length() method returns 0 and the * operator returns
1967 * NULL. 1912 * NULL.
1968 */ 1913 */
1969 class V8_EXPORT Utf8Value { 1914 class V8_EXPORT Utf8Value {
1970 public: 1915 public:
1971 explicit Utf8Value(Handle<v8::Value> obj); 1916 explicit Utf8Value(Handle<v8::Value> obj);
1972 ~Utf8Value(); 1917 ~Utf8Value();
1973 char* operator*() { return str_; } 1918 char* operator*() { return str_; }
1974 const char* operator*() const { return str_; } 1919 const char* operator*() const { return str_; }
1975 int length() const { return length_; } 1920 int length() const { return length_; }
1976 private: 1921 private:
1977 char* str_; 1922 char* str_;
1978 int length_; 1923 int length_;
1979 1924
1980 // Disallow copying and assigning. 1925 // Disallow copying and assigning.
1981 Utf8Value(const Utf8Value&); 1926 Utf8Value(const Utf8Value&);
1982 void operator=(const Utf8Value&); 1927 void operator=(const Utf8Value&);
1983 }; 1928 };
1984 1929
Michael Starzinger 2013/12/02 15:01:28 nit: Only one empty new-line withing class body.
Sven Panne 2013/12/02 17:18:09 Doesn't this improve readability? ;-) Will remove
1985 /**
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 1930
2009 /** 1931 /**
2010 * Converts an object to a two-byte string. 1932 * Converts an object to a two-byte string.
2011 * If conversion to a string fails (eg. due to an exception in the toString() 1933 * 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 1934 * method of the object) then the length() method returns 0 and the * operator
2013 * returns NULL. 1935 * returns NULL.
2014 */ 1936 */
2015 class V8_EXPORT Value { 1937 class V8_EXPORT Value {
2016 public: 1938 public:
2017 explicit Value(Handle<v8::Value> obj); 1939 explicit Value(Handle<v8::Value> obj);
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
2480 * Clones an element at index |index|. Returns an empty 2402 * Clones an element at index |index|. Returns an empty
2481 * handle if cloning fails (for any reason). 2403 * handle if cloning fails (for any reason).
2482 */ 2404 */
2483 Local<Object> CloneElementAt(uint32_t index); 2405 Local<Object> CloneElementAt(uint32_t index);
2484 2406
2485 /** 2407 /**
2486 * Creates a JavaScript array with the given length. If the length 2408 * Creates a JavaScript array with the given length. If the length
2487 * is negative the returned array will have length 0. 2409 * is negative the returned array will have length 0.
2488 */ 2410 */
2489 static Local<Array> New(Isolate* isolate, int length = 0); 2411 static Local<Array> New(Isolate* isolate, int length = 0);
2490 V8_DEPRECATED("Will be removed", static Local<Array> New(int length = 0));
2491 2412
2492 V8_INLINE static Array* Cast(Value* obj); 2413 V8_INLINE static Array* Cast(Value* obj);
2493 private: 2414 private:
2494 Array(); 2415 Array();
2495 static void CheckCast(Value* obj); 2416 static void CheckCast(Value* obj);
2496 }; 2417 };
2497 2418
2498 2419
2499 template<typename T> 2420 template<typename T>
2500 class ReturnValue { 2421 class ReturnValue {
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
2649 * kLineOffsetNotFound if no information available. 2570 * kLineOffsetNotFound if no information available.
2650 */ 2571 */
2651 int GetScriptColumnNumber() const; 2572 int GetScriptColumnNumber() const;
2652 2573
2653 /** 2574 /**
2654 * Tells whether this function is builtin. 2575 * Tells whether this function is builtin.
2655 */ 2576 */
2656 bool IsBuiltin() const; 2577 bool IsBuiltin() const;
2657 2578
2658 /** 2579 /**
2659 * Returns scriptId object.
2660 */
2661 V8_DEPRECATED("Use ScriptId instead", Handle<Value> GetScriptId() const);
2662
2663 /**
2664 * Returns scriptId. 2580 * Returns scriptId.
2665 */ 2581 */
2666 int ScriptId() const; 2582 int ScriptId() const;
2667 2583
2668 ScriptOrigin GetScriptOrigin() const; 2584 ScriptOrigin GetScriptOrigin() const;
2669 V8_INLINE static Function* Cast(Value* obj); 2585 V8_INLINE static Function* Cast(Value* obj);
2670 static const int kLineOffsetNotFound; 2586 static const int kLineOffsetNotFound;
2671 2587
2672 private: 2588 private:
2673 Function(); 2589 Function();
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
2744 */ 2660 */
2745 size_t ByteLength() const; 2661 size_t ByteLength() const;
2746 2662
2747 /** 2663 /**
2748 * Create a new ArrayBuffer. Allocate |byte_length| bytes. 2664 * Create a new ArrayBuffer. Allocate |byte_length| bytes.
2749 * Allocated memory will be owned by a created ArrayBuffer and 2665 * Allocated memory will be owned by a created ArrayBuffer and
2750 * will be deallocated when it is garbage-collected, 2666 * will be deallocated when it is garbage-collected,
2751 * unless the object is externalized. 2667 * unless the object is externalized.
2752 */ 2668 */
2753 static Local<ArrayBuffer> New(Isolate* isolate, size_t byte_length); 2669 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 2670
2757 /** 2671 /**
2758 * Create a new ArrayBuffer over an existing memory block. 2672 * Create a new ArrayBuffer over an existing memory block.
2759 * The created array buffer is immediately in externalized state. 2673 * The created array buffer is immediately in externalized state.
2760 * The memory block will not be reclaimed when a created ArrayBuffer 2674 * The memory block will not be reclaimed when a created ArrayBuffer
2761 * is garbage-collected. 2675 * is garbage-collected.
2762 */ 2676 */
2763 static Local<ArrayBuffer> New(Isolate* isolate, void* data, 2677 static Local<ArrayBuffer> New(Isolate* isolate, void* data,
2764 size_t byte_length); 2678 size_t byte_length);
2765 V8_DEPRECATED("Will be removed",
2766 static Local<ArrayBuffer> New(void* data, size_t byte_length));
2767 2679
2768 /** 2680 /**
2769 * Returns true if ArrayBuffer is extrenalized, that is, does not 2681 * Returns true if ArrayBuffer is extrenalized, that is, does not
2770 * own its memory block. 2682 * own its memory block.
2771 */ 2683 */
2772 bool IsExternal() const; 2684 bool IsExternal() const;
2773 2685
2774 /** 2686 /**
2775 * Neuters this ArrayBuffer and all its views (typed arrays). 2687 * Neuters this ArrayBuffer and all its views (typed arrays).
2776 * Neutering sets the byte length of the buffer and all typed arrays to zero, 2688 * 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
3017 static void CheckCast(Value* obj); 2929 static void CheckCast(Value* obj);
3018 }; 2930 };
3019 2931
3020 2932
3021 /** 2933 /**
3022 * An instance of the built-in Date constructor (ECMA-262, 15.9). 2934 * An instance of the built-in Date constructor (ECMA-262, 15.9).
3023 */ 2935 */
3024 class V8_EXPORT Date : public Object { 2936 class V8_EXPORT Date : public Object {
3025 public: 2937 public:
3026 static Local<Value> New(Isolate* isolate, double time); 2938 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
3033 /**
3034 * A specialization of Value::NumberValue that is more efficient
Michael Starzinger 2013/12/02 15:01:28 Why do we remove this comment, I liked it, can we
Sven Panne 2013/12/02 17:18:09 Hmmm, Value::NumberValue is dead, and I don't like
3035 * because we know the structure of this object.
3036 */
3037 double ValueOf() const; 2939 double ValueOf() const;
3038
3039 V8_INLINE static Date* Cast(v8::Value* obj); 2940 V8_INLINE static Date* Cast(v8::Value* obj);
3040 2941
3041 /** 2942 /**
3042 * Notification that the embedder has changed the time zone, 2943 * Notification that the embedder has changed the time zone,
3043 * daylight savings time, or other date / time configuration 2944 * daylight savings time, or other date / time configuration
3044 * parameters. V8 keeps a cache of various values used for 2945 * parameters. V8 keeps a cache of various values used for
3045 * date / time computation. This notification will reset 2946 * date / time computation. This notification will reset
3046 * those cached values for the current context so that date / 2947 * those cached values for the current context so that date /
3047 * time configuration changes would be reflected in the Date 2948 * time configuration changes would be reflected in the Date
3048 * object. 2949 * object.
3049 * 2950 *
3050 * This API should not be called more than needed as it will 2951 * This API should not be called more than needed as it will
3051 * negatively impact the performance of date operations. 2952 * negatively impact the performance of date operations.
3052 */ 2953 */
3053 static void DateTimeConfigurationChangeNotification(Isolate* isolate); 2954 static void DateTimeConfigurationChangeNotification(Isolate* isolate);
3054 V8_DEPRECATED("Will be removed",
3055 static void DateTimeConfigurationChangeNotification());
3056 2955
3057 private: 2956 private:
3058 static void CheckCast(v8::Value* obj); 2957 static void CheckCast(v8::Value* obj);
3059 }; 2958 };
3060 2959
3061 2960
3062 /** 2961 /**
3063 * A Number object (ECMA-262, 4.3.21). 2962 * A Number object (ECMA-262, 4.3.21).
3064 */ 2963 */
3065 class V8_EXPORT NumberObject : public Object { 2964 class V8_EXPORT NumberObject : public Object {
3066 public: 2965 public:
3067 static Local<Value> New(Isolate* isolate, double value); 2966 static Local<Value> New(Isolate* isolate, double value);
3068 V8_DEPRECATED("Will be removed", static Local<Value> New(double value));
3069
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; 2967 double ValueOf() const;
3078
3079 V8_INLINE static NumberObject* Cast(v8::Value* obj); 2968 V8_INLINE static NumberObject* Cast(v8::Value* obj);
3080
3081 private: 2969 private:
3082 static void CheckCast(v8::Value* obj); 2970 static void CheckCast(v8::Value* obj);
3083 }; 2971 };
3084 2972
3085 2973
3086 /** 2974 /**
3087 * A Boolean object (ECMA-262, 4.3.15). 2975 * A Boolean object (ECMA-262, 4.3.15).
3088 */ 2976 */
3089 class V8_EXPORT BooleanObject : public Object { 2977 class V8_EXPORT BooleanObject : public Object {
3090 public: 2978 public:
3091 static Local<Value> New(bool value); 2979 static Local<Value> New(bool value);
3092
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; 2980 bool ValueOf() const;
3101
3102 V8_INLINE static BooleanObject* Cast(v8::Value* obj); 2981 V8_INLINE static BooleanObject* Cast(v8::Value* obj);
3103
3104 private: 2982 private:
3105 static void CheckCast(v8::Value* obj); 2983 static void CheckCast(v8::Value* obj);
3106 }; 2984 };
3107 2985
3108 2986
3109 /** 2987 /**
3110 * A String object (ECMA-262, 4.3.18). 2988 * A String object (ECMA-262, 4.3.18).
3111 */ 2989 */
3112 class V8_EXPORT StringObject : public Object { 2990 class V8_EXPORT StringObject : public Object {
3113 public: 2991 public:
3114 static Local<Value> New(Handle<String> value); 2992 static Local<Value> New(Handle<String> value);
3115
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; 2993 Local<String> ValueOf() const;
3124
3125 V8_INLINE static StringObject* Cast(v8::Value* obj); 2994 V8_INLINE static StringObject* Cast(v8::Value* obj);
3126
3127 private: 2995 private:
3128 static void CheckCast(v8::Value* obj); 2996 static void CheckCast(v8::Value* obj);
3129 }; 2997 };
3130 2998
3131 2999
3132 /** 3000 /**
3133 * A Symbol object (ECMA-262 edition 6). 3001 * A Symbol object (ECMA-262 edition 6).
3134 * 3002 *
3135 * This is an experimental feature. Use at your own risk. 3003 * This is an experimental feature. Use at your own risk.
3136 */ 3004 */
3137 class V8_EXPORT SymbolObject : public Object { 3005 class V8_EXPORT SymbolObject : public Object {
3138 public: 3006 public:
3139 static Local<Value> New(Isolate* isolate, Handle<Symbol> value); 3007 static Local<Value> New(Isolate* isolate, Handle<Symbol> value);
3140
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; 3008 Local<Symbol> ValueOf() const;
3149
3150 V8_INLINE static SymbolObject* Cast(v8::Value* obj); 3009 V8_INLINE static SymbolObject* Cast(v8::Value* obj);
3151
3152 private: 3010 private:
3153 static void CheckCast(v8::Value* obj); 3011 static void CheckCast(v8::Value* obj);
3154 }; 3012 };
3155 3013
3156 3014
3157 /** 3015 /**
3158 * An instance of the built-in RegExp constructor (ECMA-262, 15.10). 3016 * An instance of the built-in RegExp constructor (ECMA-262, 15.10).
3159 */ 3017 */
3160 class V8_EXPORT RegExp : public Object { 3018 class V8_EXPORT RegExp : public Object {
3161 public: 3019 public:
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
3200 }; 3058 };
3201 3059
3202 3060
3203 /** 3061 /**
3204 * A JavaScript value that wraps a C++ void*. This type of value is mainly used 3062 * A JavaScript value that wraps a C++ void*. This type of value is mainly used
3205 * to associate C++ data structures with JavaScript objects. 3063 * to associate C++ data structures with JavaScript objects.
3206 */ 3064 */
3207 class V8_EXPORT External : public Value { 3065 class V8_EXPORT External : public Value {
3208 public: 3066 public:
3209 static Local<External> New(Isolate* isolate, void* value); 3067 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); 3068 V8_INLINE static External* Cast(Value* obj);
3212 void* Value() const; 3069 void* Value() const;
3213 private: 3070 private:
3214 static void CheckCast(v8::Value* obj); 3071 static void CheckCast(v8::Value* obj);
3215 }; 3072 };
3216 3073
3217 3074
3218 // --- Templates --- 3075 // --- Templates ---
3219 3076
3220 3077
3221 /** 3078 /**
3222 * The superclass of object and function templates. 3079 * The superclass of object and function templates.
3223 */ 3080 */
3224 class V8_EXPORT Template : public Data { 3081 class V8_EXPORT Template : public Data {
3225 public: 3082 public:
3226 /** Adds a property to each instance created by this template.*/ 3083 /** Adds a property to each instance created by this template.*/
3227 void Set(Handle<String> name, Handle<Data> value, 3084 void Set(Handle<String> name, Handle<Data> value,
3228 PropertyAttribute attributes = None); 3085 PropertyAttribute attributes = None);
3229 V8_INLINE void Set(Isolate* isolate, const char* name, Handle<Data> value); 3086 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 3087
3233 void SetAccessorProperty( 3088 void SetAccessorProperty(
3234 Local<String> name, 3089 Local<String> name,
3235 Local<FunctionTemplate> getter = Local<FunctionTemplate>(), 3090 Local<FunctionTemplate> getter = Local<FunctionTemplate>(),
3236 Local<FunctionTemplate> setter = Local<FunctionTemplate>(), 3091 Local<FunctionTemplate> setter = Local<FunctionTemplate>(),
3237 PropertyAttribute attribute = None, 3092 PropertyAttribute attribute = None,
3238 AccessControl settings = DEFAULT); 3093 AccessControl settings = DEFAULT);
3239 3094
3240 /** 3095 /**
3241 * Whenever the property with the given name is accessed on objects 3096 * Whenever the property with the given name is accessed on objects
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
3757 * A Signature specifies which receivers and arguments are valid 3612 * A Signature specifies which receivers and arguments are valid
3758 * parameters to a function. 3613 * parameters to a function.
3759 */ 3614 */
3760 class V8_EXPORT Signature : public Data { 3615 class V8_EXPORT Signature : public Data {
3761 public: 3616 public:
3762 static Local<Signature> New(Isolate* isolate, 3617 static Local<Signature> New(Isolate* isolate,
3763 Handle<FunctionTemplate> receiver = 3618 Handle<FunctionTemplate> receiver =
3764 Handle<FunctionTemplate>(), 3619 Handle<FunctionTemplate>(),
3765 int argc = 0, 3620 int argc = 0,
3766 Handle<FunctionTemplate> argv[] = 0); 3621 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 3622
3774 private: 3623 private:
3775 Signature(); 3624 Signature();
3776 }; 3625 };
3777 3626
3778 3627
3779 /** 3628 /**
3780 * An AccessorSignature specifies which receivers are valid parameters 3629 * An AccessorSignature specifies which receivers are valid parameters
3781 * to an accessor callback. 3630 * to an accessor callback.
3782 */ 3631 */
3783 class V8_EXPORT AccessorSignature : public Data { 3632 class V8_EXPORT AccessorSignature : public Data {
3784 public: 3633 public:
3785 static Local<AccessorSignature> New(Isolate* isolate, 3634 static Local<AccessorSignature> New(Isolate* isolate,
3786 Handle<FunctionTemplate> receiver = 3635 Handle<FunctionTemplate> receiver =
3787 Handle<FunctionTemplate>()); 3636 Handle<FunctionTemplate>());
3788 V8_DEPRECATED("Will be removed", static Local<AccessorSignature> New(
3789 Handle<FunctionTemplate> receiver =
3790 Handle<FunctionTemplate>()));
3791 3637
3792 private: 3638 private:
3793 AccessorSignature(); 3639 AccessorSignature();
3794 }; 3640 };
3795 3641
3796 3642
3797 class V8_EXPORT DeclaredAccessorDescriptor : public Data { 3643 class V8_EXPORT DeclaredAccessorDescriptor : public Data {
3798 private: 3644 private:
3799 DeclaredAccessorDescriptor(); 3645 DeclaredAccessorDescriptor();
3800 }; 3646 };
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
3894 virtual ~Extension() { } 3740 virtual ~Extension() { }
3895 virtual v8::Handle<v8::FunctionTemplate> GetNativeFunctionTemplate( 3741 virtual v8::Handle<v8::FunctionTemplate> GetNativeFunctionTemplate(
3896 v8::Isolate* isolate, v8::Handle<v8::String> name) { 3742 v8::Isolate* isolate, v8::Handle<v8::String> name) {
3897 #if defined(V8_DEPRECATION_WARNINGS) 3743 #if defined(V8_DEPRECATION_WARNINGS)
3898 return v8::Handle<v8::FunctionTemplate>(); 3744 return v8::Handle<v8::FunctionTemplate>();
3899 #else 3745 #else
3900 return GetNativeFunction(name); 3746 return GetNativeFunction(name);
3901 #endif 3747 #endif
3902 } 3748 }
3903 3749
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_; } 3750 const char* name() const { return name_; }
3911 size_t source_length() const { return source_length_; } 3751 size_t source_length() const { return source_length_; }
3912 const String::ExternalAsciiStringResource* source() const { 3752 const String::ExternalAsciiStringResource* source() const {
3913 return &source_; } 3753 return &source_; }
3914 int dependency_count() { return dep_count_; } 3754 int dependency_count() { return dep_count_; }
3915 const char** dependencies() { return deps_; } 3755 const char** dependencies() { return deps_; }
3916 void set_auto_enable(bool value) { auto_enable_ = value; } 3756 void set_auto_enable(bool value) { auto_enable_ = value; }
3917 bool auto_enable() { return auto_enable_; } 3757 bool auto_enable() { return auto_enable_; }
3918 3758
3919 private: 3759 private:
(...skipping 24 matching lines...) Expand all
3944 }; 3784 };
3945 3785
3946 3786
3947 // --- Statics --- 3787 // --- Statics ---
3948 3788
3949 V8_INLINE Handle<Primitive> Undefined(Isolate* isolate); 3789 V8_INLINE Handle<Primitive> Undefined(Isolate* isolate);
3950 V8_INLINE Handle<Primitive> Null(Isolate* isolate); 3790 V8_INLINE Handle<Primitive> Null(Isolate* isolate);
3951 V8_INLINE Handle<Boolean> True(Isolate* isolate); 3791 V8_INLINE Handle<Boolean> True(Isolate* isolate);
3952 V8_INLINE Handle<Boolean> False(Isolate* isolate); 3792 V8_INLINE Handle<Boolean> False(Isolate* isolate);
3953 3793
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 3794
3960 /** 3795 /**
3961 * A set of constraints that specifies the limits of the runtime's memory use. 3796 * 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 3797 * You must set the heap size before initializing the VM - the size cannot be
3963 * adjusted after the VM is initialized. 3798 * adjusted after the VM is initialized.
3964 * 3799 *
3965 * If you are using threads then you should hold the V8::Locker lock while 3800 * 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 3801 * setting the stack limit and you must set a non-default stack limit separately
3967 * for each thread. 3802 * for each thread.
3968 */ 3803 */
3969 class V8_EXPORT ResourceConstraints { 3804 class V8_EXPORT ResourceConstraints {
3970 public: 3805 public:
3971 ResourceConstraints(); 3806 ResourceConstraints();
3972 3807
3973 /** 3808 /**
3974 * Configures the constraints with reasonable default values based on the 3809 * Configures the constraints with reasonable default values based on the
3975 * capabilities of the current device the VM is running on. 3810 * capabilities of the current device the VM is running on.
3976 * 3811 *
3977 * \param physical_memory The total amount of physical memory on the current 3812 * \param physical_memory The total amount of physical memory on the current
3978 * device, in bytes. 3813 * device, in bytes.
3979 * \param number_of_processors The number of CPUs available on the current 3814 * \param number_of_processors The number of CPUs available on the current
3980 * device. 3815 * device.
3981 */ 3816 */
3982 void ConfigureDefaults(uint64_t physical_memory, 3817 void ConfigureDefaults(uint64_t physical_memory,
3983 uint32_t number_of_processors); 3818 uint32_t number_of_processors);
3984 V8_DEPRECATED("Will be removed",
3985 void ConfigureDefaults(uint64_t physical_memory));
3986 3819
3987 int max_young_space_size() const { return max_young_space_size_; } 3820 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; } 3821 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_; } 3822 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; } 3823 void set_max_old_space_size(int value) { max_old_space_size_ = value; }
3991 int max_executable_size() const { return max_executable_size_; } 3824 int max_executable_size() const { return max_executable_size_; }
3992 void set_max_executable_size(int value) { max_executable_size_ = value; } 3825 void set_max_executable_size(int value) { max_executable_size_ = value; }
3993 uint32_t* stack_limit() const { return stack_limit_; } 3826 uint32_t* stack_limit() const { return stack_limit_; }
3994 // Sets an address beyond which the VM's stack may not grow. 3827 // Sets an address beyond which the VM's stack may not grow.
3995 void set_stack_limit(uint32_t* value) { stack_limit_ = value; } 3828 void set_stack_limit(uint32_t* value) { stack_limit_ = value; }
(...skipping 21 matching lines...) Expand all
4017 3850
4018 // --- Exceptions --- 3851 // --- Exceptions ---
4019 3852
4020 3853
4021 typedef void (*FatalErrorCallback)(const char* location, const char* message); 3854 typedef void (*FatalErrorCallback)(const char* location, const char* message);
4022 3855
4023 3856
4024 typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> error); 3857 typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> error);
4025 3858
4026 3859
4027 V8_DEPRECATED(
4028 "Use Isolate::ThrowException instead",
4029 Handle<Value> V8_EXPORT ThrowException(Handle<Value> exception));
4030
4031 /** 3860 /**
4032 * Create new error objects by calling the corresponding error object 3861 * Create new error objects by calling the corresponding error object
4033 * constructor with the message. 3862 * constructor with the message.
4034 */ 3863 */
4035 class V8_EXPORT Exception { 3864 class V8_EXPORT Exception {
4036 public: 3865 public:
4037 static Local<Value> RangeError(Handle<String> message); 3866 static Local<Value> RangeError(Handle<String> message);
4038 static Local<Value> ReferenceError(Handle<String> message); 3867 static Local<Value> ReferenceError(Handle<String> message);
4039 static Local<Value> SyntaxError(Handle<String> message); 3868 static Local<Value> SyntaxError(Handle<String> message);
4040 static Local<Value> TypeError(Handle<String> message); 3869 static Local<Value> TypeError(Handle<String> message);
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
4213 * Requires: this == Isolate::GetCurrent(). 4042 * Requires: this == Isolate::GetCurrent().
4214 */ 4043 */
4215 void Exit(); 4044 void Exit();
4216 4045
4217 /** 4046 /**
4218 * Disposes the isolate. The isolate must not be entered by any 4047 * Disposes the isolate. The isolate must not be entered by any
4219 * thread to be disposable. 4048 * thread to be disposable.
4220 */ 4049 */
4221 void Dispose(); 4050 void Dispose();
4222 4051
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 /** 4052 /**
4228 * Associate embedder-specific data with the isolate. |slot| has to be 4053 * Associate embedder-specific data with the isolate. |slot| has to be
4229 * between 0 and GetNumberOfDataSlots() - 1. 4054 * between 0 and GetNumberOfDataSlots() - 1.
4230 */ 4055 */
4231 V8_INLINE void SetData(uint32_t slot, void* data); 4056 V8_INLINE void SetData(uint32_t slot, void* data);
4232 4057
4233 /** 4058 /**
4234 * Retrieve embedder-specific data from the isolate. 4059 * Retrieve embedder-specific data from the isolate.
4235 * Returns NULL if SetData has never been called for the given |slot|. 4060 * Returns NULL if SetData has never been called for the given |slot|.
4236 */ 4061 */
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
4834 * are not guaranteed to live past each call. The \p event_handler must 4659 * are not guaranteed to live past each call. The \p event_handler must
4835 * copy strings and other parameters it needs to keep around. 4660 * copy strings and other parameters it needs to keep around.
4836 * \note the set of events declared in JitCodeEvent::EventType is expected to 4661 * \note the set of events declared in JitCodeEvent::EventType is expected to
4837 * grow over time, and the JitCodeEvent structure is expected to accrue 4662 * grow over time, and the JitCodeEvent structure is expected to accrue
4838 * new members. The \p event_handler function must ignore event codes 4663 * new members. The \p event_handler function must ignore event codes
4839 * it does not recognize to maintain future compatibility. 4664 * it does not recognize to maintain future compatibility.
4840 */ 4665 */
4841 static void SetJitCodeEventHandler(JitCodeEventOptions options, 4666 static void SetJitCodeEventHandler(JitCodeEventOptions options,
4842 JitCodeEventHandler event_handler); 4667 JitCodeEventHandler event_handler);
4843 4668
4844 V8_DEPRECATED(
4845 "Use Isolate::AdjustAmountOfExternalAllocatedMemory instead",
4846 static int64_t AdjustAmountOfExternalAllocatedMemory(
4847 int64_t change_in_bytes));
4848
4849 /** 4669 /**
4850 * Forcefully terminate the current thread of JavaScript execution 4670 * Forcefully terminate the current thread of JavaScript execution
4851 * in the given isolate. If no isolate is provided, the default 4671 * in the given isolate. If no isolate is provided, the default
4852 * isolate is used. 4672 * isolate is used.
4853 * 4673 *
4854 * This method can be used by any thread even if that thread has not 4674 * This method can be used by any thread even if that thread has not
4855 * acquired the V8 lock with a Locker object. 4675 * acquired the V8 lock with a Locker object.
4856 * 4676 *
4857 * \param isolate The isolate in which to terminate the current JS execution. 4677 * \param isolate The isolate in which to terminate the current JS execution.
4858 */ 4678 */
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
5202 * created by a previous call to Context::New with the same global 5022 * created by a previous call to Context::New with the same global
5203 * template. The state of the global object will be completely reset 5023 * template. The state of the global object will be completely reset
5204 * and only object identify will remain. 5024 * and only object identify will remain.
5205 */ 5025 */
5206 static Local<Context> New( 5026 static Local<Context> New(
5207 Isolate* isolate, 5027 Isolate* isolate,
5208 ExtensionConfiguration* extensions = NULL, 5028 ExtensionConfiguration* extensions = NULL,
5209 Handle<ObjectTemplate> global_template = Handle<ObjectTemplate>(), 5029 Handle<ObjectTemplate> global_template = Handle<ObjectTemplate>(),
5210 Handle<Value> global_object = Handle<Value>()); 5030 Handle<Value> global_object = Handle<Value>());
5211 5031
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 /** 5032 /**
5222 * Sets the security token for the context. To access an object in 5033 * Sets the security token for the context. To access an object in
5223 * another context, the security tokens must match. 5034 * another context, the security tokens must match.
5224 */ 5035 */
5225 void SetSecurityToken(Handle<Value> token); 5036 void SetSecurityToken(Handle<Value> token);
5226 5037
5227 /** Restores the security token to the default value. */ 5038 /** Restores the security token to the default value. */
5228 void UseDefaultSecurityToken(); 5039 void UseDefaultSecurityToken();
5229 5040
5230 /** Returns the security token of this context.*/ 5041 /** Returns the security token of this context.*/
5231 Handle<Value> GetSecurityToken(); 5042 Handle<Value> GetSecurityToken();
5232 5043
5233 /** 5044 /**
5234 * Enter this context. After entering a context, all code compiled 5045 * Enter this context. After entering a context, all code compiled
5235 * and run is compiled and run in this context. If another context 5046 * 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 5047 * is already entered, this old context is saved so it can be
5237 * restored when the new context is exited. 5048 * restored when the new context is exited.
5238 */ 5049 */
5239 void Enter(); 5050 void Enter();
5240 5051
5241 /** 5052 /**
5242 * Exit this context. Exiting the current context restores the 5053 * Exit this context. Exiting the current context restores the
5243 * context that was in place when entering the current context. 5054 * context that was in place when entering the current context.
5244 */ 5055 */
5245 void Exit(); 5056 void Exit();
5246 5057
5247 /** Returns true if the context has experienced an out of memory situation. */ 5058 /** Returns true if the context has experienced an out of memory situation. */
5248 bool HasOutOfMemoryException(); 5059 bool HasOutOfMemoryException();
5249 5060
5250 V8_DEPRECATED("Use Isolate::InContext instead",
5251 static bool InContext());
5252
5253 /** Returns an isolate associated with a current context. */ 5061 /** Returns an isolate associated with a current context. */
5254 v8::Isolate* GetIsolate(); 5062 v8::Isolate* GetIsolate();
5255 5063
5256 /** 5064 /**
5257 * Gets the embedder data with the given index, which must have been set by a 5065 * 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 5066 * previous call to SetEmbedderData with the same index. Note that index 0
5259 * currently has a special meaning for Chrome's debugger. 5067 * currently has a special meaning for Chrome's debugger.
5260 */ 5068 */
5261 V8_INLINE Local<Value> GetEmbedderData(int index); 5069 V8_INLINE Local<Value> GetEmbedderData(int index);
5262 5070
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
5312 5120
5313 /** 5121 /**
5314 * Stack-allocated class which sets the execution context for all 5122 * Stack-allocated class which sets the execution context for all
5315 * operations executed within a local scope. 5123 * operations executed within a local scope.
5316 */ 5124 */
5317 class Scope { 5125 class Scope {
5318 public: 5126 public:
5319 explicit V8_INLINE Scope(Handle<Context> context) : context_(context) { 5127 explicit V8_INLINE Scope(Handle<Context> context) : context_(context) {
5320 context_->Enter(); 5128 context_->Enter();
5321 } 5129 }
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(); } 5130 V8_INLINE ~Scope() { context_->Exit(); }
5329 5131
5330 private: 5132 private:
5331 Handle<Context> context_; 5133 Handle<Context> context_;
5332 }; 5134 };
5333 5135
5334 private: 5136 private:
5335 friend class Value; 5137 friend class Value;
5336 friend class Script; 5138 friend class Script;
5337 friend class Object; 5139 friend class Object;
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
6195 Handle<Boolean> ScriptOrigin::ResourceIsSharedCrossOrigin() const { 5997 Handle<Boolean> ScriptOrigin::ResourceIsSharedCrossOrigin() const {
6196 return resource_is_shared_cross_origin_; 5998 return resource_is_shared_cross_origin_;
6197 } 5999 }
6198 6000
6199 6001
6200 Handle<Boolean> Boolean::New(Isolate* isolate, bool value) { 6002 Handle<Boolean> Boolean::New(Isolate* isolate, bool value) {
6201 return value ? True(isolate) : False(isolate); 6003 return value ? True(isolate) : False(isolate);
6202 } 6004 }
6203 6005
6204 6006
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) { 6007 void Template::Set(Isolate* isolate, const char* name, v8::Handle<Data> value) {
6211 Set(v8::String::NewFromUtf8(isolate, name), value); 6008 Set(v8::String::NewFromUtf8(isolate, name), value);
6212 } 6009 }
6213 6010
6214 6011
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) { 6012 Local<Value> Object::GetInternalField(int index) {
6221 #ifndef V8_ENABLE_CHECKS 6013 #ifndef V8_ENABLE_CHECKS
6222 typedef internal::Object O; 6014 typedef internal::Object O;
6223 typedef internal::HeapObject HO; 6015 typedef internal::HeapObject HO;
6224 typedef internal::Internals I; 6016 typedef internal::Internals I;
6225 O* obj = *reinterpret_cast<O**>(this); 6017 O* obj = *reinterpret_cast<O**>(this);
6226 // Fast path: If the object is a plain JSObject, which is the common case, we 6018 // 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. 6019 // know where to find the internal fields and can return the value directly.
6228 if (I::GetInstanceType(obj) == I::kJSObjectType) { 6020 if (I::GetInstanceType(obj) == I::kJSObjectType) {
6229 int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index); 6021 int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
6262 6054
6263 Local<String> String::Empty(Isolate* isolate) { 6055 Local<String> String::Empty(Isolate* isolate) {
6264 typedef internal::Object* S; 6056 typedef internal::Object* S;
6265 typedef internal::Internals I; 6057 typedef internal::Internals I;
6266 I::CheckInitialized(isolate); 6058 I::CheckInitialized(isolate);
6267 S* slot = I::GetRoot(isolate, I::kEmptyStringRootIndex); 6059 S* slot = I::GetRoot(isolate, I::kEmptyStringRootIndex);
6268 return Local<String>(reinterpret_cast<String*>(slot)); 6060 return Local<String>(reinterpret_cast<String*>(slot));
6269 } 6061 }
6270 6062
6271 6063
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 { 6064 String::ExternalStringResource* String::GetExternalStringResource() const {
6299 typedef internal::Object O; 6065 typedef internal::Object O;
6300 typedef internal::Internals I; 6066 typedef internal::Internals I;
6301 O* obj = *reinterpret_cast<O**>(const_cast<String*>(this)); 6067 O* obj = *reinterpret_cast<O**>(const_cast<String*>(this));
6302 String::ExternalStringResource* result; 6068 String::ExternalStringResource* result;
6303 if (I::IsExternalTwoByteString(I::GetInstanceType(obj))) { 6069 if (I::IsExternalTwoByteString(I::GetInstanceType(obj))) {
6304 void* value = I::ReadField<void*>(obj, I::kStringResourceOffset); 6070 void* value = I::ReadField<void*>(obj, I::kStringResourceOffset);
6305 result = reinterpret_cast<String::ExternalStringResource*>(value); 6071 result = reinterpret_cast<String::ExternalStringResource*>(value);
6306 } else { 6072 } else {
6307 result = NULL; 6073 result = NULL;
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
6658 6424
6659 Handle<Boolean> False(Isolate* isolate) { 6425 Handle<Boolean> False(Isolate* isolate) {
6660 typedef internal::Object* S; 6426 typedef internal::Object* S;
6661 typedef internal::Internals I; 6427 typedef internal::Internals I;
6662 I::CheckInitialized(isolate); 6428 I::CheckInitialized(isolate);
6663 S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex); 6429 S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex);
6664 return Handle<Boolean>(reinterpret_cast<Boolean*>(slot)); 6430 return Handle<Boolean>(reinterpret_cast<Boolean*>(slot));
6665 } 6431 }
6666 6432
6667 6433
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) { 6434 void Isolate::SetData(uint32_t slot, void* data) {
6681 typedef internal::Internals I; 6435 typedef internal::Internals I;
6682 I::SetEmbedderData(this, slot, data); 6436 I::SetEmbedderData(this, slot, data);
6683 } 6437 }
6684 6438
6685 6439
6686 void* Isolate::GetData(uint32_t slot) { 6440 void* Isolate::GetData(uint32_t slot) {
6687 typedef internal::Internals I; 6441 typedef internal::Internals I;
6688 return I::GetEmbedderData(this, slot); 6442 return I::GetEmbedderData(this, slot);
6689 } 6443 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
6759 */ 6513 */
6760 6514
6761 6515
6762 } // namespace v8 6516 } // namespace v8
6763 6517
6764 6518
6765 #undef TYPE_CHECK 6519 #undef TYPE_CHECK
6766 6520
6767 6521
6768 #endif // V8_H_ 6522 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698