| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_CHECKS_H_ | 5 #ifndef V8_CHECKS_H_ |
| 6 #define V8_CHECKS_H_ | 6 #define V8_CHECKS_H_ |
| 7 | 7 |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include "../include/v8stdint.h" | 10 #include "../include/v8stdint.h" |
| 11 #include "base/build_config.h" |
| 11 | 12 |
| 12 extern "C" void V8_Fatal(const char* file, int line, const char* format, ...); | 13 extern "C" void V8_Fatal(const char* file, int line, const char* format, ...); |
| 13 | 14 |
| 14 | 15 |
| 15 // The FATAL, UNREACHABLE and UNIMPLEMENTED macros are useful during | 16 // The FATAL, UNREACHABLE and UNIMPLEMENTED macros are useful during |
| 16 // development, but they should not be relied on in the final product. | 17 // development, but they should not be relied on in the final product. |
| 17 #ifdef DEBUG | 18 #ifdef DEBUG |
| 18 #define FATAL(msg) \ | 19 #define FATAL(msg) \ |
| 19 V8_Fatal(__FILE__, __LINE__, "%s", (msg)) | 20 V8_Fatal(__FILE__, __LINE__, "%s", (msg)) |
| 20 #define UNIMPLEMENTED() \ | 21 #define UNIMPLEMENTED() \ |
| 21 V8_Fatal(__FILE__, __LINE__, "unimplemented code") | 22 V8_Fatal(__FILE__, __LINE__, "unimplemented code") |
| 22 #define UNREACHABLE() \ | 23 #define UNREACHABLE() \ |
| 23 V8_Fatal(__FILE__, __LINE__, "unreachable code") | 24 V8_Fatal(__FILE__, __LINE__, "unreachable code") |
| 24 #else | 25 #else |
| 25 #define FATAL(msg) \ | 26 #define FATAL(msg) \ |
| 26 V8_Fatal("", 0, "%s", (msg)) | 27 V8_Fatal("", 0, "%s", (msg)) |
| 27 #define UNIMPLEMENTED() \ | 28 #define UNIMPLEMENTED() \ |
| 28 V8_Fatal("", 0, "unimplemented code") | 29 V8_Fatal("", 0, "unimplemented code") |
| 29 #define UNREACHABLE() ((void) 0) | 30 #define UNREACHABLE() ((void) 0) |
| 30 #endif | 31 #endif |
| 31 | 32 |
| 32 // Simulator specific helpers. | 33 // Simulator specific helpers. |
| 33 #if defined(USE_SIMULATOR) && defined(V8_TARGET_ARCH_ARM64) | 34 // We can't use USE_SIMULATOR here because it isn't defined yet. |
| 35 #if V8_TARGET_ARCH_ARM64 && !V8_HOST_ARCH_ARM64 |
| 34 // TODO(all): If possible automatically prepend an indicator like | 36 // TODO(all): If possible automatically prepend an indicator like |
| 35 // UNIMPLEMENTED or LOCATION. | 37 // UNIMPLEMENTED or LOCATION. |
| 36 #define ASM_UNIMPLEMENTED(message) \ | 38 #define ASM_UNIMPLEMENTED(message) \ |
| 37 __ Debug(message, __LINE__, NO_PARAM) | 39 __ Debug(message, __LINE__, NO_PARAM) |
| 38 #define ASM_UNIMPLEMENTED_BREAK(message) \ | 40 #define ASM_UNIMPLEMENTED_BREAK(message) \ |
| 39 __ Debug(message, __LINE__, \ | 41 __ Debug(message, __LINE__, \ |
| 40 FLAG_ignore_asm_unimplemented_break ? NO_PARAM : BREAK) | 42 FLAG_ignore_asm_unimplemented_break ? NO_PARAM : BREAK) |
| 41 #define ASM_LOCATION(message) \ | 43 #define ASM_LOCATION(message) \ |
| 42 __ Debug("LOCATION: " message, __LINE__, NO_PARAM) | 44 __ Debug("LOCATION: " message, __LINE__, NO_PARAM) |
| 43 #else | 45 #else |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 290 |
| 289 // "Extra checks" are lightweight checks that are enabled in some release | 291 // "Extra checks" are lightweight checks that are enabled in some release |
| 290 // builds. | 292 // builds. |
| 291 #ifdef ENABLE_EXTRA_CHECKS | 293 #ifdef ENABLE_EXTRA_CHECKS |
| 292 #define EXTRA_CHECK(condition) CHECK(condition) | 294 #define EXTRA_CHECK(condition) CHECK(condition) |
| 293 #else | 295 #else |
| 294 #define EXTRA_CHECK(condition) ((void) 0) | 296 #define EXTRA_CHECK(condition) ((void) 0) |
| 295 #endif | 297 #endif |
| 296 | 298 |
| 297 #endif // V8_CHECKS_H_ | 299 #endif // V8_CHECKS_H_ |
| OLD | NEW |