OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/profiler/heap-snapshot-generator.h" | 5 #include "src/profiler/heap-snapshot-generator.h" |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/conversions.h" | 8 #include "src/conversions.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/objects-body-descriptors.h" | 10 #include "src/objects-body-descriptors.h" |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 void HeapObjectsMap::StopHeapObjectsTracking() { | 471 void HeapObjectsMap::StopHeapObjectsTracking() { |
472 time_intervals_.Clear(); | 472 time_intervals_.Clear(); |
473 } | 473 } |
474 | 474 |
475 | 475 |
476 void HeapObjectsMap::UpdateHeapObjectsMap() { | 476 void HeapObjectsMap::UpdateHeapObjectsMap() { |
477 if (FLAG_heap_profiler_trace_objects) { | 477 if (FLAG_heap_profiler_trace_objects) { |
478 PrintF("Begin HeapObjectsMap::UpdateHeapObjectsMap. map has %d entries.\n", | 478 PrintF("Begin HeapObjectsMap::UpdateHeapObjectsMap. map has %d entries.\n", |
479 entries_map_.occupancy()); | 479 entries_map_.occupancy()); |
480 } | 480 } |
481 heap_->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask, | 481 heap_->CollectAllGarbage(Heap::kMakeHeapIterableMask, |
482 "HeapObjectsMap::UpdateHeapObjectsMap"); | 482 "HeapObjectsMap::UpdateHeapObjectsMap"); |
483 HeapIterator iterator(heap_); | 483 HeapIterator iterator(heap_); |
484 for (HeapObject* obj = iterator.next(); | 484 for (HeapObject* obj = iterator.next(); |
485 obj != NULL; | 485 obj != NULL; |
486 obj = iterator.next()) { | 486 obj = iterator.next()) { |
487 FindOrAddEntry(obj->address(), obj->Size()); | 487 FindOrAddEntry(obj->address(), obj->Size()); |
488 if (FLAG_heap_profiler_trace_objects) { | 488 if (FLAG_heap_profiler_trace_objects) { |
489 PrintF("Update object : %p %6d. Next address is %p\n", | 489 PrintF("Update object : %p %6d. Next address is %p\n", |
490 obj->address(), | 490 obj->address(), |
491 obj->Size(), | 491 obj->Size(), |
492 obj->address() + obj->Size()); | 492 obj->address() + obj->Size()); |
(...skipping 2005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2498 } | 2498 } |
2499 | 2499 |
2500 | 2500 |
2501 bool HeapSnapshotGenerator::GenerateSnapshot() { | 2501 bool HeapSnapshotGenerator::GenerateSnapshot() { |
2502 v8_heap_explorer_.TagGlobalObjects(); | 2502 v8_heap_explorer_.TagGlobalObjects(); |
2503 | 2503 |
2504 // TODO(1562) Profiler assumes that any object that is in the heap after | 2504 // TODO(1562) Profiler assumes that any object that is in the heap after |
2505 // full GC is reachable from the root when computing dominators. | 2505 // full GC is reachable from the root when computing dominators. |
2506 // This is not true for weakly reachable objects. | 2506 // This is not true for weakly reachable objects. |
2507 // As a temporary solution we call GC twice. | 2507 // As a temporary solution we call GC twice. |
2508 heap_->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask, | 2508 heap_->CollectAllGarbage( |
2509 "HeapSnapshotGenerator::GenerateSnapshot"); | 2509 Heap::kMakeHeapIterableMask, |
2510 heap_->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask, | 2510 "HeapSnapshotGenerator::GenerateSnapshot"); |
2511 "HeapSnapshotGenerator::GenerateSnapshot"); | 2511 heap_->CollectAllGarbage( |
| 2512 Heap::kMakeHeapIterableMask, |
| 2513 "HeapSnapshotGenerator::GenerateSnapshot"); |
2512 | 2514 |
2513 #ifdef VERIFY_HEAP | 2515 #ifdef VERIFY_HEAP |
2514 Heap* debug_heap = heap_; | 2516 Heap* debug_heap = heap_; |
2515 if (FLAG_verify_heap) { | 2517 if (FLAG_verify_heap) { |
2516 debug_heap->Verify(); | 2518 debug_heap->Verify(); |
2517 } | 2519 } |
2518 #endif | 2520 #endif |
2519 | 2521 |
2520 SetProgressTotal(2); // 2 passes. | 2522 SetProgressTotal(2); // 2 passes. |
2521 | 2523 |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3121 for (int i = 1; i < sorted_strings.length(); ++i) { | 3123 for (int i = 1; i < sorted_strings.length(); ++i) { |
3122 writer_->AddCharacter(','); | 3124 writer_->AddCharacter(','); |
3123 SerializeString(sorted_strings[i]); | 3125 SerializeString(sorted_strings[i]); |
3124 if (writer_->aborted()) return; | 3126 if (writer_->aborted()) return; |
3125 } | 3127 } |
3126 } | 3128 } |
3127 | 3129 |
3128 | 3130 |
3129 } // namespace internal | 3131 } // namespace internal |
3130 } // namespace v8 | 3132 } // namespace v8 |
OLD | NEW |