OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_CHECKS_H_ | 5 #ifndef V8_CHECKS_H_ |
6 #define V8_CHECKS_H_ | 6 #define V8_CHECKS_H_ |
7 | 7 |
8 #include "include/v8.h" | |
9 #include "src/base/logging.h" | 8 #include "src/base/logging.h" |
10 | 9 |
11 namespace v8 { | 10 namespace v8 { |
12 | 11 |
13 class Value; | 12 class Value; |
14 template <class T> class Handle; | 13 template <class T> class Handle; |
15 | 14 |
16 namespace internal { | 15 namespace internal { |
17 | 16 |
| 17 intptr_t HeapObjectTagMask(); |
| 18 |
18 #ifdef ENABLE_SLOW_DCHECKS | 19 #ifdef ENABLE_SLOW_DCHECKS |
19 #define SLOW_DCHECK(condition) \ | 20 #define SLOW_DCHECK(condition) \ |
20 CHECK(!v8::internal::FLAG_enable_slow_asserts || (condition)) | 21 CHECK(!v8::internal::FLAG_enable_slow_asserts || (condition)) |
21 extern bool FLAG_enable_slow_asserts; | 22 extern bool FLAG_enable_slow_asserts; |
22 #else | 23 #else |
23 #define SLOW_DCHECK(condition) ((void) 0) | 24 #define SLOW_DCHECK(condition) ((void) 0) |
24 const bool FLAG_enable_slow_asserts = false; | 25 const bool FLAG_enable_slow_asserts = false; |
25 #endif | 26 #endif |
26 | 27 |
27 } } // namespace v8::internal | 28 } } // namespace v8::internal |
28 | 29 |
29 #define DCHECK_TAG_ALIGNED(address) \ | |
30 DCHECK((reinterpret_cast<intptr_t>(address) & \ | |
31 ::v8::internal::kHeapObjectTagMask) == 0) | |
32 | 30 |
33 #define DCHECK_SIZE_TAG_ALIGNED(size) \ | 31 void CheckNonEqualsHelper(const char* file, int line, |
34 DCHECK((size & ::v8::internal::kHeapObjectTagMask) == 0) | 32 const char* expected_source, double expected, |
| 33 const char* value_source, double value); |
| 34 |
| 35 void CheckEqualsHelper(const char* file, int line, const char* expected_source, |
| 36 double expected, const char* value_source, double value); |
| 37 |
| 38 void CheckNonEqualsHelper(const char* file, int line, |
| 39 const char* unexpected_source, |
| 40 v8::Handle<v8::Value> unexpected, |
| 41 const char* value_source, |
| 42 v8::Handle<v8::Value> value); |
| 43 |
| 44 void CheckEqualsHelper(const char* file, |
| 45 int line, |
| 46 const char* expected_source, |
| 47 v8::Handle<v8::Value> expected, |
| 48 const char* value_source, |
| 49 v8::Handle<v8::Value> value); |
| 50 |
| 51 #define DCHECK_TAG_ALIGNED(address) \ |
| 52 DCHECK((reinterpret_cast<intptr_t>(address) & HeapObjectTagMask()) == 0) |
| 53 |
| 54 #define DCHECK_SIZE_TAG_ALIGNED(size) DCHECK((size & HeapObjectTagMask()) == 0) |
35 | 55 |
36 #endif // V8_CHECKS_H_ | 56 #endif // V8_CHECKS_H_ |
OLD | NEW |