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 2200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2211 HeapEntry* child_entry = GetEntry(child_obj); | 2211 HeapEntry* child_entry = GetEntry(child_obj); |
2212 if (child_entry != NULL) { | 2212 if (child_entry != NULL) { |
2213 filler_->SetStrongRootReference(child_obj, child_entry); | 2213 filler_->SetStrongRootReference(child_obj, child_entry); |
2214 } | 2214 } |
2215 } | 2215 } |
2216 | 2216 |
2217 | 2217 |
2218 void HeapSnapshotGenerator::SetProgressTotal(int iterations_count) { | 2218 void HeapSnapshotGenerator::SetProgressTotal(int iterations_count) { |
2219 if (control_ == NULL) return; | 2219 if (control_ == NULL) return; |
2220 | 2220 |
2221 HeapIterator iterator(HeapIterator::kFilterUnreachable); | 2221 HeapIterator iterator; |
2222 int objects_count = 0; | 2222 int objects_count = 0; |
2223 for (HeapObject* obj = iterator.next(); | 2223 for (HeapObject* obj = iterator.Next(); |
2224 obj != NULL; | 2224 obj != NULL; |
2225 obj = iterator.next(), ++objects_count) {} | 2225 obj = iterator.Next(), ++objects_count) {} |
2226 progress_total_ = objects_count * iterations_count; | 2226 progress_total_ = objects_count * iterations_count; |
2227 progress_counter_ = 0; | 2227 progress_counter_ = 0; |
2228 } | 2228 } |
2229 | 2229 |
2230 | 2230 |
2231 bool HeapSnapshotGenerator::CountEntriesAndReferences() { | 2231 bool HeapSnapshotGenerator::CountEntriesAndReferences() { |
2232 SnapshotCounter counter(&entries_); | 2232 SnapshotCounter counter(&entries_); |
2233 filler_ = &counter; | 2233 filler_ = &counter; |
2234 filler_->AddEntry(HeapSnapshot::kInternalRootObject); | 2234 filler_->AddEntry(HeapSnapshot::kInternalRootObject); |
2235 filler_->AddEntry(HeapSnapshot::kGcRootsObject); | 2235 filler_->AddEntry(HeapSnapshot::kGcRootsObject); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2364 entry = dominator, dominator = entry->dominator()) { | 2364 entry = dominator, dominator = entry->dominator()) { |
2365 dominator->add_retained_size(entry_size); | 2365 dominator->add_retained_size(entry_size); |
2366 } | 2366 } |
2367 if (!ReportProgress()) return false; | 2367 if (!ReportProgress()) return false; |
2368 } | 2368 } |
2369 return true; | 2369 return true; |
2370 } | 2370 } |
2371 | 2371 |
2372 | 2372 |
2373 bool HeapSnapshotGenerator::IterateAndExtractReferences() { | 2373 bool HeapSnapshotGenerator::IterateAndExtractReferences() { |
2374 HeapIterator iterator(HeapIterator::kFilterUnreachable); | 2374 Heap::EnsureHeapIsIterable(); |
Vyacheslav Egorov (Chromium)
2011/03/15 09:20:09
Sometimes we call Ensure, sometimes we don't.
Thi
Erik Corry
2011/03/17 13:39:17
Done.
| |
2375 HeapIterator iterator; | |
2375 bool interrupted = false; | 2376 bool interrupted = false; |
2376 // Heap iteration with filtering must be finished in any case. | 2377 // Heap iteration with filtering must be finished in any case. |
2377 for (HeapObject* obj = iterator.next(); | 2378 for (HeapObject* obj = iterator.Next(); |
2378 obj != NULL; | 2379 obj != NULL; |
2379 obj = iterator.next(), IncProgressCounter()) { | 2380 obj = iterator.Next(), IncProgressCounter()) { |
2380 if (!interrupted) { | 2381 if (!interrupted) { |
2381 ExtractReferences(obj); | 2382 ExtractReferences(obj); |
2382 if (!ReportProgress()) interrupted = true; | 2383 if (!ReportProgress()) interrupted = true; |
2383 } | 2384 } |
2384 } | 2385 } |
2385 if (interrupted) return false; | 2386 if (interrupted) return false; |
2386 SetRootGcRootsReference(); | 2387 SetRootGcRootsReference(); |
2387 RootsReferencesExtractor extractor(this); | 2388 RootsReferencesExtractor extractor(this); |
2388 Heap::IterateRoots(&extractor, VISIT_ALL); | 2389 Heap::IterateRoots(&extractor, VISIT_ALL); |
2389 return ReportProgress(); | 2390 return ReportProgress(); |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2833 | 2834 |
2834 | 2835 |
2835 String* GetConstructorNameForHeapProfile(JSObject* object) { | 2836 String* GetConstructorNameForHeapProfile(JSObject* object) { |
2836 if (object->IsJSFunction()) return Heap::closure_symbol(); | 2837 if (object->IsJSFunction()) return Heap::closure_symbol(); |
2837 return object->constructor_name(); | 2838 return object->constructor_name(); |
2838 } | 2839 } |
2839 | 2840 |
2840 } } // namespace v8::internal | 2841 } } // namespace v8::internal |
2841 | 2842 |
2842 #endif // ENABLE_LOGGING_AND_PROFILING | 2843 #endif // ENABLE_LOGGING_AND_PROFILING |
OLD | NEW |