Title: [250867] trunk/Source/WTF
- Revision
- 250867
- Author
- rmoris...@apple.com
- Date
- 2019-10-08 15:16:04 -0700 (Tue, 08 Oct 2019)
Log Message
dataLogIf should be ALWAYS_INLINE
https://bugs.webkit.org/show_bug.cgi?id=202703
Reviewed by Saam Barati.
We often have the following pattern:
```
static constexpr bool verbose = false;
...
dataLogLnIf(verbose, "Something is happening");
```
To make sure that these are always properly eliminated I'd like to make dataLogIf/dataLogLnIf ALWAYS_INLINE.
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.
* wtf/DataLog.h:
(WTF::dataLogIf):
(WTF::dataLogLnIf):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (250866 => 250867)
--- trunk/Source/WTF/ChangeLog 2019-10-08 22:13:39 UTC (rev 250866)
+++ trunk/Source/WTF/ChangeLog 2019-10-08 22:16:04 UTC (rev 250867)
@@ -1,3 +1,24 @@
+2019-10-08 Robin Morisset <rmoris...@apple.com>
+
+ dataLogIf should be ALWAYS_INLINE
+ https://bugs.webkit.org/show_bug.cgi?id=202703
+
+ Reviewed by Saam Barati.
+
+ We often have the following pattern:
+ ```
+ static constexpr bool verbose = false;
+ ...
+ dataLogLnIf(verbose, "Something is happening");
+ ```
+ To make sure that these are always properly eliminated I'd like to make dataLogIf/dataLogLnIf ALWAYS_INLINE.
+
+ 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.
+
+ * wtf/DataLog.h:
+ (WTF::dataLogIf):
+ (WTF::dataLogLnIf):
+
2019-10-07 Alexey Proskuryakov <a...@apple.com>
Build failure in WebHTMLView.mm with the public SDK (Xcode 11 and Mojave)
Modified: trunk/Source/WTF/wtf/DataLog.h (250866 => 250867)
--- trunk/Source/WTF/wtf/DataLog.h 2019-10-08 22:13:39 UTC (rev 250866)
+++ trunk/Source/WTF/wtf/DataLog.h 2019-10-08 22:16:04 UTC (rev 250867)
@@ -52,16 +52,16 @@
}
template<typename... Types>
-void dataLogIf(bool shouldLog, const Types&... values)
+ALWAYS_INLINE void dataLogIf(bool shouldLog, const Types&... values)
{
- if (shouldLog)
+ if (UNLIKELY(shouldLog))
dataLog(values...);
}
template<typename... Types>
-void dataLogLnIf(bool shouldLog, const Types&... values)
+ALWAYS_INLINE void dataLogLnIf(bool shouldLog, const Types&... values)
{
- if (shouldLog)
+ if (UNLIKELY(shouldLog))
dataLogLn(values...);
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes