Provide fast-path for CHECK macro.
authorvegorov@chromium.org <vegorov@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 25 Oct 2011 09:06:07 +0000 (09:06 +0000)
committervegorov@chromium.org <vegorov@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 25 Oct 2011 09:06:07 +0000 (09:06 +0000)
Makes debug build 20% faster.

R=erik.corry@gmail.com

Review URL: http://codereview.chromium.org/8256011

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9767 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/checks.h

index 0a77cae4066d8851b95a6de0175e1d7bda486f7d..28006fa6f2f26891374c032e0122ea8e11559773 100644 (file)
@@ -63,7 +63,9 @@ static inline void CheckHelper(const char* file,
 
 // The CHECK macro checks that the given condition is true; if not, it
 // prints a message to stderr and aborts.
-#define CHECK(condition) CheckHelper(__FILE__, __LINE__, #condition, condition)
+#define CHECK(condition) do {                                             \
+    if (!(condition)) CheckHelper(__FILE__, __LINE__, #condition, false); \
+  } while(0)
 
 
 // Helper function used by the CHECK_EQ function when given int