Bug 935370 - Inline all the Pod functions. r=waldo, a=bajaj
authorChris Peterson <cpeterson@mozilla.com>
Mon, 04 Nov 2013 18:52:51 -0800
changeset 166476 680778a8bcb33c0c4881ecbaf05f4f99fdee47e8
parent 166475 9270d191480b7e3b16a406614838f9a7e7789608
child 166477 74cf83afd3cafaf75ebb334f4d04ee5fe2a3bb87
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswaldo, bajaj
bugs935370
milestone27.0a2
Bug 935370 - Inline all the Pod functions. r=waldo, a=bajaj
mfbt/PodOperations.h
--- a/mfbt/PodOperations.h
+++ b/mfbt/PodOperations.h
@@ -19,25 +19,25 @@
 #include "mozilla/Util.h"
 
 #include <string.h>
 
 namespace mozilla {
 
 /** Set the contents of |t| to 0. */
 template<typename T>
-static void
+static MOZ_ALWAYS_INLINE void
 PodZero(T* t)
 {
   memset(t, 0, sizeof(T));
 }
 
 /** Set the contents of |nelem| elements starting at |t| to 0. */
 template<typename T>
-static void
+static MOZ_ALWAYS_INLINE void
 PodZero(T* t, size_t nelem)
 {
   /*
    * This function is often called with 'nelem' small; we use an inline loop
    * instead of calling 'memset' with a non-constant length.  The compiler
    * should inline the memset call with constant size, though.
    */
   for (T* end = t + nelem; t < end; t++)
@@ -53,42 +53,42 @@ PodZero(T* t, size_t nelem)
  */
 template<typename T, size_t N>
 static void PodZero(T (&t)[N]) MOZ_DELETE;
 template<typename T, size_t N>
 static void PodZero(T (&t)[N], size_t nelem) MOZ_DELETE;
 
 /** Set the contents of the array |t| to zero. */
 template <class T, size_t N>
-static void
+static MOZ_ALWAYS_INLINE void
 PodArrayZero(T (&t)[N])
 {
   memset(t, 0, N * sizeof(T));
 }
 
 /**
  * Assign |*src| to |*dst|.  The locations must not be the same and must not
  * overlap.
  */
 template<typename T>
-static void
+static MOZ_ALWAYS_INLINE void
 PodAssign(T* dst, const T* src)
 {
   MOZ_ASSERT(dst != src);
   MOZ_ASSERT_IF(src < dst, PointerRangeSize(src, static_cast<const T*>(dst)) >= 1);
   MOZ_ASSERT_IF(dst < src, PointerRangeSize(static_cast<const T*>(dst), src) >= 1);
   memcpy(reinterpret_cast<char*>(dst), reinterpret_cast<const char*>(src), sizeof(T));
 }
 
 /**
  * Copy |nelem| T elements from |src| to |dst|.  The two memory ranges must not
  * overlap!
  */
 template<typename T>
-MOZ_ALWAYS_INLINE static void
+static MOZ_ALWAYS_INLINE void
 PodCopy(T* dst, const T* src, size_t nelem)
 {
   MOZ_ASSERT(dst != src);
   MOZ_ASSERT_IF(src < dst, PointerRangeSize(src, static_cast<const T*>(dst)) >= nelem);
   MOZ_ASSERT_IF(dst < src, PointerRangeSize(static_cast<const T*>(dst), src) >= nelem);
 
   if (nelem < 128) {
     /*
@@ -98,17 +98,17 @@ PodCopy(T* dst, const T* src, size_t nel
     for (const T* srcend = src + nelem; src < srcend; src++, dst++)
       PodAssign(dst, src);
   } else {
     memcpy(dst, src, nelem * sizeof(T));
   }
 }
 
 template<typename T>
-MOZ_ALWAYS_INLINE static void
+static MOZ_ALWAYS_INLINE void
 PodCopy(volatile T* dst, const volatile T* src, size_t nelem)
 {
   MOZ_ASSERT(dst != src);
   MOZ_ASSERT_IF(src < dst,
                 PointerRangeSize(src, static_cast<const volatile T*>(dst)) >= nelem);
   MOZ_ASSERT_IF(dst < src,
                 PointerRangeSize(static_cast<const volatile T*>(dst), src) >= nelem);
 
@@ -122,28 +122,28 @@ PodCopy(volatile T* dst, const volatile 
     *dst = *src;
 }
 
 /*
  * Copy the contents of the array |src| into the array |dst|, both of size N.
  * The arrays must not overlap!
  */
 template <class T, size_t N>
-static void
+static MOZ_ALWAYS_INLINE void
 PodArrayCopy(T (&dst)[N], const T (&src)[N])
 {
   PodCopy(dst, src, N);
 }
 
 /**
  * Determine whether the |len| elements at |one| are memory-identical to the
  * |len| elements at |two|.
  */
 template<typename T>
-MOZ_ALWAYS_INLINE static bool
+static MOZ_ALWAYS_INLINE bool
 PodEqual(const T* one, const T* two, size_t len)
 {
   if (len < 128) {
     const T* p1end = one + len;
     const T* p1 = one;
     const T* p2 = two;
     for (; p1 < p1end; p1++, p2++) {
       if (*p1 != *p2)