Revision: 5079
Author: [email protected]
Date: Thu Jul 15 07:28:52 2010
Log: Fix compile errors on Linux x64 and Windows.

Will fix test-heap-profiler in the next change.

[email protected]

Review URL: http://codereview.chromium.org/2877019
http://code.google.com/p/v8/source/detail?r=5079

Modified:
 /branches/bleeding_edge/src/checks.h
 /branches/bleeding_edge/src/profile-generator.h
 /branches/bleeding_edge/test/cctest/test-heap-profiler.cc

=======================================
--- /branches/bleeding_edge/src/checks.h        Thu Jul 15 06:21:50 2010
+++ /branches/bleeding_edge/src/checks.h        Thu Jul 15 07:28:52 2010
@@ -101,28 +101,6 @@
              static_cast<uint32_t>(value));
   }
 }
-
-
-// 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 uint64_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
=======================================
--- /branches/bleeding_edge/src/profile-generator.h     Thu Jul 15 06:21:50 2010
+++ /branches/bleeding_edge/src/profile-generator.h     Thu Jul 15 07:28:52 2010
@@ -496,7 +496,7 @@
   HeapEntry(HeapSnapshot* snapshot,
             Type type,
             const char* name,
-            int id,
+            uint64_t id,
             int self_size,
             int security_token_id)
       : snapshot_(snapshot),
=======================================
--- /branches/bleeding_edge/test/cctest/test-heap-profiler.cc Thu Jul 15 06:21:50 2010 +++ /branches/bleeding_edge/test/cctest/test-heap-profiler.cc Thu Jul 15 07:28:52 2010
@@ -629,6 +629,12 @@
 }


+// Trying to introduce a check helper for uint64_t causes many
+// overloading ambiguities, so it seems easier just to cast
+// them to a signed type.
+#define CHECK_EQ_UINT64_T(a, b) \
+  CHECK_EQ(static_cast<int64_t>(a), static_cast<int64_t>(b))
+
 TEST(HeapEntryIdsAndGC) {
   v8::HandleScope scope;
   LocalContext env;
@@ -648,32 +654,32 @@

   const v8::HeapGraphNode* global1 = GetGlobalObject(snapshot1);
   const v8::HeapGraphNode* global2 = GetGlobalObject(snapshot2);
-  CHECK_NE(0, global1->GetId());
-  CHECK_EQ(global1->GetId(), global2->GetId());
+  CHECK(global1->GetId() != 0);
+  CHECK_EQ_UINT64_T(global1->GetId(), global2->GetId());
   const v8::HeapGraphNode* A1 =
       GetProperty(global1, v8::HeapGraphEdge::PROPERTY, "A");
   const v8::HeapGraphNode* A2 =
       GetProperty(global2, v8::HeapGraphEdge::PROPERTY, "A");
-  CHECK_NE(0, A1->GetId());
-  CHECK_EQ(A1->GetId(), A2->GetId());
+  CHECK(A1->GetId() != 0);
+  CHECK_EQ_UINT64_T(A1->GetId(), A2->GetId());
   const v8::HeapGraphNode* B1 =
       GetProperty(global1, v8::HeapGraphEdge::PROPERTY, "B");
   const v8::HeapGraphNode* B2 =
       GetProperty(global2, v8::HeapGraphEdge::PROPERTY, "B");
-  CHECK_NE(0, B1->GetId());
-  CHECK_EQ(B1->GetId(), B2->GetId());
+  CHECK(B1->GetId() != 0);
+  CHECK_EQ_UINT64_T(B1->GetId(), B2->GetId());
   const v8::HeapGraphNode* a1 =
       GetProperty(global1, v8::HeapGraphEdge::PROPERTY, "a");
   const v8::HeapGraphNode* a2 =
       GetProperty(global2, v8::HeapGraphEdge::PROPERTY, "a");
-  CHECK_NE(0, a1->GetId());
-  CHECK_EQ(a1->GetId(), a2->GetId());
+  CHECK(a1->GetId() != 0);
+  CHECK_EQ_UINT64_T(a1->GetId(), a2->GetId());
   const v8::HeapGraphNode* b1 =
       GetProperty(global1, v8::HeapGraphEdge::PROPERTY, "b");
   const v8::HeapGraphNode* b2 =
       GetProperty(global2, v8::HeapGraphEdge::PROPERTY, "b");
-  CHECK_NE(0, b1->GetId());
-  CHECK_EQ(b1->GetId(), b2->GetId());
+  CHECK(b1->GetId() != 0);
+  CHECK_EQ_UINT64_T(b1->GetId(), b2->GetId());
 }


@@ -741,7 +747,7 @@
     }
   }
   CHECK(found_A_del);
-  CHECK_NE(0, s1_A_id);
+  CHECK(s1_A_id != 0);
   CHECK(s1_A_id != s2_A_id);
 }

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to