Reviewers: Mikhail Naganov (Chromium),

Message:
Misha, could you please take a look. Thanks!

Description:
Store entry id as 32-bit int.


BUG=
TEST=


Please review this at https://chromiumcodereview.appspot.com/9695046/

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 d967ed3897a6a462b91e550cad6419356d568292..65369befdfa8fa710eecf09a2e174f64fec214b2 100644
--- a/src/profile-generator-inl.h
+++ b/src/profile-generator-inl.h
@@ -114,15 +114,6 @@ int V8HeapExplorer::GetGcSubrootOrder(HeapObject* subroot) {
       HeapObjectsMap::kObjectIdStep);
 }

-
-SnapshotObjectId HeapEntry::id() {
-  union {
-    Id stored_id;
-    SnapshotObjectId returned_id;
-  } id_adaptor = {id_};
-  return id_adaptor.returned_id;
-}
-
 } }  // namespace v8::internal

 #endif  // V8_PROFILE_GENERATOR_INL_H_
Index: src/profile-generator.cc
diff --git a/src/profile-generator.cc b/src/profile-generator.cc
index ca975652afe525f1c0f0d6a88819bd44281ed6e8..2d0984ecbf36d4d09d9d687b11420320ce13ce25 100644
--- a/src/profile-generator.cc
+++ b/src/profile-generator.cc
@@ -978,12 +978,7 @@ void HeapEntry::Init(HeapSnapshot* snapshot,
   children_count_ = children_count;
   retainers_count_ = retainers_count;
   dominator_ = NULL;
-
-  union {
-    SnapshotObjectId set_id;
-    Id stored_id;
-  } id_adaptor = {id};
-  id_ = id_adaptor.stored_id;
+  id_ = id;
 }


@@ -1113,7 +1108,7 @@ template <size_t ptr_size> struct SnapshotSizeConstants;

 template <> struct SnapshotSizeConstants<4> {
   static const int kExpectedHeapGraphEdgeSize = 12;
-  static const int kExpectedHeapEntrySize = 36;
+  static const int kExpectedHeapEntrySize = 32;
   static const size_t kMaxSerializableSnapshotRawSize = 256 * MB;
 };

@@ -1139,10 +1134,10 @@ HeapSnapshot::HeapSnapshot(HeapSnapshotsCollection* collection,
       natives_root_entry_(NULL),
       raw_entries_(NULL),
       entries_sorted_(false) {
-  STATIC_ASSERT(
+  STATIC_CHECK(
       sizeof(HeapGraphEdge) ==
       SnapshotSizeConstants<kPointerSize>::kExpectedHeapGraphEdgeSize);
-  STATIC_ASSERT(
+  STATIC_CHECK(
       sizeof(HeapEntry) ==
       SnapshotSizeConstants<kPointerSize>::kExpectedHeapEntrySize);
   for (int i = 0; i < VisitorSynchronization::kNumberOfSyncTags; ++i) {
Index: src/profile-generator.h
diff --git a/src/profile-generator.h b/src/profile-generator.h
index fadae7e28d7553d924753213b4bab80771b20881..d9a1319b87bc9f9f5480b2106afa8242e54e981f 100644
--- a/src/profile-generator.h
+++ b/src/profile-generator.h
@@ -544,7 +544,7 @@ class HeapEntry BASE_EMBEDDED {
   Type type() { return static_cast<Type>(type_); }
   const char* name() { return name_; }
   void set_name(const char* name) { name_ = name; }
-  inline SnapshotObjectId id();
+  inline SnapshotObjectId id() { return id_; }
   int self_size() { return self_size_; }
   int retained_size() { return retained_size_; }
   void add_retained_size(int size) { retained_size_ += size; }
@@ -608,12 +608,9 @@ class HeapEntry BASE_EMBEDDED {
     int ordered_index_;  // Used during dominator tree building.
     int retained_size_;  // At that moment, there is no retained size yet.
   };
+  SnapshotObjectId id_;
   HeapEntry* dominator_;
   HeapSnapshot* snapshot_;
-  struct Id {
-    uint32_t id1_;
-    uint32_t id2_;
-  } id_;  // This is to avoid extra padding of 64-bit value.
   const char* name_;

   DISALLOW_COPY_AND_ASSIGN(HeapEntry);


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

Reply via email to