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

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

Issue 185653004: Experimental parser: merge to r19637 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 9 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-inl.h ('k') | src/heap-snapshot-generator.cc » ('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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 kWeak = v8::HeapGraphEdge::kWeak 50 kWeak = v8::HeapGraphEdge::kWeak
51 }; 51 };
52 52
53 HeapGraphEdge() { } 53 HeapGraphEdge() { }
54 HeapGraphEdge(Type type, const char* name, int from, int to); 54 HeapGraphEdge(Type type, const char* name, int from, int to);
55 HeapGraphEdge(Type type, int index, int from, int to); 55 HeapGraphEdge(Type type, int index, int from, int to);
56 void ReplaceToIndexWithEntry(HeapSnapshot* snapshot); 56 void ReplaceToIndexWithEntry(HeapSnapshot* snapshot);
57 57
58 Type type() const { return static_cast<Type>(type_); } 58 Type type() const { return static_cast<Type>(type_); }
59 int index() const { 59 int index() const {
60 ASSERT(type_ == kElement || type_ == kHidden || type_ == kWeak); 60 ASSERT(type_ == kElement || type_ == kHidden);
61 return index_; 61 return index_;
62 } 62 }
63 const char* name() const { 63 const char* name() const {
64 ASSERT(type_ == kContextVariable 64 ASSERT(type_ == kContextVariable
65 || type_ == kProperty 65 || type_ == kProperty
66 || type_ == kInternal 66 || type_ == kInternal
67 || type_ == kShortcut); 67 || type_ == kShortcut
68 || type_ == kWeak);
68 return name_; 69 return name_;
69 } 70 }
70 INLINE(HeapEntry* from() const); 71 INLINE(HeapEntry* from() const);
71 HeapEntry* to() const { return to_entry_; } 72 HeapEntry* to() const { return to_entry_; }
72 73
73 private: 74 private:
74 INLINE(HeapSnapshot* snapshot() const); 75 INLINE(HeapSnapshot* snapshot() const);
75 76
76 unsigned type_ : 3; 77 unsigned type_ : 3;
77 int from_index_ : 29; 78 int from_index_ : 29;
(...skipping 28 matching lines...) Expand all
106 kConsString = v8::HeapGraphNode::kConsString, 107 kConsString = v8::HeapGraphNode::kConsString,
107 kSlicedString = v8::HeapGraphNode::kSlicedString 108 kSlicedString = v8::HeapGraphNode::kSlicedString
108 }; 109 };
109 static const int kNoEntry; 110 static const int kNoEntry;
110 111
111 HeapEntry() { } 112 HeapEntry() { }
112 HeapEntry(HeapSnapshot* snapshot, 113 HeapEntry(HeapSnapshot* snapshot,
113 Type type, 114 Type type,
114 const char* name, 115 const char* name,
115 SnapshotObjectId id, 116 SnapshotObjectId id,
116 int self_size); 117 size_t self_size);
117 118
118 HeapSnapshot* snapshot() { return snapshot_; } 119 HeapSnapshot* snapshot() { return snapshot_; }
119 Type type() { return static_cast<Type>(type_); } 120 Type type() { return static_cast<Type>(type_); }
120 const char* name() { return name_; } 121 const char* name() { return name_; }
121 void set_name(const char* name) { name_ = name; } 122 void set_name(const char* name) { name_ = name; }
122 inline SnapshotObjectId id() { return id_; } 123 inline SnapshotObjectId id() { return id_; }
123 int self_size() { return self_size_; } 124 size_t self_size() { return self_size_; }
124 INLINE(int index() const); 125 INLINE(int index() const);
125 int children_count() const { return children_count_; } 126 int children_count() const { return children_count_; }
126 INLINE(int set_children_index(int index)); 127 INLINE(int set_children_index(int index));
127 void add_child(HeapGraphEdge* edge) { 128 void add_child(HeapGraphEdge* edge) {
128 children_arr()[children_count_++] = edge; 129 children_arr()[children_count_++] = edge;
129 } 130 }
130 Vector<HeapGraphEdge*> children() { 131 Vector<HeapGraphEdge*> children() {
131 return Vector<HeapGraphEdge*>(children_arr(), children_count_); } 132 return Vector<HeapGraphEdge*>(children_arr(), children_count_); }
132 133
133 void SetIndexedReference( 134 void SetIndexedReference(
134 HeapGraphEdge::Type type, int index, HeapEntry* entry); 135 HeapGraphEdge::Type type, int index, HeapEntry* entry);
135 void SetNamedReference( 136 void SetNamedReference(
136 HeapGraphEdge::Type type, const char* name, HeapEntry* entry); 137 HeapGraphEdge::Type type, const char* name, HeapEntry* entry);
137 138
138 void Print( 139 void Print(
139 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);
140 141
141 private: 142 private:
142 INLINE(HeapGraphEdge** children_arr()); 143 INLINE(HeapGraphEdge** children_arr());
143 const char* TypeAsString(); 144 const char* TypeAsString();
144 145
145 unsigned type_: 4; 146 unsigned type_: 4;
146 int children_count_: 28; 147 int children_count_: 28;
147 int children_index_; 148 int children_index_;
148 int self_size_; 149 size_t self_size_;
149 SnapshotObjectId id_; 150 SnapshotObjectId id_;
150 HeapSnapshot* snapshot_; 151 HeapSnapshot* snapshot_;
151 const char* name_; 152 const char* name_;
152 }; 153 };
153 154
154 155
155 // HeapSnapshot represents a single heap snapshot. It is stored in 156 // HeapSnapshot represents a single heap snapshot. It is stored in
156 // HeapProfiler, which is also a factory for 157 // HeapProfiler, which is also a factory for
157 // HeapSnapshots. All HeapSnapshots share strings copied from JS heap 158 // HeapSnapshots. All HeapSnapshots share strings copied from JS heap
158 // 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
178 List<HeapGraphEdge>& edges() { return edges_; } 179 List<HeapGraphEdge>& edges() { return edges_; }
179 List<HeapGraphEdge*>& children() { return children_; } 180 List<HeapGraphEdge*>& children() { return children_; }
180 void RememberLastJSObjectId(); 181 void RememberLastJSObjectId();
181 SnapshotObjectId max_snapshot_js_object_id() const { 182 SnapshotObjectId max_snapshot_js_object_id() const {
182 return max_snapshot_js_object_id_; 183 return max_snapshot_js_object_id_;
183 } 184 }
184 185
185 HeapEntry* AddEntry(HeapEntry::Type type, 186 HeapEntry* AddEntry(HeapEntry::Type type,
186 const char* name, 187 const char* name,
187 SnapshotObjectId id, 188 SnapshotObjectId id,
188 int size); 189 size_t size);
189 HeapEntry* AddRootEntry(); 190 HeapEntry* AddRootEntry();
190 HeapEntry* AddGcRootsEntry(); 191 HeapEntry* AddGcRootsEntry();
191 HeapEntry* AddGcSubrootEntry(int tag); 192 HeapEntry* AddGcSubrootEntry(int tag);
192 HeapEntry* AddNativesRootEntry(); 193 HeapEntry* AddNativesRootEntry();
193 HeapEntry* GetEntryById(SnapshotObjectId id); 194 HeapEntry* GetEntryById(SnapshotObjectId id);
194 List<HeapEntry*>* GetSortedEntriesList(); 195 List<HeapEntry*>* GetSortedEntriesList();
195 void FillChildren(); 196 void FillChildren();
196 197
197 void Print(int max_depth); 198 void Print(int max_depth);
198 void PrintEntriesSize(); 199 void PrintEntriesSize();
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 V8HeapExplorer(HeapSnapshot* snapshot, 378 V8HeapExplorer(HeapSnapshot* snapshot,
378 SnapshottingProgressReportingInterface* progress, 379 SnapshottingProgressReportingInterface* progress,
379 v8::HeapProfiler::ObjectNameResolver* resolver); 380 v8::HeapProfiler::ObjectNameResolver* resolver);
380 virtual ~V8HeapExplorer(); 381 virtual ~V8HeapExplorer();
381 virtual HeapEntry* AllocateEntry(HeapThing ptr); 382 virtual HeapEntry* AllocateEntry(HeapThing ptr);
382 void AddRootEntries(SnapshotFillerInterface* filler); 383 void AddRootEntries(SnapshotFillerInterface* filler);
383 int EstimateObjectsCount(HeapIterator* iterator); 384 int EstimateObjectsCount(HeapIterator* iterator);
384 bool IterateAndExtractReferences(SnapshotFillerInterface* filler); 385 bool IterateAndExtractReferences(SnapshotFillerInterface* filler);
385 void TagGlobalObjects(); 386 void TagGlobalObjects();
386 void TagCodeObject(Code* code); 387 void TagCodeObject(Code* code);
387 void TagCodeObject(Code* code, const char* external_name); 388 void TagBuiltinCodeObject(Code* code, const char* name);
389 HeapEntry* AddEntry(Address address,
390 HeapEntry::Type type,
391 const char* name,
392 size_t size);
388 393
389 static String* GetConstructorName(JSObject* object); 394 static String* GetConstructorName(JSObject* object);
390 395
391 static HeapObject* const kInternalRootObject; 396 static HeapObject* const kInternalRootObject;
392 397
393 private: 398 private:
394 HeapEntry* AddEntry(HeapObject* object); 399 HeapEntry* AddEntry(HeapObject* object);
395 HeapEntry* AddEntry(HeapObject* object, 400 HeapEntry* AddEntry(HeapObject* object,
396 HeapEntry::Type type, 401 HeapEntry::Type type,
397 const char* name); 402 const char* name);
403
398 const char* GetSystemEntryName(HeapObject* object); 404 const char* GetSystemEntryName(HeapObject* object);
399 405
400 void ExtractReferences(HeapObject* obj); 406 void ExtractReferences(HeapObject* obj);
401 void ExtractJSGlobalProxyReferences(int entry, JSGlobalProxy* proxy); 407 void ExtractJSGlobalProxyReferences(int entry, JSGlobalProxy* proxy);
402 void ExtractJSObjectReferences(int entry, JSObject* js_obj); 408 void ExtractJSObjectReferences(int entry, JSObject* js_obj);
403 void ExtractStringReferences(int entry, String* obj); 409 void ExtractStringReferences(int entry, String* obj);
404 void ExtractContextReferences(int entry, Context* context); 410 void ExtractContextReferences(int entry, Context* context);
405 void ExtractMapReferences(int entry, Map* map); 411 void ExtractMapReferences(int entry, Map* map);
406 void ExtractSharedFunctionInfoReferences(int entry, 412 void ExtractSharedFunctionInfoReferences(int entry,
407 SharedFunctionInfo* shared); 413 SharedFunctionInfo* shared);
408 void ExtractScriptReferences(int entry, Script* script); 414 void ExtractScriptReferences(int entry, Script* script);
409 void ExtractAccessorPairReferences(int entry, AccessorPair* accessors); 415 void ExtractAccessorPairReferences(int entry, AccessorPair* accessors);
410 void ExtractCodeCacheReferences(int entry, CodeCache* code_cache); 416 void ExtractCodeCacheReferences(int entry, CodeCache* code_cache);
411 void ExtractCodeReferences(int entry, Code* code); 417 void ExtractCodeReferences(int entry, Code* code);
418 void ExtractBoxReferences(int entry, Box* box);
412 void ExtractCellReferences(int entry, Cell* cell); 419 void ExtractCellReferences(int entry, Cell* cell);
413 void ExtractPropertyCellReferences(int entry, PropertyCell* cell); 420 void ExtractPropertyCellReferences(int entry, PropertyCell* cell);
414 void ExtractAllocationSiteReferences(int entry, AllocationSite* site); 421 void ExtractAllocationSiteReferences(int entry, AllocationSite* site);
422 void ExtractJSArrayBufferReferences(int entry, JSArrayBuffer* buffer);
415 void ExtractClosureReferences(JSObject* js_obj, int entry); 423 void ExtractClosureReferences(JSObject* js_obj, int entry);
416 void ExtractPropertyReferences(JSObject* js_obj, int entry); 424 void ExtractPropertyReferences(JSObject* js_obj, int entry);
417 bool ExtractAccessorPairProperty(JSObject* js_obj, int entry, 425 bool ExtractAccessorPairProperty(JSObject* js_obj, int entry,
418 Object* key, Object* callback_obj); 426 Object* key, Object* callback_obj);
419 void ExtractElementReferences(JSObject* js_obj, int entry); 427 void ExtractElementReferences(JSObject* js_obj, int entry);
420 void ExtractInternalReferences(JSObject* js_obj, int entry); 428 void ExtractInternalReferences(JSObject* js_obj, int entry);
421 bool IsEssentialObject(Object* object); 429 bool IsEssentialObject(Object* object);
422 void SetContextReference(HeapObject* parent_obj, 430 void SetContextReference(HeapObject* parent_obj,
423 int parent, 431 int parent,
424 String* reference_name, 432 String* reference_name,
(...skipping 16 matching lines...) Expand all
441 int parent, 449 int parent,
442 int index, 450 int index,
443 Object* child, 451 Object* child,
444 int field_offset = -1); 452 int field_offset = -1);
445 void SetHiddenReference(HeapObject* parent_obj, 453 void SetHiddenReference(HeapObject* parent_obj,
446 int parent, 454 int parent,
447 int index, 455 int index,
448 Object* child); 456 Object* child);
449 void SetWeakReference(HeapObject* parent_obj, 457 void SetWeakReference(HeapObject* parent_obj,
450 int parent, 458 int parent,
451 int index, 459 const char* reference_name,
452 Object* child_obj, 460 Object* child_obj,
453 int field_offset); 461 int field_offset);
454 void SetPropertyReference(HeapObject* parent_obj, 462 void SetPropertyReference(HeapObject* parent_obj,
455 int parent, 463 int parent,
456 Name* reference_name, 464 Name* reference_name,
457 Object* child, 465 Object* child,
458 const char* name_format_string = NULL, 466 const char* name_format_string = NULL,
459 int field_offset = -1); 467 int field_offset = -1);
460 void SetUserGlobalReference(Object* user_global); 468 void SetUserGlobalReference(Object* user_global);
461 void SetRootGcRootsReference(); 469 void SetRootGcRootsReference();
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 friend class HeapSnapshotJSONSerializerEnumerator; 642 friend class HeapSnapshotJSONSerializerEnumerator;
635 friend class HeapSnapshotJSONSerializerIterator; 643 friend class HeapSnapshotJSONSerializerIterator;
636 644
637 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); 645 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer);
638 }; 646 };
639 647
640 648
641 } } // namespace v8::internal 649 } } // namespace v8::internal
642 650
643 #endif // V8_HEAP_SNAPSHOT_GENERATOR_H_ 651 #endif // V8_HEAP_SNAPSHOT_GENERATOR_H_
OLDNEW
« no previous file with comments | « src/heap-inl.h ('k') | src/heap-snapshot-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698