Bug 800106: replace NS_ALWAYS_INLINE with MOZ_ALWAYS_INLINE; r=ehsan

This commit is contained in:
Jacek Szpot 2012-10-13 17:52:10 +02:00
parent 27e40a03e1
commit 06b915eb2e
9 changed files with 19 additions and 40 deletions

View File

@ -3784,13 +3784,6 @@ AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
dnl See if compiler supports some gcc-style attributes
AC_CACHE_CHECK(for __attribute__((always_inline)),
ac_cv_attribute_always_inline,
[AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
[],
ac_cv_attribute_always_inline=yes,
ac_cv_attribute_always_inline=no)])
AC_CACHE_CHECK(for __attribute__((malloc)),
ac_cv_attribute_malloc,
[AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
@ -3842,12 +3835,6 @@ dnl are defined in build/autoconf/altoptions.m4.
dnl If the compiler supports these attributes, define them as
dnl convenience macros.
if test "$ac_cv_attribute_always_inline" = yes ; then
AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
else
AC_DEFINE(NS_ALWAYS_INLINE,)
fi
if test "$ac_cv_attribute_malloc" = yes ; then
AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
else

View File

@ -36,7 +36,7 @@ static const uint8_t gASCIIToLower [128] = {
// We want ToLowerCase(uint32_t) and ToLowerCaseASCII(uint32_t) to be fast
// when they're called from within the case-insensitive comparators, so we
// define inlined versions.
static NS_ALWAYS_INLINE uint32_t
static MOZ_ALWAYS_INLINE uint32_t
ToLowerCase_inline(uint32_t aChar)
{
if (IS_ASCII(aChar)) {
@ -46,7 +46,7 @@ ToLowerCase_inline(uint32_t aChar)
return mozilla::unicode::GetLowercase(aChar);
}
static NS_ALWAYS_INLINE uint32_t
static MOZ_ALWAYS_INLINE uint32_t
ToLowerCaseASCII_inline(const uint32_t aChar)
{
if (IS_ASCII(aChar)) {
@ -271,7 +271,7 @@ CaseInsensitiveCompare(const PRUnichar *a,
// the end of the string (as marked by aEnd), returns -1 and does not set
// aNext. Note that this function doesn't check that aStr < aEnd -- it assumes
// you've done that already.
static NS_ALWAYS_INLINE uint32_t
static MOZ_ALWAYS_INLINE uint32_t
GetLowerUTF8Codepoint(const char* aStr, const char* aEnd, const char **aNext)
{
// Convert to unsigned char so that stuffing chars into PRUint32s doesn't

View File

@ -3094,13 +3094,6 @@ AC_CHECK_FUNCS(strndup posix_memalign memalign valloc)
dnl See if compiler supports some gcc-style attributes
AC_CACHE_CHECK(for __attribute__((always_inline)),
ac_cv_attribute_always_inline,
[AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
[],
ac_cv_attribute_always_inline=yes,
ac_cv_attribute_always_inline=no)])
AC_CACHE_CHECK(for __attribute__((malloc)),
ac_cv_attribute_malloc,
[AC_TRY_COMPILE([void* f(int) __attribute__((malloc));],
@ -3152,12 +3145,6 @@ dnl are defined in build/autoconf/altoptions.m4.
dnl If the compiler supports these attributes, define them as
dnl convenience macros.
if test "$ac_cv_attribute_always_inline" = yes ; then
AC_DEFINE(NS_ALWAYS_INLINE, [__attribute__((always_inline))])
else
AC_DEFINE(NS_ALWAYS_INLINE,)
fi
if test "$ac_cv_attribute_malloc" = yes ; then
AC_DEFINE(NS_ATTR_MALLOC, [__attribute__((malloc))])
else

View File

@ -58,6 +58,10 @@ To upgrade to a new revision of libjpeg-turbo, do the following:
$ hg addremove
== October 13, 2012 ==
* Modified config.h to use MOZ_ALWAYS_INLINE (bug 800106).
== July 4, 2012 (libjpeg-turbo v1.2.1 r853 2012-06-30) ==
* Updated to v1.2.1 stable release.

View File

@ -3,4 +3,5 @@
#define PACKAGE_NAME "libjpeg-turbo"
/* Need to use Mozilla-specific function inlining. */
#define INLINE NS_ALWAYS_INLINE
#include "mozilla/Attributes.h"
#define INLINE MOZ_ALWAYS_INLINE

View File

@ -39,8 +39,8 @@
#endif
#if defined(NS_ALWAYS_INLINE)
# define MOZALLOC_INLINE NS_ALWAYS_INLINE inline
#if defined(MOZ_ALWAYS_INLINE)
# define MOZALLOC_INLINE MOZ_ALWAYS_INLINE
#elif defined(HAVE_FORCEINLINE)
# define MOZALLOC_INLINE __forceinline
#else

View File

@ -65,7 +65,7 @@ public:
}
template<int N>
NS_ALWAYS_INLINE already_AddRefed<StatementType>
MOZ_ALWAYS_INLINE already_AddRefed<StatementType>
GetCachedStatement(const char (&aQuery)[N])
{
nsDependentCString query(aQuery, N - 1);

View File

@ -44,7 +44,7 @@ namespace {
* @return a pointer to the next word boundary after aStart
*/
static
NS_ALWAYS_INLINE const_char_iterator
MOZ_ALWAYS_INLINE const_char_iterator
nextWordBoundary(const_char_iterator const aStart,
const_char_iterator const aNext,
const_char_iterator const aEnd) {
@ -76,7 +76,7 @@ namespace {
* findAnywhere and findOnBoundary do almost the same thing, so it's natural
* to implement them in terms of a single function. They're both
* performance-critical functions, however, and checking aBehavior makes them
* a bit slower. Our solution is to define findInString as NS_ALWAYS_INLINE
* a bit slower. Our solution is to define findInString as MOZ_ALWAYS_INLINE
* and rely on the compiler to optimize out the aBehavior check.
*
* @param aToken
@ -91,7 +91,7 @@ namespace {
* @return true if aToken was found in aSourceString, false otherwise.
*/
static
NS_ALWAYS_INLINE bool
MOZ_ALWAYS_INLINE bool
findInString(const nsDependentCSubstring &aToken,
const nsACString &aSourceString,
FindInStringBehavior aBehavior)

View File

@ -286,7 +286,7 @@ class ConvertUTF8toUTF16
bool ErrorEncountered() const { return mErrorEncountered; }
void NS_ALWAYS_INLINE write( const value_type* start, uint32_t N )
void MOZ_ALWAYS_INLINE write( const value_type* start, uint32_t N )
{
if ( mErrorEncountered )
return;
@ -345,7 +345,7 @@ class CalculateUTF8Length
size_t Length() const { return mLength; }
void NS_ALWAYS_INLINE write( const value_type* start, uint32_t N )
void MOZ_ALWAYS_INLINE write( const value_type* start, uint32_t N )
{
// ignore any further requests
if ( mErrorEncountered )
@ -449,7 +449,7 @@ class ConvertUTF16toUTF8
size_t Size() const { return mBuffer - mStart; }
void NS_ALWAYS_INLINE write( const value_type* start, uint32_t N )
void MOZ_ALWAYS_INLINE write( const value_type* start, uint32_t N )
{
buffer_type *out = mBuffer; // gcc isn't smart enough to do this!
@ -566,7 +566,7 @@ class CalculateUTF8Size
size_t Size() const { return mSize; }
void NS_ALWAYS_INLINE write( const value_type* start, uint32_t N )
void MOZ_ALWAYS_INLINE write( const value_type* start, uint32_t N )
{
// Assume UCS2 surrogate pairs won't be spread across fragments.
for (const value_type *p = start, *end = start + N; p < end; ++p )