Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(798)

Unified Diff: runtime/platform/assert.h

Issue 11014013: Added slow_assert macro and flag for slow development assertions in the VM. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/compiler.cc » ('j') | runtime/vm/flow_graph_inliner.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/platform/assert.h
diff --git a/runtime/platform/assert.h b/runtime/platform/assert.h
index 3ad928c9296825d91c88eb9ec6dfce59ae8c9ff8..0e3e7148f8d597299eee6a598a78863b3f8622c4 100644
--- a/runtime/platform/assert.h
+++ b/runtime/platform/assert.h
@@ -256,8 +256,13 @@ void DynamicAssertionHelper::NotNull(const T p) {
// DEBUG_ASSERT allows identifiers in condition to be undeclared in release
// mode.
-#define DEBUG_ASSERT(cond) \
- if (!(cond)) dart::Assert(__FILE__, __LINE__).Fail("expected: %s", #cond);
+#define DEBUG_ASSERT(cond) ASSERT(cond)
+
+// SLOW_ASSERT is used for slow assertion code and disabled by default.
+#define SLOW_ASSERT(cond) \
+ do { \
+ if (FLAG_slow_assert) ASSERT(cond); \
Kevin Millikin (Google) 2012/10/01 10:53:25 Align the \. You can add something like (defun m
zerny-google 2012/10/01 11:12:04 Done.
+ } while (false)
#else // if defined(DEBUG)
@@ -268,6 +273,8 @@ void DynamicAssertionHelper::NotNull(const T p) {
#define DEBUG_ASSERT(cond)
+#define SLOW_ASSERT(cond)
Kevin Millikin (Google) 2012/10/01 10:53:25 This should probably just expand into ASSERT(cond)
zerny-google 2012/10/01 11:12:04 Well, in the case of the verification code, it's n
+
// The COMPILE_ASSERT macro can be used to verify that a compile time
// expression is true. For example, you could use it to verify the
// size of a static array:
« no previous file with comments | « no previous file | runtime/vm/compiler.cc » ('j') | runtime/vm/flow_graph_inliner.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698