Reviewers: alph, loislo, Jakob, Yang,

Description:
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

Please review this at https://codereview.chromium.org/18701002/

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

Affected files:
  M include/v8-profiler.h
  M src/api.cc
  M src/heap-profiler.h
  M src/heap-profiler.cc
  M src/heap-snapshot-generator.h
  M src/heap-snapshot-generator.cc


Index: include/v8-profiler.h
diff --git a/include/v8-profiler.h b/include/v8-profiler.h
index 8e6251aca50c2be9ce979d301dcd89d3829887f5..df3bd9ff6b30b77c84482288ff6b3b9b04602193 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.
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index c89dc2ccaac184b43facbfd50be539d172fd24ae..638a25f317cfa779ab4690ed73db14426c20e800 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<const HeapSnapshot*>(
-      reinterpret_cast<i::HeapProfiler*>(this)->FindSnapshot(uid));
-}
-
-
 SnapshotObjectId HeapProfiler::GetObjectId(Handle<Value> value) {
   i::Handle<i::Object> obj = Utils::OpenHandle(*value);
return reinterpret_cast<i::HeapProfiler*>(this)->GetSnapshotObjectId(obj);
Index: src/heap-profiler.cc
diff --git a/src/heap-profiler.cc b/src/heap-profiler.cc
index 4f6fdb1122d8c916e9d4f54b1ba96eadd994fe33..e517df4a1a2977d71ff68f320d032346a467aaf9 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<Object> obj) {
   if (!obj->IsHeapObject())
     return v8::HeapProfiler::kUnknownObjectId;
Index: src/heap-profiler.h
diff --git a/src/heap-profiler.h b/src/heap-profiler.h
index 1ed73b9ca692803019650b57264d14fae5f429a1..4869404495d696c475829e50b333e15793a7e680 100644
--- a/src/heap-profiler.h
+++ b/src/heap-profiler.h
@@ -65,7 +65,6 @@ class HeapProfiler {
   SnapshotObjectId PushHeapObjectsStats(OutputStream* stream);
   int GetSnapshotsCount();
   HeapSnapshot* GetSnapshot(int index);
-  HeapSnapshot* FindSnapshot(unsigned uid);
   SnapshotObjectId GetSnapshotObjectId(Handle<Object> obj);
   void DeleteAllSnapshots();

Index: src/heap-snapshot-generator.cc
diff --git a/src/heap-snapshot-generator.cc b/src/heap-snapshot-generator.cc
index dd8896ebd72a599a740733e1d6f0f0464ce11d9b..037e812aaa0abf8a272262ec336668c8300f7b93 100644
--- a/src/heap-snapshot-generator.cc
+++ b/src/heap-snapshot-generator.cc
@@ -189,15 +189,11 @@ template <size_t ptr_size> 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<T, P>& list) {


 size_t HeapSnapshot::RawSnapshotSize() const {
- STATIC_CHECK(SnapshotSizeConstants<kPointerSize>::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<void*>(snapshot->uid()),
-                               static_cast<uint32_t>(snapshot->uid()),
-                               true);
-    ASSERT(entry->value == NULL);
-    entry->value = snapshot;
   }
 }


-HeapSnapshot* HeapSnapshotsCollection::GetSnapshot(unsigned uid) {
- HashMap::Entry* entry = snapshots_uids_.Lookup(reinterpret_cast<void*>(uid), - static_cast<uint32_t>(uid),
-                                                 false);
- return entry != NULL ? reinterpret_cast<HeapSnapshot*>(entry->value) : NULL;
-}
-
-
 void HeapSnapshotsCollection::RemoveSnapshot(HeapSnapshot* snapshot) {
   snapshots_.RemoveElement(snapshot);
-  unsigned uid = snapshot->uid();
-  snapshots_uids_.Remove(reinterpret_cast<void*>(uid),
-                         static_cast<uint32_t>(uid));
 }


@@ -656,13 +632,9 @@ Handle<HeapObject> HeapSnapshotsCollection::FindHeapObjectById(


 size_t HeapSnapshotsCollection::GetUsedMemorySize() const {
-  STATIC_CHECK(SnapshotSizeConstants<kPointerSize>::
-      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();
Index: src/heap-snapshot-generator.h
diff --git a/src/heap-snapshot-generator.h b/src/heap-snapshot-generator.h
index 84ad089a084f2f1633107795f41ca66fbea423bb..cd1ec29242e7e253c8c61caaeb9a495392d9c369 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<HeapSnapshot*>* 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<HeapSnapshot*> snapshots_;
-  // Mapping from snapshots' uids to HeapSnapshot* pointers.
-  HashMap snapshots_uids_;
   StringsStorage names_;
   TokenEnumerator* token_enumerator_;
   // Mapping from HeapObject addresses to objects' uids.


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to