OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2648 HeapGraphEdge::kElement, | 2648 HeapGraphEdge::kElement, |
2649 kGcRootsObject, snapshot_->gc_roots(), | 2649 kGcRootsObject, snapshot_->gc_roots(), |
2650 GetNthGcSubrootObject(tag), snapshot_->gc_subroot(tag)); | 2650 GetNthGcSubrootObject(tag), snapshot_->gc_subroot(tag)); |
2651 } | 2651 } |
2652 | 2652 |
2653 | 2653 |
2654 void V8HeapExplorer::SetGcSubrootReference( | 2654 void V8HeapExplorer::SetGcSubrootReference( |
2655 VisitorSynchronization::SyncTag tag, bool is_weak, Object* child_obj) { | 2655 VisitorSynchronization::SyncTag tag, bool is_weak, Object* child_obj) { |
2656 HeapEntry* child_entry = GetEntry(child_obj); | 2656 HeapEntry* child_entry = GetEntry(child_obj); |
2657 if (child_entry != NULL) { | 2657 if (child_entry != NULL) { |
2658 filler_->SetIndexedAutoIndexReference( | 2658 const char* name = GetStrongGcSubrootName(child_obj); |
2659 is_weak ? HeapGraphEdge::kWeak : HeapGraphEdge::kElement, | 2659 if (name != NULL) { |
2660 GetNthGcSubrootObject(tag), snapshot_->gc_subroot(tag), | 2660 filler_->SetNamedReference( |
2661 child_obj, child_entry); | 2661 HeapGraphEdge::kInternal, |
| 2662 GetNthGcSubrootObject(tag), snapshot_->gc_subroot(tag), |
| 2663 name, |
| 2664 child_obj, child_entry); |
| 2665 } else { |
| 2666 filler_->SetIndexedAutoIndexReference( |
| 2667 is_weak ? HeapGraphEdge::kWeak : HeapGraphEdge::kElement, |
| 2668 GetNthGcSubrootObject(tag), snapshot_->gc_subroot(tag), |
| 2669 child_obj, child_entry); |
| 2670 } |
2662 } | 2671 } |
2663 } | 2672 } |
2664 | 2673 |
2665 | 2674 |
| 2675 const char* V8HeapExplorer::GetStrongGcSubrootName(Object* object) { |
| 2676 if (strong_gc_subroot_names_.is_empty()) { |
| 2677 #define NAME_ENTRY(name) strong_gc_subroot_names_.SetTag(heap_->name(), #name); |
| 2678 #define ROOT_NAME(type, name, camel_name) NAME_ENTRY(name) |
| 2679 STRONG_ROOT_LIST(ROOT_NAME) |
| 2680 #undef ROOT_NAME |
| 2681 #define STRUCT_MAP_NAME(NAME, Name, name) NAME_ENTRY(name##_map) |
| 2682 STRUCT_LIST(STRUCT_MAP_NAME) |
| 2683 #undef STRUCT_MAP_NAME |
| 2684 #define SYMBOL_NAME(name, str) NAME_ENTRY(name) |
| 2685 SYMBOL_LIST(SYMBOL_NAME) |
| 2686 #undef SYMBOL_NAME |
| 2687 #undef NAME_ENTRY |
| 2688 CHECK(!strong_gc_subroot_names_.is_empty()); |
| 2689 } |
| 2690 return strong_gc_subroot_names_.GetTag(object); |
| 2691 } |
| 2692 |
| 2693 |
2666 void V8HeapExplorer::TagObject(Object* obj, const char* tag) { | 2694 void V8HeapExplorer::TagObject(Object* obj, const char* tag) { |
2667 if (obj->IsHeapObject() && | 2695 if (obj->IsHeapObject() && |
2668 !obj->IsOddball() && | 2696 !obj->IsOddball() && |
2669 obj != heap_->raw_unchecked_empty_byte_array() && | 2697 obj != heap_->raw_unchecked_empty_byte_array() && |
2670 obj != heap_->raw_unchecked_empty_fixed_array() && | 2698 obj != heap_->raw_unchecked_empty_fixed_array() && |
2671 obj != heap_->raw_unchecked_empty_descriptor_array()) { | 2699 obj != heap_->raw_unchecked_empty_descriptor_array()) { |
2672 objects_tags_.SetTag(obj, tag); | 2700 objects_tags_.SetTag(obj, tag); |
2673 } | 2701 } |
2674 } | 2702 } |
2675 | 2703 |
(...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3901 | 3929 |
3902 | 3930 |
3903 void HeapSnapshotJSONSerializer::SortHashMap( | 3931 void HeapSnapshotJSONSerializer::SortHashMap( |
3904 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 3932 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
3905 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 3933 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
3906 sorted_entries->Add(p); | 3934 sorted_entries->Add(p); |
3907 sorted_entries->Sort(SortUsingEntryValue); | 3935 sorted_entries->Sort(SortUsingEntryValue); |
3908 } | 3936 } |
3909 | 3937 |
3910 } } // namespace v8::internal | 3938 } } // namespace v8::internal |
OLD | NEW |