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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 * and create a new one with the contents of other if other is non empty | 577 * and create a new one with the contents of other if other is non empty |
578 */ | 578 */ |
579 template <class S> | 579 template <class S> |
580 V8_INLINE void Reset(Isolate* isolate, const Handle<S>& other); | 580 V8_INLINE void Reset(Isolate* isolate, const Handle<S>& other); |
581 /** | 581 /** |
582 * If non-empty, destroy the underlying storage cell | 582 * If non-empty, destroy the underlying storage cell |
583 * and create a new one with the contents of other if other is non empty | 583 * and create a new one with the contents of other if other is non empty |
584 */ | 584 */ |
585 template <class S, class M2> | 585 template <class S, class M2> |
586 V8_INLINE void Reset(Isolate* isolate, const Persistent<S, M2>& other); | 586 V8_INLINE void Reset(Isolate* isolate, const Persistent<S, M2>& other); |
587 // TODO(dcarney): deprecate | 587 |
588 V8_INLINE void Dispose() { Reset(); } | 588 V8_DEPRECATED("Use Reset instead", |
| 589 V8_INLINE void Dispose()) { Reset(); } |
589 | 590 |
590 V8_INLINE bool IsEmpty() const { return val_ == 0; } | 591 V8_INLINE bool IsEmpty() const { return val_ == 0; } |
591 | 592 |
592 // TODO(dcarney): this is pretty useless, fix or remove | 593 // TODO(dcarney): this is pretty useless, fix or remove |
593 template <class S> | 594 template <class S> |
594 V8_INLINE static Persistent<T>& Cast(Persistent<S>& that) { // NOLINT | 595 V8_INLINE static Persistent<T>& Cast(Persistent<S>& that) { // NOLINT |
595 #ifdef V8_ENABLE_CHECKS | 596 #ifdef V8_ENABLE_CHECKS |
596 // If we're going to perform the type check then we have to check | 597 // If we're going to perform the type check then we have to check |
597 // that the handle isn't empty before doing the checked cast. | 598 // that the handle isn't empty before doing the checked cast. |
598 if (!that.IsEmpty()) T::Cast(*that); | 599 if (!that.IsEmpty()) T::Cast(*that); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 template<typename P> | 635 template<typename P> |
635 V8_INLINE void SetWeak( | 636 V8_INLINE void SetWeak( |
636 P* parameter, | 637 P* parameter, |
637 typename WeakCallbackData<T, P>::Callback callback); | 638 typename WeakCallbackData<T, P>::Callback callback); |
638 | 639 |
639 template<typename S, typename P> | 640 template<typename S, typename P> |
640 V8_INLINE void SetWeak( | 641 V8_INLINE void SetWeak( |
641 P* parameter, | 642 P* parameter, |
642 typename WeakCallbackData<S, P>::Callback callback); | 643 typename WeakCallbackData<S, P>::Callback callback); |
643 | 644 |
644 // TODO(dcarney): deprecate | |
645 template<typename S, typename P> | 645 template<typename S, typename P> |
646 V8_INLINE void MakeWeak( | 646 V8_DEPRECATED( |
647 P* parameter, | 647 "Use SetWeak instead", |
648 typename WeakReferenceCallbacks<S, P>::Revivable callback); | 648 V8_INLINE void MakeWeak( |
| 649 P* parameter, |
| 650 typename WeakReferenceCallbacks<S, P>::Revivable callback)); |
649 | 651 |
650 // TODO(dcarney): deprecate | |
651 template<typename P> | 652 template<typename P> |
652 V8_INLINE void MakeWeak( | 653 V8_DEPRECATED( |
653 P* parameter, | 654 "Use SetWeak instead", |
654 typename WeakReferenceCallbacks<T, P>::Revivable callback); | 655 V8_INLINE void MakeWeak( |
| 656 P* parameter, |
| 657 typename WeakReferenceCallbacks<T, P>::Revivable callback)); |
655 | 658 |
656 V8_INLINE void ClearWeak(); | 659 V8_INLINE void ClearWeak(); |
657 | 660 |
658 /** | 661 /** |
659 * Marks the reference to this object independent. Garbage collector is free | 662 * Marks the reference to this object independent. Garbage collector is free |
660 * to ignore any object groups containing this object. Weak callback for an | 663 * to ignore any object groups containing this object. Weak callback for an |
661 * independent handle should not assume that it will be preceded by a global | 664 * independent handle should not assume that it will be preceded by a global |
662 * GC prologue callback or followed by a global GC epilogue callback. | 665 * GC prologue callback or followed by a global GC epilogue callback. |
663 */ | 666 */ |
664 V8_INLINE void MarkIndependent(); | 667 V8_INLINE void MarkIndependent(); |
(...skipping 21 matching lines...) Expand all Loading... |
686 * description in v8-profiler.h for details. | 689 * description in v8-profiler.h for details. |
687 */ | 690 */ |
688 V8_INLINE void SetWrapperClassId(uint16_t class_id); | 691 V8_INLINE void SetWrapperClassId(uint16_t class_id); |
689 | 692 |
690 /** | 693 /** |
691 * Returns the class ID previously assigned to this handle or 0 if no class ID | 694 * Returns the class ID previously assigned to this handle or 0 if no class ID |
692 * was previously assigned. | 695 * was previously assigned. |
693 */ | 696 */ |
694 V8_INLINE uint16_t WrapperClassId() const; | 697 V8_INLINE uint16_t WrapperClassId() const; |
695 | 698 |
696 // TODO(dcarney): remove | 699 V8_DEPRECATED("This will be removed", |
697 V8_INLINE T* ClearAndLeak(); | 700 V8_INLINE T* ClearAndLeak()); |
698 | 701 |
699 // TODO(dcarney): remove | 702 V8_DEPRECATED("This will be removed", |
700 V8_INLINE void Clear() { val_ = 0; } | 703 V8_INLINE void Clear()) { val_ = 0; } |
701 | 704 |
702 // TODO(dcarney): remove | 705 // TODO(dcarney): remove |
703 #ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR | 706 #ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR |
704 | 707 |
705 private: | 708 private: |
706 #endif | 709 #endif |
707 template <class S> V8_INLINE Persistent(S* that) : val_(that) { } | 710 template <class S> V8_INLINE Persistent(S* that) : val_(that) { } |
708 | 711 |
709 V8_INLINE T* operator*() const { return val_; } | 712 V8_INLINE T* operator*() const { return val_; } |
710 | 713 |
(...skipping 24 matching lines...) Expand all Loading... |
735 * garbage collector will no longer track the object stored in the | 738 * garbage collector will no longer track the object stored in the |
736 * handle and may deallocate it. The behavior of accessing a handle | 739 * handle and may deallocate it. The behavior of accessing a handle |
737 * for which the handle scope has been deleted is undefined. | 740 * for which the handle scope has been deleted is undefined. |
738 */ | 741 */ |
739 class V8_EXPORT HandleScope { | 742 class V8_EXPORT HandleScope { |
740 public: | 743 public: |
741 HandleScope(Isolate* isolate); | 744 HandleScope(Isolate* isolate); |
742 | 745 |
743 ~HandleScope(); | 746 ~HandleScope(); |
744 | 747 |
745 // TODO(dcarney): deprecated - use EscapableHandleScope::Escape. | 748 template <class T> |
746 template <class T> Local<T> Close(Handle<T> value); | 749 V8_DEPRECATED("Use EscapableHandleScope::Escape instead", |
| 750 Local<T> Close(Handle<T> value)); |
747 | 751 |
748 /** | 752 /** |
749 * Counts the number of allocated handles. | 753 * Counts the number of allocated handles. |
750 */ | 754 */ |
751 static int NumberOfHandles(); | 755 static int NumberOfHandles(); |
752 | 756 |
753 private: | 757 private: |
754 /** | 758 /** |
755 * Creates a new handle with the given value. | 759 * Creates a new handle with the given value. |
756 */ | 760 */ |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 * Runs the script returning the resulting value. If the script is | 1030 * Runs the script returning the resulting value. If the script is |
1027 * context independent (created using ::New) it will be run in the | 1031 * context independent (created using ::New) it will be run in the |
1028 * currently entered context. If it is context specific (created | 1032 * currently entered context. If it is context specific (created |
1029 * using ::Compile) it will be run in the context in which it was | 1033 * using ::Compile) it will be run in the context in which it was |
1030 * compiled. | 1034 * compiled. |
1031 */ | 1035 */ |
1032 Local<Value> Run(); | 1036 Local<Value> Run(); |
1033 | 1037 |
1034 /** | 1038 /** |
1035 * Returns the script id value. | 1039 * Returns the script id value. |
1036 * DEPRECATED: Please use GetId(). | |
1037 */ | 1040 */ |
1038 Local<Value> Id(); | 1041 V8_DEPRECATED("Use GetId instead", Local<Value> Id()); |
1039 | 1042 |
1040 /** | 1043 /** |
1041 * Returns the script id. | 1044 * Returns the script id. |
1042 */ | 1045 */ |
1043 int GetId(); | 1046 int GetId(); |
1044 | 1047 |
1045 /** | 1048 /** |
1046 * Associate an additional data object with the script. This is mainly used | 1049 * Associate an additional data object with the script. This is mainly used |
1047 * with the debugger as this data object is only available through the | 1050 * with the debugger as this data object is only available through the |
1048 * debugger API. | 1051 * debugger API. |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1814 * The string is not modified if the operation fails. See NewExternal for | 1817 * The string is not modified if the operation fails. See NewExternal for |
1815 * information on the lifetime of the resource. | 1818 * information on the lifetime of the resource. |
1816 */ | 1819 */ |
1817 bool MakeExternal(ExternalAsciiStringResource* resource); | 1820 bool MakeExternal(ExternalAsciiStringResource* resource); |
1818 | 1821 |
1819 /** | 1822 /** |
1820 * Returns true if this string can be made external. | 1823 * Returns true if this string can be made external. |
1821 */ | 1824 */ |
1822 bool CanMakeExternal(); | 1825 bool CanMakeExternal(); |
1823 | 1826 |
1824 // TODO(dcarney): deprecate | |
1825 /** Creates an undetectable string from the supplied ASCII or UTF-8 data.*/ | 1827 /** Creates an undetectable string from the supplied ASCII or UTF-8 data.*/ |
1826 V8_INLINE static Local<String> NewUndetectable(const char* data, | 1828 V8_DEPRECATED( |
1827 int length = -1); | 1829 "Use NewFromUtf8 instead", |
| 1830 V8_INLINE static Local<String> NewUndetectable(const char* data, |
| 1831 int length = -1)); |
1828 | 1832 |
1829 // TODO(dcarney): deprecate | |
1830 /** Creates an undetectable string from the supplied 16-bit character codes.*/ | 1833 /** Creates an undetectable string from the supplied 16-bit character codes.*/ |
1831 V8_INLINE static Local<String> NewUndetectable(const uint16_t* data, | 1834 V8_DEPRECATED( |
1832 int length = -1); | 1835 "Use NewFromTwoByte instead", |
| 1836 V8_INLINE static Local<String> NewUndetectable(const uint16_t* data, |
| 1837 int length = -1)); |
1833 | 1838 |
1834 /** | 1839 /** |
1835 * Converts an object to a UTF-8-encoded character array. Useful if | 1840 * Converts an object to a UTF-8-encoded character array. Useful if |
1836 * you want to print the object. If conversion to a string fails | 1841 * you want to print the object. If conversion to a string fails |
1837 * (e.g. due to an exception in the toString() method of the object) | 1842 * (e.g. due to an exception in the toString() method of the object) |
1838 * then the length() method returns 0 and the * operator returns | 1843 * then the length() method returns 0 and the * operator returns |
1839 * NULL. | 1844 * NULL. |
1840 */ | 1845 */ |
1841 class V8_EXPORT Utf8Value { | 1846 class V8_EXPORT Utf8Value { |
1842 public: | 1847 public: |
(...skipping 13 matching lines...) Expand all Loading... |
1856 | 1861 |
1857 /** | 1862 /** |
1858 * Converts an object to an ASCII string. | 1863 * Converts an object to an ASCII string. |
1859 * Useful if you want to print the object. | 1864 * Useful if you want to print the object. |
1860 * If conversion to a string fails (eg. due to an exception in the toString() | 1865 * If conversion to a string fails (eg. due to an exception in the toString() |
1861 * method of the object) then the length() method returns 0 and the * operator | 1866 * method of the object) then the length() method returns 0 and the * operator |
1862 * returns NULL. | 1867 * returns NULL. |
1863 */ | 1868 */ |
1864 class V8_EXPORT AsciiValue { | 1869 class V8_EXPORT AsciiValue { |
1865 public: | 1870 public: |
1866 // TODO(dcarney): deprecate | 1871 V8_DEPRECATED("Use Utf8Value instead", |
1867 explicit AsciiValue(Handle<v8::Value> obj); | 1872 explicit AsciiValue(Handle<v8::Value> obj)); |
1868 ~AsciiValue(); | 1873 ~AsciiValue(); |
1869 char* operator*() { return str_; } | 1874 char* operator*() { return str_; } |
1870 const char* operator*() const { return str_; } | 1875 const char* operator*() const { return str_; } |
1871 int length() const { return length_; } | 1876 int length() const { return length_; } |
1872 private: | 1877 private: |
1873 char* str_; | 1878 char* str_; |
1874 int length_; | 1879 int length_; |
1875 | 1880 |
1876 // Disallow copying and assigning. | 1881 // Disallow copying and assigning. |
1877 AsciiValue(const AsciiValue&); | 1882 AsciiValue(const AsciiValue&); |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2476 */ | 2481 */ |
2477 int GetScriptLineNumber() const; | 2482 int GetScriptLineNumber() const; |
2478 /** | 2483 /** |
2479 * Returns zero based column number of function body and | 2484 * Returns zero based column number of function body and |
2480 * kLineOffsetNotFound if no information available. | 2485 * kLineOffsetNotFound if no information available. |
2481 */ | 2486 */ |
2482 int GetScriptColumnNumber() const; | 2487 int GetScriptColumnNumber() const; |
2483 | 2488 |
2484 /** | 2489 /** |
2485 * Returns scriptId object. | 2490 * Returns scriptId object. |
2486 * DEPRECATED: use ScriptId() instead. | |
2487 */ | 2491 */ |
2488 Handle<Value> GetScriptId() const; | 2492 V8_DEPRECATED("Use ScriptId instead", Handle<Value> GetScriptId()) const; |
2489 | 2493 |
2490 /** | 2494 /** |
2491 * Returns scriptId. | 2495 * Returns scriptId. |
2492 */ | 2496 */ |
2493 int ScriptId() const; | 2497 int ScriptId() const; |
2494 | 2498 |
2495 ScriptOrigin GetScriptOrigin() const; | 2499 ScriptOrigin GetScriptOrigin() const; |
2496 V8_INLINE static Function* Cast(Value* obj); | 2500 V8_INLINE static Function* Cast(Value* obj); |
2497 static const int kLineOffsetNotFound; | 2501 static const int kLineOffsetNotFound; |
2498 | 2502 |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2840 }; | 2844 }; |
2841 | 2845 |
2842 | 2846 |
2843 /** | 2847 /** |
2844 * An instance of the built-in Date constructor (ECMA-262, 15.9). | 2848 * An instance of the built-in Date constructor (ECMA-262, 15.9). |
2845 */ | 2849 */ |
2846 class V8_EXPORT Date : public Object { | 2850 class V8_EXPORT Date : public Object { |
2847 public: | 2851 public: |
2848 static Local<Value> New(double time); | 2852 static Local<Value> New(double time); |
2849 | 2853 |
2850 // Deprecated, use Date::ValueOf() instead. | 2854 V8_DEPRECATED( |
2851 // TODO(svenpanne) Actually deprecate when Chrome is adapted. | 2855 "Use ValueOf instead", |
2852 double NumberValue() const { return ValueOf(); } | 2856 double NumberValue()) const { return ValueOf(); } |
2853 | 2857 |
2854 /** | 2858 /** |
2855 * A specialization of Value::NumberValue that is more efficient | 2859 * A specialization of Value::NumberValue that is more efficient |
2856 * because we know the structure of this object. | 2860 * because we know the structure of this object. |
2857 */ | 2861 */ |
2858 double ValueOf() const; | 2862 double ValueOf() const; |
2859 | 2863 |
2860 V8_INLINE static Date* Cast(v8::Value* obj); | 2864 V8_INLINE static Date* Cast(v8::Value* obj); |
2861 | 2865 |
2862 /** | 2866 /** |
(...skipping 15 matching lines...) Expand all Loading... |
2878 }; | 2882 }; |
2879 | 2883 |
2880 | 2884 |
2881 /** | 2885 /** |
2882 * A Number object (ECMA-262, 4.3.21). | 2886 * A Number object (ECMA-262, 4.3.21). |
2883 */ | 2887 */ |
2884 class V8_EXPORT NumberObject : public Object { | 2888 class V8_EXPORT NumberObject : public Object { |
2885 public: | 2889 public: |
2886 static Local<Value> New(double value); | 2890 static Local<Value> New(double value); |
2887 | 2891 |
2888 // Deprecated, use NumberObject::ValueOf() instead. | 2892 V8_DEPRECATED( |
2889 // TODO(svenpanne) Actually deprecate when Chrome is adapted. | 2893 "Use ValueOf instead", |
2890 double NumberValue() const { return ValueOf(); } | 2894 double NumberValue()) const { return ValueOf(); } |
2891 | 2895 |
2892 /** | 2896 /** |
2893 * Returns the Number held by the object. | 2897 * Returns the Number held by the object. |
2894 */ | 2898 */ |
2895 double ValueOf() const; | 2899 double ValueOf() const; |
2896 | 2900 |
2897 V8_INLINE static NumberObject* Cast(v8::Value* obj); | 2901 V8_INLINE static NumberObject* Cast(v8::Value* obj); |
2898 | 2902 |
2899 private: | 2903 private: |
2900 static void CheckCast(v8::Value* obj); | 2904 static void CheckCast(v8::Value* obj); |
2901 }; | 2905 }; |
2902 | 2906 |
2903 | 2907 |
2904 /** | 2908 /** |
2905 * A Boolean object (ECMA-262, 4.3.15). | 2909 * A Boolean object (ECMA-262, 4.3.15). |
2906 */ | 2910 */ |
2907 class V8_EXPORT BooleanObject : public Object { | 2911 class V8_EXPORT BooleanObject : public Object { |
2908 public: | 2912 public: |
2909 static Local<Value> New(bool value); | 2913 static Local<Value> New(bool value); |
2910 | 2914 |
2911 // Deprecated, use BooleanObject::ValueOf() instead. | 2915 V8_DEPRECATED( |
2912 // TODO(svenpanne) Actually deprecate when Chrome is adapted. | 2916 "Use ValueOf instead", |
2913 bool BooleanValue() const { return ValueOf(); } | 2917 bool BooleanValue()) const { return ValueOf(); } |
2914 | 2918 |
2915 /** | 2919 /** |
2916 * Returns the Boolean held by the object. | 2920 * Returns the Boolean held by the object. |
2917 */ | 2921 */ |
2918 bool ValueOf() const; | 2922 bool ValueOf() const; |
2919 | 2923 |
2920 V8_INLINE static BooleanObject* Cast(v8::Value* obj); | 2924 V8_INLINE static BooleanObject* Cast(v8::Value* obj); |
2921 | 2925 |
2922 private: | 2926 private: |
2923 static void CheckCast(v8::Value* obj); | 2927 static void CheckCast(v8::Value* obj); |
2924 }; | 2928 }; |
2925 | 2929 |
2926 | 2930 |
2927 /** | 2931 /** |
2928 * A String object (ECMA-262, 4.3.18). | 2932 * A String object (ECMA-262, 4.3.18). |
2929 */ | 2933 */ |
2930 class V8_EXPORT StringObject : public Object { | 2934 class V8_EXPORT StringObject : public Object { |
2931 public: | 2935 public: |
2932 static Local<Value> New(Handle<String> value); | 2936 static Local<Value> New(Handle<String> value); |
2933 | 2937 |
2934 // Deprecated, use StringObject::ValueOf() instead. | 2938 V8_DEPRECATED( |
2935 // TODO(svenpanne) Actually deprecate when Chrome is adapted. | 2939 "Use ValueOf instead", |
2936 Local<String> StringValue() const { return ValueOf(); } | 2940 Local<String> StringValue()) const { return ValueOf(); } |
2937 | 2941 |
2938 /** | 2942 /** |
2939 * Returns the String held by the object. | 2943 * Returns the String held by the object. |
2940 */ | 2944 */ |
2941 Local<String> ValueOf() const; | 2945 Local<String> ValueOf() const; |
2942 | 2946 |
2943 V8_INLINE static StringObject* Cast(v8::Value* obj); | 2947 V8_INLINE static StringObject* Cast(v8::Value* obj); |
2944 | 2948 |
2945 private: | 2949 private: |
2946 static void CheckCast(v8::Value* obj); | 2950 static void CheckCast(v8::Value* obj); |
2947 }; | 2951 }; |
2948 | 2952 |
2949 | 2953 |
2950 /** | 2954 /** |
2951 * A Symbol object (ECMA-262 edition 6). | 2955 * A Symbol object (ECMA-262 edition 6). |
2952 * | 2956 * |
2953 * This is an experimental feature. Use at your own risk. | 2957 * This is an experimental feature. Use at your own risk. |
2954 */ | 2958 */ |
2955 class V8_EXPORT SymbolObject : public Object { | 2959 class V8_EXPORT SymbolObject : public Object { |
2956 public: | 2960 public: |
2957 static Local<Value> New(Isolate* isolate, Handle<Symbol> value); | 2961 static Local<Value> New(Isolate* isolate, Handle<Symbol> value); |
2958 | 2962 |
2959 // Deprecated, use SymbolObject::ValueOf() instead. | 2963 V8_DEPRECATED( |
2960 // TODO(svenpanne) Actually deprecate when Chrome is adapted. | 2964 "Use ValueOf instead", |
2961 Local<Symbol> SymbolValue() const { return ValueOf(); } | 2965 Local<Symbol> SymbolValue()) const { return ValueOf(); } |
2962 | 2966 |
2963 /** | 2967 /** |
2964 * Returns the Symbol held by the object. | 2968 * Returns the Symbol held by the object. |
2965 */ | 2969 */ |
2966 Local<Symbol> ValueOf() const; | 2970 Local<Symbol> ValueOf() const; |
2967 | 2971 |
2968 V8_INLINE static SymbolObject* Cast(v8::Value* obj); | 2972 V8_INLINE static SymbolObject* Cast(v8::Value* obj); |
2969 | 2973 |
2970 private: | 2974 private: |
2971 static void CheckCast(v8::Value* obj); | 2975 static void CheckCast(v8::Value* obj); |
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3778 | 3782 |
3779 // --- Exceptions --- | 3783 // --- Exceptions --- |
3780 | 3784 |
3781 | 3785 |
3782 typedef void (*FatalErrorCallback)(const char* location, const char* message); | 3786 typedef void (*FatalErrorCallback)(const char* location, const char* message); |
3783 | 3787 |
3784 | 3788 |
3785 typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> error); | 3789 typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> error); |
3786 | 3790 |
3787 | 3791 |
3788 // TODO(dcarney): remove. Use Isolate::ThrowException instead. | 3792 V8_DEPRECATED( |
3789 Handle<Value> V8_EXPORT ThrowException(Handle<Value> exception); | 3793 "Use Isolate::ThrowException instead", |
| 3794 Handle<Value> V8_EXPORT ThrowException(Handle<Value> exception)); |
3790 | 3795 |
3791 /** | 3796 /** |
3792 * Create new error objects by calling the corresponding error object | 3797 * Create new error objects by calling the corresponding error object |
3793 * constructor with the message. | 3798 * constructor with the message. |
3794 */ | 3799 */ |
3795 class V8_EXPORT Exception { | 3800 class V8_EXPORT Exception { |
3796 public: | 3801 public: |
3797 static Local<Value> RangeError(Handle<String> message); | 3802 static Local<Value> RangeError(Handle<String> message); |
3798 static Local<Value> ReferenceError(Handle<String> message); | 3803 static Local<Value> ReferenceError(Handle<String> message); |
3799 static Local<Value> SyntaxError(Handle<String> message); | 3804 static Local<Value> SyntaxError(Handle<String> message); |
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4580 * are not guaranteed to live past each call. The \p event_handler must | 4585 * are not guaranteed to live past each call. The \p event_handler must |
4581 * copy strings and other parameters it needs to keep around. | 4586 * copy strings and other parameters it needs to keep around. |
4582 * \note the set of events declared in JitCodeEvent::EventType is expected to | 4587 * \note the set of events declared in JitCodeEvent::EventType is expected to |
4583 * grow over time, and the JitCodeEvent structure is expected to accrue | 4588 * grow over time, and the JitCodeEvent structure is expected to accrue |
4584 * new members. The \p event_handler function must ignore event codes | 4589 * new members. The \p event_handler function must ignore event codes |
4585 * it does not recognize to maintain future compatibility. | 4590 * it does not recognize to maintain future compatibility. |
4586 */ | 4591 */ |
4587 static void SetJitCodeEventHandler(JitCodeEventOptions options, | 4592 static void SetJitCodeEventHandler(JitCodeEventOptions options, |
4588 JitCodeEventHandler event_handler); | 4593 JitCodeEventHandler event_handler); |
4589 | 4594 |
4590 // TODO(svenpanne) Really deprecate me when Chrome is fixed. | 4595 V8_DEPRECATED( |
4591 /** Deprecated. Use Isolate::AdjustAmountOfExternalAllocatedMemory instead. */ | 4596 "Use Isolate::AdjustAmountOfExternalAllocatedMemory instead", |
4592 static intptr_t AdjustAmountOfExternalAllocatedMemory( | 4597 static intptr_t AdjustAmountOfExternalAllocatedMemory( |
4593 intptr_t change_in_bytes); | 4598 intptr_t change_in_bytes)); |
4594 | 4599 |
4595 /** | 4600 /** |
4596 * Forcefully terminate the current thread of JavaScript execution | 4601 * Forcefully terminate the current thread of JavaScript execution |
4597 * in the given isolate. If no isolate is provided, the default | 4602 * in the given isolate. If no isolate is provided, the default |
4598 * isolate is used. | 4603 * isolate is used. |
4599 * | 4604 * |
4600 * This method can be used by any thread even if that thread has not | 4605 * This method can be used by any thread even if that thread has not |
4601 * acquired the V8 lock with a Locker object. | 4606 * acquired the V8 lock with a Locker object. |
4602 * | 4607 * |
4603 * \param isolate The isolate in which to terminate the current JS execution. | 4608 * \param isolate The isolate in which to terminate the current JS execution. |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4973 | 4978 |
4974 /** | 4979 /** |
4975 * Exit this context. Exiting the current context restores the | 4980 * Exit this context. Exiting the current context restores the |
4976 * context that was in place when entering the current context. | 4981 * context that was in place when entering the current context. |
4977 */ | 4982 */ |
4978 void Exit(); | 4983 void Exit(); |
4979 | 4984 |
4980 /** Returns true if the context has experienced an out of memory situation. */ | 4985 /** Returns true if the context has experienced an out of memory situation. */ |
4981 bool HasOutOfMemoryException(); | 4986 bool HasOutOfMemoryException(); |
4982 | 4987 |
4983 // TODO(dcarney) Remove this function. | 4988 V8_DEPRECATED("Use Isolate::InContext instead", |
4984 /** Deprecated. Use Isolate::InContext instead. */ | 4989 static bool InContext()); |
4985 static bool InContext(); | |
4986 | 4990 |
4987 /** Returns an isolate associated with a current context. */ | 4991 /** Returns an isolate associated with a current context. */ |
4988 v8::Isolate* GetIsolate(); | 4992 v8::Isolate* GetIsolate(); |
4989 | 4993 |
4990 /** | 4994 /** |
4991 * Gets the embedder data with the given index, which must have been set by a | 4995 * Gets the embedder data with the given index, which must have been set by a |
4992 * previous call to SetEmbedderData with the same index. Note that index 0 | 4996 * previous call to SetEmbedderData with the same index. Note that index 0 |
4993 * currently has a special meaning for Chrome's debugger. | 4997 * currently has a special meaning for Chrome's debugger. |
4994 */ | 4998 */ |
4995 V8_INLINE Local<Value> GetEmbedderData(int index); | 4999 V8_INLINE Local<Value> GetEmbedderData(int index); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5046 | 5050 |
5047 /** | 5051 /** |
5048 * Stack-allocated class which sets the execution context for all | 5052 * Stack-allocated class which sets the execution context for all |
5049 * operations executed within a local scope. | 5053 * operations executed within a local scope. |
5050 */ | 5054 */ |
5051 class Scope { | 5055 class Scope { |
5052 public: | 5056 public: |
5053 explicit V8_INLINE Scope(Handle<Context> context) : context_(context) { | 5057 explicit V8_INLINE Scope(Handle<Context> context) : context_(context) { |
5054 context_->Enter(); | 5058 context_->Enter(); |
5055 } | 5059 } |
5056 // TODO(dcarney): deprecate | 5060 V8_DEPRECATED( |
5057 V8_INLINE Scope(Isolate* isolate, Persistent<Context>& context) // NOLINT | 5061 "Use Handle version instead", |
| 5062 V8_INLINE Scope(Isolate* isolate, Persistent<Context>& context)) // NOLI
NT |
5058 : context_(Handle<Context>::New(isolate, context)) { | 5063 : context_(Handle<Context>::New(isolate, context)) { |
5059 context_->Enter(); | 5064 context_->Enter(); |
5060 } | 5065 } |
5061 V8_INLINE ~Scope() { context_->Exit(); } | 5066 V8_INLINE ~Scope() { context_->Exit(); } |
5062 | 5067 |
5063 private: | 5068 private: |
5064 Handle<Context> context_; | 5069 Handle<Context> context_; |
5065 }; | 5070 }; |
5066 | 5071 |
5067 private: | 5072 private: |
(...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6450 */ | 6455 */ |
6451 | 6456 |
6452 | 6457 |
6453 } // namespace v8 | 6458 } // namespace v8 |
6454 | 6459 |
6455 | 6460 |
6456 #undef TYPE_CHECK | 6461 #undef TYPE_CHECK |
6457 | 6462 |
6458 | 6463 |
6459 #endif // V8_H_ | 6464 #endif // V8_H_ |
OLD | NEW |