Changeset 250867 in webkit
- Timestamp:
- Oct 8, 2019 3:16:04 PM (5 years ago)
- Location:
- trunk/Source/WTF
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r250809 r250867 1 2019-10-08 Robin Morisset <rmorisset@apple.com> 2 3 dataLogIf should be ALWAYS_INLINE 4 https://bugs.webkit.org/show_bug.cgi?id=202703 5 6 Reviewed by Saam Barati. 7 8 We often have the following pattern: 9 ``` 10 static constexpr bool verbose = false; 11 ... 12 dataLogLnIf(verbose, "Something is happening"); 13 ``` 14 To make sure that these are always properly eliminated I'd like to make dataLogIf/dataLogLnIf ALWAYS_INLINE. 15 16 We may as well mark the branch as UNLIKELY too, for the cases where the condition comes from Options::verboseSomething() and is only known at runtime. 17 18 * wtf/DataLog.h: 19 (WTF::dataLogIf): 20 (WTF::dataLogLnIf): 21 1 22 2019-10-07 Alexey Proskuryakov <ap@apple.com> 2 23 -
trunk/Source/WTF/wtf/DataLog.h
r237099 r250867 53 53 54 54 template<typename... Types> 55 void dataLogIf(bool shouldLog, const Types&... values)55 ALWAYS_INLINE void dataLogIf(bool shouldLog, const Types&... values) 56 56 { 57 if ( shouldLog)57 if (UNLIKELY(shouldLog)) 58 58 dataLog(values...); 59 59 } 60 60 61 61 template<typename... Types> 62 void dataLogLnIf(bool shouldLog, const Types&... values)62 ALWAYS_INLINE void dataLogLnIf(bool shouldLog, const Types&... values) 63 63 { 64 if ( shouldLog)64 if (UNLIKELY(shouldLog)) 65 65 dataLogLn(values...); 66 66 }
Note: See TracChangeset
for help on using the changeset viewer.