OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 static inline void CheckEqualsHelper(const char* file, int line, | 73 static inline void CheckEqualsHelper(const char* file, int line, |
74 const char* expected_source, int expected, | 74 const char* expected_source, int expected, |
75 const char* value_source, int value) { | 75 const char* value_source, int value) { |
76 if (expected != value) { | 76 if (expected != value) { |
77 V8_Fatal(file, line, | 77 V8_Fatal(file, line, |
78 "CHECK_EQ(%s, %s) failed\n# Expected: %i\n# Found: %i", | 78 "CHECK_EQ(%s, %s) failed\n# Expected: %i\n# Found: %i", |
79 expected_source, value_source, expected, value); | 79 expected_source, value_source, expected, value); |
80 } | 80 } |
81 } | 81 } |
82 | 82 |
83 | |
84 // Helper function used by the CHECK_EQ function when given int64_t | 83 // Helper function used by the CHECK_EQ function when given int64_t |
85 // arguments. Should not be called directly. | 84 // arguments. Should not be called directly. |
86 static inline void CheckEqualsHelper(const char* file, int line, | 85 static inline void CheckEqualsHelper(const char* file, int line, |
87 const char* expected_source, | 86 const char* expected_source, |
88 int64_t expected, | 87 int64_t expected, |
89 const char* value_source, | 88 const char* value_source, |
90 int64_t value) { | 89 int64_t value) { |
91 if (expected != value) { | 90 if (expected != value) { |
92 // Print int64_t values in hex, as two int32s, | 91 // Print int64_t values in hex, as two int32s, |
93 // to avoid platform-dependencies. | 92 // to avoid platform-dependencies. |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 if (*exp != *val) { | 195 if (*exp != *val) { |
197 V8_Fatal(file, line, | 196 V8_Fatal(file, line, |
198 "CHECK_EQ(%s, %s) failed\n# Expected: %f\n# Found: %f", | 197 "CHECK_EQ(%s, %s) failed\n# Expected: %f\n# Found: %f", |
199 expected_source, value_source, *exp, *val); | 198 expected_source, value_source, *exp, *val); |
200 } | 199 } |
201 delete[] exp; | 200 delete[] exp; |
202 delete[] val; | 201 delete[] val; |
203 } | 202 } |
204 | 203 |
205 | 204 |
206 static inline void CheckNonEqualsHelper(const char* file, | |
207 int line, | |
208 const char* expected_source, | |
209 double expected, | |
210 const char* value_source, | |
211 double value) { | |
212 // Force values to 64 bit memory to truncate 80 bit precision on IA32. | |
213 volatile double* exp = new double[1]; | |
214 *exp = expected; | |
215 volatile double* val = new double[1]; | |
216 *val = value; | |
217 if (*exp == *val) { | |
218 V8_Fatal(file, line, | |
219 "CHECK_NE(%s, %s) failed\n# Value: %f", | |
220 expected_source, value_source, *val); | |
221 } | |
222 delete[] exp; | |
223 delete[] val; | |
224 } | |
225 | |
226 | |
227 namespace v8 { | 205 namespace v8 { |
228 class Value; | 206 class Value; |
229 template <class T> class Handle; | 207 template <class T> class Handle; |
230 } | 208 } |
231 | 209 |
232 | 210 |
233 void CheckNonEqualsHelper(const char* file, | 211 void CheckNonEqualsHelper(const char* file, |
234 int line, | 212 int line, |
235 const char* unexpected_source, | 213 const char* unexpected_source, |
236 v8::Handle<v8::Value> unexpected, | 214 v8::Handle<v8::Value> unexpected, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 | 277 |
300 | 278 |
301 #define ASSERT_TAG_ALIGNED(address) \ | 279 #define ASSERT_TAG_ALIGNED(address) \ |
302 ASSERT((reinterpret_cast<intptr_t>(address) & kHeapObjectTagMask) == 0) | 280 ASSERT((reinterpret_cast<intptr_t>(address) & kHeapObjectTagMask) == 0) |
303 | 281 |
304 #define ASSERT_SIZE_TAG_ALIGNED(size) ASSERT((size & kHeapObjectTagMask) == 0) | 282 #define ASSERT_SIZE_TAG_ALIGNED(size) ASSERT((size & kHeapObjectTagMask) == 0) |
305 | 283 |
306 #define ASSERT_NOT_NULL(p) ASSERT_NE(NULL, p) | 284 #define ASSERT_NOT_NULL(p) ASSERT_NE(NULL, p) |
307 | 285 |
308 #endif // V8_CHECKS_H_ | 286 #endif // V8_CHECKS_H_ |
OLD | NEW |