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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 namespace v8 { | 299 namespace v8 { |
300 namespace internal { | 300 namespace internal { |
301 #ifdef ENABLE_SLOW_ASSERTS | 301 #ifdef ENABLE_SLOW_ASSERTS |
302 #define SLOW_ASSERT(condition) \ | 302 #define SLOW_ASSERT(condition) \ |
303 CHECK(!v8::internal::FLAG_enable_slow_asserts || (condition)) | 303 CHECK(!v8::internal::FLAG_enable_slow_asserts || (condition)) |
304 extern bool FLAG_enable_slow_asserts; | 304 extern bool FLAG_enable_slow_asserts; |
305 #else | 305 #else |
306 #define SLOW_ASSERT(condition) ((void) 0) | 306 #define SLOW_ASSERT(condition) ((void) 0) |
307 const bool FLAG_enable_slow_asserts = false; | 307 const bool FLAG_enable_slow_asserts = false; |
308 #endif | 308 #endif |
309 } // namespace internal | 309 |
310 } // namespace v8 | 310 // Exposed for making debugging easier (to see where your function is being |
| 311 // called, just add a call to DumpBacktrace). |
| 312 void DumpBacktrace(); |
| 313 |
| 314 } } // namespace v8::internal |
311 | 315 |
312 | 316 |
313 // The ASSERT macro is equivalent to CHECK except that it only | 317 // The ASSERT macro is equivalent to CHECK except that it only |
314 // generates code in debug builds. | 318 // generates code in debug builds. |
315 #ifdef DEBUG | 319 #ifdef DEBUG |
316 #define ASSERT_RESULT(expr) CHECK(expr) | 320 #define ASSERT_RESULT(expr) CHECK(expr) |
317 #define ASSERT(condition) CHECK(condition) | 321 #define ASSERT(condition) CHECK(condition) |
318 #define ASSERT_EQ(v1, v2) CHECK_EQ(v1, v2) | 322 #define ASSERT_EQ(v1, v2) CHECK_EQ(v1, v2) |
319 #define ASSERT_NE(v1, v2) CHECK_NE(v1, v2) | 323 #define ASSERT_NE(v1, v2) CHECK_NE(v1, v2) |
320 #define ASSERT_GE(v1, v2) CHECK_GE(v1, v2) | 324 #define ASSERT_GE(v1, v2) CHECK_GE(v1, v2) |
(...skipping 19 matching lines...) Expand all Loading... |
340 | 344 |
341 // "Extra checks" are lightweight checks that are enabled in some release | 345 // "Extra checks" are lightweight checks that are enabled in some release |
342 // builds. | 346 // builds. |
343 #ifdef ENABLE_EXTRA_CHECKS | 347 #ifdef ENABLE_EXTRA_CHECKS |
344 #define EXTRA_CHECK(condition) CHECK(condition) | 348 #define EXTRA_CHECK(condition) CHECK(condition) |
345 #else | 349 #else |
346 #define EXTRA_CHECK(condition) ((void) 0) | 350 #define EXTRA_CHECK(condition) ((void) 0) |
347 #endif | 351 #endif |
348 | 352 |
349 #endif // V8_CHECKS_H_ | 353 #endif // V8_CHECKS_H_ |
OLD | NEW |