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/heap-snapshot-generator.h" | 5 #include "src/heap-snapshot-generator.h" |
6 | 6 |
7 #include "src/allocation-tracker.h" | 7 #include "src/allocation-tracker.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/conversions.h" | 9 #include "src/conversions.h" |
10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.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("HeapObjectsMap::UpdateHeapObjectsMap", | 481 heap_->CollectAllGarbage(Heap::kMakeHeapIterableMask, |
482 Heap::kMakeHeapIterableMask); | 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 2054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2547 } | 2547 } |
2548 | 2548 |
2549 | 2549 |
2550 bool HeapSnapshotGenerator::GenerateSnapshot() { | 2550 bool HeapSnapshotGenerator::GenerateSnapshot() { |
2551 v8_heap_explorer_.TagGlobalObjects(); | 2551 v8_heap_explorer_.TagGlobalObjects(); |
2552 | 2552 |
2553 // TODO(1562) Profiler assumes that any object that is in the heap after | 2553 // TODO(1562) Profiler assumes that any object that is in the heap after |
2554 // full GC is reachable from the root when computing dominators. | 2554 // full GC is reachable from the root when computing dominators. |
2555 // This is not true for weakly reachable objects. | 2555 // This is not true for weakly reachable objects. |
2556 // As a temporary solution we call GC twice. | 2556 // As a temporary solution we call GC twice. |
2557 heap_->CollectAllGarbage("HeapSnapshotGenerator::GenerateSnapshot", | 2557 heap_->CollectAllGarbage( |
2558 Heap::kMakeHeapIterableMask); | 2558 Heap::kMakeHeapIterableMask, |
2559 heap_->CollectAllGarbage("HeapSnapshotGenerator::GenerateSnapshot", | 2559 "HeapSnapshotGenerator::GenerateSnapshot"); |
2560 Heap::kMakeHeapIterableMask); | 2560 heap_->CollectAllGarbage( |
| 2561 Heap::kMakeHeapIterableMask, |
| 2562 "HeapSnapshotGenerator::GenerateSnapshot"); |
2561 | 2563 |
2562 #ifdef VERIFY_HEAP | 2564 #ifdef VERIFY_HEAP |
2563 Heap* debug_heap = heap_; | 2565 Heap* debug_heap = heap_; |
2564 if (FLAG_verify_heap) { | 2566 if (FLAG_verify_heap) { |
2565 debug_heap->Verify(); | 2567 debug_heap->Verify(); |
2566 } | 2568 } |
2567 #endif | 2569 #endif |
2568 | 2570 |
2569 SetProgressTotal(2); // 2 passes. | 2571 SetProgressTotal(2); // 2 passes. |
2570 | 2572 |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3170 for (int i = 1; i < sorted_strings.length(); ++i) { | 3172 for (int i = 1; i < sorted_strings.length(); ++i) { |
3171 writer_->AddCharacter(','); | 3173 writer_->AddCharacter(','); |
3172 SerializeString(sorted_strings[i]); | 3174 SerializeString(sorted_strings[i]); |
3173 if (writer_->aborted()) return; | 3175 if (writer_->aborted()) return; |
3174 } | 3176 } |
3175 } | 3177 } |
3176 | 3178 |
3177 | 3179 |
3178 } // namespace internal | 3180 } // namespace internal |
3179 } // namespace v8 | 3181 } // namespace v8 |
OLD | NEW |