OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/extensions/statistics-extension.h" | 5 #include "src/extensions/statistics-extension.h" |
6 | 6 |
7 #include "src/counters.h" | 7 #include "src/counters.h" |
8 #include "src/heap/heap-inl.h" | 8 #include "src/heap/heap-inl.h" |
9 #include "src/isolate.h" | 9 #include "src/isolate.h" |
10 | 10 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 } | 137 } |
138 | 138 |
139 AddNumber64(args.GetIsolate(), result, heap->external_memory(), | 139 AddNumber64(args.GetIsolate(), result, heap->external_memory(), |
140 "amount_of_external_allocated_memory"); | 140 "amount_of_external_allocated_memory"); |
141 args.GetReturnValue().Set(result); | 141 args.GetReturnValue().Set(result); |
142 | 142 |
143 HeapIterator iterator(reinterpret_cast<Isolate*>(args.GetIsolate())->heap()); | 143 HeapIterator iterator(reinterpret_cast<Isolate*>(args.GetIsolate())->heap()); |
144 HeapObject* obj; | 144 HeapObject* obj; |
145 int reloc_info_total = 0; | 145 int reloc_info_total = 0; |
146 int source_position_table_total = 0; | 146 int source_position_table_total = 0; |
147 while ((obj = iterator.next())) { | 147 while ((obj = iterator.next()) != nullptr) { |
148 if (obj->IsCode()) { | 148 if (obj->IsCode()) { |
149 Code* code = Code::cast(obj); | 149 Code* code = Code::cast(obj); |
150 reloc_info_total += code->relocation_info()->Size(); | 150 reloc_info_total += code->relocation_info()->Size(); |
151 ByteArray* source_position_table = code->source_position_table(); | 151 ByteArray* source_position_table = code->source_position_table(); |
152 if (source_position_table->length() > 0) { | 152 if (source_position_table->length() > 0) { |
153 source_position_table_total += code->source_position_table()->Size(); | 153 source_position_table_total += code->source_position_table()->Size(); |
154 } | 154 } |
155 } else if (obj->IsBytecodeArray()) { | 155 } else if (obj->IsBytecodeArray()) { |
156 source_position_table_total += | 156 source_position_table_total += |
157 BytecodeArray::cast(obj)->source_position_table()->Size(); | 157 BytecodeArray::cast(obj)->source_position_table()->Size(); |
158 } | 158 } |
159 } | 159 } |
160 | 160 |
161 AddNumber(args.GetIsolate(), result, reloc_info_total, | 161 AddNumber(args.GetIsolate(), result, reloc_info_total, |
162 "reloc_info_total_size"); | 162 "reloc_info_total_size"); |
163 AddNumber(args.GetIsolate(), result, source_position_table_total, | 163 AddNumber(args.GetIsolate(), result, source_position_table_total, |
164 "source_position_table_total_size"); | 164 "source_position_table_total_size"); |
165 } | 165 } |
166 | 166 |
167 } // namespace internal | 167 } // namespace internal |
168 } // namespace v8 | 168 } // namespace v8 |
OLD | NEW |