1// Copyright 2012 the V8 project authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#ifndef V8_CHECKS_H_ 6#define V8_CHECKS_H_ 7 8#include "include/v8.h" 9#include "src/base/logging.h" 10#include "src/globals.h" 11 12namespace v8 { 13 14class Value; 15 16namespace internal { 17 18#ifdef ENABLE_SLOW_DCHECKS 19#define SLOW_DCHECK(condition) \ 20 CHECK(!v8::internal::FLAG_enable_slow_asserts || (condition)) 21V8_EXPORT_PRIVATE extern bool FLAG_enable_slow_asserts; 22#else 23#define SLOW_DCHECK(condition) ((void) 0) 24static const bool FLAG_enable_slow_asserts = false; 25#endif 26 27} // namespace internal 28} // namespace v8 29 30#define DCHECK_TAG_ALIGNED(address) \ 31 DCHECK((reinterpret_cast<intptr_t>(address) & \ 32 ::v8::internal::kHeapObjectTagMask) == 0) 33 34#define DCHECK_SIZE_TAG_ALIGNED(size) \ 35 DCHECK((size & ::v8::internal::kHeapObjectTagMask) == 0) 36 37#endif // V8_CHECKS_H_ 38