OLD | NEW |
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 kConsString = v8::HeapGraphNode::kConsString, | 107 kConsString = v8::HeapGraphNode::kConsString, |
108 kSlicedString = v8::HeapGraphNode::kSlicedString | 108 kSlicedString = v8::HeapGraphNode::kSlicedString |
109 }; | 109 }; |
110 static const int kNoEntry; | 110 static const int kNoEntry; |
111 | 111 |
112 HeapEntry() { } | 112 HeapEntry() { } |
113 HeapEntry(HeapSnapshot* snapshot, | 113 HeapEntry(HeapSnapshot* snapshot, |
114 Type type, | 114 Type type, |
115 const char* name, | 115 const char* name, |
116 SnapshotObjectId id, | 116 SnapshotObjectId id, |
117 int self_size); | 117 size_t self_size); |
118 | 118 |
119 HeapSnapshot* snapshot() { return snapshot_; } | 119 HeapSnapshot* snapshot() { return snapshot_; } |
120 Type type() { return static_cast<Type>(type_); } | 120 Type type() { return static_cast<Type>(type_); } |
121 const char* name() { return name_; } | 121 const char* name() { return name_; } |
122 void set_name(const char* name) { name_ = name; } | 122 void set_name(const char* name) { name_ = name; } |
123 inline SnapshotObjectId id() { return id_; } | 123 inline SnapshotObjectId id() { return id_; } |
124 int self_size() { return self_size_; } | 124 size_t self_size() { return self_size_; } |
125 INLINE(int index() const); | 125 INLINE(int index() const); |
126 int children_count() const { return children_count_; } | 126 int children_count() const { return children_count_; } |
127 INLINE(int set_children_index(int index)); | 127 INLINE(int set_children_index(int index)); |
128 void add_child(HeapGraphEdge* edge) { | 128 void add_child(HeapGraphEdge* edge) { |
129 children_arr()[children_count_++] = edge; | 129 children_arr()[children_count_++] = edge; |
130 } | 130 } |
131 Vector<HeapGraphEdge*> children() { | 131 Vector<HeapGraphEdge*> children() { |
132 return Vector<HeapGraphEdge*>(children_arr(), children_count_); } | 132 return Vector<HeapGraphEdge*>(children_arr(), children_count_); } |
133 | 133 |
134 void SetIndexedReference( | 134 void SetIndexedReference( |
135 HeapGraphEdge::Type type, int index, HeapEntry* entry); | 135 HeapGraphEdge::Type type, int index, HeapEntry* entry); |
136 void SetNamedReference( | 136 void SetNamedReference( |
137 HeapGraphEdge::Type type, const char* name, HeapEntry* entry); | 137 HeapGraphEdge::Type type, const char* name, HeapEntry* entry); |
138 | 138 |
139 void Print( | 139 void Print( |
140 const char* prefix, const char* edge_name, int max_depth, int indent); | 140 const char* prefix, const char* edge_name, int max_depth, int indent); |
141 | 141 |
142 private: | 142 private: |
143 INLINE(HeapGraphEdge** children_arr()); | 143 INLINE(HeapGraphEdge** children_arr()); |
144 const char* TypeAsString(); | 144 const char* TypeAsString(); |
145 | 145 |
146 unsigned type_: 4; | 146 unsigned type_: 4; |
147 int children_count_: 28; | 147 int children_count_: 28; |
148 int children_index_; | 148 int children_index_; |
149 int self_size_; | 149 size_t self_size_; |
150 SnapshotObjectId id_; | 150 SnapshotObjectId id_; |
151 HeapSnapshot* snapshot_; | 151 HeapSnapshot* snapshot_; |
152 const char* name_; | 152 const char* name_; |
153 }; | 153 }; |
154 | 154 |
155 | 155 |
156 // HeapSnapshot represents a single heap snapshot. It is stored in | 156 // HeapSnapshot represents a single heap snapshot. It is stored in |
157 // HeapProfiler, which is also a factory for | 157 // HeapProfiler, which is also a factory for |
158 // HeapSnapshots. All HeapSnapshots share strings copied from JS heap | 158 // HeapSnapshots. All HeapSnapshots share strings copied from JS heap |
159 // to be able to return them even if they were collected. | 159 // to be able to return them even if they were collected. |
(...skipping 19 matching lines...) Expand all Loading... |
179 List<HeapGraphEdge>& edges() { return edges_; } | 179 List<HeapGraphEdge>& edges() { return edges_; } |
180 List<HeapGraphEdge*>& children() { return children_; } | 180 List<HeapGraphEdge*>& children() { return children_; } |
181 void RememberLastJSObjectId(); | 181 void RememberLastJSObjectId(); |
182 SnapshotObjectId max_snapshot_js_object_id() const { | 182 SnapshotObjectId max_snapshot_js_object_id() const { |
183 return max_snapshot_js_object_id_; | 183 return max_snapshot_js_object_id_; |
184 } | 184 } |
185 | 185 |
186 HeapEntry* AddEntry(HeapEntry::Type type, | 186 HeapEntry* AddEntry(HeapEntry::Type type, |
187 const char* name, | 187 const char* name, |
188 SnapshotObjectId id, | 188 SnapshotObjectId id, |
189 int size); | 189 size_t size); |
190 HeapEntry* AddRootEntry(); | 190 HeapEntry* AddRootEntry(); |
191 HeapEntry* AddGcRootsEntry(); | 191 HeapEntry* AddGcRootsEntry(); |
192 HeapEntry* AddGcSubrootEntry(int tag); | 192 HeapEntry* AddGcSubrootEntry(int tag); |
193 HeapEntry* AddNativesRootEntry(); | 193 HeapEntry* AddNativesRootEntry(); |
194 HeapEntry* GetEntryById(SnapshotObjectId id); | 194 HeapEntry* GetEntryById(SnapshotObjectId id); |
195 List<HeapEntry*>* GetSortedEntriesList(); | 195 List<HeapEntry*>* GetSortedEntriesList(); |
196 void FillChildren(); | 196 void FillChildren(); |
197 | 197 |
198 void Print(int max_depth); | 198 void Print(int max_depth); |
199 void PrintEntriesSize(); | 199 void PrintEntriesSize(); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 static HeapObject* const kInternalRootObject; | 392 static HeapObject* const kInternalRootObject; |
393 | 393 |
394 private: | 394 private: |
395 HeapEntry* AddEntry(HeapObject* object); | 395 HeapEntry* AddEntry(HeapObject* object); |
396 HeapEntry* AddEntry(HeapObject* object, | 396 HeapEntry* AddEntry(HeapObject* object, |
397 HeapEntry::Type type, | 397 HeapEntry::Type type, |
398 const char* name); | 398 const char* name); |
399 HeapEntry* AddEntry(Address address, | 399 HeapEntry* AddEntry(Address address, |
400 HeapEntry::Type type, | 400 HeapEntry::Type type, |
401 const char* name, | 401 const char* name, |
402 int size); | 402 size_t size); |
403 | 403 |
404 const char* GetSystemEntryName(HeapObject* object); | 404 const char* GetSystemEntryName(HeapObject* object); |
405 | 405 |
406 void ExtractReferences(HeapObject* obj); | 406 void ExtractReferences(HeapObject* obj); |
407 void ExtractJSGlobalProxyReferences(int entry, JSGlobalProxy* proxy); | 407 void ExtractJSGlobalProxyReferences(int entry, JSGlobalProxy* proxy); |
408 void ExtractJSObjectReferences(int entry, JSObject* js_obj); | 408 void ExtractJSObjectReferences(int entry, JSObject* js_obj); |
409 void ExtractStringReferences(int entry, String* obj); | 409 void ExtractStringReferences(int entry, String* obj); |
410 void ExtractContextReferences(int entry, Context* context); | 410 void ExtractContextReferences(int entry, Context* context); |
411 void ExtractMapReferences(int entry, Map* map); | 411 void ExtractMapReferences(int entry, Map* map); |
412 void ExtractSharedFunctionInfoReferences(int entry, | 412 void ExtractSharedFunctionInfoReferences(int entry, |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 friend class HeapSnapshotJSONSerializerEnumerator; | 642 friend class HeapSnapshotJSONSerializerEnumerator; |
643 friend class HeapSnapshotJSONSerializerIterator; | 643 friend class HeapSnapshotJSONSerializerIterator; |
644 | 644 |
645 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); | 645 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); |
646 }; | 646 }; |
647 | 647 |
648 | 648 |
649 } } // namespace v8::internal | 649 } } // namespace v8::internal |
650 | 650 |
651 #endif // V8_HEAP_SNAPSHOT_GENERATOR_H_ | 651 #endif // V8_HEAP_SNAPSHOT_GENERATOR_H_ |
OLD | NEW |