From 93f99ec06bb4f2648d473b27ce9afa6bc3b649bd Mon Sep 17 00:00:00 2001 From: "vegorov@chromium.org" Date: Tue, 25 Oct 2011 09:06:07 +0000 Subject: [PATCH] Provide fast-path for CHECK macro. 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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/checks.h b/src/checks.h index 0a77cae406..28006fa6f2 100644 --- a/src/checks.h +++ b/src/checks.h @@ -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