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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
157 | 157 |
158 | 158 |
159 // Helper function used by the CHECK function when given floating | 159 // Helper function used by the CHECK function when given floating |
160 // point arguments. Should not be called directly. | 160 // point arguments. Should not be called directly. |
161 static inline void CheckEqualsHelper(const char* file, | 161 static inline void CheckEqualsHelper(const char* file, |
162 int line, | 162 int line, |
163 const char* expected_source, | 163 const char* expected_source, |
164 double expected, | 164 double expected, |
165 const char* value_source, | 165 const char* value_source, |
166 double value) { | 166 double value) { |
167 if (expected != value) { | 167 // Force values to 64 bit memory to truncate 80 bit precision on IA32. |
168 volatile double* exp = new double[1]; | |
169 *exp = expected; | |
170 volatile double* val = new double[1]; | |
171 *val = value; | |
Feng Qian
2008/09/26 23:13:01
ugly (not your fault). LGTM.
| |
172 if (*exp != *val) { | |
168 V8_Fatal(file, line, | 173 V8_Fatal(file, line, |
169 "CHECK_EQ(%s, %s) failed\n# Expected: %f\n# Found: %f", | 174 "CHECK_EQ(%s, %s) failed\n# Expected: %f\n# Found: %f", |
170 expected_source, value_source, expected, value); | 175 expected_source, value_source, *exp, *val); |
171 } | 176 } |
177 delete[] exp; | |
178 delete[] val; | |
172 } | 179 } |
173 | 180 |
174 | 181 |
175 namespace v8 { | 182 namespace v8 { |
176 class Value; | 183 class Value; |
177 template <class T> class Handle; | 184 template <class T> class Handle; |
178 } | 185 } |
179 | 186 |
180 | 187 |
181 void CheckNonEqualsHelper(const char* file, | 188 void CheckNonEqualsHelper(const char* file, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
243 #define SLOW_ASSERT(condition) ((void) 0) | 250 #define SLOW_ASSERT(condition) ((void) 0) |
244 #endif | 251 #endif |
245 | 252 |
246 | 253 |
247 #define ASSERT_TAG_ALIGNED(address) \ | 254 #define ASSERT_TAG_ALIGNED(address) \ |
248 ASSERT((reinterpret_cast<int>(address) & kHeapObjectTagMask) == 0) | 255 ASSERT((reinterpret_cast<int>(address) & kHeapObjectTagMask) == 0) |
249 | 256 |
250 #define ASSERT_SIZE_TAG_ALIGNED(size) ASSERT((size & kHeapObjectTagMask) == 0) | 257 #define ASSERT_SIZE_TAG_ALIGNED(size) ASSERT((size & kHeapObjectTagMask) == 0) |
251 | 258 |
252 #endif // V8_CHECKS_H_ | 259 #endif // V8_CHECKS_H_ |
OLD | NEW |