From cd819760653545eda593c8b6ca5b39782efbaf8f Mon Sep 17 00:00:00 2001 From: "alexeif@chromium.org" Date: Tue, 13 Mar 2012 15:42:26 +0000 Subject: [PATCH] Store entry id as 32-bit int. BUG= TEST= Review URL: https://chromiumcodereview.appspot.com/9695046 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11029 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/profile-generator-inl.h | 9 --------- src/profile-generator.cc | 13 ++++--------- src/profile-generator.h | 7 ++----- 3 files changed, 6 insertions(+), 23 deletions(-) diff --git a/src/profile-generator-inl.h b/src/profile-generator-inl.h index d967ed3..65369be 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_ diff --git a/src/profile-generator.cc b/src/profile-generator.cc index ca97565..2d0984e 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 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::kExpectedHeapGraphEdgeSize); - STATIC_ASSERT( + STATIC_CHECK( sizeof(HeapEntry) == SnapshotSizeConstants::kExpectedHeapEntrySize); for (int i = 0; i < VisitorSynchronization::kNumberOfSyncTags; ++i) { diff --git a/src/profile-generator.h b/src/profile-generator.h index fadae7e..d9a1319 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_); } 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); -- 2.7.4