Changeset 237429 in webkit
- Timestamp:
- Oct 25, 2018 3:23:23 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r237402 r237429 1 2018-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 1 19 2018-10-24 Megan Gardner <megan_gardner@apple.com> 2 20 -
trunk/Source/JavaScriptCore/bytecode/ArrayProfile.h
r235827 r237429 59 59 const ArrayModes Float64ArrayMode = 1 << 29; 60 60 61 inlineconstexpr ArrayModes asArrayModes(IndexingType indexingMode)61 constexpr ArrayModes asArrayModes(IndexingType indexingMode) 62 62 { 63 63 return static_cast<unsigned>(1) << static_cast<unsigned>(indexingMode); -
trunk/Source/JavaScriptCore/runtime/IndexingType.h
r234331 r237429 196 196 } 197 197 198 inlineconstexpr bool isCopyOnWrite(IndexingType indexingMode)198 constexpr bool isCopyOnWrite(IndexingType indexingMode) 199 199 { 200 200 return indexingMode & CopyOnWrite; -
trunk/Source/JavaScriptCore/runtime/MathCommon.h
r237136 r237429 36 36 int32_t JIT_OPERATION operationToInt32SensibleSlow(double) WTF_INTERNAL; 37 37 38 inlineconstexpr double maxSafeInteger()38 constexpr double maxSafeInteger() 39 39 { 40 40 // 2 ^ 53 - 1 … … 42 42 } 43 43 44 inlineconstexpr double minSafeInteger()44 constexpr double minSafeInteger() 45 45 { 46 46 // -(2 ^ 53 - 1) -
trunk/Source/JavaScriptCore/runtime/StackAlignment.h
r229486 r237429 33 33 34 34 // NB. Different platforms may have different requirements here. But 16 bytes is very common. 35 inlineconstexpr unsigned stackAlignmentBytes() { return 16; }35 constexpr unsigned stackAlignmentBytes() { return 16; } 36 36 37 inlineconstexpr unsigned stackAlignmentRegisters()37 constexpr unsigned stackAlignmentRegisters() 38 38 { 39 39 return stackAlignmentBytes() / sizeof(EncodedJSValue); -
trunk/Source/WTF/ChangeLog
r237419 r237429 1 2018-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 1 41 2018-10-25 Geoffrey Garen <ggaren@apple.com> 2 42 -
trunk/Source/WTF/wtf/Bitmap.h
r237099 r237429 134 134 135 135 template<size_t bitmapSize, typename WordType> 136 constexpr inlineBitmap<bitmapSize, WordType>::Bitmap()136 constexpr Bitmap<bitmapSize, WordType>::Bitmap() 137 137 { 138 138 clearAll(); -
trunk/Source/WTF/wtf/LEBDecoder.h
r237099 r237429 37 37 38 38 template<typename T> 39 inlineconstexpr size_t maxByteLength()39 constexpr size_t maxByteLength() 40 40 { 41 41 const size_t numBits = sizeof(T) * CHAR_BIT; -
trunk/Source/WTF/wtf/MathExtras.h
r237173 r237429 119 119 120 120 // std::numeric_limits<T>::min() returns the smallest positive value for floating point types 121 template<typename T> constexpr inlineT defaultMinimumForClamp() { return std::numeric_limits<T>::min(); }122 template<> constexpr inlinefloat defaultMinimumForClamp() { return -std::numeric_limits<float>::max(); }123 template<> constexpr inlinedouble defaultMinimumForClamp() { return -std::numeric_limits<double>::max(); }124 template<typename T> constexpr inlineT defaultMaximumForClamp() { return std::numeric_limits<T>::max(); }121 template<typename T> constexpr T defaultMinimumForClamp() { return std::numeric_limits<T>::min(); } 122 template<> constexpr float defaultMinimumForClamp() { return -std::numeric_limits<float>::max(); } 123 template<> constexpr double defaultMinimumForClamp() { return -std::numeric_limits<double>::max(); } 124 template<typename T> constexpr T defaultMaximumForClamp() { return std::numeric_limits<T>::max(); } 125 125 126 126 template<typename T> inline T clampTo(double value, T min = defaultMinimumForClamp<T>(), T max = defaultMaximumForClamp<T>()) … … 173 173 // Explicitly accept 64bit result when clamping double value. 174 174 // Keep in mind that double can only represent 53bit integer precisely. 175 template<typename T> constexpr inlineT clampToAccepting64(double value, T min = defaultMinimumForClamp<T>(), T max = defaultMaximumForClamp<T>())175 template<typename T> constexpr T clampToAccepting64(double value, T min = defaultMinimumForClamp<T>(), T max = defaultMaximumForClamp<T>()) 176 176 { 177 177 return (value >= static_cast<double>(max)) ? max : ((value <= static_cast<double>(min)) ? min : static_cast<T>(value)); … … 251 251 } 252 252 253 template<typename T> constexpr inlinebool isLessThan(const T& a, const T& b) { return a < b; }254 template<typename T> constexpr inlinebool isLessThanEqual(const T& a, const T& b) { return a <= b; }255 template<typename T> constexpr inlinebool isGreaterThan(const T& a, const T& b) { return a > b; }256 template<typename T> constexpr inlinebool isGreaterThanEqual(const T& a, const T& b) { return a >= b; }253 template<typename T> constexpr bool isLessThan(const T& a, const T& b) { return a < b; } 254 template<typename T> constexpr bool isLessThanEqual(const T& a, const T& b) { return a <= b; } 255 template<typename T> constexpr bool isGreaterThan(const T& a, const T& b) { return a > b; } 256 template<typename T> constexpr bool isGreaterThanEqual(const T& a, const T& b) { return a >= b; } 257 257 258 258 #ifndef UINT64_C … … 334 334 335 335 // From http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 336 inlineconstexpr uint32_t roundUpToPowerOfTwo(uint32_t v)336 constexpr uint32_t roundUpToPowerOfTwo(uint32_t v) 337 337 { 338 338 v--; … … 346 346 } 347 347 348 inlineconstexpr unsigned maskForSize(unsigned size)348 constexpr unsigned maskForSize(unsigned size) 349 349 { 350 350 if (!size) -
trunk/Source/WTF/wtf/Optional.h
r235661 r237429 216 216 217 217 // workaround: std utility functions aren't constexpr yet 218 template <class T> inlineconstexpr T&& constexpr_forward(typename std::remove_reference<T>::type& t) __NOEXCEPT218 template <class T> constexpr T&& constexpr_forward(typename std::remove_reference<T>::type& t) __NOEXCEPT 219 219 { 220 220 return static_cast<T&&>(t); 221 221 } 222 222 223 template <class T> inlineconstexpr T&& constexpr_forward(typename std::remove_reference<T>::type&& t) __NOEXCEPT223 template <class T> constexpr T&& constexpr_forward(typename std::remove_reference<T>::type&& t) __NOEXCEPT 224 224 { 225 225 static_assert(!std::is_lvalue_reference<T>::value, "!!"); … … 227 227 } 228 228 229 template <class T> inlineconstexpr typename std::remove_reference<T>::type&& constexpr_move(T&& t) __NOEXCEPT229 template <class T> constexpr typename std::remove_reference<T>::type&& constexpr_move(T&& t) __NOEXCEPT 230 230 { 231 231 return static_cast<typename std::remove_reference<T>::type&&>(t); -
trunk/Source/WTF/wtf/PtrTag.h
r236589 r237429 83 83 84 84 template<typename T, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value && !std::is_same<T, PtrType>::value>> 85 inlineconstexpr T tagCodePtr(PtrType ptr, PtrTag) { return bitwise_cast<T>(ptr); }85 constexpr T tagCodePtr(PtrType ptr, PtrTag) { return bitwise_cast<T>(ptr); } 86 86 87 87 template<typename T, PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>> … … 89 89 90 90 template<typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>> 91 inlineconstexpr PtrType tagCodePtr(PtrType ptr, PtrTag) { return ptr; }91 constexpr PtrType tagCodePtr(PtrType ptr, PtrTag) { return ptr; } 92 92 93 93 template<PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>> … … 95 95 96 96 template<typename T, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value && !std::is_same<T, PtrType>::value>> 97 inlineconstexpr T untagCodePtr(PtrType ptr, PtrTag) { return bitwise_cast<T>(ptr); }97 constexpr T untagCodePtr(PtrType ptr, PtrTag) { return bitwise_cast<T>(ptr); } 98 98 99 99 template<typename T, PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>> … … 101 101 102 102 template<typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>> 103 inlineconstexpr PtrType untagCodePtr(PtrType ptr, PtrTag) { return ptr; }103 constexpr PtrType untagCodePtr(PtrType ptr, PtrTag) { return ptr; } 104 104 105 105 template<PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>> … … 107 107 108 108 template<typename T, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value && !std::is_same<T, PtrType>::value>> 109 inlineconstexpr T retagCodePtr(PtrType ptr, PtrTag, PtrTag) { return bitwise_cast<T>(ptr); }109 constexpr T retagCodePtr(PtrType ptr, PtrTag, PtrTag) { return bitwise_cast<T>(ptr); } 110 110 111 111 template<typename T, PtrTag, PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>> … … 113 113 114 114 template<typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>> 115 inlineconstexpr PtrType retagCodePtr(PtrType ptr, PtrTag, PtrTag) { return ptr; }115 constexpr PtrType retagCodePtr(PtrType ptr, PtrTag, PtrTag) { return ptr; } 116 116 117 117 template<PtrTag, PtrTag, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value>> … … 119 119 120 120 template<typename T, typename PtrType, typename = std::enable_if_t<std::is_pointer<PtrType>::value && !std::is_same<T, PtrType>::value>> 121 inlineconstexpr 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 inlineconstexpr PtrType removeCodePtrTag(PtrType ptr) { return ptr; }121 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 constexpr PtrType removeCodePtrTag(PtrType ptr) { return ptr; } 125 125 126 126 template<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 190 190 } 191 191 192 template<size_t divisor> inlineconstexpr size_t roundUpToMultipleOf(size_t x)192 template<size_t divisor> constexpr size_t roundUpToMultipleOf(size_t x) 193 193 { 194 194 static_assert(divisor && !(divisor & (divisor - 1)), "divisor must be a power of two!"); … … 449 449 // For more info see: https://bugs.webkit.org/show_bug.cgi?id=180692 and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65978 450 450 template <class ...Args> 451 inlineconstexpr std::tuple<Args&...> tie(Args&... values)451 constexpr std::tuple<Args&...> tie(Args&... values) 452 452 { 453 453 return std::tuple<Args&...>(values...); -
trunk/Source/WTF/wtf/Variant.h
r236284 r237429 2028 2028 struct Monostate{}; 2029 2029 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;}2030 constexpr bool operator==(Monostate const&, Monostate const&) { return true; } 2031 constexpr bool operator!=(Monostate const&, Monostate const&) { return false; } 2032 constexpr bool operator>=(Monostate const&, Monostate const&) { return true; } 2033 constexpr bool operator<=(Monostate const&, Monostate const&) { return true; } 2034 constexpr bool operator>(Monostate const&, Monostate const&) { return false; } 2035 constexpr bool operator<(Monostate const&, Monostate const&) { return false; } 2036 2036 2037 2037 struct __hash_visitor{ -
trunk/Source/WTF/wtf/text/StringImpl.h
r237099 r237429 774 774 } 775 775 776 template<unsigned characterCount> inlineconstexpr StringImplShape::StringImplShape(unsigned refCount, unsigned length, const char (&characters)[characterCount], unsigned hashAndFlags, ConstructWithConstExprTag)776 template<unsigned characterCount> constexpr StringImplShape::StringImplShape(unsigned refCount, unsigned length, const char (&characters)[characterCount], unsigned hashAndFlags, ConstructWithConstExprTag) 777 777 : m_refCount(refCount) 778 778 , m_length(length) … … 782 782 } 783 783 784 template<unsigned characterCount> inlineconstexpr StringImplShape::StringImplShape(unsigned refCount, unsigned length, const char16_t (&characters)[characterCount], unsigned hashAndFlags, ConstructWithConstExprTag)784 template<unsigned characterCount> constexpr StringImplShape::StringImplShape(unsigned refCount, unsigned length, const char16_t (&characters)[characterCount], unsigned hashAndFlags, ConstructWithConstExprTag) 785 785 : m_refCount(refCount) 786 786 , m_length(length) … … 1160 1160 } 1161 1161 1162 template<unsigned characterCount> inlineconstexpr StringImpl::StaticStringImpl::StaticStringImpl(const char (&characters)[characterCount], StringKind stringKind)1162 template<unsigned characterCount> constexpr StringImpl::StaticStringImpl::StaticStringImpl(const char (&characters)[characterCount], StringKind stringKind) 1163 1163 : StringImplShape(s_refCountFlagIsStaticString, characterCount - 1, characters, 1164 1164 s_hashFlag8BitBuffer | s_hashFlagDidReportCost | stringKind | BufferInternal | (StringHasher::computeLiteralHashAndMaskTop8Bits(characters) << s_flagCount), ConstructWithConstExpr) … … 1166 1166 } 1167 1167 1168 template<unsigned characterCount> inlineconstexpr StringImpl::StaticStringImpl::StaticStringImpl(const char16_t (&characters)[characterCount], StringKind stringKind)1168 template<unsigned characterCount> constexpr StringImpl::StaticStringImpl::StaticStringImpl(const char16_t (&characters)[characterCount], StringKind stringKind) 1169 1169 : StringImplShape(s_refCountFlagIsStaticString, characterCount - 1, characters, 1170 1170 s_hashFlagDidReportCost | stringKind | BufferInternal | (StringHasher::computeLiteralHashAndMaskTop8Bits(characters) << s_flagCount), ConstructWithConstExpr) -
trunk/Source/bmalloc/ChangeLog
r237399 r237429 1 2018-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 1 23 2018-10-24 Alexey Proskuryakov <ap@apple.com> 2 24 -
trunk/Source/bmalloc/bmalloc/Algorithm.h
r237080 r237429 39 39 40 40 // Versions of min and max that are compatible with compile-time constants. 41 template<typename T> inlineconstexpr T max(T a, T b)41 template<typename T> constexpr T max(T a, T b) 42 42 { 43 43 return a > b ? a : b; 44 44 } 45 45 46 template<typename T> inlineconstexpr T min(T a, T b)46 template<typename T> constexpr T min(T a, T b) 47 47 { 48 48 return a < b ? a : b; 49 49 } 50 50 51 template<typename T> inlineconstexpr T mask(T value, uintptr_t mask)51 template<typename T> constexpr T mask(T value, uintptr_t mask) 52 52 { 53 53 static_assert(sizeof(T) == sizeof(uintptr_t), "sizeof(T) must be equal to sizeof(uintptr_t)."); … … 60 60 } 61 61 62 template<typename T> inlineconstexpr bool test(T value, uintptr_t mask)62 template<typename T> constexpr bool test(T value, uintptr_t mask) 63 63 { 64 64 return !!(reinterpret_cast<uintptr_t>(value) & mask); … … 66 66 67 67 template <typename T> 68 inlineconstexpr bool isPowerOfTwo(T size)68 constexpr bool isPowerOfTwo(T size) 69 69 { 70 70 static_assert(std::is_integral<T>::value, ""); … … 103 103 } 104 104 105 template<size_t divisor, typename T> inlineconstexpr T roundDownToMultipleOf(T x)105 template<size_t divisor, typename T> constexpr T roundDownToMultipleOf(T x) 106 106 { 107 107 static_assert(isPowerOfTwo(divisor), "'divisor' must be a power of two."); … … 130 130 // Version of sizeof that returns 0 for empty classes. 131 131 132 template<typename T> inlineconstexpr size_t sizeOf()132 template<typename T> constexpr size_t sizeOf() 133 133 { 134 134 return std::is_empty<T>::value ? 0 : sizeof(T); 135 135 } 136 136 137 template<typename T> inlineconstexpr size_t bitCount()137 template<typename T> constexpr size_t bitCount() 138 138 { 139 139 return sizeof(T) * 8; … … 157 157 #endif 158 158 159 inlineconstexpr unsigned long log2(unsigned long value)159 constexpr unsigned long log2(unsigned long value) 160 160 { 161 161 return bitCount<unsigned long>() - 1 - __builtin_clzl(value); -
trunk/Source/bmalloc/bmalloc/Bits.h
r228576 r237429 32 32 namespace bmalloc { 33 33 34 constexpr inlinesize_t bitsArrayLength(size_t numBits) { return (numBits + 31) / 32; }34 constexpr size_t bitsArrayLength(size_t numBits) { return (numBits + 31) / 32; } 35 35 36 36 class BitsWordView { -
trunk/Source/bmalloc/bmalloc/Sizes.h
r232269 r237429 74 74 static const size_t maskSizeClassCount = maskSizeClassMax / alignment; 75 75 76 inlineconstexpr size_t maskSizeClass(size_t size)76 constexpr size_t maskSizeClass(size_t size) 77 77 { 78 78 // We mask to accommodate zero.
Note: See TracChangeset
for help on using the changeset viewer.