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

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: comments addressed 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 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::RememberLastJSObjectId() {
1162 max_snapshot_js_object_id_ = collection_->last_assigned_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 1862 matching lines...) Expand 10 before | Expand all | Expand 10 after
3104 snapshot_->AllocateEntries(entries_.entries_count(), 3104 snapshot_->AllocateEntries(entries_.entries_count(),
3105 entries_.total_children_count(), 3105 entries_.total_children_count(),
3106 entries_.total_retainers_count()); 3106 entries_.total_retainers_count());
3107 3107
3108 // Allocate heap objects to entries hash map. 3108 // Allocate heap objects to entries hash map.
3109 entries_.AllocateEntries(); 3109 entries_.AllocateEntries();
3110 3110
3111 // Pass 2. Fill references. 3111 // Pass 2. Fill references.
3112 if (!FillReferences()) return false; 3112 if (!FillReferences()) return false;
3113 3113
3114 snapshot_->RememberLastJSObjectId();
3115
3114 if (!SetEntriesDominators()) return false; 3116 if (!SetEntriesDominators()) return false;
3115 if (!CalculateRetainedSizes()) return false; 3117 if (!CalculateRetainedSizes()) return false;
3116 3118
3117 progress_counter_ = progress_total_; 3119 progress_counter_ = progress_total_;
3118 if (!ProgressReport(true)) return false; 3120 if (!ProgressReport(true)) return false;
3119 return true; 3121 return true;
3120 } 3122 }
3121 3123
3122 3124
3123 void HeapSnapshotGenerator::ProgressStep() { 3125 void HeapSnapshotGenerator::ProgressStep() {
(...skipping 613 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
« 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