blob: 80404e8d89710e9360da27ffbaef9e5e47a28cc3 [file] [log] [blame]
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001// Copyright 2012 the V8 project authors. All rights reserved.
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
Steve Blocka7e24c12009-10-30 11:49:00 +00004
5#ifndef V8_CHECKS_H_
6#define V8_CHECKS_H_
7
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00008#include "include/v8.h"
Ben Murdochb8a8cc12014-11-26 15:28:44 +00009#include "src/base/logging.h"
Steve Blocka7e24c12009-10-30 11:49:00 +000010
Ben Murdochb8a8cc12014-11-26 15:28:44 +000011namespace v8 {
Steve Blocka7e24c12009-10-30 11:49:00 +000012
Ben Murdochb8a8cc12014-11-26 15:28:44 +000013class Value;
Steve Blocka7e24c12009-10-30 11:49:00 +000014
Ben Murdochb8a8cc12014-11-26 15:28:44 +000015namespace internal {
Steve Blocka7e24c12009-10-30 11:49:00 +000016
Ben Murdochb8a8cc12014-11-26 15:28:44 +000017#ifdef ENABLE_SLOW_DCHECKS
18#define SLOW_DCHECK(condition) \
19 CHECK(!v8::internal::FLAG_enable_slow_asserts || (condition))
Ben Murdoch3ef787d2012-04-12 10:51:47 +010020extern bool FLAG_enable_slow_asserts;
Steve Blocka7e24c12009-10-30 11:49:00 +000021#else
Ben Murdochb8a8cc12014-11-26 15:28:44 +000022#define SLOW_DCHECK(condition) ((void) 0)
23const bool FLAG_enable_slow_asserts = false;
Steve Blocka7e24c12009-10-30 11:49:00 +000024#endif
Steve Blocka7e24c12009-10-30 11:49:00 +000025
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000026} // namespace internal
27} // namespace v8
Ben Murdochb8a8cc12014-11-26 15:28:44 +000028
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000029#define DCHECK_TAG_ALIGNED(address) \
30 DCHECK((reinterpret_cast<intptr_t>(address) & \
31 ::v8::internal::kHeapObjectTagMask) == 0)
Ben Murdochb8a8cc12014-11-26 15:28:44 +000032
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000033#define DCHECK_SIZE_TAG_ALIGNED(size) \
34 DCHECK((size & ::v8::internal::kHeapObjectTagMask) == 0)
Steve Blocka7e24c12009-10-30 11:49:00 +000035
36#endif // V8_CHECKS_H_