Commit b60d340e authored by bmeurer@chromium.org's avatar bmeurer@chromium.org

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
parent b60b8c3b
This diff is collapsed.
......@@ -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
......
......@@ -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.
......
......@@ -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.
......
......@@ -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;
......
......@@ -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);
}
......
......@@ -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_++;
......
......@@ -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;
}
......
......@@ -54,7 +54,7 @@ namespace internal {
class RandomAddressGenerator V8_FINAL {
public:
V8_INLINE(uintptr_t NextAddress()) {
V8_INLINE uintptr_t NextAddress() {
LockGuard<Mutex> lock_guard(&mutex_);
uintptr_t address = rng_.NextInt();
#if V8_HOST_ARCH_64_BIT
......@@ -75,7 +75,7 @@ typedef LazyInstance<RandomAddressGenerator,
#define LAZY_RANDOM_ADDRESS_GENERATOR_INITIALIZER LAZY_INSTANCE_INITIALIZER
static V8_INLINE(void* GenerateRandomAddress()) {
static V8_INLINE void* GenerateRandomAddress() {
#if V8_OS_NACL
// TODO(bradchen): Restore randomization once Native Client gets smarter
// about using mmap address hints.
......
......@@ -193,7 +193,7 @@ class VirtualMemory V8_FINAL {
// Returns true if OS performs lazy commits, i.e. the memory allocation call
// defers actual physical memory allocation till the first memory access.
// Otherwise returns false.
static V8_INLINE(bool HasLazyCommits()) {
static V8_INLINE bool HasLazyCommits() {
#if V8_OS_LINUX
return true;
#else
......
......@@ -1092,7 +1092,7 @@ class MemoryAllocator {
// Returns an indication of whether a pointer is in a space that has
// been allocated by this MemoryAllocator.
V8_INLINE(bool IsOutsideAllocatedSpace(const void* address)) const {
V8_INLINE bool IsOutsideAllocatedSpace(const void* address) const {
return address < lowest_ever_allocated_ ||
address >= highest_ever_allocated_;
}
......
......@@ -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;
}
......
......@@ -12670,8 +12670,8 @@ struct CopyablePersistentTraits {
typedef Persistent<T, CopyablePersistentTraits<T> > CopyablePersistent;
static const bool kResetInDestructor = true;
template<class S, class M>
V8_INLINE(static void Copy(const Persistent<S, M>& source,
CopyablePersistent* dest)) {
static V8_INLINE void Copy(const Persistent<S, M>& source,
CopyablePersistent* dest) {
// do nothing, just allow copy
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment