| v8.h | | v8.h | |
| | | | |
| skipping to change at line 123 | | skipping to change at line 123 | |
| class StackTrace; | | class StackTrace; | |
| class String; | | class String; | |
| class StringObject; | | class StringObject; | |
| class Symbol; | | class Symbol; | |
| class SymbolObject; | | class SymbolObject; | |
| class Uint32; | | class Uint32; | |
| class Utils; | | class Utils; | |
| class Value; | | class Value; | |
| template <class T> class Handle; | | template <class T> class Handle; | |
| template <class T> class Local; | | template <class T> class Local; | |
|
| | | template <class T> class Eternal; | |
| template <class T> class Persistent; | | template <class T> class Persistent; | |
| class FunctionTemplate; | | class FunctionTemplate; | |
| class ObjectTemplate; | | class ObjectTemplate; | |
| class Data; | | class Data; | |
| class AccessorInfo; | | class AccessorInfo; | |
| template<typename T> class PropertyCallbackInfo; | | template<typename T> class PropertyCallbackInfo; | |
| class StackTrace; | | class StackTrace; | |
| class StackFrame; | | class StackFrame; | |
| class Isolate; | | class Isolate; | |
| class DeclaredAccessorDescriptor; | | class DeclaredAccessorDescriptor; | |
| | | | |
| skipping to change at line 368 | | skipping to change at line 369 | |
| friend class Context; | | friend class Context; | |
| friend class HandleScope; | | friend class HandleScope; | |
| | | | |
| #ifndef V8_USE_UNSAFE_HANDLES | | #ifndef V8_USE_UNSAFE_HANDLES | |
| V8_INLINE(static Handle<T> New(Isolate* isolate, T* that)); | | V8_INLINE(static Handle<T> New(Isolate* isolate, T* that)); | |
| #endif | | #endif | |
| | | | |
| T* val_; | | T* val_; | |
| }; | | }; | |
| | | | |
|
| // A value which will never be returned by Local::Eternalize | | | |
| // Useful for static initialization | | | |
| const int kUninitializedEternalIndex = -1; | | | |
| | | | |
| /** | | /** | |
| * A light-weight stack-allocated object handle. All operations | | * A light-weight stack-allocated object handle. All operations | |
| * that return objects from within v8 return them in local handles. They | | * that return objects from within v8 return them in local handles. They | |
| * are created within HandleScopes, and all local handles allocated within
a | | * are created within HandleScopes, and all local handles allocated within
a | |
| * handle scope are destroyed when the handle scope is destroyed. Hence it | | * handle scope are destroyed when the handle scope is destroyed. Hence it | |
| * is not necessary to explicitly deallocate local handles. | | * is not necessary to explicitly deallocate local handles. | |
| */ | | */ | |
| // TODO(dcarney): deprecate entire class | | // TODO(dcarney): deprecate entire class | |
| template <class T> class Local : public Handle<T> { | | template <class T> class Local : public Handle<T> { | |
| public: | | public: | |
| | | | |
| skipping to change at line 416 | | skipping to change at line 413 | |
| template <class S> V8_INLINE(Local(Handle<S> that)) | | template <class S> V8_INLINE(Local(Handle<S> that)) | |
| : Handle<T>(reinterpret_cast<T*>(*that)) { | | : Handle<T>(reinterpret_cast<T*>(*that)) { | |
| TYPE_CHECK(T, S); | | TYPE_CHECK(T, S); | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| template <class S> V8_INLINE(Local<S> As()) { | | template <class S> V8_INLINE(Local<S> As()) { | |
| return Local<S>::Cast(*this); | | return Local<S>::Cast(*this); | |
| } | | } | |
| | | | |
|
| // Keep this Local alive for the lifetime of the Isolate. | | | |
| // It remains retrievable via the returned index, | | | |
| V8_INLINE(int Eternalize(Isolate* isolate)); | | | |
| V8_INLINE(static Local<T> GetEternal(Isolate* isolate, int index)); | | | |
| | | | |
| /** | | /** | |
| * Create a local handle for the content of another handle. | | * Create a local handle for the content of another handle. | |
| * The referee is kept alive by the local handle even when | | * The referee is kept alive by the local handle even when | |
| * the original handle is destroyed/disposed. | | * the original handle is destroyed/disposed. | |
| */ | | */ | |
| V8_INLINE(static Local<T> New(Handle<T> that)); | | V8_INLINE(static Local<T> New(Handle<T> that)); | |
| V8_INLINE(static Local<T> New(Isolate* isolate, Handle<T> that)); | | V8_INLINE(static Local<T> New(Isolate* isolate, Handle<T> that)); | |
| #ifndef V8_USE_UNSAFE_HANDLES | | #ifndef V8_USE_UNSAFE_HANDLES | |
| // TODO(dcarney): remove before cutover | | // TODO(dcarney): remove before cutover | |
| V8_INLINE(static Local<T> New(Isolate* isolate, const Persistent<T>& that
)); | | V8_INLINE(static Local<T> New(Isolate* isolate, const Persistent<T>& that
)); | |
| | | | |
| #ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR | | #ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR | |
| | | | |
| private: | | private: | |
| #endif | | #endif | |
| template <class S> V8_INLINE(Local(S* that) : Handle<T>(that)) { } | | template <class S> V8_INLINE(Local(S* that) : Handle<T>(that)) { } | |
| #endif | | #endif | |
| | | | |
| private: | | private: | |
| friend class Utils; | | friend class Utils; | |
|
| | | template<class F> friend class Eternal; | |
| template<class F> friend class Persistent; | | template<class F> friend class Persistent; | |
| template<class F> friend class Handle; | | template<class F> friend class Handle; | |
| friend class Arguments; | | friend class Arguments; | |
| template<class F> friend class FunctionCallbackInfo; | | template<class F> friend class FunctionCallbackInfo; | |
| template<class F> friend class PropertyCallbackInfo; | | template<class F> friend class PropertyCallbackInfo; | |
| friend class String; | | friend class String; | |
| friend class Object; | | friend class Object; | |
| friend class AccessorInfo; | | friend class AccessorInfo; | |
| friend class Context; | | friend class Context; | |
| template<class F> friend class internal::CustomArguments; | | template<class F> friend class internal::CustomArguments; | |
| friend class HandleScope; | | friend class HandleScope; | |
| | | | |
| V8_INLINE(static Local<T> New(Isolate* isolate, T* that)); | | V8_INLINE(static Local<T> New(Isolate* isolate, T* that)); | |
| }; | | }; | |
| | | | |
|
| | | // Eternal handles are set-once handles that live for the life of the isola | |
| | | te. | |
| | | template <class T> class Eternal { | |
| | | public: | |
| | | V8_INLINE(Eternal()) : index_(kInitialValue) { } | |
| | | template<class S> | |
| | | V8_INLINE(Eternal(Isolate* isolate, Local<S> handle)) | |
| | | : index_(kInitialValue) { | |
| | | Set(isolate, handle); | |
| | | } | |
| | | // Can only be safely called if already set. | |
| | | V8_INLINE(Local<T> Get(Isolate* isolate)); | |
| | | V8_INLINE(bool IsEmpty()) { return index_ != kInitialValue; } | |
| | | template<class S> | |
| | | V8_INLINE(void Set(Isolate* isolate, Local<S> handle)); | |
| | | | |
| | | private: | |
| | | static const int kInitialValue = -1; | |
| | | int index_; | |
| | | }; | |
| | | | |
| /** | | /** | |
| * An object reference that is independent of any handle scope. Where | | * An object reference that is independent of any handle scope. Where | |
| * a Local handle only lives as long as the HandleScope in which it was | | * a Local handle only lives as long as the HandleScope in which it was | |
| * allocated, a Persistent handle remains valid until it is explicitly | | * allocated, a Persistent handle remains valid until it is explicitly | |
| * disposed. | | * disposed. | |
| * | | * | |
| * A persistent handle contains a reference to a storage cell within | | * A persistent handle contains a reference to a storage cell within | |
| * the v8 engine which holds an object value and which is updated by | | * the v8 engine which holds an object value and which is updated by | |
| * the garbage collector whenever the object is moved. A new storage | | * the garbage collector whenever the object is moved. A new storage | |
| * cell can be created using Persistent::New and existing handles can | | * cell can be created using Persistent::New and existing handles can | |
| | | | |
| skipping to change at line 2915 | | skipping to change at line 2928 | |
| | | | |
| /** | | /** | |
| * The superclass of object and function templates. | | * The superclass of object and function templates. | |
| */ | | */ | |
| class V8_EXPORT Template : public Data { | | class V8_EXPORT Template : public Data { | |
| public: | | public: | |
| /** Adds a property to each instance created by this template.*/ | | /** Adds a property to each instance created by this template.*/ | |
| void Set(Handle<String> name, Handle<Data> value, | | void Set(Handle<String> name, Handle<Data> value, | |
| PropertyAttribute attributes = None); | | PropertyAttribute attributes = None); | |
| V8_INLINE(void Set(const char* name, Handle<Data> value)); | | V8_INLINE(void Set(const char* name, Handle<Data> value)); | |
|
| | | | |
| | | void SetAccessorProperty( | |
| | | Local<String> name, | |
| | | Local<FunctionTemplate> getter = Local<FunctionTemplate>(), | |
| | | Local<FunctionTemplate> setter = Local<FunctionTemplate>(), | |
| | | PropertyAttribute attribute = None, | |
| | | AccessControl settings = DEFAULT); | |
| | | | |
| private: | | private: | |
| Template(); | | Template(); | |
| | | | |
| friend class ObjectTemplate; | | friend class ObjectTemplate; | |
| friend class FunctionTemplate; | | friend class FunctionTemplate; | |
| }; | | }; | |
| | | | |
| template<typename T> | | template<typename T> | |
| class ReturnValue { | | class ReturnValue { | |
| public: | | public: | |
| | | | |
| skipping to change at line 4684 | | skipping to change at line 4705 | |
| V8(); | | V8(); | |
| | | | |
| static internal::Object** GlobalizeReference(internal::Isolate* isolate, | | static internal::Object** GlobalizeReference(internal::Isolate* isolate, | |
| internal::Object** handle); | | internal::Object** handle); | |
| static void DisposeGlobal(internal::Object** global_handle); | | static void DisposeGlobal(internal::Object** global_handle); | |
| typedef WeakReferenceCallbacks<Value, void>::Revivable RevivableCallback; | | typedef WeakReferenceCallbacks<Value, void>::Revivable RevivableCallback; | |
| static void MakeWeak(internal::Object** global_handle, | | static void MakeWeak(internal::Object** global_handle, | |
| void* data, | | void* data, | |
| RevivableCallback weak_reference_callback); | | RevivableCallback weak_reference_callback); | |
| static void ClearWeak(internal::Object** global_handle); | | static void ClearWeak(internal::Object** global_handle); | |
|
| static int Eternalize(internal::Isolate* isolate, | | static void Eternalize(Isolate* isolate, | |
| internal::Object** handle); | | Value* handle, | |
| static internal::Object** GetEternal(internal::Isolate* isolate, int inde | | int* index); | |
| x); | | static Local<Value> GetEternal(Isolate* isolate, int index); | |
| | | | |
| template <class T> friend class Handle; | | template <class T> friend class Handle; | |
| template <class T> friend class Local; | | template <class T> friend class Local; | |
|
| | | template <class T> friend class Eternal; | |
| template <class T> friend class Persistent; | | template <class T> friend class Persistent; | |
| friend class Context; | | friend class Context; | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * An external exception handler. | | * An external exception handler. | |
| */ | | */ | |
| class V8_EXPORT TryCatch { | | class V8_EXPORT TryCatch { | |
| public: | | public: | |
| /** | | /** | |
| | | | |
| skipping to change at line 5535 | | skipping to change at line 5558 | |
| template <class T> | | template <class T> | |
| Local<T> Local<T>::New(Isolate* isolate, T* that) { | | Local<T> Local<T>::New(Isolate* isolate, T* that) { | |
| if (that == NULL) return Local<T>(); | | if (that == NULL) return Local<T>(); | |
| T* that_ptr = that; | | T* that_ptr = that; | |
| internal::Object** p = reinterpret_cast<internal::Object**>(that_ptr); | | internal::Object** p = reinterpret_cast<internal::Object**>(that_ptr); | |
| return Local<T>(reinterpret_cast<T*>(HandleScope::CreateHandle( | | return Local<T>(reinterpret_cast<T*>(HandleScope::CreateHandle( | |
| reinterpret_cast<internal::Isolate*>(isolate), *p))); | | reinterpret_cast<internal::Isolate*>(isolate), *p))); | |
| } | | } | |
| | | | |
| template<class T> | | template<class T> | |
|
| int Local<T>::Eternalize(Isolate* isolate) { | | template<class S> | |
| return V8::Eternalize(reinterpret_cast<internal::Isolate*>(isolate), | | void Eternal<T>::Set(Isolate* isolate, Local<S> handle) { | |
| reinterpret_cast<internal::Object**>(this->val_)); | | TYPE_CHECK(T, S); | |
| | | V8::Eternalize(isolate, Value::Cast(*handle), &this->index_); | |
| } | | } | |
| | | | |
| template<class T> | | template<class T> | |
|
| Local<T> Local<T>::GetEternal(Isolate* isolate, int index) { | | Local<T> Eternal<T>::Get(Isolate* isolate) { | |
| internal::Object** handle = | | return Local<T>::Cast(V8::GetEternal(isolate, index_)); | |
| V8::GetEternal(reinterpret_cast<internal::Isolate*>(isolate), index); | | | |
| return Local<T>(T::Cast(reinterpret_cast<Value*>(handle))); | | | |
| } | | } | |
| | | | |
| #ifdef V8_USE_UNSAFE_HANDLES | | #ifdef V8_USE_UNSAFE_HANDLES | |
| template <class T> | | template <class T> | |
| Persistent<T> Persistent<T>::New(Handle<T> that) { | | Persistent<T> Persistent<T>::New(Handle<T> that) { | |
| return New(Isolate::GetCurrent(), that.val_); | | return New(Isolate::GetCurrent(), that.val_); | |
| } | | } | |
| | | | |
| template <class T> | | template <class T> | |
| Persistent<T> Persistent<T>::New(Isolate* isolate, Handle<T> that) { | | Persistent<T> Persistent<T>::New(Isolate* isolate, Handle<T> that) { | |
| | | | |
End of changes. 10 change blocks. |
| 20 lines changed or deleted | | 42 lines changed or added | |
|
| v8config.h | | v8config.h | |
| | | | |
| skipping to change at line 99 | | skipping to change at line 99 | |
| // Compiler detection | | // Compiler detection | |
| // | | // | |
| // V8_CC_CLANG - Clang | | // V8_CC_CLANG - Clang | |
| // V8_CC_GNU - GNU C++ | | // V8_CC_GNU - GNU C++ | |
| // V8_CC_MINGW - Minimalist GNU for Windows | | // V8_CC_MINGW - Minimalist GNU for Windows | |
| // V8_CC_MSVC - Microsoft Visual C/C++ | | // V8_CC_MSVC - Microsoft Visual C/C++ | |
| // | | // | |
| // C++11 feature detection | | // C++11 feature detection | |
| // | | // | |
| // V8_HAS_CXX11_ALIGNAS - alignas specifier supported | | // V8_HAS_CXX11_ALIGNAS - alignas specifier supported | |
|
| | | // V8_HAS_CXX11_ALIGNOF - alignof(type) operator supported | |
| // V8_HAS_CXX11_STATIC_ASSERT - static_assert() supported | | // V8_HAS_CXX11_STATIC_ASSERT - static_assert() supported | |
| // V8_HAS_CXX11_DELETE - deleted functions supported | | // V8_HAS_CXX11_DELETE - deleted functions supported | |
| // V8_HAS_CXX11_FINAL - final marker supported | | // V8_HAS_CXX11_FINAL - final marker supported | |
| // V8_HAS_CXX11_OVERRIDE - override marker supported | | // V8_HAS_CXX11_OVERRIDE - override marker supported | |
| // | | // | |
| // Compiler-specific feature detection | | // Compiler-specific feature detection | |
| // | | // | |
|
| // V8_HAS_ATTRIBUTE___ALIGNED__ - __attribute__((__aligned__(n))) suppo | | // V8_HAS___ALIGNOF - __alignof(type) operator supported | |
| rted | | // V8_HAS___ALIGNOF__ - __alignof__(type) operator supported | |
| | | // V8_HAS_ATTRIBUTE_ALIGNED - __attribute__((aligned(n))) supported | |
| // V8_HAS_ATTRIBUTE_ALWAYS_INLINE - __attribute__((always_inline)) suppor
ted | | // V8_HAS_ATTRIBUTE_ALWAYS_INLINE - __attribute__((always_inline)) suppor
ted | |
| // V8_HAS_ATTRIBUTE_DEPRECATED - __attribute__((deprecated)) supported | | // V8_HAS_ATTRIBUTE_DEPRECATED - __attribute__((deprecated)) supported | |
| // V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported | | // V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported | |
| // V8_HAS_BUILTIN_EXPECT - __builtin_expect() supported | | // V8_HAS_BUILTIN_EXPECT - __builtin_expect() supported | |
| // V8_HAS_DECLSPEC_ALIGN - __declspec(align(n)) supported | | // V8_HAS_DECLSPEC_ALIGN - __declspec(align(n)) supported | |
| // V8_HAS_DECLSPEC_DEPRECATED - __declspec(deprecated) supported | | // V8_HAS_DECLSPEC_DEPRECATED - __declspec(deprecated) supported | |
| // V8_HAS___FINAL - __final supported in non-C++11 mode | | // V8_HAS___FINAL - __final supported in non-C++11 mode | |
| // V8_HAS___FORCEINLINE - __forceinline supported | | // V8_HAS___FORCEINLINE - __forceinline supported | |
| // V8_HAS_SEALED - MSVC style sealed marker supported | | // V8_HAS_SEALED - MSVC style sealed marker supported | |
| | | | |
| #if defined(__clang__) | | #if defined(__clang__) | |
| | | | |
| // Don't treat clang as GCC. | | // Don't treat clang as GCC. | |
| # define V8_GNUC_PREREQ(major, minor, patchlevel) 0 | | # define V8_GNUC_PREREQ(major, minor, patchlevel) 0 | |
| | | | |
| # define V8_CC_CLANG 1 | | # define V8_CC_CLANG 1 | |
| | | | |
|
| # define V8_HAS_ATTRIBUTE___ALIGNED__ (__has_attribute(__aligned__)) | | // Clang defines __alignof__ as alias for __alignof | |
| | | # define V8_HAS___ALIGNOF 1 | |
| | | # define V8_HAS___ALIGNOF__ V8_HAS___ALIGNOF | |
| | | | |
| | | # define V8_HAS_ATTRIBUTE_ALIGNED (__has_attribute(aligned)) | |
| # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline)) | | # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline)) | |
| # define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated)) | | # define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated)) | |
| # define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility)) | | # define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility)) | |
| | | | |
| # define V8_HAS_BUILTIN_EXPECT (__has_builtin(__builtin_expect)) | | # define V8_HAS_BUILTIN_EXPECT (__has_builtin(__builtin_expect)) | |
| | | | |
| # define V8_HAS_CXX11_ALIGNAS (__has_feature(cxx_alignas)) | | # define V8_HAS_CXX11_ALIGNAS (__has_feature(cxx_alignas)) | |
| # define V8_HAS_CXX11_STATIC_ASSERT (__has_feature(cxx_static_assert)) | | # define V8_HAS_CXX11_STATIC_ASSERT (__has_feature(cxx_static_assert)) | |
| # define V8_HAS_CXX11_DELETE (__has_feature(cxx_deleted_functions)) | | # define V8_HAS_CXX11_DELETE (__has_feature(cxx_deleted_functions)) | |
| # define V8_HAS_CXX11_FINAL (__has_feature(cxx_override_control)) | | # define V8_HAS_CXX11_FINAL (__has_feature(cxx_override_control)) | |
| | | | |
| skipping to change at line 148 | | skipping to change at line 155 | |
| | | | |
| # define V8_GNUC_PREREQ(major, minor, patchlevel) \ | | # define V8_GNUC_PREREQ(major, minor, patchlevel) \ | |
| ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= \ | | ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= \ | |
| ((major) * 10000 + (minor) * 100 + (patchlevel))) | | ((major) * 10000 + (minor) * 100 + (patchlevel))) | |
| | | | |
| # define V8_CC_GNU 1 | | # define V8_CC_GNU 1 | |
| # if defined(__MINGW32__) | | # if defined(__MINGW32__) | |
| # define V8_CC_MINGW 1 | | # define V8_CC_MINGW 1 | |
| # endif | | # endif | |
| | | | |
|
| # define V8_HAS_ATTRIBUTE___ALIGNED__ (V8_GNUC_PREREQ(2, 95, 0)) | | # define V8_HAS___ALIGNOF__ (V8_GNUC_PREREQ(4, 3, 0)) | |
| # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (V8_GNUC_PREREQ(4, 0, 0)) | | | |
| | | # define V8_HAS_ATTRIBUTE_ALIGNED (V8_GNUC_PREREQ(2, 95, 0)) | |
| | | // always_inline is available in gcc 4.0 but not very reliable until 4.4. | |
| | | // Works around "sorry, unimplemented: inlining failed" build errors with | |
| | | // older compilers. | |
| | | # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (V8_GNUC_PREREQ(4, 4, 0)) | |
| # define V8_HAS_ATTRIBUTE_DEPRECATED (V8_GNUC_PREREQ(3, 4, 0)) | | # define V8_HAS_ATTRIBUTE_DEPRECATED (V8_GNUC_PREREQ(3, 4, 0)) | |
| # define V8_HAS_ATTRIBUTE_VISIBILITY (V8_GNUC_PREREQ(4, 3, 0)) | | # define V8_HAS_ATTRIBUTE_VISIBILITY (V8_GNUC_PREREQ(4, 3, 0)) | |
| | | | |
| # define V8_HAS_BUILTIN_EXPECT (V8_GNUC_PREREQ(2, 96, 0)) | | # define V8_HAS_BUILTIN_EXPECT (V8_GNUC_PREREQ(2, 96, 0)) | |
| | | | |
| // g++ requires -std=c++0x or -std=gnu++0x to support C++11 functionality | | // g++ requires -std=c++0x or -std=gnu++0x to support C++11 functionality | |
| // without warnings (functionality used by the macros below). These modes | | // without warnings (functionality used by the macros below). These modes | |
| // are detectable by checking whether __GXX_EXPERIMENTAL_CXX0X__ is defined
or, | | // are detectable by checking whether __GXX_EXPERIMENTAL_CXX0X__ is defined
or, | |
| // more standardly, by checking whether __cplusplus has a C++11 or greater | | // more standardly, by checking whether __cplusplus has a C++11 or greater | |
| // value. Current versions of g++ do not correctly set __cplusplus, so we c
heck | | // value. Current versions of g++ do not correctly set __cplusplus, so we c
heck | |
| // both for forward compatibility. | | // both for forward compatibility. | |
| # if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L | | # if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L | |
| # define V8_HAS_CXX11_ALIGNAS (V8_GNUC_PREREQ(4, 8, 0)) | | # define V8_HAS_CXX11_ALIGNAS (V8_GNUC_PREREQ(4, 8, 0)) | |
|
| | | # define V8_HAS_CXX11_ALIGNOF (V8_GNUC_PREREQ(4, 8, 0)) | |
| # define V8_HAS_CXX11_STATIC_ASSERT (V8_GNUC_PREREQ(4, 3, 0)) | | # define V8_HAS_CXX11_STATIC_ASSERT (V8_GNUC_PREREQ(4, 3, 0)) | |
| # define V8_HAS_CXX11_DELETE (V8_GNUC_PREREQ(4, 4, 0)) | | # define V8_HAS_CXX11_DELETE (V8_GNUC_PREREQ(4, 4, 0)) | |
| # define V8_HAS_CXX11_OVERRIDE (V8_GNUC_PREREQ(4, 7, 0)) | | # define V8_HAS_CXX11_OVERRIDE (V8_GNUC_PREREQ(4, 7, 0)) | |
| # define V8_HAS_CXX11_FINAL (V8_GNUC_PREREQ(4, 7, 0)) | | # define V8_HAS_CXX11_FINAL (V8_GNUC_PREREQ(4, 7, 0)) | |
| # else | | # else | |
| // '__final' is a non-C++11 GCC synonym for 'final', per GCC r176655. | | // '__final' is a non-C++11 GCC synonym for 'final', per GCC r176655. | |
| # define V8_HAS___FINAL (V8_GNUC_PREREQ(4, 7, 0)) | | # define V8_HAS___FINAL (V8_GNUC_PREREQ(4, 7, 0)) | |
| # endif | | # endif | |
| | | | |
| #elif defined(_MSC_VER) | | #elif defined(_MSC_VER) | |
| | | | |
| # define V8_GNUC_PREREQ(major, minor, patchlevel) 0 | | # define V8_GNUC_PREREQ(major, minor, patchlevel) 0 | |
| | | | |
| # define V8_CC_MSVC 1 | | # define V8_CC_MSVC 1 | |
| | | | |
|
| | | # define V8_HAS___ALIGNOF 1 | |
| | | | |
| // Override control was added with Visual Studio 2005, but | | // Override control was added with Visual Studio 2005, but | |
| // Visual Studio 2010 and earlier spell "final" as "sealed". | | // Visual Studio 2010 and earlier spell "final" as "sealed". | |
| # define V8_HAS_CXX11_FINAL (_MSC_VER >= 1700) | | # define V8_HAS_CXX11_FINAL (_MSC_VER >= 1700) | |
| # define V8_HAS_CXX11_OVERRIDE (_MSC_VER >= 1400) | | # define V8_HAS_CXX11_OVERRIDE (_MSC_VER >= 1400) | |
| # define V8_HAS_SEALED (_MSC_VER >= 1400) | | # define V8_HAS_SEALED (_MSC_VER >= 1400) | |
| | | | |
| # define V8_HAS_DECLSPEC_ALIGN 1 | | # define V8_HAS_DECLSPEC_ALIGN 1 | |
| # define V8_HAS_DECLSPEC_DEPRECATED (_MSC_VER >= 1300) | | # define V8_HAS_DECLSPEC_DEPRECATED (_MSC_VER >= 1300) | |
| | | | |
| # define V8_HAS___FORCEINLINE 1 | | # define V8_HAS___FORCEINLINE 1 | |
| | | | |
| skipping to change at line 267 | | skipping to change at line 282 | |
| #elif V8_HAS___FINAL | | #elif V8_HAS___FINAL | |
| # define V8_FINAL __final | | # define V8_FINAL __final | |
| #elif V8_HAS_SEALED | | #elif V8_HAS_SEALED | |
| # define V8_FINAL sealed | | # define V8_FINAL sealed | |
| #else | | #else | |
| # define V8_FINAL /* NOT SUPPORTED */ | | # define V8_FINAL /* NOT SUPPORTED */ | |
| #endif | | #endif | |
| | | | |
| // This macro allows to specify memory alignment for structs, classes, etc. | | // This macro allows to specify memory alignment for structs, classes, etc. | |
| // Use like: | | // Use like: | |
|
| // class V8_ALIGNAS(16) MyClass { ... }; | | // class V8_ALIGNED(16) MyClass { ... }; | |
| // V8_ALIGNAS(32) int array[42]; | | // V8_ALIGNED(32) int array[42]; | |
| #if V8_HAS_CXX11_ALIGNAS | | #if V8_HAS_CXX11_ALIGNAS | |
|
| # define V8_ALIGNAS(n) alignas(n) | | # define V8_ALIGNED(n) alignas(n) | |
| #elif V8_HAS_ATTRIBUTE___ALIGNED__ | | #elif V8_HAS_ATTRIBUTE_ALIGNED | |
| # define V8_ALIGNAS(n) __attribute__((__aligned__(n))) | | # define V8_ALIGNED(n) __attribute__((aligned(n))) | |
| #elif V8_HAS_DECLSPEC_ALIGN | | #elif V8_HAS_DECLSPEC_ALIGN | |
|
| # define V8_ALIGNAS(n) __declspec(align(n)) | | # define V8_ALIGNED(n) __declspec(align(n)) | |
| #else | | #else | |
|
| # define V8_ALIGNAS(n) /* NOT SUPPORTED */ | | # define V8_ALIGNED(n) /* NOT SUPPORTED */ | |
| | | #endif | |
| | | | |
| | | // This macro is similar to V8_ALIGNED(), but takes a type instead of size | |
| | | // in bytes. If the compiler does not supports using the alignment of the | |
| | | // |type|, it will align according to the |alignment| instead. For example, | |
| | | // Visual Studio C++ cannot combine __declspec(align) and __alignof. The | |
| | | // |alignment| must be a literal that is used as a kind of worst-case fallb | |
| | | ack | |
| | | // alignment. | |
| | | // Use like: | |
| | | // struct V8_ALIGNAS(AnotherClass, 16) NewClass { ... }; | |
| | | // V8_ALIGNAS(double, 8) int array[100]; | |
| | | #if V8_HAS_CXX11_ALIGNAS | |
| | | # define V8_ALIGNAS(type, alignment) alignas(type) | |
| | | #elif V8_HAS___ALIGNOF__ && V8_HAS_ATTRIBUTE_ALIGNED | |
| | | # define V8_ALIGNAS(type, alignment) __attribute__((aligned(__alignof__(typ | |
| | | e)))) | |
| | | #else | |
| | | # define V8_ALIGNAS(type, alignment) V8_ALIGNED(alignment) | |
| | | #endif | |
| | | | |
| | | // This macro returns alignment in bytes (an integer power of two) required | |
| | | for | |
| | | // any instance of the given type, which is either complete type, an array | |
| | | type, | |
| | | // or a reference type. | |
| | | // Use like: | |
| | | // size_t alignment = V8_ALIGNOF(double); | |
| | | #if V8_HAS_CXX11_ALIGNOF | |
| | | # define V8_ALIGNOF(type) alignof(type) | |
| | | #elif V8_HAS___ALIGNOF | |
| | | # define V8_ALIGNOF(type) __alignof(type) | |
| | | #elif V8_HAS___ALIGNOF__ | |
| | | # define V8_ALIGNOF(type) __alignof__(type) | |
| | | #else | |
| | | // Note that alignment of a type within a struct can be less than the | |
| | | // alignment of the type stand-alone (because of ancient ABIs), so this | |
| | | // should only be used as a last resort. | |
| | | namespace v8 { template <typename T> class AlignOfHelper { char c; T t; }; | |
| | | } | |
| | | # define V8_ALIGNOF(type) (sizeof(::v8::AlignOfHelper<type>) - sizeof(type) | |
| | | ) | |
| #endif | | #endif | |
| | | | |
| #endif // V8CONFIG_H_ | | #endif // V8CONFIG_H_ | |
| | | | |
End of changes. 10 change blocks. |
| 12 lines changed or deleted | | 68 lines changed or added | |
|