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_BASE_LOGGING_H_ | 5 #ifndef V8_BASE_LOGGING_H_ |
6 #define V8_BASE_LOGGING_H_ | 6 #define V8_BASE_LOGGING_H_ |
7 | 7 |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include "include/v8stdint.h" | 10 #include "include/v8stdint.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 namespace v8 { | 183 namespace v8 { |
184 namespace base { | 184 namespace base { |
185 | 185 |
186 // Exposed for making debugging easier (to see where your function is being | 186 // Exposed for making debugging easier (to see where your function is being |
187 // called, just add a call to DumpBacktrace). | 187 // called, just add a call to DumpBacktrace). |
188 void DumpBacktrace(); | 188 void DumpBacktrace(); |
189 | 189 |
190 } } // namespace v8::base | 190 } } // namespace v8::base |
191 | 191 |
192 | 192 |
193 // The ASSERT macro is equivalent to CHECK except that it only | 193 // The DCHECK macro is equivalent to CHECK except that it only |
194 // generates code in debug builds. | 194 // generates code in debug builds. |
195 #ifdef DEBUG | 195 #ifdef DEBUG |
196 #define ASSERT_RESULT(expr) CHECK(expr) | 196 #define DCHECK_RESULT(expr) CHECK(expr) |
197 #define ASSERT(condition) CHECK(condition) | 197 #define DCHECK(condition) CHECK(condition) |
198 #define ASSERT_EQ(v1, v2) CHECK_EQ(v1, v2) | 198 #define DCHECK_EQ(v1, v2) CHECK_EQ(v1, v2) |
199 #define ASSERT_NE(v1, v2) CHECK_NE(v1, v2) | 199 #define DCHECK_NE(v1, v2) CHECK_NE(v1, v2) |
200 #define ASSERT_GE(v1, v2) CHECK_GE(v1, v2) | 200 #define DCHECK_GE(v1, v2) CHECK_GE(v1, v2) |
201 #define ASSERT_LT(v1, v2) CHECK_LT(v1, v2) | 201 #define DCHECK_LT(v1, v2) CHECK_LT(v1, v2) |
202 #define ASSERT_LE(v1, v2) CHECK_LE(v1, v2) | 202 #define DCHECK_LE(v1, v2) CHECK_LE(v1, v2) |
203 #else | 203 #else |
204 #define ASSERT_RESULT(expr) (expr) | 204 #define DCHECK_RESULT(expr) (expr) |
205 #define ASSERT(condition) ((void) 0) | 205 #define DCHECK(condition) ((void) 0) |
206 #define ASSERT_EQ(v1, v2) ((void) 0) | 206 #define DCHECK_EQ(v1, v2) ((void) 0) |
207 #define ASSERT_NE(v1, v2) ((void) 0) | 207 #define DCHECK_NE(v1, v2) ((void) 0) |
208 #define ASSERT_GE(v1, v2) ((void) 0) | 208 #define DCHECK_GE(v1, v2) ((void) 0) |
209 #define ASSERT_LT(v1, v2) ((void) 0) | 209 #define DCHECK_LT(v1, v2) ((void) 0) |
210 #define ASSERT_LE(v1, v2) ((void) 0) | 210 #define DCHECK_LE(v1, v2) ((void) 0) |
211 #endif | 211 #endif |
212 | 212 |
213 #define ASSERT_NOT_NULL(p) ASSERT_NE(NULL, p) | 213 #define DCHECK_NOT_NULL(p) DCHECK_NE(NULL, p) |
214 | 214 |
215 // "Extra checks" are lightweight checks that are enabled in some release | 215 // "Extra checks" are lightweight checks that are enabled in some release |
216 // builds. | 216 // builds. |
217 #ifdef ENABLE_EXTRA_CHECKS | 217 #ifdef ENABLE_EXTRA_CHECKS |
218 #define EXTRA_CHECK(condition) CHECK(condition) | 218 #define EXTRA_CHECK(condition) CHECK(condition) |
219 #else | 219 #else |
220 #define EXTRA_CHECK(condition) ((void) 0) | 220 #define EXTRA_CHECK(condition) ((void) 0) |
221 #endif | 221 #endif |
222 | 222 |
223 #endif // V8_BASE_LOGGING_H_ | 223 #endif // V8_BASE_LOGGING_H_ |
OLD | NEW |