Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Unified Diff: src/checks.cc

Issue 893533003: Revert "Make GCC happy again." and "Initial switch to Chromium-style CHECK_* and DCHECK_* macros.". (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/checks.h ('k') | src/compiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/checks.cc
diff --git a/src/checks.cc b/src/checks.cc
index 2871a66c64a6e3a5d2300adb7efd200a7e1ab6de..e5a4caa6c8a3926601b8ac7af65c2ee9d798f1fc 100644
--- a/src/checks.cc
+++ b/src/checks.cc
@@ -4,6 +4,85 @@
#include "src/checks.h"
+#include "src/v8.h"
+
namespace v8 {
-namespace internal {} // namespace internal
-} // namespace v8
+namespace internal {
+
+intptr_t HeapObjectTagMask() { return kHeapObjectTagMask; }
+
+} } // namespace v8::internal
+
+
+static bool CheckEqualsStrict(volatile double* exp, volatile double* val) {
+ v8::internal::DoubleRepresentation exp_rep(*exp);
+ v8::internal::DoubleRepresentation val_rep(*val);
+ if (std::isnan(exp_rep.value) && std::isnan(val_rep.value)) return true;
+ return exp_rep.bits == val_rep.bits;
+}
+
+
+void CheckEqualsHelper(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 (!CheckEqualsStrict(exp, val)) {
+ V8_Fatal(file, line,
+ "CHECK_EQ(%s, %s) failed\n# Expected: %f\n# Found: %f",
+ expected_source, value_source, *exp, *val);
+ }
+ delete[] exp;
+ delete[] val;
+}
+
+
+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 (CheckEqualsStrict(exp, val)) {
+ V8_Fatal(file, line,
+ "CHECK_EQ(%s, %s) failed\n# Expected: %f\n# Found: %f",
+ expected_source, value_source, *exp, *val);
+ }
+ delete[] exp;
+ delete[] val;
+}
+
+
+void CheckEqualsHelper(const char* file,
+ int line,
+ const char* expected_source,
+ v8::Handle<v8::Value> expected,
+ const char* value_source,
+ v8::Handle<v8::Value> value) {
+ if (!expected->Equals(value)) {
+ v8::String::Utf8Value value_str(value);
+ v8::String::Utf8Value expected_str(expected);
+ V8_Fatal(file, line,
+ "CHECK_EQ(%s, %s) failed\n# Expected: %s\n# Found: %s",
+ expected_source, value_source, *expected_str, *value_str);
+ }
+}
+
+
+void CheckNonEqualsHelper(const char* file,
+ int line,
+ const char* unexpected_source,
+ v8::Handle<v8::Value> unexpected,
+ const char* value_source,
+ v8::Handle<v8::Value> value) {
+ if (unexpected->Equals(value)) {
+ v8::String::Utf8Value value_str(value);
+ V8_Fatal(file, line, "CHECK_NE(%s, %s) failed\n# Value: %s",
+ unexpected_source, value_source, *value_str);
+ }
+}
« no previous file with comments | « src/checks.h ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698