OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/profiler/heap-snapshot-generator.h" | 5 #include "src/profiler/heap-snapshot-generator.h" |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/conversions.h" | 8 #include "src/conversions.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/objects-body-descriptors.h" | 10 #include "src/objects-body-descriptors.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 HeapEntry* entry) { | 73 HeapEntry* entry) { |
74 HeapGraphEdge edge(type, index, this->index(), entry->index()); | 74 HeapGraphEdge edge(type, index, this->index(), entry->index()); |
75 snapshot_->edges().Add(edge); | 75 snapshot_->edges().Add(edge); |
76 ++children_count_; | 76 ++children_count_; |
77 } | 77 } |
78 | 78 |
79 | 79 |
80 void HeapEntry::Print( | 80 void HeapEntry::Print( |
81 const char* prefix, const char* edge_name, int max_depth, int indent) { | 81 const char* prefix, const char* edge_name, int max_depth, int indent) { |
82 STATIC_ASSERT(sizeof(unsigned) == sizeof(id())); | 82 STATIC_ASSERT(sizeof(unsigned) == sizeof(id())); |
83 base::OS::Print("%6" PRIuS " @%6u %*c %s%s: ", self_size(), id(), indent, | 83 base::OS::Print("%6" PRIuS " @%6u %*c %s%s: ", self_size(), id(), indent, ' ', |
84 ' ', prefix, edge_name); | 84 prefix, edge_name); |
85 if (type() != kString) { | 85 if (type() != kString) { |
86 base::OS::Print("%s %.40s\n", TypeAsString(), name_); | 86 base::OS::Print("%s %.40s\n", TypeAsString(), name_); |
87 } else { | 87 } else { |
88 base::OS::Print("\""); | 88 base::OS::Print("\""); |
89 const char* c = name_; | 89 const char* c = name_; |
90 while (*c && (c - name_) <= 40) { | 90 while (*c && (c - name_) <= 40) { |
91 if (*c != '\n') | 91 if (*c != '\n') |
92 base::OS::Print("%c", *c); | 92 base::OS::Print("%c", *c); |
93 else | 93 else |
94 base::OS::Print("\\n"); | 94 base::OS::Print("\\n"); |
(...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1371 SharedFunctionInfo::kFunctionDataOffset); | 1371 SharedFunctionInfo::kFunctionDataOffset); |
1372 SetInternalReference(obj, entry, | 1372 SetInternalReference(obj, entry, |
1373 "debug_info", shared->debug_info(), | 1373 "debug_info", shared->debug_info(), |
1374 SharedFunctionInfo::kDebugInfoOffset); | 1374 SharedFunctionInfo::kDebugInfoOffset); |
1375 SetInternalReference(obj, entry, "function_identifier", | 1375 SetInternalReference(obj, entry, "function_identifier", |
1376 shared->function_identifier(), | 1376 shared->function_identifier(), |
1377 SharedFunctionInfo::kFunctionIdentifierOffset); | 1377 SharedFunctionInfo::kFunctionIdentifierOffset); |
1378 SetInternalReference(obj, entry, | 1378 SetInternalReference(obj, entry, |
1379 "optimized_code_map", shared->optimized_code_map(), | 1379 "optimized_code_map", shared->optimized_code_map(), |
1380 SharedFunctionInfo::kOptimizedCodeMapOffset); | 1380 SharedFunctionInfo::kOptimizedCodeMapOffset); |
1381 SetInternalReference(obj, entry, | 1381 SetInternalReference(obj, entry, "feedback_metadata", |
1382 "feedback_vector", shared->feedback_vector(), | 1382 shared->feedback_metadata(), |
1383 SharedFunctionInfo::kFeedbackVectorOffset); | 1383 SharedFunctionInfo::kFeedbackMetadataOffset); |
1384 } | 1384 } |
1385 | 1385 |
1386 | 1386 |
1387 void V8HeapExplorer::ExtractScriptReferences(int entry, Script* script) { | 1387 void V8HeapExplorer::ExtractScriptReferences(int entry, Script* script) { |
1388 HeapObject* obj = script; | 1388 HeapObject* obj = script; |
1389 SetInternalReference(obj, entry, | 1389 SetInternalReference(obj, entry, |
1390 "source", script->source(), | 1390 "source", script->source(), |
1391 Script::kSourceOffset); | 1391 Script::kSourceOffset); |
1392 SetInternalReference(obj, entry, | 1392 SetInternalReference(obj, entry, |
1393 "name", script->name(), | 1393 "name", script->name(), |
(...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3114 for (int i = 1; i < sorted_strings.length(); ++i) { | 3114 for (int i = 1; i < sorted_strings.length(); ++i) { |
3115 writer_->AddCharacter(','); | 3115 writer_->AddCharacter(','); |
3116 SerializeString(sorted_strings[i]); | 3116 SerializeString(sorted_strings[i]); |
3117 if (writer_->aborted()) return; | 3117 if (writer_->aborted()) return; |
3118 } | 3118 } |
3119 } | 3119 } |
3120 | 3120 |
3121 | 3121 |
3122 } // namespace internal | 3122 } // namespace internal |
3123 } // namespace v8 | 3123 } // namespace v8 |
OLD | NEW |