| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 #ifndef V8_CHECKS_H_ | 28 #ifndef V8_CHECKS_H_ |
| 29 #define V8_CHECKS_H_ | 29 #define V8_CHECKS_H_ |
| 30 | 30 |
| 31 #include <string.h> | 31 #include <string.h> |
| 32 | 32 |
| 33 #include "../include/v8stdint.h" | 33 #include "../include/v8stdint.h" |
| 34 | 34 |
| 35 extern "C" void V8_Fatal(const char* file, int line, const char* format, ...); | 35 extern "C" void V8_Fatal(const char* file, int line, const char* format, ...); |
| 36 | 36 |
| 37 |
| 37 // The FATAL, UNREACHABLE and UNIMPLEMENTED macros are useful during | 38 // The FATAL, UNREACHABLE and UNIMPLEMENTED macros are useful during |
| 38 // development, but they should not be relied on in the final product. | 39 // development, but they should not be relied on in the final product. |
| 39 #ifdef DEBUG | 40 #ifdef DEBUG |
| 40 #define FATAL(msg) \ | 41 #define FATAL(msg) \ |
| 41 V8_Fatal(__FILE__, __LINE__, "%s", (msg)) | 42 V8_Fatal(__FILE__, __LINE__, "%s", (msg)) |
| 42 #define UNIMPLEMENTED() \ | 43 #define UNIMPLEMENTED() \ |
| 43 V8_Fatal(__FILE__, __LINE__, "unimplemented code") | 44 V8_Fatal(__FILE__, __LINE__, "unimplemented code") |
| 44 #define UNREACHABLE() \ | 45 #define UNREACHABLE() \ |
| 45 V8_Fatal(__FILE__, __LINE__, "unreachable code") | 46 V8_Fatal(__FILE__, __LINE__, "unreachable code") |
| 46 #else | 47 #else |
| 47 #define FATAL(msg) \ | 48 #define FATAL(msg) \ |
| 48 V8_Fatal("", 0, "%s", (msg)) | 49 V8_Fatal("", 0, "%s", (msg)) |
| 49 #define UNIMPLEMENTED() \ | 50 #define UNIMPLEMENTED() \ |
| 50 V8_Fatal("", 0, "unimplemented code") | 51 V8_Fatal("", 0, "unimplemented code") |
| 51 #define UNREACHABLE() ((void) 0) | 52 #define UNREACHABLE() ((void) 0) |
| 52 #endif | 53 #endif |
| 53 | 54 |
| 55 // Simulator specific helpers. |
| 56 #if defined(USE_SIMULATOR) && defined(V8_TARGET_ARCH_A64) |
| 57 // TODO(all): If possible automatically prepend an indicator like |
| 58 // UNIMPLEMENTED or LOCATION. |
| 59 #define ASM_UNIMPLEMENTED(message) \ |
| 60 __ Debug(message, __LINE__, NO_PARAM) |
| 61 #define ASM_UNIMPLEMENTED_BREAK(message) \ |
| 62 __ Debug(message, __LINE__, \ |
| 63 FLAG_ignore_asm_unimplemented_break ? NO_PARAM : BREAK) |
| 64 #define ASM_LOCATION(message) \ |
| 65 __ Debug("LOCATION: " message, __LINE__, NO_PARAM) |
| 66 #else |
| 67 #define ASM_UNIMPLEMENTED(message) |
| 68 #define ASM_UNIMPLEMENTED_BREAK(message) |
| 69 #define ASM_LOCATION(message) |
| 70 #endif |
| 71 |
| 54 | 72 |
| 55 // The CHECK macro checks that the given condition is true; if not, it | 73 // The CHECK macro checks that the given condition is true; if not, it |
| 56 // prints a message to stderr and aborts. | 74 // prints a message to stderr and aborts. |
| 57 #define CHECK(condition) do { \ | 75 #define CHECK(condition) do { \ |
| 58 if (!(condition)) { \ | 76 if (!(condition)) { \ |
| 59 V8_Fatal(__FILE__, __LINE__, "CHECK(%s) failed", #condition); \ | 77 V8_Fatal(__FILE__, __LINE__, "CHECK(%s) failed", #condition); \ |
| 60 } \ | 78 } \ |
| 61 } while (0) | 79 } while (0) |
| 62 | 80 |
| 63 | 81 |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 | 340 |
| 323 // "Extra checks" are lightweight checks that are enabled in some release | 341 // "Extra checks" are lightweight checks that are enabled in some release |
| 324 // builds. | 342 // builds. |
| 325 #ifdef ENABLE_EXTRA_CHECKS | 343 #ifdef ENABLE_EXTRA_CHECKS |
| 326 #define EXTRA_CHECK(condition) CHECK(condition) | 344 #define EXTRA_CHECK(condition) CHECK(condition) |
| 327 #else | 345 #else |
| 328 #define EXTRA_CHECK(condition) ((void) 0) | 346 #define EXTRA_CHECK(condition) ((void) 0) |
| 329 #endif | 347 #endif |
| 330 | 348 |
| 331 #endif // V8_CHECKS_H_ | 349 #endif // V8_CHECKS_H_ |
| OLD | NEW |