Chromium Code Reviews

Unified Diff: src/profile-generator.cc

Issue 9858016: I'd like to add HeapSnapshot::GetMaxSnapshotJSObjectId function. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « src/profile-generator.h ('k') | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/profile-generator.cc
diff --git a/src/profile-generator.cc b/src/profile-generator.cc
index 2d0984ecbf36d4d09d9d687b11420320ce13ce25..77335ad2bb3828b4d1990e3934b32a4d1ef14eb5 100644
--- a/src/profile-generator.cc
+++ b/src/profile-generator.cc
@@ -1133,7 +1133,8 @@ HeapSnapshot::HeapSnapshot(HeapSnapshotsCollection* collection,
gc_roots_entry_(NULL),
natives_root_entry_(NULL),
raw_entries_(NULL),
- entries_sorted_(false) {
+ entries_sorted_(false),
+ max_snapshot_js_object_id_(0) {
STATIC_CHECK(
sizeof(HeapGraphEdge) ==
SnapshotSizeConstants<kPointerSize>::kExpectedHeapGraphEdgeSize);
@@ -1223,6 +1224,11 @@ HeapEntry* HeapSnapshot::AddEntry(HeapEntry::Type type,
int retainers_count) {
HeapEntry* entry = GetNextEntryToInit();
entry->Init(this, type, name, id, size, children_count, retainers_count);
+
+ // Track only js objects. They has odd ids.
yurys 2012/03/26 14:53:20 typo: has -> have
+ if (id % 2 && id > max_snapshot_js_object_id_)
+ max_snapshot_js_object_id_ = id;
+
return entry;
}
@@ -1327,6 +1333,7 @@ SnapshotObjectId HeapObjectsMap::FindObject(Address addr) {
if (existing != 0) return existing;
}
SnapshotObjectId id = next_id_;
+ printf("newId = %d\n", next_id_);
yurys 2012/03/26 14:53:20 Remove this.
next_id_ += kObjectIdStep;
AddEntry(addr, id);
return id;
« no previous file with comments | « src/profile-generator.h ('k') | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine