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

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

Issue 5537001: New Heap Profiler: add API method for finding a graph node by id. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 10 years 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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 (raw_entries_ + raw_entries_size_)); 1537 (raw_entries_ + raw_entries_size_));
1538 return entries_.last(); 1538 return entries_.last();
1539 } 1539 }
1540 1540
1541 1541
1542 HeapSnapshotsDiff* HeapSnapshot::CompareWith(HeapSnapshot* snapshot) { 1542 HeapSnapshotsDiff* HeapSnapshot::CompareWith(HeapSnapshot* snapshot) {
1543 return collection_->CompareSnapshots(this, snapshot); 1543 return collection_->CompareSnapshots(this, snapshot);
1544 } 1544 }
1545 1545
1546 1546
1547 HeapEntry* HeapSnapshot::GetEntryById(uint64_t id) {
1548 // GetSortedEntriesList is used in diff algorithm and sorts
1549 // entries by their id.
1550 List<HeapEntry*>* entries_by_id = GetSortedEntriesList();
1551
1552 // Perform a binary search by id.
1553 int low = 0;
1554 int high = entries_by_id->length() - 1;
1555 while (low <= high) {
1556 int mid = ((unsigned int)low + (unsigned int)high) >> 1;
Søren Thygesen Gjesse 2010/12/02 07:37:15 No C-style casts please.
mnaganov (inactive) 2010/12/02 15:38:25 Done.
1557 uint64_t mid_id = entries_by_id->at(mid)->id();
1558 if (mid_id > id)
1559 high = mid - 1;
1560 else if (mid_id < id)
1561 low = mid + 1;
1562 else
1563 return entries_by_id->at(mid);
1564 }
1565 return NULL;
1566 }
1567
1568
1547 List<HeapGraphPath*>* HeapSnapshot::GetRetainingPaths(HeapEntry* entry) { 1569 List<HeapGraphPath*>* HeapSnapshot::GetRetainingPaths(HeapEntry* entry) {
1548 HashMap::Entry* p = 1570 HashMap::Entry* p =
1549 retaining_paths_.Lookup(entry, HeapEntry::Hash(entry), true); 1571 retaining_paths_.Lookup(entry, HeapEntry::Hash(entry), true);
1550 if (p->value == NULL) { 1572 if (p->value == NULL) {
1551 p->value = entry->CalculateRetainingPaths(); 1573 p->value = entry->CalculateRetainingPaths();
1552 } 1574 }
1553 return reinterpret_cast<List<HeapGraphPath*>*>(p->value); 1575 return reinterpret_cast<List<HeapGraphPath*>*>(p->value);
1554 } 1576 }
1555 1577
1556 1578
(...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after
2771 2793
2772 2794
2773 String* GetConstructorNameForHeapProfile(JSObject* object) { 2795 String* GetConstructorNameForHeapProfile(JSObject* object) {
2774 if (object->IsJSFunction()) return Heap::closure_symbol(); 2796 if (object->IsJSFunction()) return Heap::closure_symbol();
2775 return object->constructor_name(); 2797 return object->constructor_name();
2776 } 2798 }
2777 2799
2778 } } // namespace v8::internal 2800 } } // namespace v8::internal
2779 2801
2780 #endif // ENABLE_LOGGING_AND_PROFILING 2802 #endif // ENABLE_LOGGING_AND_PROFILING
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