Reviewers: Søren Gjesse,

Description:
Fix windows compilation after r5867. Now linux-friendly.

[email protected]

Please review this at http://codereview.chromium.org/5216008/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/profile-generator-inl.h
  M src/profile-generator.h
  M src/profile-generator.cc


Index: src/profile-generator-inl.h
diff --git a/src/profile-generator-inl.h b/src/profile-generator-inl.h
index 71de2d1797be03e2b20354aaa40724f4cfac4410..659fb80231239c70cf674319859bb48aae01e542 100644
--- a/src/profile-generator-inl.h
+++ b/src/profile-generator-inl.h
@@ -122,6 +122,17 @@ CodeEntry* ProfileGenerator::EntryForVMState(StateTag tag) {
 }


+#ifdef _WIN32
+inline uint64_t HeapEntry::id() {
+  return *(reinterpret_cast<uint64_t*>(&id_));
+}
+#else
+inline uint64_t HeapEntry::id() {
+  return id_;
+}
+#endif
+
+
 template<class Visitor>
 void HeapEntriesMap::UpdateEntries(Visitor* visitor) {
   for (HashMap::Entry* p = entries_.Start();
Index: src/profile-generator.cc
diff --git a/src/profile-generator.cc b/src/profile-generator.cc
index 9f475a49135a5550b24061c553af50d0d7be6740..8e9f13712ea82ada2a54dcc3a5e5c39f7bb5c538 100644
--- a/src/profile-generator.cc
+++ b/src/profile-generator.cc
@@ -870,7 +870,11 @@ void HeapEntry::Init(HeapSnapshot* snapshot,
   type_ = type;
   painted_ = kUnpainted;
   name_ = name;
+#ifdef WIN32
+  *(reinterpret_cast<uint64_t*>(&id_)) = id;
+#else
   id_ = id;
+#endif
   self_size_ = self_size;
   retained_size_ = 0;
   children_count_ = children_count;
@@ -952,7 +956,7 @@ void HeapEntry::PaintAllReachable() {


 void HeapEntry::Print(int max_depth, int indent) {
-  OS::Print("%6d %6d [%llu] ", self_size(), RetainedSize(false), id_);
+  OS::Print("%6d %6d [%llu] ", self_size(), RetainedSize(false), id());
   if (type() != kString) {
     OS::Print("%s %.40s\n", TypeAsString(), name_);
   } else {
Index: src/profile-generator.h
diff --git a/src/profile-generator.h b/src/profile-generator.h
index 7f8ffbdba44b18f48e23cf9db717af4a17e6a468..9f956e115a508c2b00075517dfad68a3c9261946 100644
--- a/src/profile-generator.h
+++ b/src/profile-generator.h
@@ -526,7 +526,7 @@ class HeapEntry BASE_EMBEDDED {
   HeapSnapshot* snapshot() { return snapshot_; }
   Type type() { return static_cast<Type>(type_); }
   const char* name() { return name_; }
-  uint64_t id() { return id_; }
+  uint64_t id();
   int self_size() { return self_size_; }
   int retained_size() { return retained_size_; }
   void add_retained_size(int size) { retained_size_ += size; }
@@ -615,8 +615,15 @@ class HeapEntry BASE_EMBEDDED {
   };
   HeapEntry* dominator_;
   HeapSnapshot* snapshot_;
-  const char* name_;
+#ifdef WIN32
+  struct Id {
+    uint32_t id1_;
+    uint32_t id2_;
+  } id_;  // This is to avoid extra padding of 64-bit value on MSVC.
+#else
   uint64_t id_;
+#endif
+  const char* name_;

   // Paints used for exact retained sizes calculation.
   static const unsigned kUnpainted = 0;


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

Reply via email to