Modified: trunk/Source/WTF/ChangeLog (289878 => 289879)
--- trunk/Source/WTF/ChangeLog 2022-02-16 06:48:03 UTC (rev 289878)
+++ trunk/Source/WTF/ChangeLog 2022-02-16 06:53:20 UTC (rev 289879)
@@ -1,3 +1,21 @@
+2022-02-15 Kimmo Kinnunen <[email protected]>
+
+ Constructing untaken LOG(Channel, ...) arguments slow debug binaries down
+ https://bugs.webkit.org/show_bug.cgi?id=235562
+
+ Reviewed by Simon Fraser.
+
+ Speed up debug build binary LOG(Channel, ...) by checking the
+ channel (and level) before constructing the log arguments.
+ This is consistent with how RELEASE_LOG() works.
+
+ If the arguments are slow to create, call sites end up implementing
+ this at the call site and risk subtle bugs which make existing logging unreliable.
+
+ Fixes a bug with LOG_WITH_STREAM where ChannelState::OnWithAccumulation channels would not log.
+
+ * wtf/Assertions.h:
+
2022-02-15 Chris Dumez <[email protected]>
Do preliminary work to pass domain names to CoreLocation
Modified: trunk/Source/WTF/wtf/Assertions.h (289878 => 289879)
--- trunk/Source/WTF/wtf/Assertions.h 2022-02-16 06:48:03 UTC (rev 289878)
+++ trunk/Source/WTF/wtf/Assertions.h 2022-02-16 06:53:20 UTC (rev 289879)
@@ -494,7 +494,10 @@
#if LOG_DISABLED
#define LOG(channel, ...) ((void)0)
#else
-#define LOG(channel, ...) WTFLog(&LOG_CHANNEL(channel), __VA_ARGS__)
+#define LOG(channel, ...) do { \
+ if (LOG_CHANNEL(channel).state != logChannelStateOff) \
+ WTFLog(&LOG_CHANNEL(channel), __VA_ARGS__); \
+ } while (0)
#endif
/* LOG_VERBOSE */
@@ -502,7 +505,10 @@
#if LOG_DISABLED
#define LOG_VERBOSE(channel, ...) ((void)0)
#else
-#define LOG_VERBOSE(channel, ...) WTFLogVerbose(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, &LOG_CHANNEL(channel), __VA_ARGS__)
+#define LOG_VERBOSE(channel, ...) do { \
+ if (LOG_CHANNEL(channel).state != logChannelStateOff) \
+ WTFLogVerbose(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, &LOG_CHANNEL(channel), __VA_ARGS__); \
+ } while (0)
#endif
/* LOG_WITH_LEVEL */
@@ -510,7 +516,10 @@
#if LOG_DISABLED
#define LOG_WITH_LEVEL(channel, level, ...) ((void)0)
#else
-#define LOG_WITH_LEVEL(channel, level, ...) WTFLogWithLevel(&LOG_CHANNEL(channel), level, __VA_ARGS__)
+#define LOG_WITH_LEVEL(channel, level, ...) do { \
+ if (LOG_CHANNEL(channel).state != logChannelStateOff && channel->level >= (level)) \
+ WTFLogWithLevel(&LOG_CHANNEL(channel), level, __VA_ARGS__); \
+ } while (0)
#endif
/* LOG_WITH_STREAM */
@@ -519,7 +528,7 @@
#define LOG_WITH_STREAM(channel, commands) ((void)0)
#else
#define LOG_WITH_STREAM(channel, commands) do { \
- if (LOG_CHANNEL(channel).state == WTFLogChannelState::On) { \
+ if (LOG_CHANNEL(channel).state != logChannelStateOff) { \
WTF::TextStream stream(WTF::TextStream::LineMode::SingleLine); \
commands; \
WTFLog(&LOG_CHANNEL(channel), "%s", stream.release().utf8().data()); \