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 | 480 INLINE(HeapEntry* from()); |
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_; } |
| 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 497 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 void MarkWindowReachableObjects(); |
1123 void ProgressStep(); | 1126 void ProgressStep(); |
1124 bool ProgressReport(bool force = false); | 1127 bool ProgressReport(bool force = false); |
1125 bool SetEntriesDominators(); | 1128 bool SetEntriesDominators(); |
1126 void SetProgressTotal(int iterations_count); | 1129 void SetProgressTotal(int iterations_count); |
1127 | 1130 |
1128 HeapSnapshot* snapshot_; | 1131 HeapSnapshot* snapshot_; |
1129 v8::ActivityControl* control_; | 1132 v8::ActivityControl* control_; |
1130 V8HeapExplorer v8_heap_explorer_; | 1133 V8HeapExplorer v8_heap_explorer_; |
1131 NativeObjectsExplorer dom_explorer_; | 1134 NativeObjectsExplorer dom_explorer_; |
1132 // Mapping from HeapThing pointers to HeapEntry* pointers. | 1135 // Mapping from HeapThing pointers to HeapEntry* pointers. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1185 | 1188 |
1186 friend class HeapSnapshotJSONSerializerEnumerator; | 1189 friend class HeapSnapshotJSONSerializerEnumerator; |
1187 friend class HeapSnapshotJSONSerializerIterator; | 1190 friend class HeapSnapshotJSONSerializerIterator; |
1188 | 1191 |
1189 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); | 1192 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); |
1190 }; | 1193 }; |
1191 | 1194 |
1192 } } // namespace v8::internal | 1195 } } // namespace v8::internal |
1193 | 1196 |
1194 #endif // V8_PROFILE_GENERATOR_H_ | 1197 #endif // V8_PROFILE_GENERATOR_H_ |
OLD | NEW |