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

Unified Diff: src/runtime/runtime-utils.h

Issue 1748183002: Make RUNTIME_ASSERT have more useful output in debug mode (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Format and improve another error message Created 4 years, 10 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 | « src/runtime/runtime-liveedit.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-utils.h
diff --git a/src/runtime/runtime-utils.h b/src/runtime/runtime-utils.h
index c673b5a1557d45d1cf9ee65b1728f113d0179b34..17c78d5a0b5ca5f4c2266b62f04e4c686f2ad4cd 100644
--- a/src/runtime/runtime-utils.h
+++ b/src/runtime/runtime-utils.h
@@ -5,19 +5,49 @@
#ifndef V8_RUNTIME_RUNTIME_UTILS_H_
#define V8_RUNTIME_RUNTIME_UTILS_H_
+#include "src/base/logging.h"
#include "src/runtime/runtime.h"
namespace v8 {
namespace internal {
-#define RUNTIME_ASSERT(value) \
- if (!(value)) return isolate->ThrowIllegalOperation();
+#ifdef DEBUG
+
+#define RUNTIME_ASSERT(value) \
+ do { \
+ if (!(value)) { \
+ V8_RuntimeError(__FILE__, __LINE__, #value); \
+ return isolate->ThrowIllegalOperation(); \
+ } \
+ } while (0)
+
+#define RUNTIME_ASSERT_HANDLIFIED(value, T) \
+ do { \
+ if (!(value)) { \
+ V8_RuntimeError(__FILE__, __LINE__, #value); \
+ isolate->ThrowIllegalOperation(); \
+ return MaybeHandle<T>(); \
+ } \
+ } while (0)
+
+#else
+
+#define RUNTIME_ASSERT(value) \
+ do { \
+ if (!(value)) { \
+ return isolate->ThrowIllegalOperation(); \
+ } \
+ } while (0)
#define RUNTIME_ASSERT_HANDLIFIED(value, T) \
- if (!(value)) { \
- isolate->ThrowIllegalOperation(); \
- return MaybeHandle<T>(); \
- }
+ do { \
+ if (!(value)) { \
+ isolate->ThrowIllegalOperation(); \
+ return MaybeHandle<T>(); \
+ } \
+ } while (0)
+
+#endif
// Cast the given object to a value of the specified type and store
// it in a variable with the given name. If the object is not of the
« no previous file with comments | « src/runtime/runtime-liveedit.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698