| 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_DEPRECATED(V8_INLINE void Dispose(Isolate* isolate)) { Reset(); } | 589 V8_INLINE void Dispose()) { Reset(); } |
| 590 | 590 |
| 591 V8_INLINE bool IsEmpty() const { return val_ == 0; } | 591 V8_INLINE bool IsEmpty() const { return val_ == 0; } |
| 592 | 592 |
| 593 // TODO(dcarney): this is pretty useless, fix or remove | 593 // TODO(dcarney): this is pretty useless, fix or remove |
| 594 template <class S> | 594 template <class S> |
| 595 V8_INLINE static Persistent<T>& Cast(Persistent<S>& that) { // NOLINT | 595 V8_INLINE static Persistent<T>& Cast(Persistent<S>& that) { // NOLINT |
| 596 #ifdef V8_ENABLE_CHECKS | 596 #ifdef V8_ENABLE_CHECKS |
| 597 // 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 |
| 598 // that the handle isn't empty before doing the checked cast. | 598 // that the handle isn't empty before doing the checked cast. |
| 599 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... |
| 635 template<typename P> | 635 template<typename P> |
| 636 V8_INLINE void SetWeak( | 636 V8_INLINE void SetWeak( |
| 637 P* parameter, | 637 P* parameter, |
| 638 typename WeakCallbackData<T, P>::Callback callback); | 638 typename WeakCallbackData<T, P>::Callback callback); |
| 639 | 639 |
| 640 template<typename S, typename P> | 640 template<typename S, typename P> |
| 641 V8_INLINE void SetWeak( | 641 V8_INLINE void SetWeak( |
| 642 P* parameter, | 642 P* parameter, |
| 643 typename WeakCallbackData<S, P>::Callback callback); | 643 typename WeakCallbackData<S, P>::Callback callback); |
| 644 | 644 |
| 645 // TODO(dcarney): deprecate | |
| 646 template<typename S, typename P> | 645 template<typename S, typename P> |
| 647 V8_INLINE void MakeWeak( | 646 V8_DEPRECATED( |
| 648 P* parameter, | 647 "Use SetWeak instead", |
| 649 typename WeakReferenceCallbacks<S, P>::Revivable callback); | 648 V8_INLINE void MakeWeak( |
| 649 P* parameter, |
| 650 typename WeakReferenceCallbacks<S, P>::Revivable callback)); |
| 650 | 651 |
| 651 // TODO(dcarney): deprecate | |
| 652 template<typename P> | 652 template<typename P> |
| 653 V8_INLINE void MakeWeak( | 653 V8_DEPRECATED( |
| 654 P* parameter, | 654 "Use SetWeak instead", |
| 655 typename WeakReferenceCallbacks<T, P>::Revivable callback); | 655 V8_INLINE void MakeWeak( |
| 656 P* parameter, |
| 657 typename WeakReferenceCallbacks<T, P>::Revivable callback)); |
| 656 | 658 |
| 657 V8_INLINE void ClearWeak(); | 659 V8_INLINE void ClearWeak(); |
| 658 | 660 |
| 659 V8_DEPRECATED(V8_INLINE void ClearWeak(Isolate* isolate)) { ClearWeak(); } | |
| 660 | |
| 661 /** | 661 /** |
| 662 * Marks the reference to this object independent. Garbage collector is free | 662 * Marks the reference to this object independent. Garbage collector is free |
| 663 * 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 |
| 664 * 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 |
| 665 * GC prologue callback or followed by a global GC epilogue callback. | 665 * GC prologue callback or followed by a global GC epilogue callback. |
| 666 */ | 666 */ |
| 667 V8_INLINE void MarkIndependent(); | 667 V8_INLINE void MarkIndependent(); |
| 668 | 668 |
| 669 V8_DEPRECATED(V8_INLINE void MarkIndependent(Isolate* isolate)) { | |
| 670 MarkIndependent(); | |
| 671 } | |
| 672 | |
| 673 /** | 669 /** |
| 674 * Marks the reference to this object partially dependent. Partially dependent | 670 * Marks the reference to this object partially dependent. Partially dependent |
| 675 * handles only depend on other partially dependent handles and these | 671 * handles only depend on other partially dependent handles and these |
| 676 * dependencies are provided through object groups. It provides a way to build | 672 * dependencies are provided through object groups. It provides a way to build |
| 677 * smaller object groups for young objects that represent only a subset of all | 673 * smaller object groups for young objects that represent only a subset of all |
| 678 * external dependencies. This mark is automatically cleared after each | 674 * external dependencies. This mark is automatically cleared after each |
| 679 * garbage collection. | 675 * garbage collection. |
| 680 */ | 676 */ |
| 681 V8_INLINE void MarkPartiallyDependent(); | 677 V8_INLINE void MarkPartiallyDependent(); |
| 682 | 678 |
| 683 V8_DEPRECATED(V8_INLINE void MarkPartiallyDependent(Isolate* isolate)) { | |
| 684 MarkPartiallyDependent(); | |
| 685 } | |
| 686 | |
| 687 V8_INLINE bool IsIndependent() const; | 679 V8_INLINE bool IsIndependent() const; |
| 688 | 680 |
| 689 V8_DEPRECATED(V8_INLINE bool IsIndependent(Isolate* isolate) const) { | |
| 690 return IsIndependent(); | |
| 691 } | |
| 692 | |
| 693 /** Checks if the handle holds the only reference to an object. */ | 681 /** Checks if the handle holds the only reference to an object. */ |
| 694 V8_INLINE bool IsNearDeath() const; | 682 V8_INLINE bool IsNearDeath() const; |
| 695 | 683 |
| 696 V8_DEPRECATED(V8_INLINE bool IsNearDeath(Isolate* isolate) const) { | |
| 697 return IsNearDeath(); | |
| 698 } | |
| 699 | |
| 700 /** Returns true if the handle's reference is weak. */ | 684 /** Returns true if the handle's reference is weak. */ |
| 701 V8_INLINE bool IsWeak() const; | 685 V8_INLINE bool IsWeak() const; |
| 702 | 686 |
| 703 V8_DEPRECATED(V8_INLINE bool IsWeak(Isolate* isolate) const) { | |
| 704 return IsWeak(); | |
| 705 } | |
| 706 | |
| 707 /** | 687 /** |
| 708 * Assigns a wrapper class ID to the handle. See RetainedObjectInfo interface | 688 * Assigns a wrapper class ID to the handle. See RetainedObjectInfo interface |
| 709 * description in v8-profiler.h for details. | 689 * description in v8-profiler.h for details. |
| 710 */ | 690 */ |
| 711 V8_INLINE void SetWrapperClassId(uint16_t class_id); | 691 V8_INLINE void SetWrapperClassId(uint16_t class_id); |
| 712 | 692 |
| 713 V8_DEPRECATED( | |
| 714 V8_INLINE void SetWrapperClassId(Isolate * isolate, uint16_t class_id)) { | |
| 715 SetWrapperClassId(class_id); | |
| 716 } | |
| 717 | |
| 718 /** | 693 /** |
| 719 * 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 |
| 720 * was previously assigned. | 695 * was previously assigned. |
| 721 */ | 696 */ |
| 722 V8_INLINE uint16_t WrapperClassId() const; | 697 V8_INLINE uint16_t WrapperClassId() const; |
| 723 | 698 |
| 724 V8_DEPRECATED(V8_INLINE uint16_t WrapperClassId(Isolate* isolate) const) { | 699 V8_DEPRECATED("This will be removed", |
| 725 return WrapperClassId(); | 700 V8_INLINE T* ClearAndLeak()); |
| 726 } | |
| 727 | 701 |
| 728 // TODO(dcarney): remove | 702 V8_DEPRECATED("This will be removed", |
| 729 V8_INLINE T* ClearAndLeak(); | 703 V8_INLINE void Clear()) { val_ = 0; } |
| 730 | |
| 731 // TODO(dcarney): remove | |
| 732 V8_INLINE void Clear() { val_ = 0; } | |
| 733 | 704 |
| 734 // TODO(dcarney): remove | 705 // TODO(dcarney): remove |
| 735 #ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR | 706 #ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR |
| 736 | 707 |
| 737 private: | 708 private: |
| 738 #endif | 709 #endif |
| 739 template <class S> V8_INLINE Persistent(S* that) : val_(that) { } | 710 template <class S> V8_INLINE Persistent(S* that) : val_(that) { } |
| 740 | 711 |
| 741 V8_INLINE T* operator*() const { return val_; } | 712 V8_INLINE T* operator*() const { return val_; } |
| 742 | 713 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 767 * garbage collector will no longer track the object stored in the | 738 * garbage collector will no longer track the object stored in the |
| 768 * handle and may deallocate it. The behavior of accessing a handle | 739 * handle and may deallocate it. The behavior of accessing a handle |
| 769 * for which the handle scope has been deleted is undefined. | 740 * for which the handle scope has been deleted is undefined. |
| 770 */ | 741 */ |
| 771 class V8_EXPORT HandleScope { | 742 class V8_EXPORT HandleScope { |
| 772 public: | 743 public: |
| 773 HandleScope(Isolate* isolate); | 744 HandleScope(Isolate* isolate); |
| 774 | 745 |
| 775 ~HandleScope(); | 746 ~HandleScope(); |
| 776 | 747 |
| 777 // TODO(dcarney): deprecated - use EscapableHandleScope::Escape. | 748 template <class T> |
| 778 template <class T> Local<T> Close(Handle<T> value); | 749 V8_DEPRECATED("Use EscapableHandleScope::Escape instead", |
| 750 Local<T> Close(Handle<T> value)); |
| 779 | 751 |
| 780 /** | 752 /** |
| 781 * Counts the number of allocated handles. | 753 * Counts the number of allocated handles. |
| 782 */ | 754 */ |
| 783 static int NumberOfHandles(); | 755 static int NumberOfHandles(); |
| 784 | 756 |
| 785 private: | 757 private: |
| 786 /** | 758 /** |
| 787 * Creates a new handle with the given value. | 759 * Creates a new handle with the given value. |
| 788 */ | 760 */ |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 template <class T> | 824 template <class T> |
| 853 V8_INLINE Local<T> Escape(Local<T> value) { | 825 V8_INLINE Local<T> Escape(Local<T> value) { |
| 854 internal::Object** slot = | 826 internal::Object** slot = |
| 855 Escape(reinterpret_cast<internal::Object**>(*value)); | 827 Escape(reinterpret_cast<internal::Object**>(*value)); |
| 856 return Local<T>(reinterpret_cast<T*>(slot)); | 828 return Local<T>(reinterpret_cast<T*>(slot)); |
| 857 } | 829 } |
| 858 | 830 |
| 859 private: | 831 private: |
| 860 internal::Object** Escape(internal::Object** escape_value); | 832 internal::Object** Escape(internal::Object** escape_value); |
| 861 | 833 |
| 834 // Make it hard to create heap-allocated or illegal handle scopes by |
| 835 // disallowing certain operations. |
| 836 EscapableHandleScope(const EscapableHandleScope&); |
| 837 void operator=(const EscapableHandleScope&); |
| 838 void* operator new(size_t size); |
| 839 void operator delete(void*, size_t); |
| 840 |
| 862 internal::Object** escape_slot_; | 841 internal::Object** escape_slot_; |
| 863 }; | 842 }; |
| 864 | 843 |
| 865 | 844 |
| 866 /** | 845 /** |
| 867 * A simple Maybe type, representing an object which may or may not have a | 846 * A simple Maybe type, representing an object which may or may not have a |
| 868 * value. | 847 * value. |
| 869 */ | 848 */ |
| 870 template<class T> | 849 template<class T> |
| 871 struct V8_EXPORT Maybe { | 850 struct V8_EXPORT Maybe { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 899 class V8_EXPORT ScriptData { // NOLINT | 878 class V8_EXPORT ScriptData { // NOLINT |
| 900 public: | 879 public: |
| 901 virtual ~ScriptData() { } | 880 virtual ~ScriptData() { } |
| 902 | 881 |
| 903 /** | 882 /** |
| 904 * Pre-compiles the specified script (context-independent). | 883 * Pre-compiles the specified script (context-independent). |
| 905 * | 884 * |
| 906 * \param input Pointer to UTF-8 script source code. | 885 * \param input Pointer to UTF-8 script source code. |
| 907 * \param length Length of UTF-8 script source code. | 886 * \param length Length of UTF-8 script source code. |
| 908 */ | 887 */ |
| 909 static ScriptData* PreCompile(const char* input, int length); | 888 static ScriptData* PreCompile(Isolate* isolate, |
| 889 const char* input, |
| 890 int length); |
| 910 | 891 |
| 911 /** | 892 /** |
| 912 * Pre-compiles the specified script (context-independent). | 893 * Pre-compiles the specified script (context-independent). |
| 913 * | 894 * |
| 914 * NOTE: Pre-compilation using this method cannot happen on another thread | 895 * NOTE: Pre-compilation using this method cannot happen on another thread |
| 915 * without using Lockers. | 896 * without using Lockers. |
| 916 * | 897 * |
| 917 * \param source Script source code. | 898 * \param source Script source code. |
| 918 */ | 899 */ |
| 919 static ScriptData* PreCompile(Handle<String> source); | 900 static ScriptData* PreCompile(Handle<String> source); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1051 * Runs the script returning the resulting value. If the script is | 1032 * Runs the script returning the resulting value. If the script is |
| 1052 * context independent (created using ::New) it will be run in the | 1033 * context independent (created using ::New) it will be run in the |
| 1053 * currently entered context. If it is context specific (created | 1034 * currently entered context. If it is context specific (created |
| 1054 * using ::Compile) it will be run in the context in which it was | 1035 * using ::Compile) it will be run in the context in which it was |
| 1055 * compiled. | 1036 * compiled. |
| 1056 */ | 1037 */ |
| 1057 Local<Value> Run(); | 1038 Local<Value> Run(); |
| 1058 | 1039 |
| 1059 /** | 1040 /** |
| 1060 * Returns the script id value. | 1041 * Returns the script id value. |
| 1061 * DEPRECATED: Please use GetId(). | |
| 1062 */ | 1042 */ |
| 1063 Local<Value> Id(); | 1043 V8_DEPRECATED("Use GetId instead", Local<Value> Id()); |
| 1064 | 1044 |
| 1065 /** | 1045 /** |
| 1066 * Returns the script id. | 1046 * Returns the script id. |
| 1067 */ | 1047 */ |
| 1068 int GetId(); | 1048 int GetId(); |
| 1069 | 1049 |
| 1070 /** | 1050 /** |
| 1071 * Associate an additional data object with the script. This is mainly used | 1051 * Associate an additional data object with the script. This is mainly used |
| 1072 * with the debugger as this data object is only available through the | 1052 * with the debugger as this data object is only available through the |
| 1073 * debugger API. | 1053 * debugger API. |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1559 */ | 1539 */ |
| 1560 int Length() const; | 1540 int Length() const; |
| 1561 | 1541 |
| 1562 /** | 1542 /** |
| 1563 * Returns the number of bytes in the UTF-8 encoded | 1543 * Returns the number of bytes in the UTF-8 encoded |
| 1564 * representation of this string. | 1544 * representation of this string. |
| 1565 */ | 1545 */ |
| 1566 int Utf8Length() const; | 1546 int Utf8Length() const; |
| 1567 | 1547 |
| 1568 /** | 1548 /** |
| 1569 * This function is no longer useful. | |
| 1570 */ | |
| 1571 V8_DEPRECATED(V8_INLINE bool MayContainNonAscii() const) { return true; } | |
| 1572 | |
| 1573 /** | |
| 1574 * Returns whether this string is known to contain only one byte data. | 1549 * Returns whether this string is known to contain only one byte data. |
| 1575 * Does not read the string. | 1550 * Does not read the string. |
| 1576 * False negatives are possible. | 1551 * False negatives are possible. |
| 1577 */ | 1552 */ |
| 1578 bool IsOneByte() const; | 1553 bool IsOneByte() const; |
| 1579 | 1554 |
| 1580 /** | 1555 /** |
| 1581 * Returns whether this string contain only one byte data. | 1556 * Returns whether this string contain only one byte data. |
| 1582 * Will read the entire string in some cases. | 1557 * Will read the entire string in some cases. |
| 1583 */ | 1558 */ |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1613 HINT_MANY_WRITES_EXPECTED = 1, | 1588 HINT_MANY_WRITES_EXPECTED = 1, |
| 1614 NO_NULL_TERMINATION = 2, | 1589 NO_NULL_TERMINATION = 2, |
| 1615 PRESERVE_ASCII_NULL = 4 | 1590 PRESERVE_ASCII_NULL = 4 |
| 1616 }; | 1591 }; |
| 1617 | 1592 |
| 1618 // 16-bit character codes. | 1593 // 16-bit character codes. |
| 1619 int Write(uint16_t* buffer, | 1594 int Write(uint16_t* buffer, |
| 1620 int start = 0, | 1595 int start = 0, |
| 1621 int length = -1, | 1596 int length = -1, |
| 1622 int options = NO_OPTIONS) const; | 1597 int options = NO_OPTIONS) const; |
| 1623 // ASCII characters. | |
| 1624 V8_DEPRECATED(int WriteAscii(char* buffer, | |
| 1625 int start = 0, | |
| 1626 int length = -1, | |
| 1627 int options = NO_OPTIONS) const); | |
| 1628 // One byte characters. | 1598 // One byte characters. |
| 1629 int WriteOneByte(uint8_t* buffer, | 1599 int WriteOneByte(uint8_t* buffer, |
| 1630 int start = 0, | 1600 int start = 0, |
| 1631 int length = -1, | 1601 int length = -1, |
| 1632 int options = NO_OPTIONS) const; | 1602 int options = NO_OPTIONS) const; |
| 1633 // UTF-8 encoded characters. | 1603 // UTF-8 encoded characters. |
| 1634 int WriteUtf8(char* buffer, | 1604 int WriteUtf8(char* buffer, |
| 1635 int length = -1, | 1605 int length = -1, |
| 1636 int* nchars_ref = NULL, | 1606 int* nchars_ref = NULL, |
| 1637 int options = NO_OPTIONS) const; | 1607 int options = NO_OPTIONS) const; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1748 V8_INLINE ExternalStringResource* GetExternalStringResource() const; | 1718 V8_INLINE ExternalStringResource* GetExternalStringResource() const; |
| 1749 | 1719 |
| 1750 /** | 1720 /** |
| 1751 * Get the ExternalAsciiStringResource for an external ASCII string. | 1721 * Get the ExternalAsciiStringResource for an external ASCII string. |
| 1752 * Returns NULL if IsExternalAscii() doesn't return true. | 1722 * Returns NULL if IsExternalAscii() doesn't return true. |
| 1753 */ | 1723 */ |
| 1754 const ExternalAsciiStringResource* GetExternalAsciiStringResource() const; | 1724 const ExternalAsciiStringResource* GetExternalAsciiStringResource() const; |
| 1755 | 1725 |
| 1756 V8_INLINE static String* Cast(v8::Value* obj); | 1726 V8_INLINE static String* Cast(v8::Value* obj); |
| 1757 | 1727 |
| 1758 // TODO(dcarney): deprecate | |
| 1759 /** | 1728 /** |
| 1760 * Allocates a new string from either UTF-8 encoded or ASCII data. | 1729 * Allocates a new string from either UTF-8 encoded or ASCII data. |
| 1761 * The second parameter 'length' gives the buffer length. If omitted, | 1730 * The second parameter 'length' gives the buffer length. If omitted, |
| 1762 * the function calls 'strlen' to determine the buffer length. | 1731 * the function calls 'strlen' to determine the buffer length. |
| 1763 */ | 1732 */ |
| 1764 V8_INLINE static Local<String> New(const char* data, int length = -1); | 1733 V8_DEPRECATED( |
| 1734 "Use NewFromOneByte instead", |
| 1735 V8_INLINE static Local<String> New(const char* data, int length = -1)); |
| 1765 | 1736 |
| 1766 // TODO(dcarney): deprecate | |
| 1767 /** Allocates a new string from 16-bit character codes.*/ | 1737 /** Allocates a new string from 16-bit character codes.*/ |
| 1768 V8_INLINE static Local<String> New(const uint16_t* data, int length = -1); | 1738 V8_DEPRECATED( |
| 1739 "Use NewFromTwoByte instead", |
| 1740 V8_INLINE static Local<String> New( |
| 1741 const uint16_t* data, int length = -1)); |
| 1769 | 1742 |
| 1770 // TODO(dcarney): deprecate | |
| 1771 /** | 1743 /** |
| 1772 * Creates an internalized string (historically called a "symbol", | 1744 * Creates an internalized string (historically called a "symbol", |
| 1773 * not to be confused with ES6 symbols). Returns one if it exists already. | 1745 * not to be confused with ES6 symbols). Returns one if it exists already. |
| 1774 */ | 1746 */ |
| 1775 V8_INLINE static Local<String> NewSymbol(const char* data, int length = -1); | 1747 V8_DEPRECATED( |
| 1748 "Use NewFromUtf8 instead", |
| 1749 V8_INLINE static Local<String> NewSymbol( |
| 1750 const char* data, int length = -1)); |
| 1776 | 1751 |
| 1777 enum NewStringType { | 1752 enum NewStringType { |
| 1778 kNormalString, kInternalizedString, kUndetectableString | 1753 kNormalString, kInternalizedString, kUndetectableString |
| 1779 }; | 1754 }; |
| 1780 | 1755 |
| 1781 /** Allocates a new string from UTF-8 data.*/ | 1756 /** Allocates a new string from UTF-8 data.*/ |
| 1782 static Local<String> NewFromUtf8(Isolate* isolate, | 1757 static Local<String> NewFromUtf8(Isolate* isolate, |
| 1783 const char* data, | 1758 const char* data, |
| 1784 NewStringType type = kNormalString, | 1759 NewStringType type = kNormalString, |
| 1785 int length = -1); | 1760 int length = -1); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1844 * The string is not modified if the operation fails. See NewExternal for | 1819 * The string is not modified if the operation fails. See NewExternal for |
| 1845 * information on the lifetime of the resource. | 1820 * information on the lifetime of the resource. |
| 1846 */ | 1821 */ |
| 1847 bool MakeExternal(ExternalAsciiStringResource* resource); | 1822 bool MakeExternal(ExternalAsciiStringResource* resource); |
| 1848 | 1823 |
| 1849 /** | 1824 /** |
| 1850 * Returns true if this string can be made external. | 1825 * Returns true if this string can be made external. |
| 1851 */ | 1826 */ |
| 1852 bool CanMakeExternal(); | 1827 bool CanMakeExternal(); |
| 1853 | 1828 |
| 1854 // TODO(dcarney): deprecate | |
| 1855 /** Creates an undetectable string from the supplied ASCII or UTF-8 data.*/ | 1829 /** Creates an undetectable string from the supplied ASCII or UTF-8 data.*/ |
| 1856 V8_INLINE static Local<String> NewUndetectable(const char* data, | 1830 V8_DEPRECATED( |
| 1857 int length = -1); | 1831 "Use NewFromUtf8 instead", |
| 1832 V8_INLINE static Local<String> NewUndetectable(const char* data, |
| 1833 int length = -1)); |
| 1858 | 1834 |
| 1859 // TODO(dcarney): deprecate | |
| 1860 /** Creates an undetectable string from the supplied 16-bit character codes.*/ | 1835 /** Creates an undetectable string from the supplied 16-bit character codes.*/ |
| 1861 V8_INLINE static Local<String> NewUndetectable(const uint16_t* data, | 1836 V8_DEPRECATED( |
| 1862 int length = -1); | 1837 "Use NewFromTwoByte instead", |
| 1838 V8_INLINE static Local<String> NewUndetectable(const uint16_t* data, |
| 1839 int length = -1)); |
| 1863 | 1840 |
| 1864 /** | 1841 /** |
| 1865 * Converts an object to a UTF-8-encoded character array. Useful if | 1842 * Converts an object to a UTF-8-encoded character array. Useful if |
| 1866 * you want to print the object. If conversion to a string fails | 1843 * you want to print the object. If conversion to a string fails |
| 1867 * (e.g. due to an exception in the toString() method of the object) | 1844 * (e.g. due to an exception in the toString() method of the object) |
| 1868 * then the length() method returns 0 and the * operator returns | 1845 * then the length() method returns 0 and the * operator returns |
| 1869 * NULL. | 1846 * NULL. |
| 1870 */ | 1847 */ |
| 1871 class V8_EXPORT Utf8Value { | 1848 class V8_EXPORT Utf8Value { |
| 1872 public: | 1849 public: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1886 | 1863 |
| 1887 /** | 1864 /** |
| 1888 * Converts an object to an ASCII string. | 1865 * Converts an object to an ASCII string. |
| 1889 * Useful if you want to print the object. | 1866 * Useful if you want to print the object. |
| 1890 * If conversion to a string fails (eg. due to an exception in the toString() | 1867 * If conversion to a string fails (eg. due to an exception in the toString() |
| 1891 * method of the object) then the length() method returns 0 and the * operator | 1868 * method of the object) then the length() method returns 0 and the * operator |
| 1892 * returns NULL. | 1869 * returns NULL. |
| 1893 */ | 1870 */ |
| 1894 class V8_EXPORT AsciiValue { | 1871 class V8_EXPORT AsciiValue { |
| 1895 public: | 1872 public: |
| 1896 // TODO(dcarney): deprecate | 1873 V8_DEPRECATED("Use Utf8Value instead", |
| 1897 explicit AsciiValue(Handle<v8::Value> obj); | 1874 explicit AsciiValue(Handle<v8::Value> obj)); |
| 1898 ~AsciiValue(); | 1875 ~AsciiValue(); |
| 1899 char* operator*() { return str_; } | 1876 char* operator*() { return str_; } |
| 1900 const char* operator*() const { return str_; } | 1877 const char* operator*() const { return str_; } |
| 1901 int length() const { return length_; } | 1878 int length() const { return length_; } |
| 1902 private: | 1879 private: |
| 1903 char* str_; | 1880 char* str_; |
| 1904 int length_; | 1881 int length_; |
| 1905 | 1882 |
| 1906 // Disallow copying and assigning. | 1883 // Disallow copying and assigning. |
| 1907 AsciiValue(const AsciiValue&); | 1884 AsciiValue(const AsciiValue&); |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2308 * Checks whether a callback is set by the | 2285 * Checks whether a callback is set by the |
| 2309 * ObjectTemplate::SetCallAsFunctionHandler method. | 2286 * ObjectTemplate::SetCallAsFunctionHandler method. |
| 2310 * When an Object is callable this method returns true. | 2287 * When an Object is callable this method returns true. |
| 2311 */ | 2288 */ |
| 2312 bool IsCallable(); | 2289 bool IsCallable(); |
| 2313 | 2290 |
| 2314 /** | 2291 /** |
| 2315 * Call an Object as a function if a callback is set by the | 2292 * Call an Object as a function if a callback is set by the |
| 2316 * ObjectTemplate::SetCallAsFunctionHandler method. | 2293 * ObjectTemplate::SetCallAsFunctionHandler method. |
| 2317 */ | 2294 */ |
| 2318 Local<Value> CallAsFunction(Handle<Object> recv, | 2295 Local<Value> CallAsFunction(Handle<Value> recv, |
| 2319 int argc, | 2296 int argc, |
| 2320 Handle<Value> argv[]); | 2297 Handle<Value> argv[]); |
| 2321 | 2298 |
| 2322 /** | 2299 /** |
| 2323 * Call an Object as a constructor if a callback is set by the | 2300 * Call an Object as a constructor if a callback is set by the |
| 2324 * ObjectTemplate::SetCallAsFunctionHandler method. | 2301 * ObjectTemplate::SetCallAsFunctionHandler method. |
| 2325 * Note: This method behaves like the Function::NewInstance method. | 2302 * Note: This method behaves like the Function::NewInstance method. |
| 2326 */ | 2303 */ |
| 2327 Local<Value> CallAsConstructor(int argc, Handle<Value> argv[]); | 2304 Local<Value> CallAsConstructor(int argc, Handle<Value> argv[]); |
| 2328 | 2305 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2412 V8_INLINE bool IsConstructCall() const; | 2389 V8_INLINE bool IsConstructCall() const; |
| 2413 V8_INLINE Local<Value> Data() const; | 2390 V8_INLINE Local<Value> Data() const; |
| 2414 V8_INLINE Isolate* GetIsolate() const; | 2391 V8_INLINE Isolate* GetIsolate() const; |
| 2415 V8_INLINE ReturnValue<T> GetReturnValue() const; | 2392 V8_INLINE ReturnValue<T> GetReturnValue() const; |
| 2416 // This shouldn't be public, but the arm compiler needs it. | 2393 // This shouldn't be public, but the arm compiler needs it. |
| 2417 static const int kArgsLength = 7; | 2394 static const int kArgsLength = 7; |
| 2418 | 2395 |
| 2419 protected: | 2396 protected: |
| 2420 friend class internal::FunctionCallbackArguments; | 2397 friend class internal::FunctionCallbackArguments; |
| 2421 friend class internal::CustomArguments<FunctionCallbackInfo>; | 2398 friend class internal::CustomArguments<FunctionCallbackInfo>; |
| 2422 static const int kContextSaveIndex = 0; | 2399 static const int kHolderIndex = 0; |
| 2423 static const int kCalleeIndex = -1; | 2400 static const int kIsolateIndex = 1; |
| 2424 static const int kDataIndex = -2; | 2401 static const int kReturnValueDefaultValueIndex = 2; |
| 2425 static const int kReturnValueIndex = -3; | 2402 static const int kReturnValueIndex = 3; |
| 2426 static const int kReturnValueDefaultValueIndex = -4; | 2403 static const int kDataIndex = 4; |
| 2427 static const int kIsolateIndex = -5; | 2404 static const int kCalleeIndex = 5; |
| 2428 static const int kHolderIndex = -6; | 2405 static const int kContextSaveIndex = 6; |
| 2429 | 2406 |
| 2430 V8_INLINE FunctionCallbackInfo(internal::Object** implicit_args, | 2407 V8_INLINE FunctionCallbackInfo(internal::Object** implicit_args, |
| 2431 internal::Object** values, | 2408 internal::Object** values, |
| 2432 int length, | 2409 int length, |
| 2433 bool is_construct_call); | 2410 bool is_construct_call); |
| 2434 internal::Object** implicit_args_; | 2411 internal::Object** implicit_args_; |
| 2435 internal::Object** values_; | 2412 internal::Object** values_; |
| 2436 int length_; | 2413 int length_; |
| 2437 bool is_construct_call_; | 2414 bool is_construct_call_; |
| 2438 }; | 2415 }; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2450 V8_INLINE Local<Object> This() const; | 2427 V8_INLINE Local<Object> This() const; |
| 2451 V8_INLINE Local<Object> Holder() const; | 2428 V8_INLINE Local<Object> Holder() const; |
| 2452 V8_INLINE ReturnValue<T> GetReturnValue() const; | 2429 V8_INLINE ReturnValue<T> GetReturnValue() const; |
| 2453 // This shouldn't be public, but the arm compiler needs it. | 2430 // This shouldn't be public, but the arm compiler needs it. |
| 2454 static const int kArgsLength = 6; | 2431 static const int kArgsLength = 6; |
| 2455 | 2432 |
| 2456 protected: | 2433 protected: |
| 2457 friend class MacroAssembler; | 2434 friend class MacroAssembler; |
| 2458 friend class internal::PropertyCallbackArguments; | 2435 friend class internal::PropertyCallbackArguments; |
| 2459 friend class internal::CustomArguments<PropertyCallbackInfo>; | 2436 friend class internal::CustomArguments<PropertyCallbackInfo>; |
| 2460 static const int kThisIndex = 0; | 2437 static const int kHolderIndex = 0; |
| 2461 static const int kDataIndex = -1; | 2438 static const int kIsolateIndex = 1; |
| 2462 static const int kReturnValueIndex = -2; | 2439 static const int kReturnValueDefaultValueIndex = 2; |
| 2463 static const int kReturnValueDefaultValueIndex = -3; | 2440 static const int kReturnValueIndex = 3; |
| 2464 static const int kIsolateIndex = -4; | 2441 static const int kDataIndex = 4; |
| 2465 static const int kHolderIndex = -5; | 2442 static const int kThisIndex = 5; |
| 2466 | 2443 |
| 2467 V8_INLINE PropertyCallbackInfo(internal::Object** args) : args_(args) {} | 2444 V8_INLINE PropertyCallbackInfo(internal::Object** args) : args_(args) {} |
| 2468 internal::Object** args_; | 2445 internal::Object** args_; |
| 2469 }; | 2446 }; |
| 2470 | 2447 |
| 2471 | 2448 |
| 2472 typedef void (*FunctionCallback)(const FunctionCallbackInfo<Value>& info); | 2449 typedef void (*FunctionCallback)(const FunctionCallbackInfo<Value>& info); |
| 2473 | 2450 |
| 2474 | 2451 |
| 2475 /** | 2452 /** |
| 2476 * A JavaScript function object (ECMA-262, 15.3). | 2453 * A JavaScript function object (ECMA-262, 15.3). |
| 2477 */ | 2454 */ |
| 2478 class V8_EXPORT Function : public Object { | 2455 class V8_EXPORT Function : public Object { |
| 2479 public: | 2456 public: |
| 2480 /** | 2457 /** |
| 2481 * Create a function in the current execution context | 2458 * Create a function in the current execution context |
| 2482 * for a given FunctionCallback. | 2459 * for a given FunctionCallback. |
| 2483 */ | 2460 */ |
| 2484 static Local<Function> New(Isolate* isolate, | 2461 static Local<Function> New(Isolate* isolate, |
| 2485 FunctionCallback callback, | 2462 FunctionCallback callback, |
| 2486 Local<Value> data = Local<Value>(), | 2463 Local<Value> data = Local<Value>(), |
| 2487 int length = 0); | 2464 int length = 0); |
| 2488 | 2465 |
| 2489 Local<Object> NewInstance() const; | 2466 Local<Object> NewInstance() const; |
| 2490 Local<Object> NewInstance(int argc, Handle<Value> argv[]) const; | 2467 Local<Object> NewInstance(int argc, Handle<Value> argv[]) const; |
| 2491 Local<Value> Call(Handle<Object> recv, int argc, Handle<Value> argv[]); | 2468 Local<Value> Call(Handle<Value> recv, int argc, Handle<Value> argv[]); |
| 2492 void SetName(Handle<String> name); | 2469 void SetName(Handle<String> name); |
| 2493 Handle<Value> GetName() const; | 2470 Handle<Value> GetName() const; |
| 2494 | 2471 |
| 2495 /** | 2472 /** |
| 2496 * Name inferred from variable or property assignment of this function. | 2473 * Name inferred from variable or property assignment of this function. |
| 2497 * Used to facilitate debugging and profiling of JavaScript code written | 2474 * Used to facilitate debugging and profiling of JavaScript code written |
| 2498 * in an OO style, where many functions are anonymous but are assigned | 2475 * in an OO style, where many functions are anonymous but are assigned |
| 2499 * to object properties. | 2476 * to object properties. |
| 2500 */ | 2477 */ |
| 2501 Handle<Value> GetInferredName() const; | 2478 Handle<Value> GetInferredName() const; |
| 2502 | 2479 |
| 2503 /** | 2480 /** |
| 2504 * Returns zero based line number of function body and | 2481 * Returns zero based line number of function body and |
| 2505 * kLineOffsetNotFound if no information available. | 2482 * kLineOffsetNotFound if no information available. |
| 2506 */ | 2483 */ |
| 2507 int GetScriptLineNumber() const; | 2484 int GetScriptLineNumber() const; |
| 2508 /** | 2485 /** |
| 2509 * Returns zero based column number of function body and | 2486 * Returns zero based column number of function body and |
| 2510 * kLineOffsetNotFound if no information available. | 2487 * kLineOffsetNotFound if no information available. |
| 2511 */ | 2488 */ |
| 2512 int GetScriptColumnNumber() const; | 2489 int GetScriptColumnNumber() const; |
| 2513 | 2490 |
| 2514 /** | 2491 /** |
| 2515 * Returns scriptId object. | 2492 * Returns scriptId object. |
| 2516 * DEPRECATED: use ScriptId() instead. | |
| 2517 */ | 2493 */ |
| 2518 Handle<Value> GetScriptId() const; | 2494 V8_DEPRECATED("Use ScriptId instead", Handle<Value> GetScriptId()) const; |
| 2519 | 2495 |
| 2520 /** | 2496 /** |
| 2521 * Returns scriptId. | 2497 * Returns scriptId. |
| 2522 */ | 2498 */ |
| 2523 int ScriptId() const; | 2499 int ScriptId() const; |
| 2524 | 2500 |
| 2525 ScriptOrigin GetScriptOrigin() const; | 2501 ScriptOrigin GetScriptOrigin() const; |
| 2526 V8_INLINE static Function* Cast(Value* obj); | 2502 V8_INLINE static Function* Cast(Value* obj); |
| 2527 static const int kLineOffsetNotFound; | 2503 static const int kLineOffsetNotFound; |
| 2528 | 2504 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2671 */ | 2647 */ |
| 2672 Local<ArrayBuffer> Buffer(); | 2648 Local<ArrayBuffer> Buffer(); |
| 2673 /** | 2649 /** |
| 2674 * Byte offset in |Buffer|. | 2650 * Byte offset in |Buffer|. |
| 2675 */ | 2651 */ |
| 2676 size_t ByteOffset(); | 2652 size_t ByteOffset(); |
| 2677 /** | 2653 /** |
| 2678 * Size of a view in bytes. | 2654 * Size of a view in bytes. |
| 2679 */ | 2655 */ |
| 2680 size_t ByteLength(); | 2656 size_t ByteLength(); |
| 2681 /** | |
| 2682 * Base address of a view. | |
| 2683 */ | |
| 2684 void* BaseAddress(); | |
| 2685 | 2657 |
| 2686 V8_INLINE static ArrayBufferView* Cast(Value* obj); | 2658 V8_INLINE static ArrayBufferView* Cast(Value* obj); |
| 2687 | 2659 |
| 2688 static const int kInternalFieldCount = | 2660 static const int kInternalFieldCount = |
| 2689 V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT; | 2661 V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT; |
| 2690 | 2662 |
| 2691 private: | 2663 private: |
| 2692 ArrayBufferView(); | 2664 ArrayBufferView(); |
| 2693 static void CheckCast(Value* obj); | 2665 static void CheckCast(Value* obj); |
| 2694 }; | 2666 }; |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2874 }; | 2846 }; |
| 2875 | 2847 |
| 2876 | 2848 |
| 2877 /** | 2849 /** |
| 2878 * An instance of the built-in Date constructor (ECMA-262, 15.9). | 2850 * An instance of the built-in Date constructor (ECMA-262, 15.9). |
| 2879 */ | 2851 */ |
| 2880 class V8_EXPORT Date : public Object { | 2852 class V8_EXPORT Date : public Object { |
| 2881 public: | 2853 public: |
| 2882 static Local<Value> New(double time); | 2854 static Local<Value> New(double time); |
| 2883 | 2855 |
| 2884 // Deprecated, use Date::ValueOf() instead. | 2856 V8_DEPRECATED( |
| 2885 // TODO(svenpanne) Actually deprecate when Chrome is adapted. | 2857 "Use ValueOf instead", |
| 2886 double NumberValue() const { return ValueOf(); } | 2858 double NumberValue()) const { return ValueOf(); } |
| 2887 | 2859 |
| 2888 /** | 2860 /** |
| 2889 * A specialization of Value::NumberValue that is more efficient | 2861 * A specialization of Value::NumberValue that is more efficient |
| 2890 * because we know the structure of this object. | 2862 * because we know the structure of this object. |
| 2891 */ | 2863 */ |
| 2892 double ValueOf() const; | 2864 double ValueOf() const; |
| 2893 | 2865 |
| 2894 V8_INLINE static Date* Cast(v8::Value* obj); | 2866 V8_INLINE static Date* Cast(v8::Value* obj); |
| 2895 | 2867 |
| 2896 /** | 2868 /** |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2912 }; | 2884 }; |
| 2913 | 2885 |
| 2914 | 2886 |
| 2915 /** | 2887 /** |
| 2916 * A Number object (ECMA-262, 4.3.21). | 2888 * A Number object (ECMA-262, 4.3.21). |
| 2917 */ | 2889 */ |
| 2918 class V8_EXPORT NumberObject : public Object { | 2890 class V8_EXPORT NumberObject : public Object { |
| 2919 public: | 2891 public: |
| 2920 static Local<Value> New(double value); | 2892 static Local<Value> New(double value); |
| 2921 | 2893 |
| 2922 // Deprecated, use NumberObject::ValueOf() instead. | 2894 V8_DEPRECATED( |
| 2923 // TODO(svenpanne) Actually deprecate when Chrome is adapted. | 2895 "Use ValueOf instead", |
| 2924 double NumberValue() const { return ValueOf(); } | 2896 double NumberValue()) const { return ValueOf(); } |
| 2925 | 2897 |
| 2926 /** | 2898 /** |
| 2927 * Returns the Number held by the object. | 2899 * Returns the Number held by the object. |
| 2928 */ | 2900 */ |
| 2929 double ValueOf() const; | 2901 double ValueOf() const; |
| 2930 | 2902 |
| 2931 V8_INLINE static NumberObject* Cast(v8::Value* obj); | 2903 V8_INLINE static NumberObject* Cast(v8::Value* obj); |
| 2932 | 2904 |
| 2933 private: | 2905 private: |
| 2934 static void CheckCast(v8::Value* obj); | 2906 static void CheckCast(v8::Value* obj); |
| 2935 }; | 2907 }; |
| 2936 | 2908 |
| 2937 | 2909 |
| 2938 /** | 2910 /** |
| 2939 * A Boolean object (ECMA-262, 4.3.15). | 2911 * A Boolean object (ECMA-262, 4.3.15). |
| 2940 */ | 2912 */ |
| 2941 class V8_EXPORT BooleanObject : public Object { | 2913 class V8_EXPORT BooleanObject : public Object { |
| 2942 public: | 2914 public: |
| 2943 static Local<Value> New(bool value); | 2915 static Local<Value> New(bool value); |
| 2944 | 2916 |
| 2945 // Deprecated, use BooleanObject::ValueOf() instead. | 2917 V8_DEPRECATED( |
| 2946 // TODO(svenpanne) Actually deprecate when Chrome is adapted. | 2918 "Use ValueOf instead", |
| 2947 bool BooleanValue() const { return ValueOf(); } | 2919 bool BooleanValue()) const { return ValueOf(); } |
| 2948 | 2920 |
| 2949 /** | 2921 /** |
| 2950 * Returns the Boolean held by the object. | 2922 * Returns the Boolean held by the object. |
| 2951 */ | 2923 */ |
| 2952 bool ValueOf() const; | 2924 bool ValueOf() const; |
| 2953 | 2925 |
| 2954 V8_INLINE static BooleanObject* Cast(v8::Value* obj); | 2926 V8_INLINE static BooleanObject* Cast(v8::Value* obj); |
| 2955 | 2927 |
| 2956 private: | 2928 private: |
| 2957 static void CheckCast(v8::Value* obj); | 2929 static void CheckCast(v8::Value* obj); |
| 2958 }; | 2930 }; |
| 2959 | 2931 |
| 2960 | 2932 |
| 2961 /** | 2933 /** |
| 2962 * A String object (ECMA-262, 4.3.18). | 2934 * A String object (ECMA-262, 4.3.18). |
| 2963 */ | 2935 */ |
| 2964 class V8_EXPORT StringObject : public Object { | 2936 class V8_EXPORT StringObject : public Object { |
| 2965 public: | 2937 public: |
| 2966 static Local<Value> New(Handle<String> value); | 2938 static Local<Value> New(Handle<String> value); |
| 2967 | 2939 |
| 2968 // Deprecated, use StringObject::ValueOf() instead. | 2940 V8_DEPRECATED( |
| 2969 // TODO(svenpanne) Actually deprecate when Chrome is adapted. | 2941 "Use ValueOf instead", |
| 2970 Local<String> StringValue() const { return ValueOf(); } | 2942 Local<String> StringValue()) const { return ValueOf(); } |
| 2971 | 2943 |
| 2972 /** | 2944 /** |
| 2973 * Returns the String held by the object. | 2945 * Returns the String held by the object. |
| 2974 */ | 2946 */ |
| 2975 Local<String> ValueOf() const; | 2947 Local<String> ValueOf() const; |
| 2976 | 2948 |
| 2977 V8_INLINE static StringObject* Cast(v8::Value* obj); | 2949 V8_INLINE static StringObject* Cast(v8::Value* obj); |
| 2978 | 2950 |
| 2979 private: | 2951 private: |
| 2980 static void CheckCast(v8::Value* obj); | 2952 static void CheckCast(v8::Value* obj); |
| 2981 }; | 2953 }; |
| 2982 | 2954 |
| 2983 | 2955 |
| 2984 /** | 2956 /** |
| 2985 * A Symbol object (ECMA-262 edition 6). | 2957 * A Symbol object (ECMA-262 edition 6). |
| 2986 * | 2958 * |
| 2987 * This is an experimental feature. Use at your own risk. | 2959 * This is an experimental feature. Use at your own risk. |
| 2988 */ | 2960 */ |
| 2989 class V8_EXPORT SymbolObject : public Object { | 2961 class V8_EXPORT SymbolObject : public Object { |
| 2990 public: | 2962 public: |
| 2991 static Local<Value> New(Isolate* isolate, Handle<Symbol> value); | 2963 static Local<Value> New(Isolate* isolate, Handle<Symbol> value); |
| 2992 | 2964 |
| 2993 // Deprecated, use SymbolObject::ValueOf() instead. | 2965 V8_DEPRECATED( |
| 2994 // TODO(svenpanne) Actually deprecate when Chrome is adapted. | 2966 "Use ValueOf instead", |
| 2995 Local<Symbol> SymbolValue() const { return ValueOf(); } | 2967 Local<Symbol> SymbolValue()) const { return ValueOf(); } |
| 2996 | 2968 |
| 2997 /** | 2969 /** |
| 2998 * Returns the Symbol held by the object. | 2970 * Returns the Symbol held by the object. |
| 2999 */ | 2971 */ |
| 3000 Local<Symbol> ValueOf() const; | 2972 Local<Symbol> ValueOf() const; |
| 3001 | 2973 |
| 3002 V8_INLINE static SymbolObject* Cast(v8::Value* obj); | 2974 V8_INLINE static SymbolObject* Cast(v8::Value* obj); |
| 3003 | 2975 |
| 3004 private: | 2976 private: |
| 3005 static void CheckCast(v8::Value* obj); | 2977 static void CheckCast(v8::Value* obj); |
| (...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3812 | 3784 |
| 3813 // --- Exceptions --- | 3785 // --- Exceptions --- |
| 3814 | 3786 |
| 3815 | 3787 |
| 3816 typedef void (*FatalErrorCallback)(const char* location, const char* message); | 3788 typedef void (*FatalErrorCallback)(const char* location, const char* message); |
| 3817 | 3789 |
| 3818 | 3790 |
| 3819 typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> error); | 3791 typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> error); |
| 3820 | 3792 |
| 3821 | 3793 |
| 3822 // TODO(dcarney): remove. Use Isolate::ThrowException instead. | 3794 V8_DEPRECATED( |
| 3823 Handle<Value> V8_EXPORT ThrowException(Handle<Value> exception); | 3795 "Use Isolate::ThrowException instead", |
| 3796 Handle<Value> V8_EXPORT ThrowException(Handle<Value> exception)); |
| 3824 | 3797 |
| 3825 /** | 3798 /** |
| 3826 * Create new error objects by calling the corresponding error object | 3799 * Create new error objects by calling the corresponding error object |
| 3827 * constructor with the message. | 3800 * constructor with the message. |
| 3828 */ | 3801 */ |
| 3829 class V8_EXPORT Exception { | 3802 class V8_EXPORT Exception { |
| 3830 public: | 3803 public: |
| 3831 static Local<Value> RangeError(Handle<String> message); | 3804 static Local<Value> RangeError(Handle<String> message); |
| 3832 static Local<Value> ReferenceError(Handle<String> message); | 3805 static Local<Value> ReferenceError(Handle<String> message); |
| 3833 static Local<Value> SyntaxError(Handle<String> message); | 3806 static Local<Value> SyntaxError(Handle<String> message); |
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4576 static void SetEntropySource(EntropySource source); | 4549 static void SetEntropySource(EntropySource source); |
| 4577 | 4550 |
| 4578 /** | 4551 /** |
| 4579 * Allows the host application to provide a callback that allows v8 to | 4552 * Allows the host application to provide a callback that allows v8 to |
| 4580 * cooperate with a profiler that rewrites return addresses on stack. | 4553 * cooperate with a profiler that rewrites return addresses on stack. |
| 4581 */ | 4554 */ |
| 4582 static void SetReturnAddressLocationResolver( | 4555 static void SetReturnAddressLocationResolver( |
| 4583 ReturnAddressLocationResolver return_address_resolver); | 4556 ReturnAddressLocationResolver return_address_resolver); |
| 4584 | 4557 |
| 4585 /** | 4558 /** |
| 4586 * Deprecated, use the variant with the Isolate parameter below instead. | |
| 4587 */ | |
| 4588 V8_DEPRECATED(static bool SetFunctionEntryHook(FunctionEntryHook entry_hook)); | |
| 4589 | |
| 4590 /** | |
| 4591 * Allows the host application to provide the address of a function that's | 4559 * Allows the host application to provide the address of a function that's |
| 4592 * invoked on entry to every V8-generated function. | 4560 * invoked on entry to every V8-generated function. |
| 4593 * Note that \p entry_hook is invoked at the very start of each | 4561 * Note that \p entry_hook is invoked at the very start of each |
| 4594 * generated function. | 4562 * generated function. |
| 4595 * | 4563 * |
| 4596 * \param isolate the isolate to operate on. | 4564 * \param isolate the isolate to operate on. |
| 4597 * \param entry_hook a function that will be invoked on entry to every | 4565 * \param entry_hook a function that will be invoked on entry to every |
| 4598 * V8-generated function. | 4566 * V8-generated function. |
| 4599 * \returns true on success on supported platforms, false on failure. | 4567 * \returns true on success on supported platforms, false on failure. |
| 4600 * \note Setting an entry hook can only be done very early in an isolates | 4568 * \note Setting an entry hook can only be done very early in an isolates |
| (...skipping 18 matching lines...) Expand all Loading... |
| 4619 * are not guaranteed to live past each call. The \p event_handler must | 4587 * are not guaranteed to live past each call. The \p event_handler must |
| 4620 * copy strings and other parameters it needs to keep around. | 4588 * copy strings and other parameters it needs to keep around. |
| 4621 * \note the set of events declared in JitCodeEvent::EventType is expected to | 4589 * \note the set of events declared in JitCodeEvent::EventType is expected to |
| 4622 * grow over time, and the JitCodeEvent structure is expected to accrue | 4590 * grow over time, and the JitCodeEvent structure is expected to accrue |
| 4623 * new members. The \p event_handler function must ignore event codes | 4591 * new members. The \p event_handler function must ignore event codes |
| 4624 * it does not recognize to maintain future compatibility. | 4592 * it does not recognize to maintain future compatibility. |
| 4625 */ | 4593 */ |
| 4626 static void SetJitCodeEventHandler(JitCodeEventOptions options, | 4594 static void SetJitCodeEventHandler(JitCodeEventOptions options, |
| 4627 JitCodeEventHandler event_handler); | 4595 JitCodeEventHandler event_handler); |
| 4628 | 4596 |
| 4629 // TODO(svenpanne) Really deprecate me when Chrome is fixed. | 4597 V8_DEPRECATED( |
| 4630 /** Deprecated. Use Isolate::AdjustAmountOfExternalAllocatedMemory instead. */ | 4598 "Use Isolate::AdjustAmountOfExternalAllocatedMemory instead", |
| 4631 static intptr_t AdjustAmountOfExternalAllocatedMemory( | 4599 static intptr_t AdjustAmountOfExternalAllocatedMemory( |
| 4632 intptr_t change_in_bytes); | 4600 intptr_t change_in_bytes)); |
| 4633 | 4601 |
| 4634 /** | 4602 /** |
| 4635 * Forcefully terminate the current thread of JavaScript execution | 4603 * Forcefully terminate the current thread of JavaScript execution |
| 4636 * in the given isolate. If no isolate is provided, the default | 4604 * in the given isolate. If no isolate is provided, the default |
| 4637 * isolate is used. | 4605 * isolate is used. |
| 4638 * | 4606 * |
| 4639 * This method can be used by any thread even if that thread has not | 4607 * This method can be used by any thread even if that thread has not |
| 4640 * acquired the V8 lock with a Locker object. | 4608 * acquired the V8 lock with a Locker object. |
| 4641 * | 4609 * |
| 4642 * \param isolate The isolate in which to terminate the current JS execution. | 4610 * \param isolate The isolate in which to terminate the current JS execution. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4677 * Releases any resources used by v8 and stops any utility threads | 4645 * Releases any resources used by v8 and stops any utility threads |
| 4678 * that may be running. Note that disposing v8 is permanent, it | 4646 * that may be running. Note that disposing v8 is permanent, it |
| 4679 * cannot be reinitialized. | 4647 * cannot be reinitialized. |
| 4680 * | 4648 * |
| 4681 * It should generally not be necessary to dispose v8 before exiting | 4649 * It should generally not be necessary to dispose v8 before exiting |
| 4682 * a process, this should happen automatically. It is only necessary | 4650 * a process, this should happen automatically. It is only necessary |
| 4683 * to use if the process needs the resources taken up by v8. | 4651 * to use if the process needs the resources taken up by v8. |
| 4684 */ | 4652 */ |
| 4685 static bool Dispose(); | 4653 static bool Dispose(); |
| 4686 | 4654 |
| 4687 /** Deprecated. Use Isolate::GetHeapStatistics instead. */ | |
| 4688 V8_DEPRECATED(static void GetHeapStatistics(HeapStatistics* heap_statistics)); | |
| 4689 | |
| 4690 /** | 4655 /** |
| 4691 * Iterates through all external resources referenced from current isolate | 4656 * Iterates through all external resources referenced from current isolate |
| 4692 * heap. GC is not invoked prior to iterating, therefore there is no | 4657 * heap. GC is not invoked prior to iterating, therefore there is no |
| 4693 * guarantee that visited objects are still alive. | 4658 * guarantee that visited objects are still alive. |
| 4694 */ | 4659 */ |
| 4695 static void VisitExternalResources(ExternalResourceVisitor* visitor); | 4660 static void VisitExternalResources(ExternalResourceVisitor* visitor); |
| 4696 | 4661 |
| 4697 /** | 4662 /** |
| 4698 * Iterates through all the persistent handles in the current isolate's heap | 4663 * Iterates through all the persistent handles in the current isolate's heap |
| 4699 * that have class_ids. | 4664 * that have class_ids. |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4977 * created by a previous call to Context::New with the same global | 4942 * created by a previous call to Context::New with the same global |
| 4978 * template. The state of the global object will be completely reset | 4943 * template. The state of the global object will be completely reset |
| 4979 * and only object identify will remain. | 4944 * and only object identify will remain. |
| 4980 */ | 4945 */ |
| 4981 static Local<Context> New( | 4946 static Local<Context> New( |
| 4982 Isolate* isolate, | 4947 Isolate* isolate, |
| 4983 ExtensionConfiguration* extensions = NULL, | 4948 ExtensionConfiguration* extensions = NULL, |
| 4984 Handle<ObjectTemplate> global_template = Handle<ObjectTemplate>(), | 4949 Handle<ObjectTemplate> global_template = Handle<ObjectTemplate>(), |
| 4985 Handle<Value> global_object = Handle<Value>()); | 4950 Handle<Value> global_object = Handle<Value>()); |
| 4986 | 4951 |
| 4987 // TODO(dcarney): Remove this function. | 4952 V8_DEPRECATED("Use Isolate::GetEnteredContext instead", |
| 4988 /** Deprecated. Use Isolate::GetEnteredContext */ | 4953 static Local<Context> GetEntered()); |
| 4989 static Local<Context> GetEntered(); | |
| 4990 | 4954 |
| 4991 // TODO(dcarney) Remove this function. | 4955 V8_DEPRECATED("Use Isolate::GetCurrentContext instead", |
| 4992 /** Deprecated. Use Isolate::GetCurrentContext instead. */ | 4956 static Local<Context> GetCurrent()); |
| 4993 static Local<Context> GetCurrent(); | |
| 4994 | 4957 |
| 4995 // TODO(dcarney) Remove this function. | 4958 V8_DEPRECATED("Use Isolate::GetCallingContext instead", |
| 4996 /** Deprecated. Use Isolate::GetCallingContext instead. */ | 4959 static Local<Context> GetCalling()); |
| 4997 static Local<Context> GetCalling(); | |
| 4998 | 4960 |
| 4999 /** | 4961 /** |
| 5000 * Sets the security token for the context. To access an object in | 4962 * Sets the security token for the context. To access an object in |
| 5001 * another context, the security tokens must match. | 4963 * another context, the security tokens must match. |
| 5002 */ | 4964 */ |
| 5003 void SetSecurityToken(Handle<Value> token); | 4965 void SetSecurityToken(Handle<Value> token); |
| 5004 | 4966 |
| 5005 /** Restores the security token to the default value. */ | 4967 /** Restores the security token to the default value. */ |
| 5006 void UseDefaultSecurityToken(); | 4968 void UseDefaultSecurityToken(); |
| 5007 | 4969 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 5018 | 4980 |
| 5019 /** | 4981 /** |
| 5020 * Exit this context. Exiting the current context restores the | 4982 * Exit this context. Exiting the current context restores the |
| 5021 * context that was in place when entering the current context. | 4983 * context that was in place when entering the current context. |
| 5022 */ | 4984 */ |
| 5023 void Exit(); | 4985 void Exit(); |
| 5024 | 4986 |
| 5025 /** Returns true if the context has experienced an out of memory situation. */ | 4987 /** Returns true if the context has experienced an out of memory situation. */ |
| 5026 bool HasOutOfMemoryException(); | 4988 bool HasOutOfMemoryException(); |
| 5027 | 4989 |
| 5028 // TODO(dcarney) Remove this function. | 4990 V8_DEPRECATED("Use Isolate::InContext instead", |
| 5029 /** Deprecated. Use Isolate::InContext instead. */ | 4991 static bool InContext()); |
| 5030 static bool InContext(); | |
| 5031 | 4992 |
| 5032 /** Returns an isolate associated with a current context. */ | 4993 /** Returns an isolate associated with a current context. */ |
| 5033 v8::Isolate* GetIsolate(); | 4994 v8::Isolate* GetIsolate(); |
| 5034 | 4995 |
| 5035 /** | 4996 /** |
| 5036 * Gets the embedder data with the given index, which must have been set by a | 4997 * Gets the embedder data with the given index, which must have been set by a |
| 5037 * previous call to SetEmbedderData with the same index. Note that index 0 | 4998 * previous call to SetEmbedderData with the same index. Note that index 0 |
| 5038 * currently has a special meaning for Chrome's debugger. | 4999 * currently has a special meaning for Chrome's debugger. |
| 5039 */ | 5000 */ |
| 5040 V8_INLINE Local<Value> GetEmbedderData(int index); | 5001 V8_INLINE Local<Value> GetEmbedderData(int index); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5091 | 5052 |
| 5092 /** | 5053 /** |
| 5093 * Stack-allocated class which sets the execution context for all | 5054 * Stack-allocated class which sets the execution context for all |
| 5094 * operations executed within a local scope. | 5055 * operations executed within a local scope. |
| 5095 */ | 5056 */ |
| 5096 class Scope { | 5057 class Scope { |
| 5097 public: | 5058 public: |
| 5098 explicit V8_INLINE Scope(Handle<Context> context) : context_(context) { | 5059 explicit V8_INLINE Scope(Handle<Context> context) : context_(context) { |
| 5099 context_->Enter(); | 5060 context_->Enter(); |
| 5100 } | 5061 } |
| 5101 // TODO(dcarney): deprecate | 5062 V8_DEPRECATED( |
| 5102 V8_INLINE Scope(Isolate* isolate, Persistent<Context>& context) // NOLINT | 5063 "Use Handle version instead", |
| 5064 V8_INLINE Scope(Isolate* isolate, Persistent<Context>& context)) // NOLI
NT |
| 5103 : context_(Handle<Context>::New(isolate, context)) { | 5065 : context_(Handle<Context>::New(isolate, context)) { |
| 5104 context_->Enter(); | 5066 context_->Enter(); |
| 5105 } | 5067 } |
| 5106 V8_INLINE ~Scope() { context_->Exit(); } | 5068 V8_INLINE ~Scope() { context_->Exit(); } |
| 5107 | 5069 |
| 5108 private: | 5070 private: |
| 5109 Handle<Context> context_; | 5071 Handle<Context> context_; |
| 5110 }; | 5072 }; |
| 5111 | 5073 |
| 5112 private: | 5074 private: |
| (...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6495 */ | 6457 */ |
| 6496 | 6458 |
| 6497 | 6459 |
| 6498 } // namespace v8 | 6460 } // namespace v8 |
| 6499 | 6461 |
| 6500 | 6462 |
| 6501 #undef TYPE_CHECK | 6463 #undef TYPE_CHECK |
| 6502 | 6464 |
| 6503 | 6465 |
| 6504 #endif // V8_H_ | 6466 #endif // V8_H_ |
| OLD | NEW |