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

Side by Side Diff: src/checks.h

Issue 133443009: A64: Synchronize with r17441. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months 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/builtins.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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 // actually causes each use to introduce a new defined type with a 333 // actually causes each use to introduce a new defined type with a
334 // name depending on the source line. 334 // name depending on the source line.
335 template <int> class StaticAssertionHelper { }; 335 template <int> class StaticAssertionHelper { };
336 #define STATIC_CHECK(test) \ 336 #define STATIC_CHECK(test) \
337 typedef \ 337 typedef \
338 StaticAssertionHelper<sizeof(StaticAssertion<static_cast<bool>((test))>)> \ 338 StaticAssertionHelper<sizeof(StaticAssertion<static_cast<bool>((test))>)> \
339 SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__) 339 SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__)
340 #endif 340 #endif
341 341
342 342
343 #ifdef DEBUG
344 #ifndef OPTIMIZED_DEBUG
345 #define ENABLE_SLOW_ASSERTS 1
346 #endif
347 #endif
348
349 namespace v8 {
350 namespace internal {
351 #ifdef ENABLE_SLOW_ASSERTS
352 #define SLOW_ASSERT(condition) \
353 CHECK(!v8::internal::FLAG_enable_slow_asserts || (condition))
343 extern bool FLAG_enable_slow_asserts; 354 extern bool FLAG_enable_slow_asserts;
355 #else
356 #define SLOW_ASSERT(condition) ((void) 0)
357 const bool FLAG_enable_slow_asserts = false;
358 #endif
359 } // namespace internal
360 } // namespace v8
344 361
345 362
346 // The ASSERT macro is equivalent to CHECK except that it only 363 // The ASSERT macro is equivalent to CHECK except that it only
347 // generates code in debug builds. 364 // generates code in debug builds.
348 #ifdef DEBUG 365 #ifdef DEBUG
349 #define ASSERT_RESULT(expr) CHECK(expr) 366 #define ASSERT_RESULT(expr) CHECK(expr)
350 #define ASSERT(condition) CHECK(condition) 367 #define ASSERT(condition) CHECK(condition)
351 #define ASSERT_EQ(v1, v2) CHECK_EQ(v1, v2) 368 #define ASSERT_EQ(v1, v2) CHECK_EQ(v1, v2)
352 #define ASSERT_NE(v1, v2) CHECK_NE(v1, v2) 369 #define ASSERT_NE(v1, v2) CHECK_NE(v1, v2)
353 #define ASSERT_GE(v1, v2) CHECK_GE(v1, v2) 370 #define ASSERT_GE(v1, v2) CHECK_GE(v1, v2)
354 #define ASSERT_LT(v1, v2) CHECK_LT(v1, v2) 371 #define ASSERT_LT(v1, v2) CHECK_LT(v1, v2)
355 #define ASSERT_LE(v1, v2) CHECK_LE(v1, v2) 372 #define ASSERT_LE(v1, v2) CHECK_LE(v1, v2)
356 #define SLOW_ASSERT(condition) CHECK(!FLAG_enable_slow_asserts || (condition))
357 #else 373 #else
358 #define ASSERT_RESULT(expr) (expr) 374 #define ASSERT_RESULT(expr) (expr)
359 #define ASSERT(condition) ((void) 0) 375 #define ASSERT(condition) ((void) 0)
360 #define ASSERT_EQ(v1, v2) ((void) 0) 376 #define ASSERT_EQ(v1, v2) ((void) 0)
361 #define ASSERT_NE(v1, v2) ((void) 0) 377 #define ASSERT_NE(v1, v2) ((void) 0)
362 #define ASSERT_GE(v1, v2) ((void) 0) 378 #define ASSERT_GE(v1, v2) ((void) 0)
363 #define ASSERT_LT(v1, v2) ((void) 0) 379 #define ASSERT_LT(v1, v2) ((void) 0)
364 #define ASSERT_LE(v1, v2) ((void) 0) 380 #define ASSERT_LE(v1, v2) ((void) 0)
365 #define SLOW_ASSERT(condition) ((void) 0)
366 #endif 381 #endif
367 // Static asserts has no impact on runtime performance, so they can be 382 // Static asserts has no impact on runtime performance, so they can be
368 // safely enabled in release mode. Moreover, the ((void) 0) expression 383 // safely enabled in release mode. Moreover, the ((void) 0) expression
369 // obeys different syntax rules than typedef's, e.g. it can't appear 384 // obeys different syntax rules than typedef's, e.g. it can't appear
370 // inside class declaration, this leads to inconsistency between debug 385 // inside class declaration, this leads to inconsistency between debug
371 // and release compilation modes behavior. 386 // and release compilation modes behavior.
372 #define STATIC_ASSERT(test) STATIC_CHECK(test) 387 #define STATIC_ASSERT(test) STATIC_CHECK(test)
373 388
374 #define ASSERT_NOT_NULL(p) ASSERT_NE(NULL, p) 389 #define ASSERT_NOT_NULL(p) ASSERT_NE(NULL, p)
375 390
376 // "Extra checks" are lightweight checks that are enabled in some release 391 // "Extra checks" are lightweight checks that are enabled in some release
377 // builds. 392 // builds.
378 #ifdef ENABLE_EXTRA_CHECKS 393 #ifdef ENABLE_EXTRA_CHECKS
379 #define EXTRA_CHECK(condition) CHECK(condition) 394 #define EXTRA_CHECK(condition) CHECK(condition)
380 #else 395 #else
381 #define EXTRA_CHECK(condition) ((void) 0) 396 #define EXTRA_CHECK(condition) ((void) 0)
382 #endif 397 #endif
383 398
384 #endif // V8_CHECKS_H_ 399 #endif // V8_CHECKS_H_
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/checks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698