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

Side by Side Diff: src/heap-snapshot-generator.cc

Issue 95283003: Do not put allocated block into HeapObjectsMap (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Reupload take 3 Created 7 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/heap-snapshot-generator.h ('k') | src/serialize.h » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 to, 439 to,
440 entries_.at(from_entry_info_index).size, 440 entries_.at(from_entry_info_index).size,
441 object_size); 441 object_size);
442 } 442 }
443 entries_.at(from_entry_info_index).size = object_size; 443 entries_.at(from_entry_info_index).size = object_size;
444 to_entry->value = from_value; 444 to_entry->value = from_value;
445 } 445 }
446 } 446 }
447 447
448 448
449 void HeapObjectsMap::NewObject(Address addr, int size) {
450 if (FLAG_heap_profiler_trace_objects) {
451 PrintF("New object : %p %6d. Next address is %p\n",
452 addr,
453 size,
454 addr + size);
455 }
456 ASSERT(addr != NULL);
457 FindOrAddEntry(addr, size, false);
458 }
459
460
461 void HeapObjectsMap::UpdateObjectSize(Address addr, int size) { 449 void HeapObjectsMap::UpdateObjectSize(Address addr, int size) {
462 FindOrAddEntry(addr, size, false); 450 FindOrAddEntry(addr, size, false);
463 } 451 }
464 452
465 453
466 SnapshotObjectId HeapObjectsMap::FindEntry(Address addr) { 454 SnapshotObjectId HeapObjectsMap::FindEntry(Address addr) {
467 HashMap::Entry* entry = entries_map_.Lookup(addr, ComputePointerHash(addr), 455 HashMap::Entry* entry = entries_map_.Lookup(addr, ComputePointerHash(addr),
468 false); 456 false);
469 if (entry == NULL) return 0; 457 if (entry == NULL) return 0;
470 int entry_index = static_cast<int>(reinterpret_cast<intptr_t>(entry->value)); 458 int entry_index = static_cast<int>(reinterpret_cast<intptr_t>(entry->value));
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 if (ids_.FindEntry(obj->address()) == id) { 804 if (ids_.FindEntry(obj->address()) == id) {
817 ASSERT(object == NULL); 805 ASSERT(object == NULL);
818 object = obj; 806 object = obj;
819 // Can't break -- kFilterUnreachable requires full heap traversal. 807 // Can't break -- kFilterUnreachable requires full heap traversal.
820 } 808 }
821 } 809 }
822 return object != NULL ? Handle<HeapObject>(object) : Handle<HeapObject>(); 810 return object != NULL ? Handle<HeapObject>(object) : Handle<HeapObject>();
823 } 811 }
824 812
825 813
826 void HeapSnapshotsCollection::NewObjectEvent(Address addr, int size) { 814 void HeapSnapshotsCollection::AllocationEvent(Address addr, int size) {
827 DisallowHeapAllocation no_allocation; 815 DisallowHeapAllocation no_allocation;
828 ids_.NewObject(addr, size);
829 if (allocation_tracker_ != NULL) { 816 if (allocation_tracker_ != NULL) {
830 allocation_tracker_->NewObjectEvent(addr, size); 817 allocation_tracker_->AllocationEvent(addr, size);
831 } 818 }
832 } 819 }
833 820
834 821
835 size_t HeapSnapshotsCollection::GetUsedMemorySize() const { 822 size_t HeapSnapshotsCollection::GetUsedMemorySize() const {
836 size_t size = sizeof(*this); 823 size_t size = sizeof(*this);
837 size += names_.GetUsedMemorySize(); 824 size += names_.GetUsedMemorySize();
838 size += ids_.GetUsedMemorySize(); 825 size += ids_.GetUsedMemorySize();
839 size += GetMemoryUsedByList(snapshots_); 826 size += GetMemoryUsedByList(snapshots_);
840 for (int i = 0; i < snapshots_.length(); ++i) { 827 for (int i = 0; i < snapshots_.length(); ++i) {
(...skipping 2234 matching lines...) Expand 10 before | Expand all | Expand 10 after
3075 writer_->AddString("\"<dummy>\""); 3062 writer_->AddString("\"<dummy>\"");
3076 for (int i = 1; i < sorted_strings.length(); ++i) { 3063 for (int i = 1; i < sorted_strings.length(); ++i) {
3077 writer_->AddCharacter(','); 3064 writer_->AddCharacter(',');
3078 SerializeString(sorted_strings[i]); 3065 SerializeString(sorted_strings[i]);
3079 if (writer_->aborted()) return; 3066 if (writer_->aborted()) return;
3080 } 3067 }
3081 } 3068 }
3082 3069
3083 3070
3084 } } // namespace v8::internal 3071 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap-snapshot-generator.h ('k') | src/serialize.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698