From 44981e4f5e3ad103c2321dbf37a0aa01d785e27a Mon Sep 17 00:00:00 2001 From: "yurys@chromium.org" Date: Thu, 4 Jul 2013 16:34:07 +0000 Subject: [PATCH] Remove deprecated heap profiler methods from V8 public API v8::HeapProfiler::FindHeapSnapshot was already deprecated when 3.19 branch was created (https://code.google.com/p/v8/source/browse/branches/3.19/include/v8-profiler.h). BUG=None R=loislo@chromium.org, yangguo@chromium.org Review URL: https://codereview.chromium.org/18701002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15493 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- include/v8-profiler.h | 3 --- src/api.cc | 6 ------ src/heap-profiler.cc | 5 ----- src/heap-profiler.h | 1 - src/heap-snapshot-generator.cc | 28 ---------------------------- src/heap-snapshot-generator.h | 7 ------- 6 files changed, 50 deletions(-) diff --git a/include/v8-profiler.h b/include/v8-profiler.h index 8e6251a..df3bd9f 100644 --- a/include/v8-profiler.h +++ b/include/v8-profiler.h @@ -415,9 +415,6 @@ class V8EXPORT HeapProfiler { /** Returns a snapshot by index. */ const HeapSnapshot* GetHeapSnapshot(int index); - /** Returns a profile by uid. */ - V8_DEPRECATED(const HeapSnapshot* FindHeapSnapshot(unsigned uid)); - /** * Returns SnapshotObjectId for a heap object referenced by |value| if * it has been seen by the heap profiler, kUnknownObjectId otherwise. diff --git a/src/api.cc b/src/api.cc index c89dc2c..638a25f 100644 --- a/src/api.cc +++ b/src/api.cc @@ -7745,12 +7745,6 @@ const HeapSnapshot* HeapProfiler::GetHeapSnapshot(int index) { } -const HeapSnapshot* HeapProfiler::FindHeapSnapshot(unsigned uid) { - return reinterpret_cast( - reinterpret_cast(this)->FindSnapshot(uid)); -} - - SnapshotObjectId HeapProfiler::GetObjectId(Handle value) { i::Handle obj = Utils::OpenHandle(*value); return reinterpret_cast(this)->GetSnapshotObjectId(obj); diff --git a/src/heap-profiler.cc b/src/heap-profiler.cc index 4f6fdb1..e517df4 100644 --- a/src/heap-profiler.cc +++ b/src/heap-profiler.cc @@ -124,11 +124,6 @@ HeapSnapshot* HeapProfiler::GetSnapshot(int index) { } -HeapSnapshot* HeapProfiler::FindSnapshot(unsigned uid) { - return snapshots_->GetSnapshot(uid); -} - - SnapshotObjectId HeapProfiler::GetSnapshotObjectId(Handle obj) { if (!obj->IsHeapObject()) return v8::HeapProfiler::kUnknownObjectId; diff --git a/src/heap-profiler.h b/src/heap-profiler.h index dd7a803..5ae60fa 100644 --- a/src/heap-profiler.h +++ b/src/heap-profiler.h @@ -66,7 +66,6 @@ class HeapProfiler { SnapshotObjectId PushHeapObjectsStats(OutputStream* stream); int GetSnapshotsCount(); HeapSnapshot* GetSnapshot(int index); - HeapSnapshot* FindSnapshot(unsigned uid); SnapshotObjectId GetSnapshotObjectId(Handle obj); void DeleteAllSnapshots(); diff --git a/src/heap-snapshot-generator.cc b/src/heap-snapshot-generator.cc index 01b3932..f959aee 100644 --- a/src/heap-snapshot-generator.cc +++ b/src/heap-snapshot-generator.cc @@ -189,15 +189,11 @@ template struct SnapshotSizeConstants; template <> struct SnapshotSizeConstants<4> { static const int kExpectedHeapGraphEdgeSize = 12; static const int kExpectedHeapEntrySize = 24; - static const int kExpectedHeapSnapshotsCollectionSize = 100; - static const int kExpectedHeapSnapshotSize = 132; }; template <> struct SnapshotSizeConstants<8> { static const int kExpectedHeapGraphEdgeSize = 24; static const int kExpectedHeapEntrySize = 32; - static const int kExpectedHeapSnapshotsCollectionSize = 152; - static const int kExpectedHeapSnapshotSize = 160; }; } // namespace @@ -353,8 +349,6 @@ static size_t GetMemoryUsedByList(const List& list) { size_t HeapSnapshot::RawSnapshotSize() const { - STATIC_CHECK(SnapshotSizeConstants::kExpectedHeapSnapshotSize == - sizeof(HeapSnapshot)); // NOLINT return sizeof(*this) + GetMemoryUsedByList(entries_) + @@ -578,7 +572,6 @@ size_t HeapObjectsMap::GetUsedMemorySize() const { HeapSnapshotsCollection::HeapSnapshotsCollection(Heap* heap) : is_tracking_objects_(false), - snapshots_uids_(HeapSnapshotsMatch), token_enumerator_(new TokenEnumerator()), ids_(heap) { } @@ -607,29 +600,12 @@ void HeapSnapshotsCollection::SnapshotGenerationFinished( ids_.SnapshotGenerationFinished(); if (snapshot != NULL) { snapshots_.Add(snapshot); - HashMap::Entry* entry = - snapshots_uids_.Lookup(reinterpret_cast(snapshot->uid()), - static_cast(snapshot->uid()), - true); - ASSERT(entry->value == NULL); - entry->value = snapshot; } } -HeapSnapshot* HeapSnapshotsCollection::GetSnapshot(unsigned uid) { - HashMap::Entry* entry = snapshots_uids_.Lookup(reinterpret_cast(uid), - static_cast(uid), - false); - return entry != NULL ? reinterpret_cast(entry->value) : NULL; -} - - void HeapSnapshotsCollection::RemoveSnapshot(HeapSnapshot* snapshot) { snapshots_.RemoveElement(snapshot); - unsigned uid = snapshot->uid(); - snapshots_uids_.Remove(reinterpret_cast(uid), - static_cast(uid)); } @@ -656,13 +632,9 @@ Handle HeapSnapshotsCollection::FindHeapObjectById( size_t HeapSnapshotsCollection::GetUsedMemorySize() const { - STATIC_CHECK(SnapshotSizeConstants:: - kExpectedHeapSnapshotsCollectionSize == - sizeof(HeapSnapshotsCollection)); // NOLINT size_t size = sizeof(*this); size += names_.GetUsedMemorySize(); size += ids_.GetUsedMemorySize(); - size += sizeof(HashMap::Entry) * snapshots_uids_.capacity(); size += GetMemoryUsedByList(snapshots_); for (int i = 0; i < snapshots_.length(); ++i) { size += snapshots_[i]->RawSnapshotSize(); diff --git a/src/heap-snapshot-generator.h b/src/heap-snapshot-generator.h index 84ad089..cd1ec29 100644 --- a/src/heap-snapshot-generator.h +++ b/src/heap-snapshot-generator.h @@ -303,7 +303,6 @@ class HeapSnapshotsCollection { HeapSnapshot* NewSnapshot(const char* name, unsigned uid); void SnapshotGenerationFinished(HeapSnapshot* snapshot); List* snapshots() { return &snapshots_; } - HeapSnapshot* GetSnapshot(unsigned uid); void RemoveSnapshot(HeapSnapshot* snapshot); StringsStorage* names() { return &names_; } @@ -323,14 +322,8 @@ class HeapSnapshotsCollection { size_t GetUsedMemorySize() const; private: - INLINE(static bool HeapSnapshotsMatch(void* key1, void* key2)) { - return key1 == key2; - } - bool is_tracking_objects_; // Whether tracking object moves is needed. List snapshots_; - // Mapping from snapshots' uids to HeapSnapshot* pointers. - HashMap snapshots_uids_; StringsStorage names_; TokenEnumerator* token_enumerator_; // Mapping from HeapObject addresses to objects' uids. -- 2.7.4