checks.h 1.03 KB
Newer Older
1
// Copyright 2012 the V8 project authors. All rights reserved.
2 3
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
4

5 6
#ifndef V8_COMMON_CHECKS_H_
#define V8_COMMON_CHECKS_H_
7

8
#include "include/v8-internal.h"
9
#include "src/base/logging.h"
10
#include "src/common/globals.h"
11

12
namespace v8 {
13 14 15

class Value;

16
namespace internal {
17

18 19
#ifdef ENABLE_SLOW_DCHECKS
#define SLOW_DCHECK(condition) \
20
  CHECK(!v8::internal::FLAG_enable_slow_asserts || (condition))
21
#define SLOW_DCHECK_IMPLIES(lhs, rhs) SLOW_DCHECK(!(lhs) || (rhs))
22
V8_EXPORT_PRIVATE extern bool FLAG_enable_slow_asserts;
23
#else
24
#define SLOW_DCHECK(condition) ((void)0)
25
#define SLOW_DCHECK_IMPLIES(v1, v2) ((void)0)
26
static const bool FLAG_enable_slow_asserts = false;
27
#endif
28

29 30
}  // namespace internal
}  // namespace v8
31

32 33
#define DCHECK_TAG_ALIGNED(address) \
  DCHECK((address & ::v8::internal::kHeapObjectTagMask) == 0)
34

35 36
#define DCHECK_SIZE_TAG_ALIGNED(size) \
  DCHECK((size & ::v8::internal::kHeapObjectTagMask) == 0)
37

38
#endif  // V8_COMMON_CHECKS_H_