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

Side by Side Diff: src/checks.h

Issue 139973004: A64: Synchronize with r15814. (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/char-predicates-inl.h ('k') | src/circular-queue.h » ('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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 #define CHECK_NE(unexpected, value) CheckNonEqualsHelper(__FILE__, __LINE__, \ 291 #define CHECK_NE(unexpected, value) CheckNonEqualsHelper(__FILE__, __LINE__, \
292 #unexpected, unexpected, #value, value) 292 #unexpected, unexpected, #value, value)
293 293
294 294
295 #define CHECK_GT(a, b) CHECK((a) > (b)) 295 #define CHECK_GT(a, b) CHECK((a) > (b))
296 #define CHECK_GE(a, b) CHECK((a) >= (b)) 296 #define CHECK_GE(a, b) CHECK((a) >= (b))
297 #define CHECK_LT(a, b) CHECK((a) < (b)) 297 #define CHECK_LT(a, b) CHECK((a) < (b))
298 #define CHECK_LE(a, b) CHECK((a) <= (b)) 298 #define CHECK_LE(a, b) CHECK((a) <= (b))
299 299
300 300
301 // Use C++11 static_assert if possible, which gives error
302 // messages that are easier to understand on first sight.
303 #if __cplusplus >= 201103L
304 #define STATIC_CHECK(test) static_assert(test, #test)
305 #else
301 // This is inspired by the static assertion facility in boost. This 306 // This is inspired by the static assertion facility in boost. This
302 // is pretty magical. If it causes you trouble on a platform you may 307 // is pretty magical. If it causes you trouble on a platform you may
303 // find a fix in the boost code. 308 // find a fix in the boost code.
304 template <bool> class StaticAssertion; 309 template <bool> class StaticAssertion;
305 template <> class StaticAssertion<true> { }; 310 template <> class StaticAssertion<true> { };
306 // This macro joins two tokens. If one of the tokens is a macro the 311 // This macro joins two tokens. If one of the tokens is a macro the
307 // helper call causes it to be resolved before joining. 312 // helper call causes it to be resolved before joining.
308 #define SEMI_STATIC_JOIN(a, b) SEMI_STATIC_JOIN_HELPER(a, b) 313 #define SEMI_STATIC_JOIN(a, b) SEMI_STATIC_JOIN_HELPER(a, b)
309 #define SEMI_STATIC_JOIN_HELPER(a, b) a##b 314 #define SEMI_STATIC_JOIN_HELPER(a, b) a##b
310 // Causes an error during compilation of the condition is not 315 // Causes an error during compilation of the condition is not
311 // statically known to be true. It is formulated as a typedef so that 316 // statically known to be true. It is formulated as a typedef so that
312 // it can be used wherever a typedef can be used. Beware that this 317 // it can be used wherever a typedef can be used. Beware that this
313 // actually causes each use to introduce a new defined type with a 318 // actually causes each use to introduce a new defined type with a
314 // name depending on the source line. 319 // name depending on the source line.
315 template <int> class StaticAssertionHelper { }; 320 template <int> class StaticAssertionHelper { };
316 #define STATIC_CHECK(test) \ 321 #define STATIC_CHECK(test) \
317 typedef \ 322 typedef \
318 StaticAssertionHelper<sizeof(StaticAssertion<static_cast<bool>((test))>)> \ 323 StaticAssertionHelper<sizeof(StaticAssertion<static_cast<bool>((test))>)> \
319 SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__) 324 SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__)
325 #endif
320 326
321 327
322 extern bool FLAG_enable_slow_asserts; 328 extern bool FLAG_enable_slow_asserts;
323 329
324 330
325 // The ASSERT macro is equivalent to CHECK except that it only 331 // The ASSERT macro is equivalent to CHECK except that it only
326 // generates code in debug builds. 332 // generates code in debug builds.
327 #ifdef DEBUG 333 #ifdef DEBUG
328 #define ASSERT_RESULT(expr) CHECK(expr) 334 #define ASSERT_RESULT(expr) CHECK(expr)
329 #define ASSERT(condition) CHECK(condition) 335 #define ASSERT(condition) CHECK(condition)
(...skipping 24 matching lines...) Expand all
354 360
355 // "Extra checks" are lightweight checks that are enabled in some release 361 // "Extra checks" are lightweight checks that are enabled in some release
356 // builds. 362 // builds.
357 #ifdef ENABLE_EXTRA_CHECKS 363 #ifdef ENABLE_EXTRA_CHECKS
358 #define EXTRA_CHECK(condition) CHECK(condition) 364 #define EXTRA_CHECK(condition) CHECK(condition)
359 #else 365 #else
360 #define EXTRA_CHECK(condition) ((void) 0) 366 #define EXTRA_CHECK(condition) ((void) 0)
361 #endif 367 #endif
362 368
363 #endif // V8_CHECKS_H_ 369 #endif // V8_CHECKS_H_
OLDNEW
« no previous file with comments | « src/char-predicates-inl.h ('k') | src/circular-queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698