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

Side by Side Diff: src/profile-generator.cc

Issue 9918005: Current schema of calculation max_snapshot_js_object_id is not always correct. (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
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 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 DeleteArray(raw_entries_); 1151 DeleteArray(raw_entries_);
1152 } 1152 }
1153 1153
1154 1154
1155 void HeapSnapshot::Delete() { 1155 void HeapSnapshot::Delete() {
1156 collection_->RemoveSnapshot(this); 1156 collection_->RemoveSnapshot(this);
1157 delete this; 1157 delete this;
1158 } 1158 }
1159 1159
1160 1160
1161 void HeapSnapshot::RememberLastSnapshotJSObjectId() {
mnaganov (inactive) 2012/03/29 12:12:17 I think, the word 'Snapshot' in the method name is
1162 max_snapshot_js_object_id_ = collection_->max_snapshot_js_object_id();
1163 }
1164
1165
1161 void HeapSnapshot::AllocateEntries(int entries_count, 1166 void HeapSnapshot::AllocateEntries(int entries_count,
1162 int children_count, 1167 int children_count,
1163 int retainers_count) { 1168 int retainers_count) {
1164 ASSERT(raw_entries_ == NULL); 1169 ASSERT(raw_entries_ == NULL);
1165 raw_entries_size_ = 1170 raw_entries_size_ =
1166 HeapEntry::EntriesSize(entries_count, children_count, retainers_count); 1171 HeapEntry::EntriesSize(entries_count, children_count, retainers_count);
1167 raw_entries_ = NewArray<char>(raw_entries_size_); 1172 raw_entries_ = NewArray<char>(raw_entries_size_);
1168 } 1173 }
1169 1174
1170 1175
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 1222
1218 1223
1219 HeapEntry* HeapSnapshot::AddEntry(HeapEntry::Type type, 1224 HeapEntry* HeapSnapshot::AddEntry(HeapEntry::Type type,
1220 const char* name, 1225 const char* name,
1221 SnapshotObjectId id, 1226 SnapshotObjectId id,
1222 int size, 1227 int size,
1223 int children_count, 1228 int children_count,
1224 int retainers_count) { 1229 int retainers_count) {
1225 HeapEntry* entry = GetNextEntryToInit(); 1230 HeapEntry* entry = GetNextEntryToInit();
1226 entry->Init(this, type, name, id, size, children_count, retainers_count); 1231 entry->Init(this, type, name, id, size, children_count, retainers_count);
1227
1228 // Track only js objects. They have odd ids.
1229 if (id % HeapObjectsMap::kObjectIdStep && id > max_snapshot_js_object_id_)
1230 max_snapshot_js_object_id_ = id;
1231
1232 return entry; 1232 return entry;
1233 } 1233 }
1234 1234
1235 1235
1236 void HeapSnapshot::SetDominatorsToSelf() { 1236 void HeapSnapshot::SetDominatorsToSelf() {
1237 for (int i = 0; i < entries_.length(); ++i) { 1237 for (int i = 0; i < entries_.length(); ++i) {
1238 HeapEntry* entry = entries_[i]; 1238 HeapEntry* entry = entries_[i];
1239 if (entry->dominator() == NULL) entry->set_dominator(entry); 1239 if (entry->dominator() == NULL) entry->set_dominator(entry);
1240 } 1240 }
1241 } 1241 }
(...skipping 1914 matching lines...) Expand 10 before | Expand all | Expand 10 after
3156 3156
3157 3157
3158 bool HeapSnapshotGenerator::FillReferences() { 3158 bool HeapSnapshotGenerator::FillReferences() {
3159 SnapshotFiller filler(snapshot_, &entries_); 3159 SnapshotFiller filler(snapshot_, &entries_);
3160 // IterateAndExtractReferences cannot set object names because 3160 // IterateAndExtractReferences cannot set object names because
3161 // it makes call to JSObject::LocalLookupRealNamedProperty which 3161 // it makes call to JSObject::LocalLookupRealNamedProperty which
3162 // in turn may relocate objects in property maps thus changing the heap 3162 // in turn may relocate objects in property maps thus changing the heap
3163 // layout and affecting retainer counts. This is not acceptable because 3163 // layout and affecting retainer counts. This is not acceptable because
3164 // number of retainers must not change between count and fill passes. 3164 // number of retainers must not change between count and fill passes.
3165 // To avoid this there's a separate postpass that set object names. 3165 // To avoid this there's a separate postpass that set object names.
3166 return v8_heap_explorer_.IterateAndExtractReferences(&filler) 3166 bool result = v8_heap_explorer_.IterateAndExtractReferences(&filler)
3167 && dom_explorer_.IterateAndExtractReferences(&filler) 3167 && dom_explorer_.IterateAndExtractReferences(&filler)
3168 && v8_heap_explorer_.IterateAndSetObjectNames(&filler); 3168 && v8_heap_explorer_.IterateAndSetObjectNames(&filler);
3169 snapshot_->RememberLastSnapshotJSObjectId();
mnaganov (inactive) 2012/03/29 12:12:17 I would place this call into GenerateSnapshot. Hav
3170 return result;
3169 } 3171 }
3170 3172
3171 3173
3172 void HeapSnapshotGenerator::FillReversePostorderIndexes( 3174 void HeapSnapshotGenerator::FillReversePostorderIndexes(
3173 Vector<HeapEntry*>* entries) { 3175 Vector<HeapEntry*>* entries) {
3174 snapshot_->ClearPaint(); 3176 snapshot_->ClearPaint();
3175 int current_entry = 0; 3177 int current_entry = 0;
3176 List<HeapEntry*> nodes_to_visit; 3178 List<HeapEntry*> nodes_to_visit;
3177 nodes_to_visit.Add(snapshot_->root()); 3179 nodes_to_visit.Add(snapshot_->root());
3178 snapshot_->root()->paint(); 3180 snapshot_->root()->paint();
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
3737 3739
3738 3740
3739 void HeapSnapshotJSONSerializer::SortHashMap( 3741 void HeapSnapshotJSONSerializer::SortHashMap(
3740 HashMap* map, List<HashMap::Entry*>* sorted_entries) { 3742 HashMap* map, List<HashMap::Entry*>* sorted_entries) {
3741 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) 3743 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p))
3742 sorted_entries->Add(p); 3744 sorted_entries->Add(p);
3743 sorted_entries->Sort(SortUsingEntryValue); 3745 sorted_entries->Sort(SortUsingEntryValue);
3744 } 3746 }
3745 3747
3746 } } // namespace v8::internal 3748 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698