| Index: src/checks.h
|
| diff --git a/src/checks.h b/src/checks.h
|
| index d0a0c2b5acf5da52e3f2c49d3138b62904fa34df..1379763c469da306dedcdd40489ad25cf9ef552c 100644
|
| --- a/src/checks.h
|
| +++ b/src/checks.h
|
| @@ -33,6 +33,9 @@
|
| #include "../include/v8stdint.h"
|
| extern "C" void V8_Fatal(const char* file, int line, const char* format, ...);
|
|
|
| +// Define custom A64 preprocessor helpers to facilitate development.
|
| +#ifndef V8_TARGET_ARCH_A64
|
| +
|
| // The FATAL, UNREACHABLE and UNIMPLEMENTED macros are useful during
|
| // development, but they should not be relied on in the final product.
|
| #ifdef DEBUG
|
| @@ -50,6 +53,71 @@ extern "C" void V8_Fatal(const char* file, int line, const char* format, ...);
|
| #define UNREACHABLE() ((void) 0)
|
| #endif
|
|
|
| +#else
|
| +
|
| + #ifdef DEBUG
|
| + #define FATAL(msg) \
|
| + V8_Fatal(__FILE__, __LINE__, "%s", (msg))
|
| + #define UNREACHABLE() \
|
| + V8_Fatal(__FILE__, __LINE__, "unreachable code")
|
| + #else
|
| + #define FATAL(msg) \
|
| + V8_Fatal("", 0, "%s", (msg))
|
| + #define UNREACHABLE() ((void) 0)
|
| + #endif
|
| +
|
| + #define ABORT() printf("in %s, line %i, %s", __FILE__, __LINE__, __func__); \
|
| + abort()
|
| +
|
| + #define ALIGNMENT_EXCEPTION() printf("ALIGNMENT EXCEPTION\t"); ABORT()
|
| +
|
| + // Helpers for unimplemented sections.
|
| + #define UNIMPLEMENTED() \
|
| + do { \
|
| + printf("UNIMPLEMENTED: %s, line %d, %s\n", \
|
| + __FILE__, __LINE__, __func__); \
|
| + V8_Fatal(__FILE__, __LINE__, "unimplemented code"); \
|
| + } while (0)
|
| + #define UNIMPLEMENTED_M(message) \
|
| + do { \
|
| + printf("UNIMPLEMENTED: %s, line %d, %s : %s\n", \
|
| + __FILE__, __LINE__, __func__, message); \
|
| + V8_Fatal(__FILE__, __LINE__, "unimplemented code"); \
|
| + } while (0)
|
| + // Like UNIMPLEMENTED, but does not abort.
|
| + #define TODO_UNIMPLEMENTED(message) \
|
| + do { \
|
| + static const unsigned int kLimit = 1; \
|
| + static unsigned int printed = 0; \
|
| + if (printed < UINT_MAX) { \
|
| + printed++; \
|
| + } \
|
| + if (printed <= kLimit) { \
|
| + printf("UNIMPLEMENTED: %s, line %d, %s: %s\n", \
|
| + __FILE__, __LINE__, __func__, message); \
|
| + } \
|
| + } while (0)
|
| +
|
| + // Simulator specific helpers.
|
| + #ifdef USE_SIMULATOR
|
| + // Helpers for unimplemented sections.
|
| + // TODO(all): If possible automatically prepend an indicator like
|
| + // UNIMPLEMENTED or LOCATION.
|
| + #define ASM_UNIMPLEMENTED(message) \
|
| + __ Debug(message, __LINE__, NO_PARAM)
|
| + #define ASM_UNIMPLEMENTED_BREAK(message) \
|
| + __ Debug(message, __LINE__, \
|
| + FLAG_ignore_asm_unimplemented_break ? NO_PARAM : BREAK)
|
| + #define ASM_LOCATION(message) \
|
| + __ Debug("LOCATION: " message, __LINE__, NO_PARAM)
|
| + #else
|
| + #define ASM_UNIMPLEMENTED(message)
|
| + #define ASM_UNIMPLEMENTED_BREAK(message)
|
| + #define ASM_LOCATION(message)
|
| + #endif
|
| +
|
| +#endif
|
| +
|
|
|
| // The CHECK macro checks that the given condition is true; if not, it
|
| // prints a message to stderr and aborts.
|
|
|