Chromium Code Reviews| Index: src/checks.h |
| diff --git a/src/checks.h b/src/checks.h |
| index f7b145fc8a8ceb052a573c05b590d3057ac8ddaa..3829b4ac39b80973a9b7300d3531260cad4c9fc9 100644 |
| --- a/src/checks.h |
| +++ b/src/checks.h |
| @@ -34,6 +34,9 @@ |
| 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 |
| @@ -51,6 +54,71 @@ extern "C" void V8_Fatal(const char* file, int line, const char* format, ...); |
| #define UNREACHABLE() ((void) 0) |
| #endif |
| +#else |
| + |
|
rmcilroy
2014/02/11 18:31:06
Could we remove these now? There is only one TODO
Rodolph Perfetta
2014/02/12 01:08:24
making them non a64 specific sounds good to me.
T
|
| + #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. |