Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 457 kHidden = v8::HeapGraphEdge::kHidden, | 457 kHidden = v8::HeapGraphEdge::kHidden, |
| 458 kShortcut = v8::HeapGraphEdge::kShortcut, | 458 kShortcut = v8::HeapGraphEdge::kShortcut, |
| 459 kWeak = v8::HeapGraphEdge::kWeak | 459 kWeak = v8::HeapGraphEdge::kWeak |
| 460 }; | 460 }; |
| 461 | 461 |
| 462 HeapGraphEdge() { } | 462 HeapGraphEdge() { } |
| 463 void Init(int child_index, Type type, const char* name, HeapEntry* to); | 463 void Init(int child_index, Type type, const char* name, HeapEntry* to); |
| 464 void Init(int child_index, Type type, int index, HeapEntry* to); | 464 void Init(int child_index, Type type, int index, HeapEntry* to); |
| 465 void Init(int child_index, int index, HeapEntry* to); | 465 void Init(int child_index, int index, HeapEntry* to); |
| 466 | 466 |
| 467 Type type() { return static_cast<Type>(type_); } | 467 Type type() const { return static_cast<Type>(type_); } |
| 468 int index() { | 468 int index() const { |
| 469 ASSERT(type_ == kElement || type_ == kHidden || type_ == kWeak); | 469 ASSERT(type_ == kElement || type_ == kHidden || type_ == kWeak); |
| 470 return index_; | 470 return index_; |
| 471 } | 471 } |
| 472 const char* name() { | 472 const char* name() const { |
| 473 ASSERT(type_ == kContextVariable | 473 ASSERT(type_ == kContextVariable |
| 474 || type_ == kProperty | 474 || type_ == kProperty |
| 475 || type_ == kInternal | 475 || type_ == kInternal |
| 476 || type_ == kShortcut); | 476 || type_ == kShortcut); |
| 477 return name_; | 477 return name_; |
| 478 } | 478 } |
| 479 HeapEntry* to() { return to_; } | 479 HeapEntry* to() const { return to_; } |
| 480 | 480 INLINE(HeapEntry* from() const); |
| 481 HeapEntry* From(); | |
| 482 | 481 |
| 483 private: | 482 private: |
| 484 int child_index_ : 29; | 483 int child_index_ : 29; |
| 485 unsigned type_ : 3; | 484 unsigned type_ : 3; |
| 486 union { | 485 union { |
| 487 int index_; | 486 int index_; |
| 488 const char* name_; | 487 const char* name_; |
| 489 }; | 488 }; |
| 490 HeapEntry* to_; | 489 HeapEntry* to_; |
| 491 | 490 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 557 Vector<HeapGraphEdge*> retainers() { | 556 Vector<HeapGraphEdge*> retainers() { |
| 558 return Vector<HeapGraphEdge*>(retainers_arr(), retainers_count_); } | 557 return Vector<HeapGraphEdge*>(retainers_arr(), retainers_count_); } |
| 559 HeapEntry* dominator() { return dominator_; } | 558 HeapEntry* dominator() { return dominator_; } |
| 560 void set_dominator(HeapEntry* entry) { | 559 void set_dominator(HeapEntry* entry) { |
| 561 ASSERT(entry != NULL); | 560 ASSERT(entry != NULL); |
| 562 dominator_ = entry; | 561 dominator_ = entry; |
| 563 } | 562 } |
| 564 void clear_paint() { painted_ = false; } | 563 void clear_paint() { painted_ = false; } |
| 565 bool painted() { return painted_; } | 564 bool painted() { return painted_; } |
| 566 void paint() { painted_ = true; } | 565 void paint() { painted_ = true; } |
| 566 bool reachable_from_window() { return reachable_from_window_; } | |
|
yurys
2012/04/16 13:23:37
Note, that there is no such think as Window in cas
alexeif
2012/04/16 13:37:23
user_root?
| |
| 567 void set_reachable_from_window() { reachable_from_window_ = true; } | |
| 567 | 568 |
| 568 void SetIndexedReference(HeapGraphEdge::Type type, | 569 void SetIndexedReference(HeapGraphEdge::Type type, |
| 569 int child_index, | 570 int child_index, |
| 570 int index, | 571 int index, |
| 571 HeapEntry* entry, | 572 HeapEntry* entry, |
| 572 int retainer_index); | 573 int retainer_index); |
| 573 void SetNamedReference(HeapGraphEdge::Type type, | 574 void SetNamedReference(HeapGraphEdge::Type type, |
| 574 int child_index, | 575 int child_index, |
| 575 const char* name, | 576 const char* name, |
| 576 HeapEntry* entry, | 577 HeapEntry* entry, |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 593 private: | 594 private: |
| 594 HeapGraphEdge* children_arr() { | 595 HeapGraphEdge* children_arr() { |
| 595 return reinterpret_cast<HeapGraphEdge*>(this + 1); | 596 return reinterpret_cast<HeapGraphEdge*>(this + 1); |
| 596 } | 597 } |
| 597 HeapGraphEdge** retainers_arr() { | 598 HeapGraphEdge** retainers_arr() { |
| 598 return reinterpret_cast<HeapGraphEdge**>(children_arr() + children_count_); | 599 return reinterpret_cast<HeapGraphEdge**>(children_arr() + children_count_); |
| 599 } | 600 } |
| 600 const char* TypeAsString(); | 601 const char* TypeAsString(); |
| 601 | 602 |
| 602 unsigned painted_: 1; | 603 unsigned painted_: 1; |
| 604 unsigned reachable_from_window_: 1; | |
| 603 unsigned type_: 4; | 605 unsigned type_: 4; |
| 604 int children_count_: 27; | 606 int children_count_: 26; |
| 605 int retainers_count_; | 607 int retainers_count_; |
| 606 int self_size_; | 608 int self_size_; |
| 607 union { | 609 union { |
| 608 int ordered_index_; // Used during dominator tree building. | 610 int ordered_index_; // Used during dominator tree building. |
| 609 int retained_size_; // At that moment, there is no retained size yet. | 611 int retained_size_; // At that moment, there is no retained size yet. |
| 610 }; | 612 }; |
| 611 int entry_index_; | 613 int entry_index_; |
| 612 SnapshotObjectId id_; | 614 SnapshotObjectId id_; |
| 613 HeapEntry* dominator_; | 615 HeapEntry* dominator_; |
| 614 HeapSnapshot* snapshot_; | 616 HeapSnapshot* snapshot_; |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1008 void SetPropertyReference(HeapObject* parent_obj, | 1010 void SetPropertyReference(HeapObject* parent_obj, |
| 1009 HeapEntry* parent, | 1011 HeapEntry* parent, |
| 1010 String* reference_name, | 1012 String* reference_name, |
| 1011 Object* child, | 1013 Object* child, |
| 1012 const char* name_format_string = NULL, | 1014 const char* name_format_string = NULL, |
| 1013 int field_offset = -1); | 1015 int field_offset = -1); |
| 1014 void SetPropertyShortcutReference(HeapObject* parent_obj, | 1016 void SetPropertyShortcutReference(HeapObject* parent_obj, |
| 1015 HeapEntry* parent, | 1017 HeapEntry* parent, |
| 1016 String* reference_name, | 1018 String* reference_name, |
| 1017 Object* child); | 1019 Object* child); |
| 1018 void SetRootShortcutReference(Object* child); | 1020 void SetWindowReference(Object* window); |
| 1019 void SetRootGcRootsReference(); | 1021 void SetRootGcRootsReference(); |
| 1020 void SetGcRootsReference(VisitorSynchronization::SyncTag tag); | 1022 void SetGcRootsReference(VisitorSynchronization::SyncTag tag); |
| 1021 void SetGcSubrootReference( | 1023 void SetGcSubrootReference( |
| 1022 VisitorSynchronization::SyncTag tag, bool is_weak, Object* child); | 1024 VisitorSynchronization::SyncTag tag, bool is_weak, Object* child); |
| 1023 void SetObjectName(HeapObject* object); | 1025 void SetObjectName(HeapObject* object); |
| 1024 void TagObject(Object* obj, const char* tag); | 1026 void TagObject(Object* obj, const char* tag); |
| 1025 | 1027 |
| 1026 HeapEntry* GetEntry(Object* obj); | 1028 HeapEntry* GetEntry(Object* obj); |
| 1027 | 1029 |
| 1028 static inline HeapObject* GetNthGcSubrootObject(int delta); | 1030 static inline HeapObject* GetNthGcSubrootObject(int delta); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1112 HeapSnapshotGenerator(HeapSnapshot* snapshot, | 1114 HeapSnapshotGenerator(HeapSnapshot* snapshot, |
| 1113 v8::ActivityControl* control); | 1115 v8::ActivityControl* control); |
| 1114 bool GenerateSnapshot(); | 1116 bool GenerateSnapshot(); |
| 1115 | 1117 |
| 1116 private: | 1118 private: |
| 1117 bool BuildDominatorTree(const Vector<HeapEntry*>& entries, | 1119 bool BuildDominatorTree(const Vector<HeapEntry*>& entries, |
| 1118 Vector<int>* dominators); | 1120 Vector<int>* dominators); |
| 1119 bool CalculateRetainedSizes(); | 1121 bool CalculateRetainedSizes(); |
| 1120 bool CountEntriesAndReferences(); | 1122 bool CountEntriesAndReferences(); |
| 1121 bool FillReferences(); | 1123 bool FillReferences(); |
| 1122 void FillReversePostorderIndexes(Vector<HeapEntry*>* entries); | 1124 void FillPostorderIndexes(Vector<HeapEntry*>* entries); |
| 1125 bool IsWindowReference(const HeapGraphEdge& edge); | |
| 1126 void MarkWindowReachableObjects(); | |
| 1123 void ProgressStep(); | 1127 void ProgressStep(); |
| 1124 bool ProgressReport(bool force = false); | 1128 bool ProgressReport(bool force = false); |
| 1125 bool SetEntriesDominators(); | 1129 bool SetEntriesDominators(); |
| 1126 void SetProgressTotal(int iterations_count); | 1130 void SetProgressTotal(int iterations_count); |
| 1127 | 1131 |
| 1128 HeapSnapshot* snapshot_; | 1132 HeapSnapshot* snapshot_; |
| 1129 v8::ActivityControl* control_; | 1133 v8::ActivityControl* control_; |
| 1130 V8HeapExplorer v8_heap_explorer_; | 1134 V8HeapExplorer v8_heap_explorer_; |
| 1131 NativeObjectsExplorer dom_explorer_; | 1135 NativeObjectsExplorer dom_explorer_; |
| 1132 // Mapping from HeapThing pointers to HeapEntry* pointers. | 1136 // Mapping from HeapThing pointers to HeapEntry* pointers. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1185 | 1189 |
| 1186 friend class HeapSnapshotJSONSerializerEnumerator; | 1190 friend class HeapSnapshotJSONSerializerEnumerator; |
| 1187 friend class HeapSnapshotJSONSerializerIterator; | 1191 friend class HeapSnapshotJSONSerializerIterator; |
| 1188 | 1192 |
| 1189 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); | 1193 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); |
| 1190 }; | 1194 }; |
| 1191 | 1195 |
| 1192 } } // namespace v8::internal | 1196 } } // namespace v8::internal |
| 1193 | 1197 |
| 1194 #endif // V8_PROFILE_GENERATOR_H_ | 1198 #endif // V8_PROFILE_GENERATOR_H_ |
| OLD | NEW |