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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 return index_; | 470 return index_; |
471 } | 471 } |
472 const char* name() { | 472 const char* name() { |
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() { return to_; } |
480 INLINE(HeapEntry* from()); | 480 |
| 481 HeapEntry* From(); |
481 | 482 |
482 private: | 483 private: |
483 int child_index_ : 29; | 484 int child_index_ : 29; |
484 unsigned type_ : 3; | 485 unsigned type_ : 3; |
485 union { | 486 union { |
486 int index_; | 487 int index_; |
487 const char* name_; | 488 const char* name_; |
488 }; | 489 }; |
489 HeapEntry* to_; | 490 HeapEntry* to_; |
490 | 491 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 Vector<HeapGraphEdge*> retainers() { | 557 Vector<HeapGraphEdge*> retainers() { |
557 return Vector<HeapGraphEdge*>(retainers_arr(), retainers_count_); } | 558 return Vector<HeapGraphEdge*>(retainers_arr(), retainers_count_); } |
558 HeapEntry* dominator() { return dominator_; } | 559 HeapEntry* dominator() { return dominator_; } |
559 void set_dominator(HeapEntry* entry) { | 560 void set_dominator(HeapEntry* entry) { |
560 ASSERT(entry != NULL); | 561 ASSERT(entry != NULL); |
561 dominator_ = entry; | 562 dominator_ = entry; |
562 } | 563 } |
563 void clear_paint() { painted_ = false; } | 564 void clear_paint() { painted_ = false; } |
564 bool painted() { return painted_; } | 565 bool painted() { return painted_; } |
565 void paint() { painted_ = true; } | 566 void paint() { painted_ = true; } |
566 bool reachable_from_window() { return reachable_from_window_; } | |
567 void set_reachable_from_window() { reachable_from_window_ = true; } | |
568 | 567 |
569 void SetIndexedReference(HeapGraphEdge::Type type, | 568 void SetIndexedReference(HeapGraphEdge::Type type, |
570 int child_index, | 569 int child_index, |
571 int index, | 570 int index, |
572 HeapEntry* entry, | 571 HeapEntry* entry, |
573 int retainer_index); | 572 int retainer_index); |
574 void SetNamedReference(HeapGraphEdge::Type type, | 573 void SetNamedReference(HeapGraphEdge::Type type, |
575 int child_index, | 574 int child_index, |
576 const char* name, | 575 const char* name, |
577 HeapEntry* entry, | 576 HeapEntry* entry, |
(...skipping 16 matching lines...) Expand all Loading... |
594 private: | 593 private: |
595 HeapGraphEdge* children_arr() { | 594 HeapGraphEdge* children_arr() { |
596 return reinterpret_cast<HeapGraphEdge*>(this + 1); | 595 return reinterpret_cast<HeapGraphEdge*>(this + 1); |
597 } | 596 } |
598 HeapGraphEdge** retainers_arr() { | 597 HeapGraphEdge** retainers_arr() { |
599 return reinterpret_cast<HeapGraphEdge**>(children_arr() + children_count_); | 598 return reinterpret_cast<HeapGraphEdge**>(children_arr() + children_count_); |
600 } | 599 } |
601 const char* TypeAsString(); | 600 const char* TypeAsString(); |
602 | 601 |
603 unsigned painted_: 1; | 602 unsigned painted_: 1; |
604 unsigned reachable_from_window_: 1; | |
605 unsigned type_: 4; | 603 unsigned type_: 4; |
606 int children_count_: 26; | 604 int children_count_: 27; |
607 int retainers_count_; | 605 int retainers_count_; |
608 int self_size_; | 606 int self_size_; |
609 union { | 607 union { |
610 int ordered_index_; // Used during dominator tree building. | 608 int ordered_index_; // Used during dominator tree building. |
611 int retained_size_; // At that moment, there is no retained size yet. | 609 int retained_size_; // At that moment, there is no retained size yet. |
612 }; | 610 }; |
613 int entry_index_; | 611 int entry_index_; |
614 SnapshotObjectId id_; | 612 SnapshotObjectId id_; |
615 HeapEntry* dominator_; | 613 HeapEntry* dominator_; |
616 HeapSnapshot* snapshot_; | 614 HeapSnapshot* snapshot_; |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 HeapSnapshotGenerator(HeapSnapshot* snapshot, | 1093 HeapSnapshotGenerator(HeapSnapshot* snapshot, |
1096 v8::ActivityControl* control); | 1094 v8::ActivityControl* control); |
1097 bool GenerateSnapshot(); | 1095 bool GenerateSnapshot(); |
1098 | 1096 |
1099 private: | 1097 private: |
1100 bool BuildDominatorTree(const Vector<HeapEntry*>& entries, | 1098 bool BuildDominatorTree(const Vector<HeapEntry*>& entries, |
1101 Vector<int>* dominators); | 1099 Vector<int>* dominators); |
1102 bool CalculateRetainedSizes(); | 1100 bool CalculateRetainedSizes(); |
1103 bool CountEntriesAndReferences(); | 1101 bool CountEntriesAndReferences(); |
1104 bool FillReferences(); | 1102 bool FillReferences(); |
1105 void FillPostorderIndexes(Vector<HeapEntry*>* entries); | 1103 void FillReversePostorderIndexes(Vector<HeapEntry*>* entries); |
1106 void MarkWindowReachableObjects(); | |
1107 void ProgressStep(); | 1104 void ProgressStep(); |
1108 bool ProgressReport(bool force = false); | 1105 bool ProgressReport(bool force = false); |
1109 bool SetEntriesDominators(); | 1106 bool SetEntriesDominators(); |
1110 void SetProgressTotal(int iterations_count); | 1107 void SetProgressTotal(int iterations_count); |
1111 | 1108 |
1112 HeapSnapshot* snapshot_; | 1109 HeapSnapshot* snapshot_; |
1113 v8::ActivityControl* control_; | 1110 v8::ActivityControl* control_; |
1114 V8HeapExplorer v8_heap_explorer_; | 1111 V8HeapExplorer v8_heap_explorer_; |
1115 NativeObjectsExplorer dom_explorer_; | 1112 NativeObjectsExplorer dom_explorer_; |
1116 // Mapping from HeapThing pointers to HeapEntry* pointers. | 1113 // Mapping from HeapThing pointers to HeapEntry* pointers. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 | 1164 |
1168 friend class HeapSnapshotJSONSerializerEnumerator; | 1165 friend class HeapSnapshotJSONSerializerEnumerator; |
1169 friend class HeapSnapshotJSONSerializerIterator; | 1166 friend class HeapSnapshotJSONSerializerIterator; |
1170 | 1167 |
1171 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); | 1168 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); |
1172 }; | 1169 }; |
1173 | 1170 |
1174 } } // namespace v8::internal | 1171 } } // namespace v8::internal |
1175 | 1172 |
1176 #endif // V8_PROFILE_GENERATOR_H_ | 1173 #endif // V8_PROFILE_GENERATOR_H_ |
OLD | NEW |