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

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

Issue 8274031: Merge r9430, r9433 and r9508 into 3.5 branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/3.5/
Patch Set: '' Created 9 years, 2 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') | src/version.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 976
977 977
978 int HeapEntry::RetainedSize(bool exact) { 978 int HeapEntry::RetainedSize(bool exact) {
979 if (exact && (retained_size_ & kExactRetainedSizeTag) == 0) { 979 if (exact && (retained_size_ & kExactRetainedSizeTag) == 0) {
980 CalculateExactRetainedSize(); 980 CalculateExactRetainedSize();
981 } 981 }
982 return retained_size_ & (~kExactRetainedSizeTag); 982 return retained_size_ & (~kExactRetainedSizeTag);
983 } 983 }
984 984
985 985
986 Handle<HeapObject> HeapEntry::GetHeapObject() {
987 return snapshot_->collection()->FindHeapObjectById(id());
988 }
989
990
986 template<class Visitor> 991 template<class Visitor>
987 void HeapEntry::ApplyAndPaintAllReachable(Visitor* visitor) { 992 void HeapEntry::ApplyAndPaintAllReachable(Visitor* visitor) {
988 List<HeapEntry*> list(10); 993 List<HeapEntry*> list(10);
989 list.Add(this); 994 list.Add(this);
990 this->paint_reachable(); 995 this->paint_reachable();
991 visitor->Apply(this); 996 visitor->Apply(this);
992 while (!list.is_empty()) { 997 while (!list.is_empty()) {
993 HeapEntry* entry = list.RemoveLast(); 998 HeapEntry* entry = list.RemoveLast();
994 Vector<HeapGraphEdge> children = entry->children(); 999 Vector<HeapGraphEdge> children = entry->children();
995 for (int i = 0; i < children.length(); ++i) { 1000 for (int i = 0; i < children.length(); ++i) {
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 entries_map_(AddressesMatch), 1341 entries_map_(AddressesMatch),
1337 entries_(new List<EntryInfo>()) { } 1342 entries_(new List<EntryInfo>()) { }
1338 1343
1339 1344
1340 HeapObjectsMap::~HeapObjectsMap() { 1345 HeapObjectsMap::~HeapObjectsMap() {
1341 delete entries_; 1346 delete entries_;
1342 } 1347 }
1343 1348
1344 1349
1345 void HeapObjectsMap::SnapshotGenerationFinished() { 1350 void HeapObjectsMap::SnapshotGenerationFinished() {
1346 initial_fill_mode_ = false; 1351 initial_fill_mode_ = false;
1347 RemoveDeadEntries(); 1352 RemoveDeadEntries();
1348 } 1353 }
1349 1354
1350 1355
1351 uint64_t HeapObjectsMap::FindObject(Address addr) { 1356 uint64_t HeapObjectsMap::FindObject(Address addr) {
1352 if (!initial_fill_mode_) { 1357 if (!initial_fill_mode_) {
1353 uint64_t existing = FindEntry(addr); 1358 uint64_t existing = FindEntry(addr);
1354 if (existing != 0) return existing; 1359 if (existing != 0) return existing;
1355 } 1360 }
1356 uint64_t id = next_id_; 1361 uint64_t id = next_id_;
1357 next_id_ += 2; 1362 next_id_ += 2;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 1488
1484 1489
1485 void HeapSnapshotsCollection::RemoveSnapshot(HeapSnapshot* snapshot) { 1490 void HeapSnapshotsCollection::RemoveSnapshot(HeapSnapshot* snapshot) {
1486 snapshots_.RemoveElement(snapshot); 1491 snapshots_.RemoveElement(snapshot);
1487 unsigned uid = snapshot->uid(); 1492 unsigned uid = snapshot->uid();
1488 snapshots_uids_.Remove(reinterpret_cast<void*>(uid), 1493 snapshots_uids_.Remove(reinterpret_cast<void*>(uid),
1489 static_cast<uint32_t>(uid)); 1494 static_cast<uint32_t>(uid));
1490 } 1495 }
1491 1496
1492 1497
1498 Handle<HeapObject> HeapSnapshotsCollection::FindHeapObjectById(uint64_t id) {
1499 AssertNoAllocation no_allocation;
1500 HeapObject* object = NULL;
1501 HeapIterator iterator(HeapIterator::kFilterUnreachable);
1502 // Make sure that object with the given id is still reachable.
1503 for (HeapObject* obj = iterator.next();
1504 obj != NULL;
1505 obj = iterator.next()) {
1506 if (ids_.FindObject(obj->address()) == id) {
1507 ASSERT(object == NULL);
1508 object = obj;
1509 // Can't break -- kFilterUnreachable requires full heap traversal.
1510 }
1511 }
1512 return object != NULL ? Handle<HeapObject>(object) : Handle<HeapObject>();
1513 }
1514
1515
1493 HeapEntry *const HeapEntriesMap::kHeapEntryPlaceholder = 1516 HeapEntry *const HeapEntriesMap::kHeapEntryPlaceholder =
1494 reinterpret_cast<HeapEntry*>(1); 1517 reinterpret_cast<HeapEntry*>(1);
1495 1518
1496 HeapEntriesMap::HeapEntriesMap() 1519 HeapEntriesMap::HeapEntriesMap()
1497 : entries_(HeapThingsMatch), 1520 : entries_(HeapThingsMatch),
1498 entries_count_(0), 1521 entries_count_(0),
1499 total_children_count_(0), 1522 total_children_count_(0),
1500 total_retainers_count_(0) { 1523 total_retainers_count_(0) {
1501 } 1524 }
1502 1525
(...skipping 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after
3294 3317
3295 3318
3296 void HeapSnapshotJSONSerializer::SortHashMap( 3319 void HeapSnapshotJSONSerializer::SortHashMap(
3297 HashMap* map, List<HashMap::Entry*>* sorted_entries) { 3320 HashMap* map, List<HashMap::Entry*>* sorted_entries) {
3298 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) 3321 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p))
3299 sorted_entries->Add(p); 3322 sorted_entries->Add(p);
3300 sorted_entries->Sort(SortUsingEntryValue); 3323 sorted_entries->Sort(SortUsingEntryValue);
3301 } 3324 }
3302 3325
3303 } } // namespace v8::internal 3326 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/profile-generator.h ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698