Index: src/checks.h |
=================================================================== |
--- src/checks.h (revision 3886) |
+++ src/checks.h (working copy) |
@@ -80,6 +80,7 @@ |
} |
} |
+ |
// Helper function used by the CHECK_EQ function when given int64_t |
// arguments. Should not be called directly. |
static inline void CheckEqualsHelper(const char* file, int line, |
@@ -102,6 +103,28 @@ |
} |
+// Helper function used by the CHECK_EQ function when given uint64_t |
+// arguments. Should not be called directly. |
+static inline void CheckEqualsHelper(const char* file, int line, |
+ const char* expected_source, |
+ uint64_t expected, |
+ const char* value_source, |
+ uint64_t value) { |
+ if (expected != value) { |
+ // Print int64_t values in hex, as two int32s, |
+ // to avoid platform-dependencies. |
+ V8_Fatal(file, line, |
+ "CHECK_EQ(%s, %s) failed\n#" |
+ " Expected: 0x%08x%08x\n# Found: 0x%08x%08x", |
+ expected_source, value_source, |
+ static_cast<uint32_t>(expected >> 32), |
+ static_cast<uint32_t>(expected), |
+ static_cast<uint32_t>(value >> 32), |
+ static_cast<uint32_t>(value)); |
+ } |
+} |
+ |
+ |
// Helper function used by the CHECK_NE function when given int |
// arguments. Should not be called directly. |
static inline void CheckNonEqualsHelper(const char* file, |
@@ -200,6 +223,27 @@ |
} |
+static inline void CheckNonEqualsHelper(const char* file, |
+ int line, |
+ const char* expected_source, |
+ double expected, |
+ const char* value_source, |
+ double value) { |
+ // Force values to 64 bit memory to truncate 80 bit precision on IA32. |
+ volatile double* exp = new double[1]; |
+ *exp = expected; |
+ volatile double* val = new double[1]; |
+ *val = value; |
+ if (*exp == *val) { |
+ V8_Fatal(file, line, |
+ "CHECK_NE(%s, %s) failed\n# Value: %f", |
+ expected_source, value_source, *val); |
+ } |
+ delete[] exp; |
+ delete[] val; |
+} |
+ |
+ |
namespace v8 { |
class Value; |
template <class T> class Handle; |