Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side 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, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/profile-generator.h ('k') | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 const char* title, 1126 const char* title,
1127 unsigned uid) 1127 unsigned uid)
1128 : collection_(collection), 1128 : collection_(collection),
1129 type_(type), 1129 type_(type),
1130 title_(title), 1130 title_(title),
1131 uid_(uid), 1131 uid_(uid),
1132 root_entry_(NULL), 1132 root_entry_(NULL),
1133 gc_roots_entry_(NULL), 1133 gc_roots_entry_(NULL),
1134 natives_root_entry_(NULL), 1134 natives_root_entry_(NULL),
1135 raw_entries_(NULL), 1135 raw_entries_(NULL),
1136 entries_sorted_(false) { 1136 entries_sorted_(false),
1137 max_snapshot_js_object_id_(0) {
1137 STATIC_CHECK( 1138 STATIC_CHECK(
1138 sizeof(HeapGraphEdge) == 1139 sizeof(HeapGraphEdge) ==
1139 SnapshotSizeConstants<kPointerSize>::kExpectedHeapGraphEdgeSize); 1140 SnapshotSizeConstants<kPointerSize>::kExpectedHeapGraphEdgeSize);
1140 STATIC_CHECK( 1141 STATIC_CHECK(
1141 sizeof(HeapEntry) == 1142 sizeof(HeapEntry) ==
1142 SnapshotSizeConstants<kPointerSize>::kExpectedHeapEntrySize); 1143 SnapshotSizeConstants<kPointerSize>::kExpectedHeapEntrySize);
1143 for (int i = 0; i < VisitorSynchronization::kNumberOfSyncTags; ++i) { 1144 for (int i = 0; i < VisitorSynchronization::kNumberOfSyncTags; ++i) {
1144 gc_subroot_entries_[i] = NULL; 1145 gc_subroot_entries_[i] = NULL;
1145 } 1146 }
1146 } 1147 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 1217
1217 1218
1218 HeapEntry* HeapSnapshot::AddEntry(HeapEntry::Type type, 1219 HeapEntry* HeapSnapshot::AddEntry(HeapEntry::Type type,
1219 const char* name, 1220 const char* name,
1220 SnapshotObjectId id, 1221 SnapshotObjectId id,
1221 int size, 1222 int size,
1222 int children_count, 1223 int children_count,
1223 int retainers_count) { 1224 int retainers_count) {
1224 HeapEntry* entry = GetNextEntryToInit(); 1225 HeapEntry* entry = GetNextEntryToInit();
1225 entry->Init(this, type, name, id, size, children_count, retainers_count); 1226 entry->Init(this, type, name, id, size, children_count, retainers_count);
1227
1228 // Track only js objects. They has odd ids.
yurys 2012/03/26 14:53:20 typo: has -> have
1229 if (id % 2 && id > max_snapshot_js_object_id_)
1230 max_snapshot_js_object_id_ = id;
1231
1226 return entry; 1232 return entry;
1227 } 1233 }
1228 1234
1229 1235
1230 void HeapSnapshot::SetDominatorsToSelf() { 1236 void HeapSnapshot::SetDominatorsToSelf() {
1231 for (int i = 0; i < entries_.length(); ++i) { 1237 for (int i = 0; i < entries_.length(); ++i) {
1232 HeapEntry* entry = entries_[i]; 1238 HeapEntry* entry = entries_[i];
1233 if (entry->dominator() == NULL) entry->set_dominator(entry); 1239 if (entry->dominator() == NULL) entry->set_dominator(entry);
1234 } 1240 }
1235 } 1241 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 RemoveDeadEntries(); 1326 RemoveDeadEntries();
1321 } 1327 }
1322 1328
1323 1329
1324 SnapshotObjectId HeapObjectsMap::FindObject(Address addr) { 1330 SnapshotObjectId HeapObjectsMap::FindObject(Address addr) {
1325 if (!initial_fill_mode_) { 1331 if (!initial_fill_mode_) {
1326 SnapshotObjectId existing = FindEntry(addr); 1332 SnapshotObjectId existing = FindEntry(addr);
1327 if (existing != 0) return existing; 1333 if (existing != 0) return existing;
1328 } 1334 }
1329 SnapshotObjectId id = next_id_; 1335 SnapshotObjectId id = next_id_;
1336 printf("newId = %d\n", next_id_);
yurys 2012/03/26 14:53:20 Remove this.
1330 next_id_ += kObjectIdStep; 1337 next_id_ += kObjectIdStep;
1331 AddEntry(addr, id); 1338 AddEntry(addr, id);
1332 return id; 1339 return id;
1333 } 1340 }
1334 1341
1335 1342
1336 void HeapObjectsMap::MoveObject(Address from, Address to) { 1343 void HeapObjectsMap::MoveObject(Address from, Address to) {
1337 if (from == to) return; 1344 if (from == to) return;
1338 HashMap::Entry* entry = entries_map_.Lookup(from, AddressHash(from), false); 1345 HashMap::Entry* entry = entries_map_.Lookup(from, AddressHash(from), false);
1339 if (entry != NULL) { 1346 if (entry != NULL) {
(...skipping 2391 matching lines...) Expand 10 before | Expand all | Expand 10 after
3731 3738
3732 3739
3733 void HeapSnapshotJSONSerializer::SortHashMap( 3740 void HeapSnapshotJSONSerializer::SortHashMap(
3734 HashMap* map, List<HashMap::Entry*>* sorted_entries) { 3741 HashMap* map, List<HashMap::Entry*>* sorted_entries) {
3735 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) 3742 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p))
3736 sorted_entries->Add(p); 3743 sorted_entries->Add(p);
3737 sorted_entries->Sort(SortUsingEntryValue); 3744 sorted_entries->Sort(SortUsingEntryValue);
3738 } 3745 }
3739 3746
3740 } } // namespace v8::internal 3747 } } // namespace v8::internal
OLDNEW
« 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
This is Rietveld 408576698