OLD | NEW |
---|---|
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
89 // one bucket. | 89 // one bucket. |
90 case OTHER: | 90 case OTHER: |
91 case EXTERNAL: | 91 case EXTERNAL: |
92 return program_entry_; | 92 return program_entry_; |
93 default: return NULL; | 93 default: return NULL; |
94 } | 94 } |
95 } | 95 } |
96 | 96 |
97 | 97 |
98 HeapEntry* HeapGraphEdge::from() const { | 98 HeapEntry* HeapGraphEdge::from() const { |
99 return const_cast<HeapEntry*>( | 99 return &snapshot()->entries()[from_]; |
100 reinterpret_cast<const HeapEntry*>(this - child_index_) - 1); | |
101 } | 100 } |
102 | 101 |
103 | 102 |
103 HeapSnapshot* HeapGraphEdge::snapshot() const { | |
104 return to_entry_->snapshot(); | |
105 } | |
106 | |
107 | |
108 int HeapEntry::index() const { | |
109 return this - &snapshot_->entries().first(); | |
mnaganov (inactive)
2012/05/03 15:44:31
I'm not sure this will compile on all platforms. H
alexeif
2012/05/07 11:04:35
I'm not sure, as I don't have a Windows machine. I
| |
110 } | |
111 | |
112 | |
113 HeapGraphEdge** HeapEntry::children_arr() { | |
114 ASSERT(children_index_ >= 0); | |
115 return &snapshot_->children()[children_index_]; | |
116 } | |
117 | |
118 | |
119 HeapGraphEdge** HeapEntry::retainers_arr() { | |
120 ASSERT(retainers_index_ >= 0); | |
121 return &snapshot_->retainers()[retainers_index_]; | |
122 } | |
123 | |
124 | |
125 HeapEntry* HeapEntry::dominator() const { | |
126 ASSERT(dominator_ >= 0); | |
127 return &snapshot_->entries()[dominator_]; | |
128 } | |
129 | |
130 | |
104 SnapshotObjectId HeapObjectsMap::GetNthGcSubrootId(int delta) { | 131 SnapshotObjectId HeapObjectsMap::GetNthGcSubrootId(int delta) { |
105 return kGcRootsFirstSubrootId + delta * kObjectIdStep; | 132 return kGcRootsFirstSubrootId + delta * kObjectIdStep; |
106 } | 133 } |
107 | 134 |
108 | 135 |
109 HeapObject* V8HeapExplorer::GetNthGcSubrootObject(int delta) { | 136 HeapObject* V8HeapExplorer::GetNthGcSubrootObject(int delta) { |
110 return reinterpret_cast<HeapObject*>( | 137 return reinterpret_cast<HeapObject*>( |
111 reinterpret_cast<char*>(kFirstGcSubrootObject) + | 138 reinterpret_cast<char*>(kFirstGcSubrootObject) + |
112 delta * HeapObjectsMap::kObjectIdStep); | 139 delta * HeapObjectsMap::kObjectIdStep); |
113 } | 140 } |
114 | 141 |
115 | 142 |
116 int V8HeapExplorer::GetGcSubrootOrder(HeapObject* subroot) { | 143 int V8HeapExplorer::GetGcSubrootOrder(HeapObject* subroot) { |
117 return static_cast<int>( | 144 return static_cast<int>( |
118 (reinterpret_cast<char*>(subroot) - | 145 (reinterpret_cast<char*>(subroot) - |
119 reinterpret_cast<char*>(kFirstGcSubrootObject)) / | 146 reinterpret_cast<char*>(kFirstGcSubrootObject)) / |
120 HeapObjectsMap::kObjectIdStep); | 147 HeapObjectsMap::kObjectIdStep); |
121 } | 148 } |
122 | 149 |
123 } } // namespace v8::internal | 150 } } // namespace v8::internal |
124 | 151 |
125 #endif // V8_PROFILE_GENERATOR_INL_H_ | 152 #endif // V8_PROFILE_GENERATOR_INL_H_ |
OLD | NEW |