| 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" |
| 8 #include "src/base/logging.h" | 9 #include "src/base/logging.h" |
| 9 | 10 |
| 10 namespace v8 { | 11 namespace v8 { |
| 11 | 12 |
| 12 class Value; | 13 class Value; |
| 13 template <class T> class Handle; | 14 template <class T> class Handle; |
| 14 | 15 |
| 15 namespace internal { | 16 namespace internal { |
| 16 | 17 |
| 17 intptr_t HeapObjectTagMask(); | |
| 18 | |
| 19 #ifdef ENABLE_SLOW_DCHECKS | 18 #ifdef ENABLE_SLOW_DCHECKS |
| 20 #define SLOW_DCHECK(condition) \ | 19 #define SLOW_DCHECK(condition) \ |
| 21 CHECK(!v8::internal::FLAG_enable_slow_asserts || (condition)) | 20 CHECK(!v8::internal::FLAG_enable_slow_asserts || (condition)) |
| 22 extern bool FLAG_enable_slow_asserts; | 21 extern bool FLAG_enable_slow_asserts; |
| 23 #else | 22 #else |
| 24 #define SLOW_DCHECK(condition) ((void) 0) | 23 #define SLOW_DCHECK(condition) ((void) 0) |
| 25 const bool FLAG_enable_slow_asserts = false; | 24 const bool FLAG_enable_slow_asserts = false; |
| 26 #endif | 25 #endif |
| 27 | 26 |
| 28 } } // namespace v8::internal | 27 } } // namespace v8::internal |
| 29 | 28 |
| 29 #define DCHECK_TAG_ALIGNED(address) \ |
| 30 DCHECK((reinterpret_cast<intptr_t>(address) & \ |
| 31 ::v8::internal::kHeapObjectTagMask) == 0) |
| 30 | 32 |
| 31 void CheckNonEqualsHelper(const char* file, int line, | 33 #define DCHECK_SIZE_TAG_ALIGNED(size) \ |
| 32 const char* expected_source, double expected, | 34 DCHECK((size & ::v8::internal::kHeapObjectTagMask) == 0) |
| 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) | |
| 55 | 35 |
| 56 #endif // V8_CHECKS_H_ | 36 #endif // V8_CHECKS_H_ |
| OLD | NEW |