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

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

Issue 328343003: Remove dependency on Vector from platform files (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 6 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/gdb-jit.cc ('k') | src/hydrogen.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 // 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
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:
111 edge_prefix = "#"; 111 edge_prefix = "#";
112 edge_name = edge.name(); 112 edge_name = edge.name();
113 break; 113 break;
114 case HeapGraphEdge::kElement: 114 case HeapGraphEdge::kElement:
115 OS::SNPrintF(index, "%d", edge.index()); 115 SNPrintF(index, "%d", edge.index());
116 break; 116 break;
117 case HeapGraphEdge::kInternal: 117 case HeapGraphEdge::kInternal:
118 edge_prefix = "$"; 118 edge_prefix = "$";
119 edge_name = edge.name(); 119 edge_name = edge.name();
120 break; 120 break;
121 case HeapGraphEdge::kProperty: 121 case HeapGraphEdge::kProperty:
122 edge_name = edge.name(); 122 edge_name = edge.name();
123 break; 123 break;
124 case HeapGraphEdge::kHidden: 124 case HeapGraphEdge::kHidden:
125 edge_prefix = "$"; 125 edge_prefix = "$";
126 OS::SNPrintF(index, "%d", edge.index()); 126 SNPrintF(index, "%d", edge.index());
127 break; 127 break;
128 case HeapGraphEdge::kShortcut: 128 case HeapGraphEdge::kShortcut:
129 edge_prefix = "^"; 129 edge_prefix = "^";
130 edge_name = edge.name(); 130 edge_name = edge.name();
131 break; 131 break;
132 case HeapGraphEdge::kWeak: 132 case HeapGraphEdge::kWeak:
133 edge_prefix = "w"; 133 edge_prefix = "w";
134 edge_name = edge.name(); 134 edge_name = edge.name();
135 break; 135 break;
136 default: 136 default:
137 OS::SNPrintF(index, "!!! unknown edge type: %d ", edge.type()); 137 SNPrintF(index, "!!! unknown edge type: %d ", edge.type());
138 } 138 }
139 edge.to()->Print(edge_prefix, edge_name, max_depth, indent + 2); 139 edge.to()->Print(edge_prefix, edge_name, max_depth, indent + 2);
140 } 140 }
141 } 141 }
142 142
143 143
144 const char* HeapEntry::TypeAsString() { 144 const char* HeapEntry::TypeAsString() {
145 switch (type()) { 145 switch (type()) {
146 case kHidden: return "/hidden/"; 146 case kHidden: return "/hidden/";
147 case kObject: return "/object/"; 147 case kObject: return "/object/";
(...skipping 2558 matching lines...) Expand 10 before | Expand all | Expand 10 after
2706 stream_->EndOfStream(); 2706 stream_->EndOfStream();
2707 } 2707 }
2708 2708
2709 private: 2709 private:
2710 template<typename T> 2710 template<typename T>
2711 void AddNumberImpl(T n, const char* format) { 2711 void AddNumberImpl(T n, const char* format) {
2712 // Buffer for the longest value plus trailing \0 2712 // Buffer for the longest value plus trailing \0
2713 static const int kMaxNumberSize = 2713 static const int kMaxNumberSize =
2714 MaxDecimalDigitsIn<sizeof(T)>::kUnsigned + 1; 2714 MaxDecimalDigitsIn<sizeof(T)>::kUnsigned + 1;
2715 if (chunk_size_ - chunk_pos_ >= kMaxNumberSize) { 2715 if (chunk_size_ - chunk_pos_ >= kMaxNumberSize) {
2716 int result = OS::SNPrintF( 2716 int result = SNPrintF(
2717 chunk_.SubVector(chunk_pos_, chunk_size_), format, n); 2717 chunk_.SubVector(chunk_pos_, chunk_size_), format, n);
2718 ASSERT(result != -1); 2718 ASSERT(result != -1);
2719 chunk_pos_ += result; 2719 chunk_pos_ += result;
2720 MaybeWriteChunk(); 2720 MaybeWriteChunk();
2721 } else { 2721 } else {
2722 EmbeddedVector<char, kMaxNumberSize> buffer; 2722 EmbeddedVector<char, kMaxNumberSize> buffer;
2723 int result = OS::SNPrintF(buffer, format, n); 2723 int result = SNPrintF(buffer, format, n);
2724 USE(result); 2724 USE(result);
2725 ASSERT(result != -1); 2725 ASSERT(result != -1);
2726 AddString(buffer.start()); 2726 AddString(buffer.start());
2727 } 2727 }
2728 } 2728 }
2729 void MaybeWriteChunk() { 2729 void MaybeWriteChunk() {
2730 ASSERT(chunk_pos_ <= chunk_size_); 2730 ASSERT(chunk_pos_ <= chunk_size_);
2731 if (chunk_pos_ == chunk_size_) { 2731 if (chunk_pos_ == chunk_size_) {
2732 WriteChunk(); 2732 WriteChunk();
2733 } 2733 }
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « src/gdb-jit.cc ('k') | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698