Changeset 237429 in webkit


Ignore:
Timestamp:
Oct 25, 2018 3:23:23 PM (5 years ago)
Author:
Ross Kirsling
Message:

Cleanup: inline constexpr is redundant as constexpr implies inline
https://bugs.webkit.org/show_bug.cgi?id=190819

Reviewed by Mark Lam.

Source/bmalloc:

  • bmalloc/Algorithm.h:

(bmalloc::max):
(bmalloc::min):
(bmalloc::mask):
(bmalloc::test):
(bmalloc::isPowerOfTwo):
(bmalloc::roundDownToMultipleOf):
(bmalloc::sizeOf):
(bmalloc::bitCount):
(bmalloc::log2):

  • bmalloc/Bits.h:

(bmalloc::bitsArrayLength):

  • bmalloc/Sizes.h:

(bmalloc::Sizes::maskSizeClass):

Source/JavaScriptCore:

  • bytecode/ArrayProfile.h:

(JSC::asArrayModes):

  • runtime/IndexingType.h:

(JSC::isCopyOnWrite):

  • runtime/MathCommon.h:

(JSC::maxSafeInteger):
(JSC::minSafeInteger):

  • runtime/StackAlignment.h:

(JSC::stackAlignmentBytes):
(JSC::stackAlignmentRegisters):

Source/WTF:

  • wtf/Bitmap.h:

(WTF::WordType>::Bitmap):

  • wtf/LEBDecoder.h:

(WTF::LEBDecoder::maxByteLength):

  • wtf/MathExtras.h:

(defaultMinimumForClamp):
(defaultMaximumForClamp):
(clampToAccepting64):
(isLessThan):
(isLessThanEqual):
(isGreaterThan):
(isGreaterThanEqual):
(WTF::roundUpToPowerOfTwo):
(WTF::maskForSize):

  • wtf/Optional.h:
  • wtf/PtrTag.h:

(WTF::tagCodePtr):
(WTF::untagCodePtr):
(WTF::retagCodePtr):
(WTF::removeCodePtrTag):

  • wtf/StdLibExtras.h:

(WTF::roundUpToMultipleOf):

  • wtf/Variant.h:

(WTF::operator==):
(WTF::operator!=):
(WTF::operator>=):
(WTF::operator<=):
(WTF::operator>):
(WTF::operator<):

  • wtf/text/StringImpl.h:

(WTF::StringImplShape::StringImplShape):
(WTF::StringImpl::StaticStringImpl::StaticStringImpl):

Location:
trunk/Source
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r237402 r237429  
     12018-10-25  Ross Kirsling  <ross.kirsling@sony.com>
     2
     3        Cleanup: inline constexpr is redundant as constexpr implies inline
     4        https://bugs.webkit.org/show_bug.cgi?id=190819
     5
     6        Reviewed by Mark Lam.
     7
     8        * bytecode/ArrayProfile.h:
     9        (JSC::asArrayModes):
     10        * runtime/IndexingType.h:
     11        (JSC::isCopyOnWrite):
     12        * runtime/MathCommon.h:
     13        (JSC::maxSafeInteger):
     14        (JSC::minSafeInteger):
     15        * runtime/StackAlignment.h:
     16        (JSC::stackAlignmentBytes):
     17        (JSC::stackAlignmentRegisters):
     18
    1192018-10-24  Megan Gardner  <megan_gardner@apple.com>
    220
  • trunk/Source/JavaScriptCore/bytecode/ArrayProfile.h

    r235827 r237429  
    5959const ArrayModes Float64ArrayMode = 1 << 29;
    6060
    61 inline constexpr ArrayModes asArrayModes(IndexingType indexingMode)
     61constexpr ArrayModes asArrayModes(IndexingType indexingMode)
    6262{
    6363    return static_cast<unsigned>(1) << static_cast<unsigned>(indexingMode);
  • trunk/Source/JavaScriptCore/runtime/IndexingType.h

    r234331 r237429  
    196196}
    197197
    198 inline constexpr bool isCopyOnWrite(IndexingType indexingMode)
     198constexpr bool isCopyOnWrite(IndexingType indexingMode)
    199199{
    200200    return indexingMode & CopyOnWrite;
  • trunk/Source/JavaScriptCore/runtime/MathCommon.h

    r237136 r237429  
    3636int32_t JIT_OPERATION operationToInt32SensibleSlow(double) WTF_INTERNAL;
    3737
    38 inline constexpr double maxSafeInteger()
     38constexpr double maxSafeInteger()
    3939{
    4040    // 2 ^ 53 - 1
     
    4242}
    4343
    44 inline constexpr double minSafeInteger()
     44constexpr double minSafeInteger()
    4545{
    4646    // -(2 ^ 53 - 1)
  • trunk/Source/JavaScriptCore/runtime/StackAlignment.h

    r229486 r237429  
    3333
    3434// NB. Different platforms may have different requirements here. But 16 bytes is very common.
    35 inline constexpr unsigned stackAlignmentBytes() { return 16; }
     35constexpr unsigned stackAlignmentBytes() { return 16; }
    3636
    37 inline constexpr unsigned stackAlignmentRegisters()
     37constexpr unsigned stackAlignmentRegisters()
    3838{
    3939    return stackAlignmentBytes() / sizeof(EncodedJSValue);
  • trunk/Source/WTF/ChangeLog

    r237419 r237429  
     12018-10-25  Ross Kirsling  <ross.kirsling@sony.com>
     2
     3        Cleanup: inline constexpr is redundant as constexpr implies inline
     4        https://bugs.webkit.org/show_bug.cgi?id=190819
     5
     6        Reviewed by Mark Lam.
     7
     8        * wtf/Bitmap.h:
     9        (WTF::WordType>::Bitmap):
     10        * wtf/LEBDecoder.h:
     11        (WTF::LEBDecoder::maxByteLength):
     12        * wtf/MathExtras.h:
     13        (defaultMinimumForClamp):
     14        (defaultMaximumForClamp):
     15        (clampToAccepting64):
     16        (isLessThan):
     17        (isLessThanEqual):
     18        (isGreaterThan):
     19        (isGreaterThanEqual):
     20        (WTF::roundUpToPowerOfTwo):
     21        (WTF::maskForSize):
     22        * wtf/Optional.h:
     23        * wtf/PtrTag.h:
     24        (WTF::tagCodePtr):
     25        (WTF::untagCodePtr):
     26        (WTF::retagCodePtr):
     27        (WTF::removeCodePtrTag):
     28        * wtf/StdLibExtras.h:
     29        (WTF::roundUpToMultipleOf):
     30        * wtf/Variant.h:
     31        (WTF::operator==):
     32        (WTF::operator!=):
     33        (WTF::operator>=):
     34        (WTF::operator<=):
     35        (WTF::operator>):
     36        (WTF::operator<):
     37        * wtf/text/StringImpl.h:
     38        (WTF::StringImplShape::StringImplShape):
     39        (WTF::StringImpl::StaticStringImpl::StaticStringImpl):
     40
    1412018-10-25  Geoffrey Garen  <ggaren@apple.com>
    242
  • trunk/Source/WTF/wtf/Bitmap.h

    r237099 r237429  
    134134
    135135template<size_t bitmapSize, typename WordType>
    136 constexpr inline Bitmap<bitmapSize, WordType>::Bitmap()
     136constexpr Bitmap<bitmapSize, WordType>::Bitmap()
    137137{
    138138    clearAll();
  • trunk/Source/WTF/wtf/LEBDecoder.h

    r237099 r237429  
    3737
    3838template<typename T>
    39 inline constexpr size_t maxByteLength()
     39constexpr size_t maxByteLength()
    4040{
    4141    const size_t numBits = sizeof(T) * CHAR_BIT;
  • trunk/Source/WTF/wtf/MathExtras.h

    r237173 r237429  
    119119
    120120// std::numeric_limits<T>::min() returns the smallest positive value for floating point types
    121 template<typename T> constexpr inline T defaultMinimumForClamp() { return std::numeric_limits<T>::min(); }
    122 template<> constexpr inline float defaultMinimumForClamp() { return -std::numeric_limits<float>::max(); }
    123 template<> constexpr inline double defaultMinimumForClamp() { return -std::numeric_limits<double>::max(); }
    124 template<typename T> constexpr inline T defaultMaximumForClamp() { return std::numeric_limits<T>::max(); }
     121template<typename T> constexpr T defaultMinimumForClamp() { return std::numeric_limits<T>::min(); }
     122template<> constexpr float defaultMinimumForClamp() { return -std::numeric_limits<float>::max(); }
     123template<> constexpr double defaultMinimumForClamp() { return -std::numeric_limits<double>::max(); }
     124template<typename T> constexpr T defaultMaximumForClamp() { return std::numeric_limits<T>::max(); }
    125125
    126126template<typename T> inline T clampTo(double value, T min = defaultMinimumForClamp<T>(), T max = defaultMaximumForClamp<T>())
     
    173173// Explicitly accept 64bit result when clamping double value.
    174174// Keep in mind that double can only represent 53bit integer precisely.
    175 template<typename T> constexpr inline T clampToAccepting64(double value, T min = defaultMinimumForClamp<T>(), T max = defaultMaximumForClamp<T>())
     175template<typename T> constexpr T clampToAccepting64(double value, T min = defaultMinimumForClamp<T>(), T max = defaultMaximumForClamp<T>())
    176176{
    177177    return (value >= static_cast<double>(max)) ? max : ((value <= static_cast<double>(min)) ? min : static_cast<T>(value));
     
    251251}
    252252
    253 template<typename T> constexpr inline bool isLessThan(const T& a, const T& b) { return a < b; }
    254 template<typename T> constexpr inline bool isLessThanEqual(const T& a, const T& b) { return a <= b; }
    255 template<typename T> constexpr inline bool isGreaterThan(const T& a, const T& b) { return a > b; }
    256 template<typename T> constexpr inline bool isGreaterThanEqual(const T& a, const T& b) { return a >= b; }
     253template<typename T> constexpr bool isLessThan(const T& a, const T& b) { return a < b; }
     254template<typename T> constexpr bool isLessThanEqual(const T& a, const T& b) { return a <= b; }
     255template<typename T> constexpr bool isGreaterThan(const T& a, const T& b) { return a > b; }
     256template<typename T> constexpr bool isGreaterThanEqual(const T& a, const T& b) { return a >= b; }
    257257
    258258#ifndef UINT64_C
     
    334334
    335335// From http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
    336 inline constexpr uint32_t roundUpToPowerOfTwo(uint32_t v)
     336constexpr uint32_t roundUpToPowerOfTwo(uint32_t v)
    337337{
    338338    v--;
     
    346346}
    347347
    348 inline constexpr unsigned maskForSize(unsigned size)
     348constexpr unsigned maskForSize(unsigned size)
    349349{
    350350    if (!size)
  • trunk/Source/WTF/wtf/Optional.h

    r235661 r237429  
    216216
    217217// workaround: std utility functions aren't constexpr yet
    218 template <class T> inline constexpr T&& constexpr_forward(typename std::remove_reference<T>::type& t) __NOEXCEPT
     218template <class T> constexpr T&& constexpr_forward(typename std::remove_reference<T>::type& t) __NOEXCEPT
    219219{
    220220  return static_cast<T&&>(t);
    221221}
    222222
    223 template <class T> inline constexpr T&& constexpr_forward(typename std::remove_reference<T>::type&& t) __NOEXCEPT
     223template <class T> constexpr T&& constexpr_forward(typename std::remove_reference<T>::type&& t) __NOEXCEPT
    224224{
    225225    static_assert(!std::is_lvalue_reference<T>::value, "!!");
     
    227227}
    228228
    229 template <class T> inline constexpr typename std::remove_reference<T>::type&& constexpr_move(T&& t) __NOEXCEPT
     229template <class T> constexpr typename std::remove_reference<T>::type&& constexpr_move(T&& t) __NOEXCEPT
    230230{
    231231    return static_cast<typename std::remove_reference<T>::type&&>(t);
  • trunk/Source/WTF/wtf/PtrTag.h

    r236589 r237429  
    8383
    8484template<typename T, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value && !std::is_same<T, PtrType>::value>>
    85 inline constexpr T tagCodePtr(PtrType ptr, PtrTag) { return bitwise_cast<T>(ptr); }
     85constexpr T tagCodePtr(PtrType ptr, PtrTag) { return bitwise_cast<T>(ptr); }
    8686
    8787template<typename T, PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
     
    8989
    9090template<typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
    91 inline constexpr PtrType tagCodePtr(PtrType ptr, PtrTag) { return ptr; }
     91constexpr PtrType tagCodePtr(PtrType ptr, PtrTag) { return ptr; }
    9292
    9393template<PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
     
    9595
    9696template<typename T, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value && !std::is_same<T, PtrType>::value>>
    97 inline constexpr T untagCodePtr(PtrType ptr, PtrTag) { return bitwise_cast<T>(ptr); }
     97constexpr T untagCodePtr(PtrType ptr, PtrTag) { return bitwise_cast<T>(ptr); }
    9898
    9999template<typename T, PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
     
    101101
    102102template<typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
    103 inline constexpr PtrType untagCodePtr(PtrType ptr, PtrTag) { return ptr; }
     103constexpr PtrType untagCodePtr(PtrType ptr, PtrTag) { return ptr; }
    104104
    105105template<PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
     
    107107
    108108template<typename T, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value && !std::is_same<T, PtrType>::value>>
    109 inline constexpr T retagCodePtr(PtrType ptr, PtrTag, PtrTag) { return bitwise_cast<T>(ptr); }
     109constexpr T retagCodePtr(PtrType ptr, PtrTag, PtrTag) { return bitwise_cast<T>(ptr); }
    110110
    111111template<typename T, PtrTag, PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
     
    113113
    114114template<typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
    115 inline constexpr PtrType retagCodePtr(PtrType ptr, PtrTag, PtrTag) { return ptr; }
     115constexpr PtrType retagCodePtr(PtrType ptr, PtrTag, PtrTag) { return ptr; }
    116116
    117117template<PtrTag, PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
     
    119119
    120120template<typename T, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value && !std::is_same<T, PtrType>::value>>
    121 inline constexpr T removeCodePtrTag(PtrType ptr) { return bitwise_cast<T>(ptr); }
    122 
    123 template<typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
    124 inline constexpr PtrType removeCodePtrTag(PtrType ptr) { return ptr; }
     121constexpr T removeCodePtrTag(PtrType ptr) { return bitwise_cast<T>(ptr); }
     122
     123template<typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>>
     124constexpr PtrType removeCodePtrTag(PtrType ptr) { return ptr; }
    125125
    126126template<typename T, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value && !std::is_same<T, PtrType>::value>>
  • trunk/Source/WTF/wtf/StdLibExtras.h

    r237099 r237429  
    190190}
    191191
    192 template<size_t divisor> inline constexpr size_t roundUpToMultipleOf(size_t x)
     192template<size_t divisor> constexpr size_t roundUpToMultipleOf(size_t x)
    193193{
    194194    static_assert(divisor && !(divisor & (divisor - 1)), "divisor must be a power of two!");
     
    449449// For more info see: https://bugs.webkit.org/show_bug.cgi?id=180692 and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65978
    450450template <class ...Args>
    451 inline constexpr std::tuple<Args&...> tie(Args&... values)
     451constexpr std::tuple<Args&...> tie(Args&... values)
    452452{
    453453    return std::tuple<Args&...>(values...);
  • trunk/Source/WTF/wtf/Variant.h

    r236284 r237429  
    20282028struct Monostate{};
    20292029
    2030 constexpr inline bool operator==(Monostate const&,Monostate const&){ return true;}
    2031 constexpr inline bool operator!=(Monostate const&,Monostate const&){ return false;}
    2032 constexpr inline bool operator>=(Monostate const&,Monostate const&){ return true;}
    2033 constexpr inline bool operator<=(Monostate const&,Monostate const&){ return true;}
    2034 constexpr inline bool operator>(Monostate const&,Monostate const&){ return false;}
    2035 constexpr inline bool operator<(Monostate const&,Monostate const&){ return false;}
     2030constexpr bool operator==(Monostate const&, Monostate const&) { return true; }
     2031constexpr bool operator!=(Monostate const&, Monostate const&) { return false; }
     2032constexpr bool operator>=(Monostate const&, Monostate const&) { return true; }
     2033constexpr bool operator<=(Monostate const&, Monostate const&) { return true; }
     2034constexpr bool operator>(Monostate const&, Monostate const&) { return false; }
     2035constexpr bool operator<(Monostate const&, Monostate const&) { return false; }
    20362036
    20372037struct __hash_visitor{
  • trunk/Source/WTF/wtf/text/StringImpl.h

    r237099 r237429  
    774774}
    775775
    776 template<unsigned characterCount> inline constexpr StringImplShape::StringImplShape(unsigned refCount, unsigned length, const char (&characters)[characterCount], unsigned hashAndFlags, ConstructWithConstExprTag)
     776template<unsigned characterCount> constexpr StringImplShape::StringImplShape(unsigned refCount, unsigned length, const char (&characters)[characterCount], unsigned hashAndFlags, ConstructWithConstExprTag)
    777777    : m_refCount(refCount)
    778778    , m_length(length)
     
    782782}
    783783
    784 template<unsigned characterCount> inline constexpr StringImplShape::StringImplShape(unsigned refCount, unsigned length, const char16_t (&characters)[characterCount], unsigned hashAndFlags, ConstructWithConstExprTag)
     784template<unsigned characterCount> constexpr StringImplShape::StringImplShape(unsigned refCount, unsigned length, const char16_t (&characters)[characterCount], unsigned hashAndFlags, ConstructWithConstExprTag)
    785785    : m_refCount(refCount)
    786786    , m_length(length)
     
    11601160}
    11611161
    1162 template<unsigned characterCount> inline constexpr StringImpl::StaticStringImpl::StaticStringImpl(const char (&characters)[characterCount], StringKind stringKind)
     1162template<unsigned characterCount> constexpr StringImpl::StaticStringImpl::StaticStringImpl(const char (&characters)[characterCount], StringKind stringKind)
    11631163    : StringImplShape(s_refCountFlagIsStaticString, characterCount - 1, characters,
    11641164        s_hashFlag8BitBuffer | s_hashFlagDidReportCost | stringKind | BufferInternal | (StringHasher::computeLiteralHashAndMaskTop8Bits(characters) << s_flagCount), ConstructWithConstExpr)
     
    11661166}
    11671167
    1168 template<unsigned characterCount> inline constexpr StringImpl::StaticStringImpl::StaticStringImpl(const char16_t (&characters)[characterCount], StringKind stringKind)
     1168template<unsigned characterCount> constexpr StringImpl::StaticStringImpl::StaticStringImpl(const char16_t (&characters)[characterCount], StringKind stringKind)
    11691169    : StringImplShape(s_refCountFlagIsStaticString, characterCount - 1, characters,
    11701170        s_hashFlagDidReportCost | stringKind | BufferInternal | (StringHasher::computeLiteralHashAndMaskTop8Bits(characters) << s_flagCount), ConstructWithConstExpr)
  • trunk/Source/bmalloc/ChangeLog

    r237399 r237429  
     12018-10-25  Ross Kirsling  <ross.kirsling@sony.com>
     2
     3        Cleanup: inline constexpr is redundant as constexpr implies inline
     4        https://bugs.webkit.org/show_bug.cgi?id=190819
     5
     6        Reviewed by Mark Lam.
     7
     8        * bmalloc/Algorithm.h:
     9        (bmalloc::max):
     10        (bmalloc::min):
     11        (bmalloc::mask):
     12        (bmalloc::test):
     13        (bmalloc::isPowerOfTwo):
     14        (bmalloc::roundDownToMultipleOf):
     15        (bmalloc::sizeOf):
     16        (bmalloc::bitCount):
     17        (bmalloc::log2):
     18        * bmalloc/Bits.h:
     19        (bmalloc::bitsArrayLength):
     20        * bmalloc/Sizes.h:
     21        (bmalloc::Sizes::maskSizeClass):
     22
    1232018-10-24  Alexey Proskuryakov  <ap@apple.com>
    224
  • trunk/Source/bmalloc/bmalloc/Algorithm.h

    r237080 r237429  
    3939
    4040// Versions of min and max that are compatible with compile-time constants.
    41 template<typename T> inline constexpr T max(T a, T b)
     41template<typename T> constexpr T max(T a, T b)
    4242{
    4343    return a > b ? a : b;
    4444}
    4545   
    46 template<typename T> inline constexpr T min(T a, T b)
     46template<typename T> constexpr T min(T a, T b)
    4747{
    4848    return a < b ? a : b;
    4949}
    5050
    51 template<typename T> inline constexpr T mask(T value, uintptr_t mask)
     51template<typename T> constexpr T mask(T value, uintptr_t mask)
    5252{
    5353    static_assert(sizeof(T) == sizeof(uintptr_t), "sizeof(T) must be equal to sizeof(uintptr_t).");
     
    6060}
    6161
    62 template<typename T> inline constexpr bool test(T value, uintptr_t mask)
     62template<typename T> constexpr bool test(T value, uintptr_t mask)
    6363{
    6464    return !!(reinterpret_cast<uintptr_t>(value) & mask);
     
    6666
    6767template <typename T>
    68 inline constexpr bool isPowerOfTwo(T size)
     68constexpr bool isPowerOfTwo(T size)
    6969{
    7070    static_assert(std::is_integral<T>::value, "");
     
    103103}
    104104
    105 template<size_t divisor, typename T> inline constexpr T roundDownToMultipleOf(T x)
     105template<size_t divisor, typename T> constexpr T roundDownToMultipleOf(T x)
    106106{
    107107    static_assert(isPowerOfTwo(divisor), "'divisor' must be a power of two.");
     
    130130// Version of sizeof that returns 0 for empty classes.
    131131
    132 template<typename T> inline constexpr size_t sizeOf()
     132template<typename T> constexpr size_t sizeOf()
    133133{
    134134    return std::is_empty<T>::value ? 0 : sizeof(T);
    135135}
    136136
    137 template<typename T> inline constexpr size_t bitCount()
     137template<typename T> constexpr size_t bitCount()
    138138{
    139139    return sizeof(T) * 8;
     
    157157#endif
    158158
    159 inline constexpr unsigned long log2(unsigned long value)
     159constexpr unsigned long log2(unsigned long value)
    160160{
    161161    return bitCount<unsigned long>() - 1 - __builtin_clzl(value);
  • trunk/Source/bmalloc/bmalloc/Bits.h

    r228576 r237429  
    3232namespace bmalloc {
    3333
    34 constexpr inline size_t bitsArrayLength(size_t numBits) { return (numBits + 31) / 32; }
     34constexpr size_t bitsArrayLength(size_t numBits) { return (numBits + 31) / 32; }
    3535
    3636class BitsWordView {
  • trunk/Source/bmalloc/bmalloc/Sizes.h

    r232269 r237429  
    7474    static const size_t maskSizeClassCount = maskSizeClassMax / alignment;
    7575
    76     inline constexpr size_t maskSizeClass(size_t size)
     76    constexpr size_t maskSizeClass(size_t size)
    7777    {
    7878        // We mask to accommodate zero.
Note: See TracChangeset for help on using the changeset viewer.