Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Side by Side Diff: src/profiler/heap-snapshot-generator.cc

Issue 1961373003: [heap] Do not invoke GC to make heap iterable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/log.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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::kMakeHeapIterableMask, 481 heap_->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask,
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
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( 2508 heap_->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask,
2509 Heap::kMakeHeapIterableMask, 2509 "HeapSnapshotGenerator::GenerateSnapshot");
2510 "HeapSnapshotGenerator::GenerateSnapshot"); 2510 heap_->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask,
2511 heap_->CollectAllGarbage( 2511 "HeapSnapshotGenerator::GenerateSnapshot");
2512 Heap::kMakeHeapIterableMask,
2513 "HeapSnapshotGenerator::GenerateSnapshot");
2514 2512
2515 #ifdef VERIFY_HEAP 2513 #ifdef VERIFY_HEAP
2516 Heap* debug_heap = heap_; 2514 Heap* debug_heap = heap_;
2517 if (FLAG_verify_heap) { 2515 if (FLAG_verify_heap) {
2518 debug_heap->Verify(); 2516 debug_heap->Verify();
2519 } 2517 }
2520 #endif 2518 #endif
2521 2519
2522 SetProgressTotal(2); // 2 passes. 2520 SetProgressTotal(2); // 2 passes.
2523 2521
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
3123 for (int i = 1; i < sorted_strings.length(); ++i) { 3121 for (int i = 1; i < sorted_strings.length(); ++i) {
3124 writer_->AddCharacter(','); 3122 writer_->AddCharacter(',');
3125 SerializeString(sorted_strings[i]); 3123 SerializeString(sorted_strings[i]);
3126 if (writer_->aborted()) return; 3124 if (writer_->aborted()) return;
3127 } 3125 }
3128 } 3126 }
3129 3127
3130 3128
3131 } // namespace internal 3129 } // namespace internal
3132 } // namespace v8 3130 } // namespace v8
OLDNEW
« no previous file with comments | « src/log.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698