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 "src/base/logging.h" | 8 #include "src/base/logging.h" |
9 | 9 |
10 #ifdef DEBUG | 10 #ifdef DEBUG |
11 #ifndef OPTIMIZED_DEBUG | 11 #ifndef OPTIMIZED_DEBUG |
12 #define ENABLE_SLOW_DCHECKS 1 | 12 #define ENABLE_SLOW_DCHECKS 1 |
13 #endif | 13 #endif |
14 #endif | 14 #endif |
15 | 15 |
16 namespace v8 { | 16 namespace v8 { |
17 | 17 |
18 class Value; | 18 class Value; |
19 template <class T> class Handle; | 19 template <class T> |
| 20 class Local; |
20 | 21 |
21 namespace internal { | 22 namespace internal { |
22 | 23 |
23 intptr_t HeapObjectTagMask(); | 24 intptr_t HeapObjectTagMask(); |
24 | 25 |
25 #ifdef ENABLE_SLOW_DCHECKS | 26 #ifdef ENABLE_SLOW_DCHECKS |
26 #define SLOW_DCHECK(condition) \ | 27 #define SLOW_DCHECK(condition) \ |
27 CHECK(!v8::internal::FLAG_enable_slow_asserts || (condition)) | 28 CHECK(!v8::internal::FLAG_enable_slow_asserts || (condition)) |
28 extern bool FLAG_enable_slow_asserts; | 29 extern bool FLAG_enable_slow_asserts; |
29 #else | 30 #else |
30 #define SLOW_DCHECK(condition) ((void) 0) | 31 #define SLOW_DCHECK(condition) ((void) 0) |
31 const bool FLAG_enable_slow_asserts = false; | 32 const bool FLAG_enable_slow_asserts = false; |
32 #endif | 33 #endif |
33 | 34 |
34 } } // namespace v8::internal | 35 } } // namespace v8::internal |
35 | 36 |
36 | 37 |
37 void CheckNonEqualsHelper(const char* file, int line, | 38 void CheckNonEqualsHelper(const char* file, int line, |
38 const char* expected_source, double expected, | 39 const char* expected_source, double expected, |
39 const char* value_source, double value); | 40 const char* value_source, double value); |
40 | 41 |
41 void CheckEqualsHelper(const char* file, int line, const char* expected_source, | 42 void CheckEqualsHelper(const char* file, int line, const char* expected_source, |
42 double expected, const char* value_source, double value); | 43 double expected, const char* value_source, double value); |
43 | 44 |
44 void CheckNonEqualsHelper(const char* file, int line, | 45 void CheckNonEqualsHelper(const char* file, int line, |
45 const char* unexpected_source, | 46 const char* unexpected_source, |
46 v8::Handle<v8::Value> unexpected, | 47 v8::Local<v8::Value> unexpected, |
47 const char* value_source, | 48 const char* value_source, v8::Local<v8::Value> value); |
48 v8::Handle<v8::Value> value); | |
49 | 49 |
50 void CheckEqualsHelper(const char* file, | 50 void CheckEqualsHelper(const char* file, int line, const char* expected_source, |
51 int line, | 51 v8::Local<v8::Value> expected, const char* value_source, |
52 const char* expected_source, | 52 v8::Local<v8::Value> value); |
53 v8::Handle<v8::Value> expected, | |
54 const char* value_source, | |
55 v8::Handle<v8::Value> value); | |
56 | 53 |
57 #define DCHECK_TAG_ALIGNED(address) \ | 54 #define DCHECK_TAG_ALIGNED(address) \ |
58 DCHECK((reinterpret_cast<intptr_t>(address) & HeapObjectTagMask()) == 0) | 55 DCHECK((reinterpret_cast<intptr_t>(address) & HeapObjectTagMask()) == 0) |
59 | 56 |
60 #define DCHECK_SIZE_TAG_ALIGNED(size) DCHECK((size & HeapObjectTagMask()) == 0) | 57 #define DCHECK_SIZE_TAG_ALIGNED(size) DCHECK((size & HeapObjectTagMask()) == 0) |
61 | 58 |
62 #endif // V8_CHECKS_H_ | 59 #endif // V8_CHECKS_H_ |
OLD | NEW |