| 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 13 matching lines...) Expand all Loading... |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 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 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, ...); |
| 35 | 36 |
| 36 // Define custom A64 preprocessor helpers to facilitate development. | 37 // Define custom A64 preprocessor helpers to facilitate development. |
| 37 #ifndef V8_TARGET_ARCH_A64 | 38 #ifndef V8_TARGET_ARCH_A64 |
| 38 | 39 |
| 39 // The FATAL, UNREACHABLE and UNIMPLEMENTED macros are useful during | 40 // The FATAL, UNREACHABLE and UNIMPLEMENTED macros are useful during |
| 40 // development, but they should not be relied on in the final product. | 41 // development, but they should not be relied on in the final product. |
| 41 #ifdef DEBUG | 42 #ifdef DEBUG |
| 42 #define FATAL(msg) \ | 43 #define FATAL(msg) \ |
| 43 V8_Fatal(__FILE__, __LINE__, "%s", (msg)) | 44 V8_Fatal(__FILE__, __LINE__, "%s", (msg)) |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 | 294 |
| 294 | 295 |
| 295 #define CHECK_GT(a, b) CHECK((a) > (b)) | 296 #define CHECK_GT(a, b) CHECK((a) > (b)) |
| 296 #define CHECK_GE(a, b) CHECK((a) >= (b)) | 297 #define CHECK_GE(a, b) CHECK((a) >= (b)) |
| 297 #define CHECK_LT(a, b) CHECK((a) < (b)) | 298 #define CHECK_LT(a, b) CHECK((a) < (b)) |
| 298 #define CHECK_LE(a, b) CHECK((a) <= (b)) | 299 #define CHECK_LE(a, b) CHECK((a) <= (b)) |
| 299 | 300 |
| 300 | 301 |
| 301 // Use C++11 static_assert if possible, which gives error | 302 // Use C++11 static_assert if possible, which gives error |
| 302 // messages that are easier to understand on first sight. | 303 // messages that are easier to understand on first sight. |
| 303 #if __cplusplus >= 201103L | 304 #if V8_HAS_CXX11_STATIC_ASSERT |
| 304 #define STATIC_CHECK(test) static_assert(test, #test) | 305 #define STATIC_CHECK(test) static_assert(test, #test) |
| 305 #else | 306 #else |
| 306 // This is inspired by the static assertion facility in boost. This | 307 // This is inspired by the static assertion facility in boost. This |
| 307 // is pretty magical. If it causes you trouble on a platform you may | 308 // is pretty magical. If it causes you trouble on a platform you may |
| 308 // find a fix in the boost code. | 309 // find a fix in the boost code. |
| 309 template <bool> class StaticAssertion; | 310 template <bool> class StaticAssertion; |
| 310 template <> class StaticAssertion<true> { }; | 311 template <> class StaticAssertion<true> { }; |
| 311 // This macro joins two tokens. If one of the tokens is a macro the | 312 // This macro joins two tokens. If one of the tokens is a macro the |
| 312 // helper call causes it to be resolved before joining. | 313 // helper call causes it to be resolved before joining. |
| 313 #define SEMI_STATIC_JOIN(a, b) SEMI_STATIC_JOIN_HELPER(a, b) | 314 #define SEMI_STATIC_JOIN(a, b) SEMI_STATIC_JOIN_HELPER(a, b) |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 | 361 |
| 361 // "Extra checks" are lightweight checks that are enabled in some release | 362 // "Extra checks" are lightweight checks that are enabled in some release |
| 362 // builds. | 363 // builds. |
| 363 #ifdef ENABLE_EXTRA_CHECKS | 364 #ifdef ENABLE_EXTRA_CHECKS |
| 364 #define EXTRA_CHECK(condition) CHECK(condition) | 365 #define EXTRA_CHECK(condition) CHECK(condition) |
| 365 #else | 366 #else |
| 366 #define EXTRA_CHECK(condition) ((void) 0) | 367 #define EXTRA_CHECK(condition) ((void) 0) |
| 367 #endif | 368 #endif |
| 368 | 369 |
| 369 #endif // V8_CHECKS_H_ | 370 #endif // V8_CHECKS_H_ |
| OLD | NEW |