| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/heap-snapshot-generator-inl.h" | 7 #include "src/heap-snapshot-generator-inl.h" |
| 8 | 8 |
| 9 #include "src/allocation-tracker.h" | 9 #include "src/allocation-tracker.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 HeapEntry* entry) { | 76 HeapEntry* entry) { |
| 77 HeapGraphEdge edge(type, index, this->index(), entry->index()); | 77 HeapGraphEdge edge(type, index, this->index(), entry->index()); |
| 78 snapshot_->edges().Add(edge); | 78 snapshot_->edges().Add(edge); |
| 79 ++children_count_; | 79 ++children_count_; |
| 80 } | 80 } |
| 81 | 81 |
| 82 | 82 |
| 83 void HeapEntry::Print( | 83 void HeapEntry::Print( |
| 84 const char* prefix, const char* edge_name, int max_depth, int indent) { | 84 const char* prefix, const char* edge_name, int max_depth, int indent) { |
| 85 STATIC_ASSERT(sizeof(unsigned) == sizeof(id())); | 85 STATIC_ASSERT(sizeof(unsigned) == sizeof(id())); |
| 86 OS::Print("%6" V8PRIuPTR " @%6u %*c %s%s: ", | 86 base::OS::Print("%6" V8PRIuPTR " @%6u %*c %s%s: ", self_size(), id(), indent, |
| 87 self_size(), id(), indent, ' ', prefix, edge_name); | 87 ' ', prefix, edge_name); |
| 88 if (type() != kString) { | 88 if (type() != kString) { |
| 89 OS::Print("%s %.40s\n", TypeAsString(), name_); | 89 base::OS::Print("%s %.40s\n", TypeAsString(), name_); |
| 90 } else { | 90 } else { |
| 91 OS::Print("\""); | 91 base::OS::Print("\""); |
| 92 const char* c = name_; | 92 const char* c = name_; |
| 93 while (*c && (c - name_) <= 40) { | 93 while (*c && (c - name_) <= 40) { |
| 94 if (*c != '\n') | 94 if (*c != '\n') |
| 95 OS::Print("%c", *c); | 95 base::OS::Print("%c", *c); |
| 96 else | 96 else |
| 97 OS::Print("\\n"); | 97 base::OS::Print("\\n"); |
| 98 ++c; | 98 ++c; |
| 99 } | 99 } |
| 100 OS::Print("\"\n"); | 100 base::OS::Print("\"\n"); |
| 101 } | 101 } |
| 102 if (--max_depth == 0) return; | 102 if (--max_depth == 0) return; |
| 103 Vector<HeapGraphEdge*> ch = children(); | 103 Vector<HeapGraphEdge*> ch = children(); |
| 104 for (int i = 0; i < ch.length(); ++i) { | 104 for (int i = 0; i < ch.length(); ++i) { |
| 105 HeapGraphEdge& edge = *ch[i]; | 105 HeapGraphEdge& edge = *ch[i]; |
| 106 const char* edge_prefix = ""; | 106 const char* edge_prefix = ""; |
| 107 EmbeddedVector<char, 64> index; | 107 EmbeddedVector<char, 64> index; |
| 108 const char* edge_name = index.start(); | 108 const char* edge_name = index.start(); |
| 109 switch (edge.type()) { | 109 switch (edge.type()) { |
| 110 case HeapGraphEdge::kContextVariable: | 110 case HeapGraphEdge::kContextVariable: |
| (...skipping 3060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3171 writer_->AddString("\"<dummy>\""); | 3171 writer_->AddString("\"<dummy>\""); |
| 3172 for (int i = 1; i < sorted_strings.length(); ++i) { | 3172 for (int i = 1; i < sorted_strings.length(); ++i) { |
| 3173 writer_->AddCharacter(','); | 3173 writer_->AddCharacter(','); |
| 3174 SerializeString(sorted_strings[i]); | 3174 SerializeString(sorted_strings[i]); |
| 3175 if (writer_->aborted()) return; | 3175 if (writer_->aborted()) return; |
| 3176 } | 3176 } |
| 3177 } | 3177 } |
| 3178 | 3178 |
| 3179 | 3179 |
| 3180 } } // namespace v8::internal | 3180 } } // namespace v8::internal |
| OLD | NEW |