From: bmeurer@chromium.org Date: Wed, 11 Sep 2013 10:28:09 +0000 (+0000) Subject: Deuglify V8_INLINE and V8_NOINLINE. X-Git-Tag: upstream/4.7.83~12571 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b60d340e085bd050900d7bfffd8c7b647a66e55c;p=platform%2Fupstream%2Fv8.git Deuglify V8_INLINE and V8_NOINLINE. R=dslomov@chromium.org Review URL: https://codereview.chromium.org/23494047 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16641 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/include/v8.h b/include/v8.h index d4d70f7..9e44d9e 100644 --- a/include/v8.h +++ b/include/v8.h @@ -211,7 +211,7 @@ template class Handle { /** * Creates an empty handle. */ - V8_INLINE(Handle()) : val_(0) {} + V8_INLINE Handle() : val_(0) {} /** * Creates a handle for the contents of the specified handle. This @@ -223,7 +223,7 @@ template class Handle { * Handle to a variable declared as Handle, is legal * because String is a subclass of Value. */ - template V8_INLINE(Handle(Handle that)) + template V8_INLINE Handle(Handle that) : val_(reinterpret_cast(*that)) { /** * This check fails when trying to convert between incompatible @@ -236,16 +236,16 @@ template class Handle { /** * Returns true if the handle is empty. */ - V8_INLINE(bool IsEmpty() const) { return val_ == 0; } + V8_INLINE bool IsEmpty() const { return val_ == 0; } /** * Sets the handle to be empty. IsEmpty() will then return true. */ - V8_INLINE(void Clear()) { val_ = 0; } + V8_INLINE void Clear() { val_ = 0; } - V8_INLINE(T* operator->() const) { return val_; } + V8_INLINE T* operator->() const { return val_; } - V8_INLINE(T* operator*() const) { return val_; } + V8_INLINE T* operator*() const { return val_; } /** * Checks whether two handles are the same. @@ -253,7 +253,7 @@ template class Handle { * to which they refer are identical. * The handles' references are not checked. */ - template V8_INLINE(bool operator==(const Handle& that) const) { + template V8_INLINE bool operator==(const Handle& that) const { internal::Object** a = reinterpret_cast(**this); internal::Object** b = reinterpret_cast(*that); if (a == 0) return b == 0; @@ -261,8 +261,8 @@ template class Handle { return *a == *b; } - template V8_INLINE( - bool operator==(const Persistent& that) const) { + template V8_INLINE bool operator==( + const Persistent& that) const { internal::Object** a = reinterpret_cast(**this); internal::Object** b = reinterpret_cast(*that); if (a == 0) return b == 0; @@ -276,16 +276,16 @@ template class Handle { * the objects to which they refer are different. * The handles' references are not checked. */ - template V8_INLINE(bool operator!=(const Handle& that) const) { + template V8_INLINE bool operator!=(const Handle& that) const { return !operator==(that); } - template V8_INLINE( - bool operator!=(const Persistent& that) const) { + template V8_INLINE bool operator!=( + const Persistent& that) const { return !operator==(that); } - template V8_INLINE(static Handle Cast(Handle that)) { + template V8_INLINE static Handle Cast(Handle that) { #ifdef V8_ENABLE_CHECKS // If we're going to perform the type check then we have to check // that the handle isn't empty before doing the checked cast. @@ -294,14 +294,14 @@ template class Handle { return Handle(T::Cast(*that)); } - template V8_INLINE(Handle As()) { + template V8_INLINE Handle As() { return Handle::Cast(*this); } - V8_INLINE(static Handle New(Isolate* isolate, Handle that)) { + V8_INLINE static Handle New(Isolate* isolate, Handle that) { return New(isolate, that.val_); } - V8_INLINE(static Handle New(Isolate* isolate, const Persistent& that)) { + V8_INLINE static Handle New(Isolate* isolate, const Persistent& that) { return New(isolate, that.val_); } @@ -312,7 +312,7 @@ template class Handle { /** * Creates a new handle for the specified value. */ - V8_INLINE(explicit Handle(T* val)) : val_(val) {} + V8_INLINE explicit Handle(T* val) : val_(val) {} private: friend class Utils; @@ -328,7 +328,7 @@ template class Handle { friend class Context; friend class HandleScope; - V8_INLINE(static Handle New(Isolate* isolate, T* that)); + V8_INLINE static Handle New(Isolate* isolate, T* that); T* val_; }; @@ -343,8 +343,8 @@ template class Handle { */ template class Local : public Handle { public: - V8_INLINE(Local()); - template V8_INLINE(Local(Local that)) + V8_INLINE Local(); + template V8_INLINE Local(Local that) : Handle(reinterpret_cast(*that)) { /** * This check fails when trying to convert between incompatible @@ -355,7 +355,7 @@ template class Local : public Handle { } - template V8_INLINE(static Local Cast(Local that)) { + template V8_INLINE static Local Cast(Local that) { #ifdef V8_ENABLE_CHECKS // If we're going to perform the type check then we have to check // that the handle isn't empty before doing the checked cast. @@ -363,12 +363,12 @@ template class Local : public Handle { #endif return Local(T::Cast(*that)); } - template V8_INLINE(Local(Handle that)) + template V8_INLINE Local(Handle that) : Handle(reinterpret_cast(*that)) { TYPE_CHECK(T, S); } - template V8_INLINE(Local As()) { + template V8_INLINE Local As() { return Local::Cast(*this); } @@ -377,17 +377,17 @@ template class Local : public Handle { * The referee is kept alive by the local handle even when * the original handle is destroyed/disposed. */ - V8_INLINE(static Local New(Handle that)); - V8_INLINE(static Local New(Isolate* isolate, Handle that)); + V8_INLINE static Local New(Handle that); + V8_INLINE static Local New(Isolate* isolate, Handle that); template - V8_INLINE(static Local New(Isolate* isolate, - const Persistent& that)); + V8_INLINE static Local New(Isolate* isolate, + const Persistent& that); #ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR private: #endif - template V8_INLINE(Local(S* that) : Handle(that)) { } + template V8_INLINE Local(S* that) : Handle(that) { } private: friend class Utils; @@ -402,24 +402,22 @@ template class Local : public Handle { template friend class internal::CustomArguments; friend class HandleScope; - V8_INLINE(static Local New(Isolate* isolate, T* that)); + V8_INLINE static Local New(Isolate* isolate, T* that); }; // Eternal handles are set-once handles that live for the life of the isolate. template class Eternal { public: - V8_INLINE(Eternal()) : index_(kInitialValue) { } + V8_INLINE Eternal() : index_(kInitialValue) { } template - V8_INLINE(Eternal(Isolate* isolate, Local handle)) - : index_(kInitialValue) { + V8_INLINE Eternal(Isolate* isolate, Local handle) : index_(kInitialValue) { Set(isolate, handle); } // Can only be safely called if already set. - V8_INLINE(Local Get(Isolate* isolate)); - V8_INLINE(bool IsEmpty()) { return index_ == kInitialValue; } - template - V8_INLINE(void Set(Isolate* isolate, Local handle)); + V8_INLINE Local Get(Isolate* isolate); + V8_INLINE bool IsEmpty() { return index_ == kInitialValue; } + template V8_INLINE void Set(Isolate* isolate, Local handle); private: static const int kInitialValue = -1; @@ -432,9 +430,9 @@ class WeakCallbackData { public: typedef void (*Callback)(const WeakCallbackData& data); - V8_INLINE(Isolate* GetIsolate()) const { return isolate_; } - V8_INLINE(Local GetValue()) const { return handle_; } - V8_INLINE(P* GetParameter()) const { return parameter_; } + V8_INLINE Isolate* GetIsolate() const { return isolate_; } + V8_INLINE Local GetValue() const { return handle_; } + V8_INLINE P* GetParameter() const { return parameter_; } private: friend class internal::GlobalHandles; @@ -470,13 +468,12 @@ class NonCopyablePersistentTraits { typedef Persistent > NonCopyablePersistent; static const bool kResetInDestructor = false; template - V8_INLINE(static void Copy(const Persistent& source, - NonCopyablePersistent* dest)) { + V8_INLINE static void Copy(const Persistent& source, + NonCopyablePersistent* dest) { Uncompilable(); } // TODO(dcarney): come up with a good compile error here. - template - V8_INLINE(static void Uncompilable()) { + template V8_INLINE static void Uncompilable() { TYPE_CHECK(O, Primitive); } }; @@ -502,13 +499,13 @@ template class Persistent { /** * A Persistent with no storage cell. */ - V8_INLINE(Persistent()) : val_(0) { } + V8_INLINE Persistent() : val_(0) { } /** * Construct a Persistent from a Handle. * When the Handle is non-empty, a new storage cell is created * pointing to the same object, and no flags are set. */ - template V8_INLINE(Persistent(Isolate* isolate, Handle that)) + template V8_INLINE Persistent(Isolate* isolate, Handle that) : val_(New(isolate, *that)) { TYPE_CHECK(T, S); } @@ -518,7 +515,7 @@ template class Persistent { * pointing to the same object, and no flags are set. */ template - V8_INLINE(Persistent(Isolate* isolate, const Persistent& that)) + V8_INLINE Persistent(Isolate* isolate, const Persistent& that) : val_(New(isolate, *that)) { TYPE_CHECK(T, S); } @@ -528,19 +525,19 @@ template class Persistent { * traits class is called, allowing the setting of flags based on the * copied Persistent. */ - V8_INLINE(Persistent(const Persistent& that)) : val_(0) { + V8_INLINE Persistent(const Persistent& that) : val_(0) { Copy(that); } template - V8_INLINE(Persistent(const Persistent& that)) : val_(0) { + V8_INLINE Persistent(const Persistent& that) : val_(0) { Copy(that); } - V8_INLINE(Persistent& operator=(const Persistent& that)) { // NOLINT + V8_INLINE Persistent& operator=(const Persistent& that) { // NOLINT Copy(that); return *this; } template - V8_INLINE(Persistent& operator=(const Persistent& that)) { // NOLINT + V8_INLINE Persistent& operator=(const Persistent& that) { // NOLINT Copy(that); return *this; } @@ -549,7 +546,7 @@ template class Persistent { * kResetInDestructor flags in the traits class. Since not calling dispose * can result in a memory leak, it is recommended to always set this flag. */ - V8_INLINE(~Persistent()) { + V8_INLINE ~Persistent() { if (M::kResetInDestructor) Reset(); } @@ -557,28 +554,28 @@ template class Persistent { * If non-empty, destroy the underlying storage cell * IsEmpty() will return true after this call. */ - V8_INLINE(void Reset()); - template + V8_INLINE void Reset(); /** * If non-empty, destroy the underlying storage cell * and create a new one with the contents of other if other is non empty */ - V8_INLINE(void Reset(Isolate* isolate, const Handle& other)); + template + V8_INLINE void Reset(Isolate* isolate, const Handle& other); /** * If non-empty, destroy the underlying storage cell * and create a new one with the contents of other if other is non empty */ template - V8_INLINE(void Reset(Isolate* isolate, const Persistent& other)); + V8_INLINE void Reset(Isolate* isolate, const Persistent& other); // TODO(dcarney): deprecate - V8_INLINE(void Dispose()) { Reset(); } - V8_DEPRECATED(V8_INLINE(void Dispose(Isolate* isolate))) { Reset(); } + V8_INLINE void Dispose() { Reset(); } + V8_DEPRECATED(V8_INLINE void Dispose(Isolate* isolate)) { Reset(); } - V8_INLINE(bool IsEmpty() const) { return val_ == 0; } + V8_INLINE bool IsEmpty() const { return val_ == 0; } // TODO(dcarney): this is pretty useless, fix or remove template - V8_INLINE(static Persistent& Cast(Persistent& that)) { // NOLINT + V8_INLINE static Persistent& Cast(Persistent& that) { // NOLINT #ifdef V8_ENABLE_CHECKS // If we're going to perform the type check then we have to check // that the handle isn't empty before doing the checked cast. @@ -588,12 +585,12 @@ template class Persistent { } // TODO(dcarney): this is pretty useless, fix or remove - template V8_INLINE(Persistent& As()) { // NOLINT + template V8_INLINE Persistent& As() { // NOLINT return Persistent::Cast(*this); } - template V8_INLINE( - bool operator==(const Persistent& that) const) { + template + V8_INLINE bool operator==(const Persistent& that) const { internal::Object** a = reinterpret_cast(**this); internal::Object** b = reinterpret_cast(*that); if (a == 0) return b == 0; @@ -601,7 +598,7 @@ template class Persistent { return *a == *b; } - template V8_INLINE(bool operator==(const Handle& that) const) { + template V8_INLINE bool operator==(const Handle& that) const { internal::Object** a = reinterpret_cast(**this); internal::Object** b = reinterpret_cast(*that); if (a == 0) return b == 0; @@ -609,40 +606,40 @@ template class Persistent { return *a == *b; } - template V8_INLINE( - bool operator!=(const Persistent& that) const) { + template + V8_INLINE bool operator!=(const Persistent& that) const { return !operator==(that); } - template V8_INLINE(bool operator!=(const Handle& that) const) { + template V8_INLINE bool operator!=(const Handle& that) const { return !operator==(that); } template - V8_INLINE(void SetWeak( + V8_INLINE void SetWeak( P* parameter, - typename WeakCallbackData::Callback callback)); + typename WeakCallbackData::Callback callback); template - V8_INLINE(void SetWeak( + V8_INLINE void SetWeak( P* parameter, - typename WeakCallbackData::Callback callback)); + typename WeakCallbackData::Callback callback); // TODO(dcarney): deprecate template - V8_INLINE(void MakeWeak( + V8_INLINE void MakeWeak( P* parameter, - typename WeakReferenceCallbacks::Revivable callback)); + typename WeakReferenceCallbacks::Revivable callback); // TODO(dcarney): deprecate template - V8_INLINE(void MakeWeak( + V8_INLINE void MakeWeak( P* parameter, - typename WeakReferenceCallbacks::Revivable callback)); + typename WeakReferenceCallbacks::Revivable callback); - V8_INLINE(void ClearWeak()); + V8_INLINE void ClearWeak(); - V8_DEPRECATED(V8_INLINE(void ClearWeak(Isolate* isolate))) { ClearWeak(); } + V8_DEPRECATED(V8_INLINE void ClearWeak(Isolate* isolate)) { ClearWeak(); } /** * Marks the reference to this object independent. Garbage collector is free @@ -650,9 +647,9 @@ template class Persistent { * independent handle should not assume that it will be preceded by a global * GC prologue callback or followed by a global GC epilogue callback. */ - V8_INLINE(void MarkIndependent()); + V8_INLINE void MarkIndependent(); - V8_DEPRECATED(V8_INLINE(void MarkIndependent(Isolate* isolate))) { + V8_DEPRECATED(V8_INLINE void MarkIndependent(Isolate* isolate)) { MarkIndependent(); } @@ -664,29 +661,29 @@ template class Persistent { * external dependencies. This mark is automatically cleared after each * garbage collection. */ - V8_INLINE(void MarkPartiallyDependent()); + V8_INLINE void MarkPartiallyDependent(); - V8_DEPRECATED(V8_INLINE(void MarkPartiallyDependent(Isolate* isolate))) { + V8_DEPRECATED(V8_INLINE void MarkPartiallyDependent(Isolate* isolate)) { MarkPartiallyDependent(); } - V8_INLINE(bool IsIndependent() const); + V8_INLINE bool IsIndependent() const; - V8_DEPRECATED(V8_INLINE(bool IsIndependent(Isolate* isolate)) const) { + V8_DEPRECATED(V8_INLINE bool IsIndependent(Isolate* isolate) const) { return IsIndependent(); } /** Checks if the handle holds the only reference to an object. */ - V8_INLINE(bool IsNearDeath() const); + V8_INLINE bool IsNearDeath() const; - V8_DEPRECATED(V8_INLINE(bool IsNearDeath(Isolate* isolate)) const) { + V8_DEPRECATED(V8_INLINE bool IsNearDeath(Isolate* isolate) const) { return IsNearDeath(); } /** Returns true if the handle's reference is weak. */ - V8_INLINE(bool IsWeak() const); + V8_INLINE bool IsWeak() const; - V8_DEPRECATED(V8_INLINE(bool IsWeak(Isolate* isolate)) const) { + V8_DEPRECATED(V8_INLINE bool IsWeak(Isolate* isolate) const) { return IsWeak(); } @@ -694,10 +691,10 @@ template class Persistent { * Assigns a wrapper class ID to the handle. See RetainedObjectInfo interface * description in v8-profiler.h for details. */ - V8_INLINE(void SetWrapperClassId(uint16_t class_id)); + V8_INLINE void SetWrapperClassId(uint16_t class_id); V8_DEPRECATED( - V8_INLINE(void SetWrapperClassId(Isolate * isolate, uint16_t class_id))) { + V8_INLINE void SetWrapperClassId(Isolate * isolate, uint16_t class_id)) { SetWrapperClassId(class_id); } @@ -705,26 +702,26 @@ template class Persistent { * Returns the class ID previously assigned to this handle or 0 if no class ID * was previously assigned. */ - V8_INLINE(uint16_t WrapperClassId() const); + V8_INLINE uint16_t WrapperClassId() const; - V8_DEPRECATED(V8_INLINE(uint16_t WrapperClassId(Isolate* isolate)) const) { + V8_DEPRECATED(V8_INLINE uint16_t WrapperClassId(Isolate* isolate) const) { return WrapperClassId(); } // TODO(dcarney): remove - V8_INLINE(T* ClearAndLeak()); + V8_INLINE T* ClearAndLeak(); // TODO(dcarney): remove - V8_INLINE(void Clear()) { val_ = 0; } + V8_INLINE void Clear() { val_ = 0; } // TODO(dcarney): remove #ifndef V8_ALLOW_ACCESS_TO_RAW_HANDLE_CONSTRUCTOR private: #endif - template V8_INLINE(Persistent(S* that)) : val_(that) { } + template V8_INLINE Persistent(S* that) : val_(that) { } - V8_INLINE(T* operator*() const) { return val_; } + V8_INLINE T* operator*() const { return val_; } private: friend class Utils; @@ -733,9 +730,9 @@ template class Persistent { template friend class Persistent; template friend class ReturnValue; - V8_INLINE(static T* New(Isolate* isolate, T* that)); + V8_INLINE static T* New(Isolate* isolate, T* that); template - V8_INLINE(void Copy(const Persistent& that)); + V8_INLINE void Copy(const Persistent& that); T* val_; }; @@ -795,7 +792,7 @@ class V8_EXPORT HandleScope { internal::Object** next; internal::Object** limit; int level; - V8_INLINE(void Initialize()) { + V8_INLINE void Initialize() { next = limit = NULL; level = 0; } @@ -904,19 +901,19 @@ class V8_EXPORT ScriptData { // NOLINT */ class ScriptOrigin { public: - V8_INLINE(ScriptOrigin( + V8_INLINE ScriptOrigin( Handle resource_name, Handle resource_line_offset = Handle(), Handle resource_column_offset = Handle(), - Handle resource_is_shared_cross_origin = Handle())) + Handle resource_is_shared_cross_origin = Handle()) : resource_name_(resource_name), resource_line_offset_(resource_line_offset), resource_column_offset_(resource_column_offset), resource_is_shared_cross_origin_(resource_is_shared_cross_origin) { } - V8_INLINE(Handle ResourceName() const); - V8_INLINE(Handle ResourceLineOffset() const); - V8_INLINE(Handle ResourceColumnOffset() const); - V8_INLINE(Handle ResourceIsSharedCrossOrigin() const); + V8_INLINE Handle ResourceName() const; + V8_INLINE Handle ResourceLineOffset() const; + V8_INLINE Handle ResourceColumnOffset() const; + V8_INLINE Handle ResourceIsSharedCrossOrigin() const; private: Handle resource_name_; Handle resource_line_offset_; @@ -1257,13 +1254,13 @@ class V8_EXPORT Value : public Data { * Returns true if this value is the undefined value. See ECMA-262 * 4.3.10. */ - V8_INLINE(bool IsUndefined() const); + V8_INLINE bool IsUndefined() const; /** * Returns true if this value is the null value. See ECMA-262 * 4.3.11. */ - V8_INLINE(bool IsNull() const); + V8_INLINE bool IsNull() const; /** * Returns true if this value is true. @@ -1279,7 +1276,7 @@ class V8_EXPORT Value : public Data { * Returns true if this value is an instance of the String type. * See ECMA-262 8.4. */ - V8_INLINE(bool IsString() const); + V8_INLINE bool IsString() const; /** * Returns true if this value is a symbol. @@ -1467,12 +1464,12 @@ class V8_EXPORT Value : public Data { bool Equals(Handle that) const; bool StrictEquals(Handle that) const; - template V8_INLINE(static Value* Cast(T* value)); + template V8_INLINE static Value* Cast(T* value); private: - V8_INLINE(bool QuickIsUndefined() const); - V8_INLINE(bool QuickIsNull() const); - V8_INLINE(bool QuickIsString() const); + V8_INLINE bool QuickIsUndefined() const; + V8_INLINE bool QuickIsNull() const; + V8_INLINE bool QuickIsString() const; bool FullIsUndefined() const; bool FullIsNull() const; bool FullIsString() const; @@ -1492,7 +1489,7 @@ class V8_EXPORT Primitive : public Value { }; class V8_EXPORT Boolean : public Primitive { public: bool Value() const; - V8_INLINE(static Handle New(bool value)); + V8_INLINE static Handle New(bool value); }; @@ -1521,7 +1518,7 @@ class V8_EXPORT String : public Primitive { /** * This function is no longer useful. */ - V8_DEPRECATED(V8_INLINE(bool MayContainNonAscii()) const) { return true; } + V8_DEPRECATED(V8_INLINE bool MayContainNonAscii() const) { return true; } /** * Returns whether this string is known to contain only one byte data. @@ -1593,7 +1590,7 @@ class V8_EXPORT String : public Primitive { * A zero length string. */ static v8::Local Empty(); - V8_INLINE(static v8::Local Empty(Isolate* isolate)); + V8_INLINE static v8::Local Empty(Isolate* isolate); /** * Returns true if the string is external @@ -1691,14 +1688,14 @@ class V8_EXPORT String : public Primitive { * regardless of the encoding, otherwise return NULL. The encoding of the * string is returned in encoding_out. */ - V8_INLINE(ExternalStringResourceBase* GetExternalStringResourceBase( - Encoding* encoding_out) const); + V8_INLINE ExternalStringResourceBase* GetExternalStringResourceBase( + Encoding* encoding_out) const; /** * Get the ExternalStringResource for an external string. Returns * NULL if IsExternal() doesn't return true. */ - V8_INLINE(ExternalStringResource* GetExternalStringResource() const); + V8_INLINE ExternalStringResource* GetExternalStringResource() const; /** * Get the ExternalAsciiStringResource for an external ASCII string. @@ -1706,7 +1703,7 @@ class V8_EXPORT String : public Primitive { */ const ExternalAsciiStringResource* GetExternalAsciiStringResource() const; - V8_INLINE(static String* Cast(v8::Value* obj)); + V8_INLINE static String* Cast(v8::Value* obj); // TODO(dcarney): deprecate /** @@ -1714,18 +1711,18 @@ class V8_EXPORT String : public Primitive { * The second parameter 'length' gives the buffer length. If omitted, * the function calls 'strlen' to determine the buffer length. */ - V8_INLINE(static Local New(const char* data, int length = -1)); + V8_INLINE static Local New(const char* data, int length = -1); // TODO(dcarney): deprecate /** Allocates a new string from 16-bit character codes.*/ - V8_INLINE(static Local New(const uint16_t* data, int length = -1)); + V8_INLINE static Local New(const uint16_t* data, int length = -1); // TODO(dcarney): deprecate /** * Creates an internalized string (historically called a "symbol", * not to be confused with ES6 symbols). Returns one if it exists already. */ - V8_INLINE(static Local NewSymbol(const char* data, int length = -1)); + V8_INLINE static Local NewSymbol(const char* data, int length = -1); enum NewStringType { kNormalString, kInternalizedString, kUndetectableString @@ -1806,13 +1803,13 @@ class V8_EXPORT String : public Primitive { // TODO(dcarney): deprecate /** Creates an undetectable string from the supplied ASCII or UTF-8 data.*/ - V8_INLINE( - static Local NewUndetectable(const char* data, int length = -1)); + V8_INLINE static Local NewUndetectable(const char* data, + int length = -1); // TODO(dcarney): deprecate /** Creates an undetectable string from the supplied 16-bit character codes.*/ - V8_INLINE(static Local NewUndetectable( - const uint16_t* data, int length = -1)); + V8_INLINE static Local NewUndetectable(const uint16_t* data, + int length = -1); /** * Converts an object to a UTF-8-encoded character array. Useful if @@ -1907,7 +1904,7 @@ class V8_EXPORT Symbol : public Primitive { // Create a symbol with a print name. static Local New(Isolate *isolate, const char* data, int length = -1); - V8_INLINE(static Symbol* Cast(v8::Value* obj)); + V8_INLINE static Symbol* Cast(v8::Value* obj); private: Symbol(); static void CheckCast(v8::Value* obj); @@ -1922,7 +1919,7 @@ class V8_EXPORT Number : public Primitive { double Value() const; static Local New(double value); static Local New(Isolate* isolate, double value); - V8_INLINE(static Number* Cast(v8::Value* obj)); + V8_INLINE static Number* Cast(v8::Value* obj); private: Number(); static void CheckCast(v8::Value* obj); @@ -1939,7 +1936,7 @@ class V8_EXPORT Integer : public Number { static Local New(int32_t value, Isolate*); static Local NewFromUnsigned(uint32_t value, Isolate*); int64_t Value() const; - V8_INLINE(static Integer* Cast(v8::Value* obj)); + V8_INLINE static Integer* Cast(v8::Value* obj); private: Integer(); static void CheckCast(v8::Value* obj); @@ -2140,7 +2137,7 @@ class V8_EXPORT Object : public Value { int InternalFieldCount(); /** Gets the value from an internal field. */ - V8_INLINE(Local GetInternalField(int index)); + V8_INLINE Local GetInternalField(int index); /** Sets the value in an internal field. */ void SetInternalField(int index, Handle value); @@ -2150,7 +2147,7 @@ class V8_EXPORT Object : public Value { * must have been set by SetAlignedPointerInInternalField, everything else * leads to undefined behavior. */ - V8_INLINE(void* GetAlignedPointerFromInternalField(int index)); + V8_INLINE void* GetAlignedPointerFromInternalField(int index); /** * Sets a 2-byte-aligned native pointer in an internal field. To retrieve such @@ -2280,7 +2277,7 @@ class V8_EXPORT Object : public Value { Local CallAsConstructor(int argc, Handle argv[]); static Local New(); - V8_INLINE(static Object* Cast(Value* obj)); + V8_INLINE static Object* Cast(Value* obj); private: Object(); @@ -2309,7 +2306,7 @@ class V8_EXPORT Array : public Object { */ static Local New(int length = 0); - V8_INLINE(static Array* Cast(Value* obj)); + V8_INLINE static Array* Cast(Value* obj); private: Array(); static void CheckCast(Value* obj); @@ -2319,31 +2316,31 @@ class V8_EXPORT Array : public Object { template class ReturnValue { public: - template V8_INLINE(ReturnValue(const ReturnValue& that)) + template V8_INLINE ReturnValue(const ReturnValue& that) : value_(that.value_) { TYPE_CHECK(T, S); } // Handle setters - template V8_INLINE(void Set(const Persistent& handle)); - template V8_INLINE(void Set(const Handle handle)); + template V8_INLINE void Set(const Persistent& handle); + template V8_INLINE void Set(const Handle handle); // Fast primitive setters - V8_INLINE(void Set(bool value)); - V8_INLINE(void Set(double i)); - V8_INLINE(void Set(int32_t i)); - V8_INLINE(void Set(uint32_t i)); + V8_INLINE void Set(bool value); + V8_INLINE void Set(double i); + V8_INLINE void Set(int32_t i); + V8_INLINE void Set(uint32_t i); // Fast JS primitive setters - V8_INLINE(void SetNull()); - V8_INLINE(void SetUndefined()); - V8_INLINE(void SetEmptyString()); + V8_INLINE void SetNull(); + V8_INLINE void SetUndefined(); + V8_INLINE void SetEmptyString(); // Convenience getter for Isolate - V8_INLINE(Isolate* GetIsolate()); + V8_INLINE Isolate* GetIsolate(); private: template friend class ReturnValue; template friend class FunctionCallbackInfo; template friend class PropertyCallbackInfo; - V8_INLINE(internal::Object* GetDefaultValue()); - V8_INLINE(explicit ReturnValue(internal::Object** slot)); + V8_INLINE internal::Object* GetDefaultValue(); + V8_INLINE explicit ReturnValue(internal::Object** slot); internal::Object** value_; }; @@ -2357,15 +2354,15 @@ class ReturnValue { template class FunctionCallbackInfo { public: - V8_INLINE(int Length() const); - V8_INLINE(Local operator[](int i) const); - V8_INLINE(Local Callee() const); - V8_INLINE(Local This() const); - V8_INLINE(Local Holder() const); - V8_INLINE(bool IsConstructCall() const); - V8_INLINE(Local Data() const); - V8_INLINE(Isolate* GetIsolate() const); - V8_INLINE(ReturnValue GetReturnValue() const); + V8_INLINE int Length() const; + V8_INLINE Local operator[](int i) const; + V8_INLINE Local Callee() const; + V8_INLINE Local This() const; + V8_INLINE Local Holder() const; + V8_INLINE bool IsConstructCall() const; + V8_INLINE Local Data() const; + V8_INLINE Isolate* GetIsolate() const; + V8_INLINE ReturnValue GetReturnValue() const; // This shouldn't be public, but the arm compiler needs it. static const int kArgsLength = 6; @@ -2379,10 +2376,10 @@ class FunctionCallbackInfo { static const int kCalleeIndex = -4; static const int kHolderIndex = -5; - V8_INLINE(FunctionCallbackInfo(internal::Object** implicit_args, + V8_INLINE FunctionCallbackInfo(internal::Object** implicit_args, internal::Object** values, int length, - bool is_construct_call)); + bool is_construct_call); internal::Object** implicit_args_; internal::Object** values_; int length_; @@ -2397,11 +2394,11 @@ class FunctionCallbackInfo { template class PropertyCallbackInfo { public: - V8_INLINE(Isolate* GetIsolate() const); - V8_INLINE(Local Data() const); - V8_INLINE(Local This() const); - V8_INLINE(Local Holder() const); - V8_INLINE(ReturnValue GetReturnValue() const); + V8_INLINE Isolate* GetIsolate() const; + V8_INLINE Local Data() const; + V8_INLINE Local This() const; + V8_INLINE Local Holder() const; + V8_INLINE ReturnValue GetReturnValue() const; // This shouldn't be public, but the arm compiler needs it. static const int kArgsLength = 6; @@ -2416,8 +2413,7 @@ class PropertyCallbackInfo { static const int kReturnValueDefaultValueIndex = -4; static const int kIsolateIndex = -5; - V8_INLINE(PropertyCallbackInfo(internal::Object** args)) - : args_(args) { } + V8_INLINE PropertyCallbackInfo(internal::Object** args) : args_(args) {} internal::Object** args_; }; @@ -2476,7 +2472,7 @@ class V8_EXPORT Function : public Object { int ScriptId() const; ScriptOrigin GetScriptOrigin() const; - V8_INLINE(static Function* Cast(Value* obj)); + V8_INLINE static Function* Cast(Value* obj); static const int kLineOffsetNotFound; private: @@ -2610,7 +2606,7 @@ class V8_EXPORT ArrayBuffer : public Object { */ Contents Externalize(); - V8_INLINE(static ArrayBuffer* Cast(Value* obj)); + V8_INLINE static ArrayBuffer* Cast(Value* obj); static const int kInternalFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT; @@ -2651,7 +2647,7 @@ class V8_EXPORT ArrayBufferView : public Object { */ void* BaseAddress(); - V8_INLINE(static ArrayBufferView* Cast(Value* obj)); + V8_INLINE static ArrayBufferView* Cast(Value* obj); static const int kInternalFieldCount = V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT; @@ -2675,7 +2671,7 @@ class V8_EXPORT TypedArray : public ArrayBufferView { */ size_t Length(); - V8_INLINE(static TypedArray* Cast(Value* obj)); + V8_INLINE static TypedArray* Cast(Value* obj); private: TypedArray(); @@ -2691,7 +2687,7 @@ class V8_EXPORT Uint8Array : public TypedArray { public: static Local New(Handle array_buffer, size_t byte_offset, size_t length); - V8_INLINE(static Uint8Array* Cast(Value* obj)); + V8_INLINE static Uint8Array* Cast(Value* obj); private: Uint8Array(); @@ -2707,7 +2703,7 @@ class V8_EXPORT Uint8ClampedArray : public TypedArray { public: static Local New(Handle array_buffer, size_t byte_offset, size_t length); - V8_INLINE(static Uint8ClampedArray* Cast(Value* obj)); + V8_INLINE static Uint8ClampedArray* Cast(Value* obj); private: Uint8ClampedArray(); @@ -2722,7 +2718,7 @@ class V8_EXPORT Int8Array : public TypedArray { public: static Local New(Handle array_buffer, size_t byte_offset, size_t length); - V8_INLINE(static Int8Array* Cast(Value* obj)); + V8_INLINE static Int8Array* Cast(Value* obj); private: Int8Array(); @@ -2738,7 +2734,7 @@ class V8_EXPORT Uint16Array : public TypedArray { public: static Local New(Handle array_buffer, size_t byte_offset, size_t length); - V8_INLINE(static Uint16Array* Cast(Value* obj)); + V8_INLINE static Uint16Array* Cast(Value* obj); private: Uint16Array(); @@ -2754,7 +2750,7 @@ class V8_EXPORT Int16Array : public TypedArray { public: static Local New(Handle array_buffer, size_t byte_offset, size_t length); - V8_INLINE(static Int16Array* Cast(Value* obj)); + V8_INLINE static Int16Array* Cast(Value* obj); private: Int16Array(); @@ -2770,7 +2766,7 @@ class V8_EXPORT Uint32Array : public TypedArray { public: static Local New(Handle array_buffer, size_t byte_offset, size_t length); - V8_INLINE(static Uint32Array* Cast(Value* obj)); + V8_INLINE static Uint32Array* Cast(Value* obj); private: Uint32Array(); @@ -2786,7 +2782,7 @@ class V8_EXPORT Int32Array : public TypedArray { public: static Local New(Handle array_buffer, size_t byte_offset, size_t length); - V8_INLINE(static Int32Array* Cast(Value* obj)); + V8_INLINE static Int32Array* Cast(Value* obj); private: Int32Array(); @@ -2802,7 +2798,7 @@ class V8_EXPORT Float32Array : public TypedArray { public: static Local New(Handle array_buffer, size_t byte_offset, size_t length); - V8_INLINE(static Float32Array* Cast(Value* obj)); + V8_INLINE static Float32Array* Cast(Value* obj); private: Float32Array(); @@ -2818,7 +2814,7 @@ class V8_EXPORT Float64Array : public TypedArray { public: static Local New(Handle array_buffer, size_t byte_offset, size_t length); - V8_INLINE(static Float64Array* Cast(Value* obj)); + V8_INLINE static Float64Array* Cast(Value* obj); private: Float64Array(); @@ -2834,7 +2830,7 @@ class V8_EXPORT DataView : public ArrayBufferView { public: static Local New(Handle array_buffer, size_t byte_offset, size_t length); - V8_INLINE(static DataView* Cast(Value* obj)); + V8_INLINE static DataView* Cast(Value* obj); private: DataView(); @@ -2859,7 +2855,7 @@ class V8_EXPORT Date : public Object { */ double ValueOf() const; - V8_INLINE(static Date* Cast(v8::Value* obj)); + V8_INLINE static Date* Cast(v8::Value* obj); /** * Notification that the embedder has changed the time zone, @@ -2896,7 +2892,7 @@ class V8_EXPORT NumberObject : public Object { */ double ValueOf() const; - V8_INLINE(static NumberObject* Cast(v8::Value* obj)); + V8_INLINE static NumberObject* Cast(v8::Value* obj); private: static void CheckCast(v8::Value* obj); @@ -2919,7 +2915,7 @@ class V8_EXPORT BooleanObject : public Object { */ bool ValueOf() const; - V8_INLINE(static BooleanObject* Cast(v8::Value* obj)); + V8_INLINE static BooleanObject* Cast(v8::Value* obj); private: static void CheckCast(v8::Value* obj); @@ -2942,7 +2938,7 @@ class V8_EXPORT StringObject : public Object { */ Local ValueOf() const; - V8_INLINE(static StringObject* Cast(v8::Value* obj)); + V8_INLINE static StringObject* Cast(v8::Value* obj); private: static void CheckCast(v8::Value* obj); @@ -2967,7 +2963,7 @@ class V8_EXPORT SymbolObject : public Object { */ Local ValueOf() const; - V8_INLINE(static SymbolObject* Cast(v8::Value* obj)); + V8_INLINE static SymbolObject* Cast(v8::Value* obj); private: static void CheckCast(v8::Value* obj); @@ -3013,7 +3009,7 @@ class V8_EXPORT RegExp : public Object { */ Flags GetFlags() const; - V8_INLINE(static RegExp* Cast(v8::Value* obj)); + V8_INLINE static RegExp* Cast(v8::Value* obj); private: static void CheckCast(v8::Value* obj); @@ -3027,7 +3023,7 @@ class V8_EXPORT RegExp : public Object { class V8_EXPORT External : public Value { public: static Local New(void* value); - V8_INLINE(static External* Cast(Value* obj)); + V8_INLINE static External* Cast(Value* obj); void* Value() const; private: static void CheckCast(v8::Value* obj); @@ -3045,7 +3041,7 @@ class V8_EXPORT Template : public Data { /** Adds a property to each instance created by this template.*/ void Set(Handle name, Handle value, PropertyAttribute attributes = None); - V8_INLINE(void Set(const char* name, Handle value)); + V8_INLINE void Set(const char* name, Handle value); void SetAccessorProperty( Local name, @@ -3722,7 +3718,7 @@ void V8_EXPORT RegisterExtension(Extension* extension); */ class V8_EXPORT DeclareExtension { public: - V8_INLINE(DeclareExtension(Extension* extension)) { + V8_INLINE DeclareExtension(Extension* extension) { RegisterExtension(extension); } }; @@ -3736,10 +3732,10 @@ Handle V8_EXPORT Null(); Handle V8_EXPORT True(); Handle V8_EXPORT False(); -V8_INLINE(Handle Undefined(Isolate* isolate)); -V8_INLINE(Handle Null(Isolate* isolate)); -V8_INLINE(Handle True(Isolate* isolate)); -V8_INLINE(Handle False(Isolate* isolate)); +V8_INLINE Handle Undefined(Isolate* isolate); +V8_INLINE Handle Null(Isolate* isolate); +V8_INLINE Handle True(Isolate* isolate); +V8_INLINE Handle False(Isolate* isolate); /** @@ -3997,13 +3993,13 @@ class V8_EXPORT Isolate { /** * Associate embedder-specific data with the isolate */ - V8_INLINE(void SetData(void* data)); + V8_INLINE void SetData(void* data); /** * Retrieve embedder-specific data from the isolate. * Returns NULL if SetData has never been called. */ - V8_INLINE(void* GetData()); + V8_INLINE void* GetData(); /** * Get statistics about the heap memory usage. @@ -4275,7 +4271,7 @@ class V8_EXPORT PersistentHandleVisitor { // NOLINT class V8_EXPORT AssertNoGCScope { #ifndef DEBUG // TODO(yangguo): remove isolate argument. - V8_INLINE(AssertNoGCScope(Isolate* isolate)) { } + V8_INLINE AssertNoGCScope(Isolate* isolate) {} #else AssertNoGCScope(Isolate* isolate); ~AssertNoGCScope(); @@ -4978,7 +4974,7 @@ class V8_EXPORT Context { * previous call to SetEmbedderData with the same index. Note that index 0 * currently has a special meaning for Chrome's debugger. */ - V8_INLINE(Local GetEmbedderData(int index)); + V8_INLINE Local GetEmbedderData(int index); /** * Sets the embedder data with the given index, growing the data as @@ -4993,7 +4989,7 @@ class V8_EXPORT Context { * SetAlignedPointerInEmbedderData with the same index. Note that index 0 * currently has a special meaning for Chrome's debugger. */ - V8_INLINE(void* GetAlignedPointerFromEmbedderData(int index)); + V8_INLINE void* GetAlignedPointerFromEmbedderData(int index); /** * Sets a 2-byte-aligned native pointer in the embedder data with the given @@ -5036,15 +5032,15 @@ class V8_EXPORT Context { */ class Scope { public: - explicit V8_INLINE(Scope(Handle context)) : context_(context) { + explicit V8_INLINE Scope(Handle context) : context_(context) { context_->Enter(); } // TODO(dcarney): deprecate - V8_INLINE(Scope(Isolate* isolate, Persistent& context)) // NOLINT + V8_INLINE Scope(Isolate* isolate, Persistent& context) // NOLINT : context_(Handle::New(isolate, context)) { context_->Enter(); } - V8_INLINE(~Scope()) { context_->Exit(); } + V8_INLINE ~Scope() { context_->Exit(); } private: Handle context_; @@ -5142,7 +5138,7 @@ class V8_EXPORT Unlocker { /** * Initialize Unlocker for a given Isolate. */ - V8_INLINE(explicit Unlocker(Isolate* isolate)) { Initialize(isolate); } + V8_INLINE explicit Unlocker(Isolate* isolate) { Initialize(isolate); } /** Deprecated. Use Isolate version instead. */ V8_DEPRECATED(Unlocker()); @@ -5160,7 +5156,7 @@ class V8_EXPORT Locker { /** * Initialize Locker for a given Isolate. */ - V8_INLINE(explicit Locker(Isolate* isolate)) { Initialize(isolate); } + V8_INLINE explicit Locker(Isolate* isolate) { Initialize(isolate); } /** Deprecated. Use Isolate version instead. */ V8_DEPRECATED(Locker()); @@ -5289,7 +5285,7 @@ const intptr_t kSmiTagMask = (1 << kSmiTagSize) - 1; template struct SmiTagging; template -V8_INLINE(internal::Object* IntToSmi(int value)) { +V8_INLINE internal::Object* IntToSmi(int value) { int smi_shift_bits = kSmiTagSize + kSmiShiftSize; intptr_t tagged_value = (static_cast(value) << smi_shift_bits) | kSmiTag; @@ -5300,15 +5296,15 @@ V8_INLINE(internal::Object* IntToSmi(int value)) { template <> struct SmiTagging<4> { static const int kSmiShiftSize = 0; static const int kSmiValueSize = 31; - V8_INLINE(static int SmiToInt(internal::Object* value)) { + V8_INLINE static int SmiToInt(internal::Object* value) { int shift_bits = kSmiTagSize + kSmiShiftSize; // Throw away top 32 bits and shift down (requires >> to be sign extending). return static_cast(reinterpret_cast(value)) >> shift_bits; } - V8_INLINE(static internal::Object* IntToSmi(int value)) { + V8_INLINE static internal::Object* IntToSmi(int value) { return internal::IntToSmi(value); } - V8_INLINE(static bool IsValidSmi(intptr_t value)) { + V8_INLINE static bool IsValidSmi(intptr_t value) { // To be representable as an tagged small integer, the two // most-significant bits of 'value' must be either 00 or 11 due to // sign-extension. To check this we add 01 to the two @@ -5328,15 +5324,15 @@ template <> struct SmiTagging<4> { template <> struct SmiTagging<8> { static const int kSmiShiftSize = 31; static const int kSmiValueSize = 32; - V8_INLINE(static int SmiToInt(internal::Object* value)) { + V8_INLINE static int SmiToInt(internal::Object* value) { int shift_bits = kSmiTagSize + kSmiShiftSize; // Shift down and throw away top 32 bits. return static_cast(reinterpret_cast(value) >> shift_bits); } - V8_INLINE(static internal::Object* IntToSmi(int value)) { + V8_INLINE static internal::Object* IntToSmi(int value) { return internal::IntToSmi(value); } - V8_INLINE(static bool IsValidSmi(intptr_t value)) { + V8_INLINE static bool IsValidSmi(intptr_t value) { // To be representable as a long smi, the value must be a 32-bit integer. return (value == static_cast(value)); } @@ -5345,8 +5341,8 @@ template <> struct SmiTagging<8> { typedef SmiTagging PlatformSmiTagging; const int kSmiShiftSize = PlatformSmiTagging::kSmiShiftSize; const int kSmiValueSize = PlatformSmiTagging::kSmiValueSize; -V8_INLINE(static bool SmiValuesAre31Bits()) { return kSmiValueSize == 31; } -V8_INLINE(static bool SmiValuesAre32Bits()) { return kSmiValueSize == 32; } +V8_INLINE static bool SmiValuesAre31Bits() { return kSmiValueSize == 31; } +V8_INLINE static bool SmiValuesAre32Bits() { return kSmiValueSize == 32; } /** * This class exports constants and functionality from within v8 that @@ -5398,94 +5394,93 @@ class Internals { static const int kNullOddballKind = 3; static void CheckInitializedImpl(v8::Isolate* isolate); - V8_INLINE(static void CheckInitialized(v8::Isolate* isolate)) { + V8_INLINE static void CheckInitialized(v8::Isolate* isolate) { #ifdef V8_ENABLE_CHECKS CheckInitializedImpl(isolate); #endif } - V8_INLINE(static bool HasHeapObjectTag(internal::Object* value)) { + V8_INLINE static bool HasHeapObjectTag(internal::Object* value) { return ((reinterpret_cast(value) & kHeapObjectTagMask) == kHeapObjectTag); } - V8_INLINE(static int SmiValue(internal::Object* value)) { + V8_INLINE static int SmiValue(internal::Object* value) { return PlatformSmiTagging::SmiToInt(value); } - V8_INLINE(static internal::Object* IntToSmi(int value)) { + V8_INLINE static internal::Object* IntToSmi(int value) { return PlatformSmiTagging::IntToSmi(value); } - V8_INLINE(static bool IsValidSmi(intptr_t value)) { + V8_INLINE static bool IsValidSmi(intptr_t value) { return PlatformSmiTagging::IsValidSmi(value); } - V8_INLINE(static int GetInstanceType(internal::Object* obj)) { + V8_INLINE static int GetInstanceType(internal::Object* obj) { typedef internal::Object O; O* map = ReadField(obj, kHeapObjectMapOffset); return ReadField(map, kMapInstanceTypeOffset); } - V8_INLINE(static int GetOddballKind(internal::Object* obj)) { + V8_INLINE static int GetOddballKind(internal::Object* obj) { typedef internal::Object O; return SmiValue(ReadField(obj, kOddballKindOffset)); } - V8_INLINE(static bool IsExternalTwoByteString(int instance_type)) { + V8_INLINE static bool IsExternalTwoByteString(int instance_type) { int representation = (instance_type & kFullStringRepresentationMask); return representation == kExternalTwoByteRepresentationTag; } - V8_INLINE(static uint8_t GetNodeFlag(internal::Object** obj, int shift)) { + V8_INLINE static uint8_t GetNodeFlag(internal::Object** obj, int shift) { uint8_t* addr = reinterpret_cast(obj) + kNodeFlagsOffset; return *addr & static_cast(1U << shift); } - V8_INLINE(static void UpdateNodeFlag(internal::Object** obj, - bool value, int shift)) { + V8_INLINE static void UpdateNodeFlag(internal::Object** obj, + bool value, int shift) { uint8_t* addr = reinterpret_cast(obj) + kNodeFlagsOffset; uint8_t mask = static_cast(1 << shift); *addr = static_cast((*addr & ~mask) | (value << shift)); } - V8_INLINE(static uint8_t GetNodeState(internal::Object** obj)) { + V8_INLINE static uint8_t GetNodeState(internal::Object** obj) { uint8_t* addr = reinterpret_cast(obj) + kNodeFlagsOffset; return *addr & kNodeStateMask; } - V8_INLINE(static void UpdateNodeState(internal::Object** obj, - uint8_t value)) { + V8_INLINE static void UpdateNodeState(internal::Object** obj, + uint8_t value) { uint8_t* addr = reinterpret_cast(obj) + kNodeFlagsOffset; *addr = static_cast((*addr & ~kNodeStateMask) | value); } - V8_INLINE(static void SetEmbedderData(v8::Isolate* isolate, void* data)) { + V8_INLINE static void SetEmbedderData(v8::Isolate* isolate, void* data) { uint8_t* addr = reinterpret_cast(isolate) + kIsolateEmbedderDataOffset; *reinterpret_cast(addr) = data; } - V8_INLINE(static void* GetEmbedderData(v8::Isolate* isolate)) { + V8_INLINE static void* GetEmbedderData(v8::Isolate* isolate) { uint8_t* addr = reinterpret_cast(isolate) + kIsolateEmbedderDataOffset; return *reinterpret_cast(addr); } - V8_INLINE(static internal::Object** GetRoot(v8::Isolate* isolate, - int index)) { + V8_INLINE static internal::Object** GetRoot(v8::Isolate* isolate, + int index) { uint8_t* addr = reinterpret_cast(isolate) + kIsolateRootsOffset; return reinterpret_cast(addr + index * kApiPointerSize); } - template - V8_INLINE(static T ReadField(Object* ptr, int offset)) { + template V8_INLINE static T ReadField(Object* ptr, int offset) { uint8_t* addr = reinterpret_cast(ptr) + offset - kHeapObjectTag; return *reinterpret_cast(addr); } template - V8_INLINE(static T ReadEmbedderData(Context* context, int index)) { + V8_INLINE static T ReadEmbedderData(Context* context, int index) { typedef internal::Object O; typedef internal::Internals I; O* ctx = *reinterpret_cast(context); @@ -5497,13 +5492,13 @@ class Internals { return I::ReadField(embedder_data, value_offset); } - V8_INLINE(static bool CanCastToHeapObject(void* o)) { return false; } - V8_INLINE(static bool CanCastToHeapObject(Context* o)) { return true; } - V8_INLINE(static bool CanCastToHeapObject(String* o)) { return true; } - V8_INLINE(static bool CanCastToHeapObject(Object* o)) { return true; } - V8_INLINE(static bool CanCastToHeapObject(Message* o)) { return true; } - V8_INLINE(static bool CanCastToHeapObject(StackTrace* o)) { return true; } - V8_INLINE(static bool CanCastToHeapObject(StackFrame* o)) { return true; } + V8_INLINE static bool CanCastToHeapObject(void* o) { return false; } + V8_INLINE static bool CanCastToHeapObject(Context* o) { return true; } + V8_INLINE static bool CanCastToHeapObject(String* o) { return true; } + V8_INLINE static bool CanCastToHeapObject(Object* o) { return true; } + V8_INLINE static bool CanCastToHeapObject(Message* o) { return true; } + V8_INLINE static bool CanCastToHeapObject(StackTrace* o) { return true; } + V8_INLINE static bool CanCastToHeapObject(StackFrame* o) { return true; } }; } // namespace internal diff --git a/include/v8config.h b/include/v8config.h index 2dfbcfa..cfafc6f 100644 --- a/include/v8config.h +++ b/include/v8config.h @@ -298,23 +298,27 @@ // Helper macros // A macro used to make better inlining. Don't bother for debug builds. +// Use like: +// V8_INLINE int GetZero() { return 0; } #if !defined(DEBUG) && V8_HAS_ATTRIBUTE_ALWAYS_INLINE -# define V8_INLINE(declarator) inline __attribute__((always_inline)) declarator +# define V8_INLINE inline __attribute__((always_inline)) #elif !defined(DEBUG) && V8_HAS___FORCEINLINE -# define V8_INLINE(declarator) __forceinline declarator +# define V8_INLINE __forceinline #else -# define V8_INLINE(declarator) inline declarator +# define V8_INLINE inline #endif // A macro used to tell the compiler to never inline a particular function. // Don't bother for debug builds. +// Use like: +// V8_NOINLINE int GetMinusOne() { return -1; } #if !defined(DEBUG) && V8_HAS_ATTRIBUTE_NOINLINE -# define V8_NOINLINE(declarator) __attribute__((noinline)) declarator +# define V8_NOINLINE __attribute__((noinline)) #elif !defined(DEBUG) && V8_HAS_DECLSPEC_NOINLINE -# define V8_NOINLINE(declarator) __declspec(noinline) declarator +# define V8_NOINLINE __declspec(noinline) #else -# define V8_NOINLINE(declarator) declarator +# define V8_NOINLINE /* NOT SUPPORTED */ #endif diff --git a/src/cpu.cc b/src/cpu.cc index 26eca61..2bf51a7 100644 --- a/src/cpu.cc +++ b/src/cpu.cc @@ -54,7 +54,7 @@ namespace internal { // Define __cpuid() for non-MSVC compilers. #if !V8_CC_MSVC -static V8_INLINE(void __cpuid(int cpu_info[4], int info_type)) { +static V8_INLINE void __cpuid(int cpu_info[4], int info_type) { #if defined(__i386__) && defined(__pic__) // Make sure to preserve ebx, which contains the pointer // to the GOT in case we're generating PIC. diff --git a/src/globals.h b/src/globals.h index 992f3a8..1977e68 100644 --- a/src/globals.h +++ b/src/globals.h @@ -342,9 +342,9 @@ F FUNCTION_CAST(Address addr) { DISALLOW_COPY_AND_ASSIGN(TypeName) -// Newly written code should use V8_INLINE() and V8_NOINLINE() directly. -#define INLINE(declarator) V8_INLINE(declarator) -#define NO_INLINE(declarator) V8_NOINLINE(declarator) +// Newly written code should use V8_INLINE and V8_NOINLINE directly. +#define INLINE(declarator) V8_INLINE declarator +#define NO_INLINE(declarator) V8_NOINLINE declarator // Newly written code should use V8_WARN_UNUSED_RESULT. diff --git a/src/platform/elapsed-timer.h b/src/platform/elapsed-timer.h index 8044bd0..2311db2 100644 --- a/src/platform/elapsed-timer.h +++ b/src/platform/elapsed-timer.h @@ -103,7 +103,7 @@ class ElapsedTimer V8_FINAL BASE_EMBEDDED { } private: - V8_INLINE(static TimeTicks Now()) { + static V8_INLINE TimeTicks Now() { TimeTicks now = TimeTicks::HighResNow(); ASSERT(!now.IsNull()); return now; diff --git a/src/platform/mutex.cc b/src/platform/mutex.cc index 1a7c69a..ad97740 100644 --- a/src/platform/mutex.cc +++ b/src/platform/mutex.cc @@ -34,7 +34,7 @@ namespace internal { #if V8_OS_POSIX -static V8_INLINE(void InitializeNativeHandle(pthread_mutex_t* mutex)) { +static V8_INLINE void InitializeNativeHandle(pthread_mutex_t* mutex) { int result; #if defined(DEBUG) // Use an error checking mutex in debug mode. @@ -55,7 +55,7 @@ static V8_INLINE(void InitializeNativeHandle(pthread_mutex_t* mutex)) { } -static V8_INLINE(void InitializeRecursiveNativeHandle(pthread_mutex_t* mutex)) { +static V8_INLINE void InitializeRecursiveNativeHandle(pthread_mutex_t* mutex) { pthread_mutexattr_t attr; int result = pthread_mutexattr_init(&attr); ASSERT_EQ(0, result); @@ -69,28 +69,28 @@ static V8_INLINE(void InitializeRecursiveNativeHandle(pthread_mutex_t* mutex)) { } -static V8_INLINE(void DestroyNativeHandle(pthread_mutex_t* mutex)) { +static V8_INLINE void DestroyNativeHandle(pthread_mutex_t* mutex) { int result = pthread_mutex_destroy(mutex); ASSERT_EQ(0, result); USE(result); } -static V8_INLINE(void LockNativeHandle(pthread_mutex_t* mutex)) { +static V8_INLINE void LockNativeHandle(pthread_mutex_t* mutex) { int result = pthread_mutex_lock(mutex); ASSERT_EQ(0, result); USE(result); } -static V8_INLINE(void UnlockNativeHandle(pthread_mutex_t* mutex)) { +static V8_INLINE void UnlockNativeHandle(pthread_mutex_t* mutex) { int result = pthread_mutex_unlock(mutex); ASSERT_EQ(0, result); USE(result); } -static V8_INLINE(bool TryLockNativeHandle(pthread_mutex_t* mutex)) { +static V8_INLINE bool TryLockNativeHandle(pthread_mutex_t* mutex) { int result = pthread_mutex_trylock(mutex); if (result == EBUSY) { return false; @@ -101,32 +101,32 @@ static V8_INLINE(bool TryLockNativeHandle(pthread_mutex_t* mutex)) { #elif V8_OS_WIN -static V8_INLINE(void InitializeNativeHandle(PCRITICAL_SECTION cs)) { +static V8_INLINE void InitializeNativeHandle(PCRITICAL_SECTION cs) { InitializeCriticalSection(cs); } -static V8_INLINE(void InitializeRecursiveNativeHandle(PCRITICAL_SECTION cs)) { +static V8_INLINE void InitializeRecursiveNativeHandle(PCRITICAL_SECTION cs) { InitializeCriticalSection(cs); } -static V8_INLINE(void DestroyNativeHandle(PCRITICAL_SECTION cs)) { +static V8_INLINE void DestroyNativeHandle(PCRITICAL_SECTION cs) { DeleteCriticalSection(cs); } -static V8_INLINE(void LockNativeHandle(PCRITICAL_SECTION cs)) { +static V8_INLINE void LockNativeHandle(PCRITICAL_SECTION cs) { EnterCriticalSection(cs); } -static V8_INLINE(void UnlockNativeHandle(PCRITICAL_SECTION cs)) { +static V8_INLINE void UnlockNativeHandle(PCRITICAL_SECTION cs) { LeaveCriticalSection(cs); } -static V8_INLINE(bool TryLockNativeHandle(PCRITICAL_SECTION cs)) { +static V8_INLINE bool TryLockNativeHandle(PCRITICAL_SECTION cs) { return TryEnterCriticalSection(cs); } diff --git a/src/platform/mutex.h b/src/platform/mutex.h index f08de4f..0f899ca 100644 --- a/src/platform/mutex.h +++ b/src/platform/mutex.h @@ -94,14 +94,14 @@ class Mutex V8_FINAL { int level_; #endif - V8_INLINE(void AssertHeldAndUnmark()) { + V8_INLINE void AssertHeldAndUnmark() { #ifdef DEBUG ASSERT_EQ(1, level_); level_--; #endif } - V8_INLINE(void AssertUnheldAndMark()) { + V8_INLINE void AssertUnheldAndMark() { #ifdef DEBUG ASSERT_EQ(0, level_); level_++; diff --git a/src/platform/socket.h b/src/platform/socket.h index e9e2fa2..ff8c1de 100644 --- a/src/platform/socket.h +++ b/src/platform/socket.h @@ -66,7 +66,7 @@ class Socket V8_FINAL { // Set the value of the SO_REUSEADDR socket option. bool SetReuseAddress(bool reuse_address); - V8_INLINE(bool IsValid()) const { + V8_INLINE bool IsValid() const { return native_handle_ != kInvalidNativeHandle; } diff --git a/src/platform/virtual-memory.cc b/src/platform/virtual-memory.cc index 627b31e..7e53542 100644 --- a/src/platform/virtual-memory.cc +++ b/src/platform/virtual-memory.cc @@ -54,7 +54,7 @@ namespace internal { class RandomAddressGenerator V8_FINAL { public: - V8_INLINE(uintptr_t NextAddress()) { + V8_INLINE uintptr_t NextAddress() { LockGuard lock_guard(&mutex_); uintptr_t address = rng_.NextInt(); #if V8_HOST_ARCH_64_BIT @@ -75,7 +75,7 @@ typedef LazyInstance= highest_ever_allocated_; } diff --git a/src/utils/random-number-generator.h b/src/utils/random-number-generator.h index fc14ef4..bd7dca7 100644 --- a/src/utils/random-number-generator.h +++ b/src/utils/random-number-generator.h @@ -59,7 +59,7 @@ class RandomNumberGenerator V8_FINAL { // that one int value is pseudorandomly generated and returned. // All 2^32 possible integer values are produced with (approximately) equal // probability. - V8_INLINE(int NextInt()) V8_WARN_UNUSED_RESULT { + V8_INLINE int NextInt() V8_WARN_UNUSED_RESULT { return Next(32); } @@ -76,7 +76,7 @@ class RandomNumberGenerator V8_FINAL { // |NextBoolean()| is that one boolean value is pseudorandomly generated and // returned. The values true and false are produced with (approximately) equal // probability. - V8_INLINE(bool NextBool()) V8_WARN_UNUSED_RESULT { + V8_INLINE bool NextBool() V8_WARN_UNUSED_RESULT { return Next(1) != 0; } diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc index 6e47cd6..f4e40cd 100644 --- a/test/cctest/test-api.cc +++ b/test/cctest/test-api.cc @@ -12670,8 +12670,8 @@ struct CopyablePersistentTraits { typedef Persistent > CopyablePersistent; static const bool kResetInDestructor = true; template - V8_INLINE(static void Copy(const Persistent& source, - CopyablePersistent* dest)) { + static V8_INLINE void Copy(const Persistent& source, + CopyablePersistent* dest) { // do nothing, just allow copy } };