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

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

Issue 157503002: A64: Synchronize with r18444. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/heap-snapshot-generator.h ('k') | src/heap-snapshot-generator-inl.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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 void HeapEntry::SetIndexedReference(HeapGraphEdge::Type type, 93 void HeapEntry::SetIndexedReference(HeapGraphEdge::Type type,
94 int index, 94 int index,
95 HeapEntry* entry) { 95 HeapEntry* entry) {
96 HeapGraphEdge edge(type, index, this->index(), entry->index()); 96 HeapGraphEdge edge(type, index, this->index(), entry->index());
97 snapshot_->edges().Add(edge); 97 snapshot_->edges().Add(edge);
98 ++children_count_; 98 ++children_count_;
99 } 99 }
100 100
101 101
102 Handle<HeapObject> HeapEntry::GetHeapObject() {
103 return snapshot_->profiler()->FindHeapObjectById(id());
104 }
105
106
107 void HeapEntry::Print( 102 void HeapEntry::Print(
108 const char* prefix, const char* edge_name, int max_depth, int indent) { 103 const char* prefix, const char* edge_name, int max_depth, int indent) {
109 STATIC_CHECK(sizeof(unsigned) == sizeof(id())); 104 STATIC_CHECK(sizeof(unsigned) == sizeof(id()));
110 OS::Print("%6d @%6u %*c %s%s: ", 105 OS::Print("%6d @%6u %*c %s%s: ",
111 self_size(), id(), indent, ' ', prefix, edge_name); 106 self_size(), id(), indent, ' ', prefix, edge_name);
112 if (type() != kString) { 107 if (type() != kString) {
113 OS::Print("%s %.40s\n", TypeAsString(), name_); 108 OS::Print("%s %.40s\n", TypeAsString(), name_);
114 } else { 109 } else {
115 OS::Print("\""); 110 OS::Print("\"");
116 const char* c = name_; 111 const char* c = name_;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 static const int kExpectedHeapEntrySize = 24; 190 static const int kExpectedHeapEntrySize = 24;
196 }; 191 };
197 192
198 template <> struct SnapshotSizeConstants<8> { 193 template <> struct SnapshotSizeConstants<8> {
199 static const int kExpectedHeapGraphEdgeSize = 24; 194 static const int kExpectedHeapGraphEdgeSize = 24;
200 static const int kExpectedHeapEntrySize = 32; 195 static const int kExpectedHeapEntrySize = 32;
201 }; 196 };
202 197
203 } // namespace 198 } // namespace
204 199
200
205 HeapSnapshot::HeapSnapshot(HeapProfiler* profiler, 201 HeapSnapshot::HeapSnapshot(HeapProfiler* profiler,
206 const char* title, 202 const char* title,
207 unsigned uid) 203 unsigned uid)
208 : profiler_(profiler), 204 : profiler_(profiler),
209 title_(title), 205 title_(title),
210 uid_(uid), 206 uid_(uid),
211 root_index_(HeapEntry::kNoEntry), 207 root_index_(HeapEntry::kNoEntry),
212 gc_roots_index_(HeapEntry::kNoEntry), 208 gc_roots_index_(HeapEntry::kNoEntry),
213 natives_root_index_(HeapEntry::kNoEntry), 209 natives_root_index_(HeapEntry::kNoEntry),
214 max_snapshot_js_object_id_(0) { 210 max_snapshot_js_object_id_(0) {
215 STATIC_CHECK( 211 STATIC_CHECK(
216 sizeof(HeapGraphEdge) == 212 sizeof(HeapGraphEdge) ==
217 SnapshotSizeConstants<kPointerSize>::kExpectedHeapGraphEdgeSize); 213 SnapshotSizeConstants<kPointerSize>::kExpectedHeapGraphEdgeSize);
218 STATIC_CHECK( 214 STATIC_CHECK(
219 sizeof(HeapEntry) == 215 sizeof(HeapEntry) ==
220 SnapshotSizeConstants<kPointerSize>::kExpectedHeapEntrySize); 216 SnapshotSizeConstants<kPointerSize>::kExpectedHeapEntrySize);
217 USE(SnapshotSizeConstants<4>::kExpectedHeapGraphEdgeSize);
218 USE(SnapshotSizeConstants<4>::kExpectedHeapEntrySize);
219 USE(SnapshotSizeConstants<8>::kExpectedHeapGraphEdgeSize);
220 USE(SnapshotSizeConstants<8>::kExpectedHeapEntrySize);
221 for (int i = 0; i < VisitorSynchronization::kNumberOfSyncTags; ++i) { 221 for (int i = 0; i < VisitorSynchronization::kNumberOfSyncTags; ++i) {
222 gc_subroot_indexes_[i] = HeapEntry::kNoEntry; 222 gc_subroot_indexes_[i] = HeapEntry::kNoEntry;
223 } 223 }
224 } 224 }
225 225
226 226
227 void HeapSnapshot::Delete() { 227 void HeapSnapshot::Delete() {
228 profiler_->RemoveSnapshot(this); 228 profiler_->RemoveSnapshot(this);
229 delete this; 229 delete this;
230 } 230 }
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 "deoptimization_data", code->deoptimization_data(), 1369 "deoptimization_data", code->deoptimization_data(),
1370 Code::kDeoptimizationDataOffset); 1370 Code::kDeoptimizationDataOffset);
1371 if (code->kind() == Code::FUNCTION) { 1371 if (code->kind() == Code::FUNCTION) {
1372 SetInternalReference(code, entry, 1372 SetInternalReference(code, entry,
1373 "type_feedback_info", code->type_feedback_info(), 1373 "type_feedback_info", code->type_feedback_info(),
1374 Code::kTypeFeedbackInfoOffset); 1374 Code::kTypeFeedbackInfoOffset);
1375 } 1375 }
1376 SetInternalReference(code, entry, 1376 SetInternalReference(code, entry,
1377 "gc_metadata", code->gc_metadata(), 1377 "gc_metadata", code->gc_metadata(),
1378 Code::kGCMetadataOffset); 1378 Code::kGCMetadataOffset);
1379 SetInternalReference(code, entry,
1380 "constant_pool", code->constant_pool(),
1381 Code::kConstantPoolOffset);
1379 } 1382 }
1380 1383
1381 1384
1382 void V8HeapExplorer::ExtractCellReferences(int entry, Cell* cell) { 1385 void V8HeapExplorer::ExtractCellReferences(int entry, Cell* cell) {
1383 SetInternalReference(cell, entry, "value", cell->value(), Cell::kValueOffset); 1386 SetInternalReference(cell, entry, "value", cell->value(), Cell::kValueOffset);
1384 } 1387 }
1385 1388
1386 1389
1387 void V8HeapExplorer::ExtractPropertyCellReferences(int entry, 1390 void V8HeapExplorer::ExtractPropertyCellReferences(int entry,
1388 PropertyCell* cell) { 1391 PropertyCell* cell) {
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1847 int field_offset) { 1850 int field_offset) {
1848 ASSERT(parent_entry == GetEntry(parent_obj)->index()); 1851 ASSERT(parent_entry == GetEntry(parent_obj)->index());
1849 HeapEntry* child_entry = GetEntry(child_obj); 1852 HeapEntry* child_entry = GetEntry(child_obj);
1850 if (child_entry != NULL) { 1853 if (child_entry != NULL) {
1851 HeapGraphEdge::Type type = 1854 HeapGraphEdge::Type type =
1852 reference_name->IsSymbol() || String::cast(reference_name)->length() > 0 1855 reference_name->IsSymbol() || String::cast(reference_name)->length() > 0
1853 ? HeapGraphEdge::kProperty : HeapGraphEdge::kInternal; 1856 ? HeapGraphEdge::kProperty : HeapGraphEdge::kInternal;
1854 const char* name = name_format_string != NULL && reference_name->IsString() 1857 const char* name = name_format_string != NULL && reference_name->IsString()
1855 ? names_->GetFormatted( 1858 ? names_->GetFormatted(
1856 name_format_string, 1859 name_format_string,
1857 *String::cast(reference_name)->ToCString( 1860 String::cast(reference_name)->ToCString(
1858 DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL)) : 1861 DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL).get()) :
1859 names_->GetName(reference_name); 1862 names_->GetName(reference_name);
1860 1863
1861 filler_->SetNamedReference(type, 1864 filler_->SetNamedReference(type,
1862 parent_entry, 1865 parent_entry,
1863 name, 1866 name,
1864 child_entry); 1867 child_entry);
1865 IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset); 1868 IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset);
1866 } 1869 }
1867 } 1870 }
1868 1871
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after
2954 writer_->AddString("\"<dummy>\""); 2957 writer_->AddString("\"<dummy>\"");
2955 for (int i = 1; i < sorted_strings.length(); ++i) { 2958 for (int i = 1; i < sorted_strings.length(); ++i) {
2956 writer_->AddCharacter(','); 2959 writer_->AddCharacter(',');
2957 SerializeString(sorted_strings[i]); 2960 SerializeString(sorted_strings[i]);
2958 if (writer_->aborted()) return; 2961 if (writer_->aborted()) return;
2959 } 2962 }
2960 } 2963 }
2961 2964
2962 2965
2963 } } // namespace v8::internal 2966 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap-snapshot-generator.h ('k') | src/heap-snapshot-generator-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698