| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 class ObjectTemplate; | 107 class ObjectTemplate; |
| 108 class Primitive; | 108 class Primitive; |
| 109 class RawOperationDescriptor; | 109 class RawOperationDescriptor; |
| 110 class Signature; | 110 class Signature; |
| 111 class StackFrame; | 111 class StackFrame; |
| 112 class StackTrace; | 112 class StackTrace; |
| 113 class String; | 113 class String; |
| 114 class StringObject; | 114 class StringObject; |
| 115 class Symbol; | 115 class Symbol; |
| 116 class SymbolObject; | 116 class SymbolObject; |
| 117 class Private; |
| 117 class Uint32; | 118 class Uint32; |
| 118 class Utils; | 119 class Utils; |
| 119 class Value; | 120 class Value; |
| 120 template <class T> class Handle; | 121 template <class T> class Handle; |
| 121 template <class T> class Local; | 122 template <class T> class Local; |
| 122 template <class T> class Eternal; | 123 template <class T> class Eternal; |
| 123 template<class T> class NonCopyablePersistentTraits; | 124 template<class T> class NonCopyablePersistentTraits; |
| 124 template<class T, | 125 template<class T, |
| 125 class M = NonCopyablePersistentTraits<T> > class Persistent; | 126 class M = NonCopyablePersistentTraits<T> > class Persistent; |
| 126 template<class T, class P> class WeakCallbackObject; | 127 template<class T, class P> class WeakCallbackObject; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 template<class F> friend class Local; | 322 template<class F> friend class Local; |
| 322 template<class F> friend class FunctionCallbackInfo; | 323 template<class F> friend class FunctionCallbackInfo; |
| 323 template<class F> friend class PropertyCallbackInfo; | 324 template<class F> friend class PropertyCallbackInfo; |
| 324 template<class F> friend class internal::CustomArguments; | 325 template<class F> friend class internal::CustomArguments; |
| 325 friend Handle<Primitive> Undefined(Isolate* isolate); | 326 friend Handle<Primitive> Undefined(Isolate* isolate); |
| 326 friend Handle<Primitive> Null(Isolate* isolate); | 327 friend Handle<Primitive> Null(Isolate* isolate); |
| 327 friend Handle<Boolean> True(Isolate* isolate); | 328 friend Handle<Boolean> True(Isolate* isolate); |
| 328 friend Handle<Boolean> False(Isolate* isolate); | 329 friend Handle<Boolean> False(Isolate* isolate); |
| 329 friend class Context; | 330 friend class Context; |
| 330 friend class HandleScope; | 331 friend class HandleScope; |
| 332 friend class Object; |
| 333 friend class Private; |
| 331 | 334 |
| 332 V8_INLINE static Handle<T> New(Isolate* isolate, T* that); | 335 V8_INLINE static Handle<T> New(Isolate* isolate, T* that); |
| 333 | 336 |
| 334 T* val_; | 337 T* val_; |
| 335 }; | 338 }; |
| 336 | 339 |
| 337 | 340 |
| 338 /** | 341 /** |
| 339 * A light-weight stack-allocated object handle. All operations | 342 * A light-weight stack-allocated object handle. All operations |
| 340 * that return objects from within v8 return them in local handles. They | 343 * that return objects from within v8 return them in local handles. They |
| (...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1919 /** | 1922 /** |
| 1920 * A JavaScript symbol (ECMA-262 edition 6) | 1923 * A JavaScript symbol (ECMA-262 edition 6) |
| 1921 * | 1924 * |
| 1922 * This is an experimental feature. Use at your own risk. | 1925 * This is an experimental feature. Use at your own risk. |
| 1923 */ | 1926 */ |
| 1924 class V8_EXPORT Symbol : public Primitive { | 1927 class V8_EXPORT Symbol : public Primitive { |
| 1925 public: | 1928 public: |
| 1926 // Returns the print name string of the symbol, or undefined if none. | 1929 // Returns the print name string of the symbol, or undefined if none. |
| 1927 Local<Value> Name() const; | 1930 Local<Value> Name() const; |
| 1928 | 1931 |
| 1929 // Create a symbol without a print name. | 1932 // Create a symbol. If data is not NULL, it will be used as a print name. |
| 1930 static Local<Symbol> New(Isolate* isolate); | 1933 static Local<Symbol> New( |
| 1931 | 1934 Isolate *isolate, const char* data = NULL, int length = -1); |
| 1932 // Create a symbol with a print name. | |
| 1933 static Local<Symbol> New(Isolate *isolate, const char* data, int length = -1); | |
| 1934 | 1935 |
| 1935 V8_INLINE static Symbol* Cast(v8::Value* obj); | 1936 V8_INLINE static Symbol* Cast(v8::Value* obj); |
| 1936 private: | 1937 private: |
| 1937 Symbol(); | 1938 Symbol(); |
| 1938 static void CheckCast(v8::Value* obj); | 1939 static void CheckCast(v8::Value* obj); |
| 1939 }; | 1940 }; |
| 1940 | 1941 |
| 1941 | 1942 |
| 1942 /** | 1943 /** |
| 1944 * A private symbol |
| 1945 * |
| 1946 * This is an experimental feature. Use at your own risk. |
| 1947 */ |
| 1948 class V8_EXPORT Private : public Data { |
| 1949 public: |
| 1950 // Returns the print name string of the private symbol, or undefined if none. |
| 1951 Local<Value> Name() const; |
| 1952 |
| 1953 // Create a private symbol. If data is not NULL, it will be the print name. |
| 1954 static Local<Private> New( |
| 1955 Isolate *isolate, const char* data = NULL, int length = -1); |
| 1956 |
| 1957 private: |
| 1958 Private(); |
| 1959 }; |
| 1960 |
| 1961 |
| 1962 /** |
| 1943 * A JavaScript number value (ECMA-262, 4.3.20) | 1963 * A JavaScript number value (ECMA-262, 4.3.20) |
| 1944 */ | 1964 */ |
| 1945 class V8_EXPORT Number : public Primitive { | 1965 class V8_EXPORT Number : public Primitive { |
| 1946 public: | 1966 public: |
| 1947 double Value() const; | 1967 double Value() const; |
| 1948 static Local<Number> New(double value); | 1968 static Local<Number> New(double value); |
| 1949 static Local<Number> New(Isolate* isolate, double value); | 1969 static Local<Number> New(Isolate* isolate, double value); |
| 1950 V8_INLINE static Number* Cast(v8::Value* obj); | 1970 V8_INLINE static Number* Cast(v8::Value* obj); |
| 1951 private: | 1971 private: |
| 1952 Number(); | 1972 Number(); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2102 AccessControl settings = DEFAULT, | 2122 AccessControl settings = DEFAULT, |
| 2103 PropertyAttribute attribute = None); | 2123 PropertyAttribute attribute = None); |
| 2104 | 2124 |
| 2105 // This function is not yet stable and should not be used at this time. | 2125 // This function is not yet stable and should not be used at this time. |
| 2106 bool SetDeclaredAccessor(Local<String> name, | 2126 bool SetDeclaredAccessor(Local<String> name, |
| 2107 Local<DeclaredAccessorDescriptor> descriptor, | 2127 Local<DeclaredAccessorDescriptor> descriptor, |
| 2108 PropertyAttribute attribute = None, | 2128 PropertyAttribute attribute = None, |
| 2109 AccessControl settings = DEFAULT); | 2129 AccessControl settings = DEFAULT); |
| 2110 | 2130 |
| 2111 /** | 2131 /** |
| 2132 * Functionality for private properties. |
| 2133 * This is an experimental feature, use at your own risk. |
| 2134 * Note: Private properties are inherited. Do not rely on this, since it may |
| 2135 * change. |
| 2136 */ |
| 2137 bool HasPrivate(Handle<Private> key); |
| 2138 bool SetPrivate(Handle<Private> key, Handle<Value> value); |
| 2139 bool DeletePrivate(Handle<Private> key); |
| 2140 Local<Value> GetPrivate(Handle<Private> key); |
| 2141 |
| 2142 /** |
| 2112 * Returns an array containing the names of the enumerable properties | 2143 * Returns an array containing the names of the enumerable properties |
| 2113 * of this object, including properties from prototype objects. The | 2144 * of this object, including properties from prototype objects. The |
| 2114 * array returned by this method contains the same values as would | 2145 * array returned by this method contains the same values as would |
| 2115 * be enumerated by a for-in statement over this object. | 2146 * be enumerated by a for-in statement over this object. |
| 2116 */ | 2147 */ |
| 2117 Local<Array> GetPropertyNames(); | 2148 Local<Array> GetPropertyNames(); |
| 2118 | 2149 |
| 2119 /** | 2150 /** |
| 2120 * This function has the same functionality as GetPropertyNames but | 2151 * This function has the same functionality as GetPropertyNames but |
| 2121 * the returned array doesn't contain the names of properties from | 2152 * the returned array doesn't contain the names of properties from |
| (...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3035 static void CheckCast(v8::Value* obj); | 3066 static void CheckCast(v8::Value* obj); |
| 3036 }; | 3067 }; |
| 3037 | 3068 |
| 3038 | 3069 |
| 3039 /** | 3070 /** |
| 3040 * A JavaScript value that wraps a C++ void*. This type of value is mainly used | 3071 * A JavaScript value that wraps a C++ void*. This type of value is mainly used |
| 3041 * to associate C++ data structures with JavaScript objects. | 3072 * to associate C++ data structures with JavaScript objects. |
| 3042 */ | 3073 */ |
| 3043 class V8_EXPORT External : public Value { | 3074 class V8_EXPORT External : public Value { |
| 3044 public: | 3075 public: |
| 3076 static Local<External> New(Isolate* isolate, void* value); |
| 3077 // Deprecated, do not use. |
| 3045 static Local<External> New(void* value); | 3078 static Local<External> New(void* value); |
| 3046 V8_INLINE static External* Cast(Value* obj); | 3079 V8_INLINE static External* Cast(Value* obj); |
| 3047 void* Value() const; | 3080 void* Value() const; |
| 3048 private: | 3081 private: |
| 3049 static void CheckCast(v8::Value* obj); | 3082 static void CheckCast(v8::Value* obj); |
| 3050 }; | 3083 }; |
| 3051 | 3084 |
| 3052 | 3085 |
| 3053 // --- Templates --- | 3086 // --- Templates --- |
| 3054 | 3087 |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3781 void set_stack_limit(uint32_t* value) { stack_limit_ = value; } | 3814 void set_stack_limit(uint32_t* value) { stack_limit_ = value; } |
| 3782 | 3815 |
| 3783 private: | 3816 private: |
| 3784 int max_young_space_size_; | 3817 int max_young_space_size_; |
| 3785 int max_old_space_size_; | 3818 int max_old_space_size_; |
| 3786 int max_executable_size_; | 3819 int max_executable_size_; |
| 3787 uint32_t* stack_limit_; | 3820 uint32_t* stack_limit_; |
| 3788 }; | 3821 }; |
| 3789 | 3822 |
| 3790 | 3823 |
| 3824 V8_DEPRECATED( |
| 3825 "Use SetResourceConstraints(isolate, constraints) instead", |
| 3826 bool V8_EXPORT SetResourceConstraints(ResourceConstraints* constraints)); |
| 3827 |
| 3828 |
| 3791 /** | 3829 /** |
| 3792 * Sets the given ResourceConstraints on the current isolate. | 3830 * Sets the given ResourceConstraints on the given Isolate. |
| 3793 */ | 3831 */ |
| 3794 bool V8_EXPORT SetResourceConstraints(ResourceConstraints* constraints); | 3832 bool V8_EXPORT SetResourceConstraints(Isolate* isolate, |
| 3833 ResourceConstraints* constraints); |
| 3795 | 3834 |
| 3796 | 3835 |
| 3797 // --- Exceptions --- | 3836 // --- Exceptions --- |
| 3798 | 3837 |
| 3799 | 3838 |
| 3800 typedef void (*FatalErrorCallback)(const char* location, const char* message); | 3839 typedef void (*FatalErrorCallback)(const char* location, const char* message); |
| 3801 | 3840 |
| 3802 | 3841 |
| 3803 typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> error); | 3842 typedef void (*MessageCallback)(Handle<Message> message, Handle<Value> error); |
| 3804 | 3843 |
| (...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5401 static const int kStringEncodingMask = 0x4; | 5440 static const int kStringEncodingMask = 0x4; |
| 5402 static const int kExternalTwoByteRepresentationTag = 0x02; | 5441 static const int kExternalTwoByteRepresentationTag = 0x02; |
| 5403 static const int kExternalAsciiRepresentationTag = 0x06; | 5442 static const int kExternalAsciiRepresentationTag = 0x06; |
| 5404 | 5443 |
| 5405 static const int kIsolateEmbedderDataOffset = 1 * kApiPointerSize; | 5444 static const int kIsolateEmbedderDataOffset = 1 * kApiPointerSize; |
| 5406 static const int kIsolateRootsOffset = 3 * kApiPointerSize; | 5445 static const int kIsolateRootsOffset = 3 * kApiPointerSize; |
| 5407 static const int kUndefinedValueRootIndex = 5; | 5446 static const int kUndefinedValueRootIndex = 5; |
| 5408 static const int kNullValueRootIndex = 7; | 5447 static const int kNullValueRootIndex = 7; |
| 5409 static const int kTrueValueRootIndex = 8; | 5448 static const int kTrueValueRootIndex = 8; |
| 5410 static const int kFalseValueRootIndex = 9; | 5449 static const int kFalseValueRootIndex = 9; |
| 5411 static const int kEmptyStringRootIndex = 132; | 5450 static const int kEmptyStringRootIndex = 134; |
| 5412 | 5451 |
| 5413 static const int kNodeClassIdOffset = 1 * kApiPointerSize; | 5452 static const int kNodeClassIdOffset = 1 * kApiPointerSize; |
| 5414 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; | 5453 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; |
| 5415 static const int kNodeStateMask = 0xf; | 5454 static const int kNodeStateMask = 0xf; |
| 5416 static const int kNodeStateIsWeakValue = 2; | 5455 static const int kNodeStateIsWeakValue = 2; |
| 5417 static const int kNodeStateIsPendingValue = 3; | 5456 static const int kNodeStateIsPendingValue = 3; |
| 5418 static const int kNodeStateIsNearDeathValue = 4; | 5457 static const int kNodeStateIsNearDeathValue = 4; |
| 5419 static const int kNodeIsIndependentShift = 4; | 5458 static const int kNodeIsIndependentShift = 4; |
| 5420 static const int kNodeIsPartiallyDependentShift = 5; | 5459 static const int kNodeIsPartiallyDependentShift = 5; |
| 5421 | 5460 |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5806 if (V8_LIKELY(I::IsValidSmi(i))) { | 5845 if (V8_LIKELY(I::IsValidSmi(i))) { |
| 5807 *value_ = I::IntToSmi(i); | 5846 *value_ = I::IntToSmi(i); |
| 5808 return; | 5847 return; |
| 5809 } | 5848 } |
| 5810 Set(Integer::New(i, GetIsolate())); | 5849 Set(Integer::New(i, GetIsolate())); |
| 5811 } | 5850 } |
| 5812 | 5851 |
| 5813 template<typename T> | 5852 template<typename T> |
| 5814 void ReturnValue<T>::Set(uint32_t i) { | 5853 void ReturnValue<T>::Set(uint32_t i) { |
| 5815 TYPE_CHECK(T, Integer); | 5854 TYPE_CHECK(T, Integer); |
| 5816 typedef internal::Internals I; | |
| 5817 // Can't simply use INT32_MAX here for whatever reason. | 5855 // Can't simply use INT32_MAX here for whatever reason. |
| 5818 bool fits_into_int32_t = (i & (1U << 31)) == 0; | 5856 bool fits_into_int32_t = (i & (1U << 31)) == 0; |
| 5819 if (V8_LIKELY(fits_into_int32_t)) { | 5857 if (V8_LIKELY(fits_into_int32_t)) { |
| 5820 Set(static_cast<int32_t>(i)); | 5858 Set(static_cast<int32_t>(i)); |
| 5821 return; | 5859 return; |
| 5822 } | 5860 } |
| 5823 Set(Integer::NewFromUnsigned(i, GetIsolate())); | 5861 Set(Integer::NewFromUnsigned(i, GetIsolate())); |
| 5824 } | 5862 } |
| 5825 | 5863 |
| 5826 template<typename T> | 5864 template<typename T> |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6499 */ | 6537 */ |
| 6500 | 6538 |
| 6501 | 6539 |
| 6502 } // namespace v8 | 6540 } // namespace v8 |
| 6503 | 6541 |
| 6504 | 6542 |
| 6505 #undef TYPE_CHECK | 6543 #undef TYPE_CHECK |
| 6506 | 6544 |
| 6507 | 6545 |
| 6508 #endif // V8_H_ | 6546 #endif // V8_H_ |
| OLD | NEW |