| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #include <string.h> | 31 #include <string.h> |
| 32 | 32 |
| 33 #include "flags.h" | 33 #include "flags.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 void API_Fatal(const char* location, const char* format, ...); | 36 void API_Fatal(const char* location, const char* format, ...); |
| 37 | 37 |
| 38 // The FATAL, UNREACHABLE and UNIMPLEMENTED macros are useful during | 38 // The FATAL, UNREACHABLE and UNIMPLEMENTED macros are useful during |
| 39 // 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. |
| 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 | 43 #define UNIMPLEMENTED() \ |
| 44 V8_Fatal(__FILE__, __LINE__, "unimplemented code") |
| 43 #define UNREACHABLE() \ | 45 #define UNREACHABLE() \ |
| 44 V8_Fatal(__FILE__, __LINE__, "unreachable code") | 46 V8_Fatal(__FILE__, __LINE__, "unreachable code") |
| 45 | 47 #else |
| 48 #define FATAL(msg) \ |
| 49 V8_Fatal("", 0, "%s", (msg)) |
| 46 #define UNIMPLEMENTED() \ | 50 #define UNIMPLEMENTED() \ |
| 47 V8_Fatal(__FILE__, __LINE__, "unimplemented code") | 51 V8_Fatal("", 0, "unimplemented code") |
| 52 #define UNREACHABLE() ((void) 0) |
| 53 #endif |
| 48 | 54 |
| 49 | 55 |
| 50 // Used by the CHECK macro -- should not be called directly. | 56 // Used by the CHECK macro -- should not be called directly. |
| 51 static inline void CheckHelper(const char* file, | 57 static inline void CheckHelper(const char* file, |
| 52 int line, | 58 int line, |
| 53 const char* source, | 59 const char* source, |
| 54 bool condition) { | 60 bool condition) { |
| 55 if (!condition) | 61 if (!condition) |
| 56 V8_Fatal(file, line, "CHECK(%s) failed", source); | 62 V8_Fatal(file, line, "CHECK(%s) failed", source); |
| 57 } | 63 } |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 #define SLOW_ASSERT(condition) ((void) 0) | 243 #define SLOW_ASSERT(condition) ((void) 0) |
| 238 #endif | 244 #endif |
| 239 | 245 |
| 240 | 246 |
| 241 #define ASSERT_TAG_ALIGNED(address) \ | 247 #define ASSERT_TAG_ALIGNED(address) \ |
| 242 ASSERT((reinterpret_cast<int>(address) & kHeapObjectTagMask) == 0) | 248 ASSERT((reinterpret_cast<int>(address) & kHeapObjectTagMask) == 0) |
| 243 | 249 |
| 244 #define ASSERT_SIZE_TAG_ALIGNED(size) ASSERT((size & kHeapObjectTagMask) == 0) | 250 #define ASSERT_SIZE_TAG_ALIGNED(size) ASSERT((size & kHeapObjectTagMask) == 0) |
| 245 | 251 |
| 246 #endif // V8_CHECKS_H_ | 252 #endif // V8_CHECKS_H_ |
| OLD | NEW |