diff options
Diffstat (limited to 'deps/v8/src/profile-generator.cc')
-rw-r--r-- | deps/v8/src/profile-generator.cc | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/deps/v8/src/profile-generator.cc b/deps/v8/src/profile-generator.cc index 640f13cd6..ff4661fbc 100644 --- a/deps/v8/src/profile-generator.cc +++ b/deps/v8/src/profile-generator.cc @@ -603,8 +603,8 @@ CpuProfile* CpuProfilesCollection::GetProfile(int security_token_id, } List<CpuProfile*>* list = GetProfilesList(security_token_id); if (list->at(index) == NULL) { - list->at(index) = - unabridged_list->at(index)->FilteredClone(security_token_id); + (*list)[index] = + unabridged_list->at(index)->FilteredClone(security_token_id); } return list->at(index); } @@ -653,7 +653,7 @@ List<CpuProfile*>* CpuProfilesCollection::Profiles(int security_token_id) { const int current_count = unabridged_list->length(); for (int i = 0; i < current_count; ++i) { if (list->at(i) == NULL) { - list->at(i) = unabridged_list->at(i)->FilteredClone(security_token_id); + (*list)[i] = unabridged_list->at(i)->FilteredClone(security_token_id); } } return list; @@ -1403,7 +1403,7 @@ void HeapSnapshot::FillReversePostorderIndexes(Vector<HeapEntry*>* entries) { } if (!has_new_edges) { entry->set_ordered_index(current_entry); - entries->at(current_entry++) = entry; + (*entries)[current_entry++] = entry; nodes_to_visit.RemoveLast(); } } @@ -1427,8 +1427,8 @@ void HeapSnapshot::BuildDominatorTree(const Vector<HeapEntry*>& entries, Vector<HeapEntry*>* dominators) { if (entries.length() == 0) return; const int root_index = entries.length() - 1; - for (int i = 0; i < root_index; ++i) dominators->at(i) = NULL; - dominators->at(root_index) = entries[root_index]; + for (int i = 0; i < root_index; ++i) (*dominators)[i] = NULL; + (*dominators)[root_index] = entries[root_index]; bool changed = true; while (changed) { changed = false; @@ -1454,7 +1454,7 @@ void HeapSnapshot::BuildDominatorTree(const Vector<HeapEntry*>& entries, } } if (new_idom != NULL && dominators->at(i) != new_idom) { - dominators->at(i) = new_idom; + (*dominators)[i] = new_idom; changed = true; } } @@ -1544,6 +1544,29 @@ HeapSnapshotsDiff* HeapSnapshot::CompareWith(HeapSnapshot* snapshot) { } +HeapEntry* HeapSnapshot::GetEntryById(uint64_t id) { + // GetSortedEntriesList is used in diff algorithm and sorts + // entries by their id. + List<HeapEntry*>* entries_by_id = GetSortedEntriesList(); + + // Perform a binary search by id. + int low = 0; + int high = entries_by_id->length() - 1; + while (low <= high) { + int mid = + (static_cast<unsigned int>(low) + static_cast<unsigned int>(high)) >> 1; + uint64_t mid_id = entries_by_id->at(mid)->id(); + if (mid_id > id) + high = mid - 1; + else if (mid_id < id) + low = mid + 1; + else + return entries_by_id->at(mid); + } + return NULL; +} + + List<HeapGraphPath*>* HeapSnapshot::GetRetainingPaths(HeapEntry* entry) { HashMap::Entry* p = retaining_paths_.Lookup(entry, HeapEntry::Hash(entry), true); |