Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(775)

Side by Side Diff: src/checks.h

Issue 39183004: Define DEBUG for v8_optimized_debug=2 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ast.cc ('k') | src/checks.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 // actually causes each use to introduce a new defined type with a 265 // actually causes each use to introduce a new defined type with a
266 // name depending on the source line. 266 // name depending on the source line.
267 template <int> class StaticAssertionHelper { }; 267 template <int> class StaticAssertionHelper { };
268 #define STATIC_CHECK(test) \ 268 #define STATIC_CHECK(test) \
269 typedef \ 269 typedef \
270 StaticAssertionHelper<sizeof(StaticAssertion<static_cast<bool>((test))>)> \ 270 StaticAssertionHelper<sizeof(StaticAssertion<static_cast<bool>((test))>)> \
271 SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__) 271 SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__)
272 #endif 272 #endif
273 273
274 274
275 #ifdef DEBUG
276 #ifndef OPTIMIZED_DEBUG
277 #define ENABLE_SLOW_ASSERTS 1
278 #endif
279 #endif
280
281 namespace v8 {
282 namespace internal {
283 #ifdef ENABLE_SLOW_ASSERTS
284 #define SLOW_ASSERT(condition) \
285 CHECK(!v8::internal::FLAG_enable_slow_asserts || (condition))
275 extern bool FLAG_enable_slow_asserts; 286 extern bool FLAG_enable_slow_asserts;
287 #else
288 #define SLOW_ASSERT(condition) ((void) 0)
289 const bool FLAG_enable_slow_asserts = false;
290 #endif
291 } // namespace internal
292 } // namespace v8
276 293
277 294
278 // The ASSERT macro is equivalent to CHECK except that it only 295 // The ASSERT macro is equivalent to CHECK except that it only
279 // generates code in debug builds. 296 // generates code in debug builds.
280 #ifdef DEBUG 297 #ifdef DEBUG
281 #define ASSERT_RESULT(expr) CHECK(expr) 298 #define ASSERT_RESULT(expr) CHECK(expr)
282 #define ASSERT(condition) CHECK(condition) 299 #define ASSERT(condition) CHECK(condition)
283 #define ASSERT_EQ(v1, v2) CHECK_EQ(v1, v2) 300 #define ASSERT_EQ(v1, v2) CHECK_EQ(v1, v2)
284 #define ASSERT_NE(v1, v2) CHECK_NE(v1, v2) 301 #define ASSERT_NE(v1, v2) CHECK_NE(v1, v2)
285 #define ASSERT_GE(v1, v2) CHECK_GE(v1, v2) 302 #define ASSERT_GE(v1, v2) CHECK_GE(v1, v2)
286 #define ASSERT_LT(v1, v2) CHECK_LT(v1, v2) 303 #define ASSERT_LT(v1, v2) CHECK_LT(v1, v2)
287 #define ASSERT_LE(v1, v2) CHECK_LE(v1, v2) 304 #define ASSERT_LE(v1, v2) CHECK_LE(v1, v2)
288 #define SLOW_ASSERT(condition) CHECK(!FLAG_enable_slow_asserts || (condition))
289 #else 305 #else
290 #define ASSERT_RESULT(expr) (expr) 306 #define ASSERT_RESULT(expr) (expr)
291 #define ASSERT(condition) ((void) 0) 307 #define ASSERT(condition) ((void) 0)
292 #define ASSERT_EQ(v1, v2) ((void) 0) 308 #define ASSERT_EQ(v1, v2) ((void) 0)
293 #define ASSERT_NE(v1, v2) ((void) 0) 309 #define ASSERT_NE(v1, v2) ((void) 0)
294 #define ASSERT_GE(v1, v2) ((void) 0) 310 #define ASSERT_GE(v1, v2) ((void) 0)
295 #define ASSERT_LT(v1, v2) ((void) 0) 311 #define ASSERT_LT(v1, v2) ((void) 0)
296 #define ASSERT_LE(v1, v2) ((void) 0) 312 #define ASSERT_LE(v1, v2) ((void) 0)
297 #define SLOW_ASSERT(condition) ((void) 0)
298 #endif 313 #endif
299 // Static asserts has no impact on runtime performance, so they can be 314 // Static asserts has no impact on runtime performance, so they can be
300 // safely enabled in release mode. Moreover, the ((void) 0) expression 315 // safely enabled in release mode. Moreover, the ((void) 0) expression
301 // obeys different syntax rules than typedef's, e.g. it can't appear 316 // obeys different syntax rules than typedef's, e.g. it can't appear
302 // inside class declaration, this leads to inconsistency between debug 317 // inside class declaration, this leads to inconsistency between debug
303 // and release compilation modes behavior. 318 // and release compilation modes behavior.
304 #define STATIC_ASSERT(test) STATIC_CHECK(test) 319 #define STATIC_ASSERT(test) STATIC_CHECK(test)
305 320
306 #define ASSERT_NOT_NULL(p) ASSERT_NE(NULL, p) 321 #define ASSERT_NOT_NULL(p) ASSERT_NE(NULL, p)
307 322
308 // "Extra checks" are lightweight checks that are enabled in some release 323 // "Extra checks" are lightweight checks that are enabled in some release
309 // builds. 324 // builds.
310 #ifdef ENABLE_EXTRA_CHECKS 325 #ifdef ENABLE_EXTRA_CHECKS
311 #define EXTRA_CHECK(condition) CHECK(condition) 326 #define EXTRA_CHECK(condition) CHECK(condition)
312 #else 327 #else
313 #define EXTRA_CHECK(condition) ((void) 0) 328 #define EXTRA_CHECK(condition) ((void) 0)
314 #endif 329 #endif
315 330
316 #endif // V8_CHECKS_H_ 331 #endif // V8_CHECKS_H_
OLDNEW
« no previous file with comments | « src/ast.cc ('k') | src/checks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698