Reviewers: Erik Corry,

Description:
Provide fast-path for CHECK macro.

Makes debug build 20% faster.

[email protected]


Please review this at http://codereview.chromium.org/8256011/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/checks.h


Index: src/checks.h
diff --git a/src/checks.h b/src/checks.h
index 2f359f6cd84efdd30f82ab6568a95657c6754edc..55206d4bae3afde09a46e978d912dea0f3152b8a 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


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to