2012-01-04 14:45:29 +00:00
|
|
|
// Copyright 2012 the V8 project authors. All rights reserved.
|
2014-04-29 06:42:26 +00:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
#ifndef V8_CHECKS_H_
|
|
|
|
#define V8_CHECKS_H_
|
|
|
|
|
2014-06-30 13:25:46 +00:00
|
|
|
#include "src/base/logging.h"
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2013-10-25 11:10:28 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
#ifndef OPTIMIZED_DEBUG
|
2014-08-04 11:34:54 +00:00
|
|
|
#define ENABLE_SLOW_DCHECKS 1
|
2013-10-25 11:10:28 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
namespace v8 {
|
2014-06-30 13:25:46 +00:00
|
|
|
|
|
|
|
class Value;
|
|
|
|
template <class T> class Handle;
|
|
|
|
|
2013-10-25 11:10:28 +00:00
|
|
|
namespace internal {
|
2014-06-30 13:25:46 +00:00
|
|
|
|
|
|
|
intptr_t HeapObjectTagMask();
|
|
|
|
|
2014-08-04 11:34:54 +00:00
|
|
|
#ifdef ENABLE_SLOW_DCHECKS
|
|
|
|
#define SLOW_DCHECK(condition) \
|
2013-10-25 11:10:28 +00:00
|
|
|
CHECK(!v8::internal::FLAG_enable_slow_asserts || (condition))
|
2011-10-13 11:54:19 +00:00
|
|
|
extern bool FLAG_enable_slow_asserts;
|
2013-10-25 11:10:28 +00:00
|
|
|
#else
|
2014-08-04 11:34:54 +00:00
|
|
|
#define SLOW_DCHECK(condition) ((void) 0)
|
2013-10-25 11:10:28 +00:00
|
|
|
const bool FLAG_enable_slow_asserts = false;
|
|
|
|
#endif
|
2014-03-17 13:33:19 +00:00
|
|
|
|
|
|
|
} } // namespace v8::internal
|
2010-11-05 13:33:40 +00:00
|
|
|
|
|
|
|
|
2014-07-30 13:54:45 +00:00
|
|
|
void CheckNonEqualsHelper(const char* file, int line,
|
|
|
|
const char* expected_source, double expected,
|
|
|
|
const char* value_source, double value);
|
|
|
|
|
|
|
|
void CheckEqualsHelper(const char* file, int line, const char* expected_source,
|
|
|
|
double expected, const char* value_source, double value);
|
|
|
|
|
|
|
|
void CheckNonEqualsHelper(const char* file, int line,
|
2014-06-30 13:25:46 +00:00
|
|
|
const char* unexpected_source,
|
|
|
|
v8::Handle<v8::Value> unexpected,
|
|
|
|
const char* value_source,
|
|
|
|
v8::Handle<v8::Value> value);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2014-06-30 13:25:46 +00:00
|
|
|
void CheckEqualsHelper(const char* file,
|
|
|
|
int line,
|
|
|
|
const char* expected_source,
|
|
|
|
v8::Handle<v8::Value> expected,
|
|
|
|
const char* value_source,
|
|
|
|
v8::Handle<v8::Value> value);
|
2008-11-25 11:07:48 +00:00
|
|
|
|
2014-08-04 11:34:54 +00:00
|
|
|
#define DCHECK_TAG_ALIGNED(address) \
|
|
|
|
DCHECK((reinterpret_cast<intptr_t>(address) & HeapObjectTagMask()) == 0)
|
2014-06-30 13:25:46 +00:00
|
|
|
|
2014-08-04 11:34:54 +00:00
|
|
|
#define DCHECK_SIZE_TAG_ALIGNED(size) DCHECK((size & HeapObjectTagMask()) == 0)
|
2012-09-05 16:06:53 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
#endif // V8_CHECKS_H_
|