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

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

Issue 2669393002: [inspector] fixed taskHeapSnapshot on pause (Closed)
Patch Set: updated test expectations Created 3 years, 10 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 | « no previous file | test/inspector/heap-profiler/take-heap-snapshot-on-pause.js » ('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 <utility> 7 #include <utility>
8 8
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 2474 matching lines...) Expand 10 before | Expand all | Expand 10 after
2485 v8::ActivityControl* control, 2485 v8::ActivityControl* control,
2486 v8::HeapProfiler::ObjectNameResolver* resolver, 2486 v8::HeapProfiler::ObjectNameResolver* resolver,
2487 Heap* heap) 2487 Heap* heap)
2488 : snapshot_(snapshot), 2488 : snapshot_(snapshot),
2489 control_(control), 2489 control_(control),
2490 v8_heap_explorer_(snapshot_, this, resolver), 2490 v8_heap_explorer_(snapshot_, this, resolver),
2491 dom_explorer_(snapshot_, this), 2491 dom_explorer_(snapshot_, this),
2492 heap_(heap) { 2492 heap_(heap) {
2493 } 2493 }
2494 2494
2495 namespace {
2496 class NullContextScope {
2497 public:
2498 explicit NullContextScope(Isolate* isolate)
2499 : isolate_(isolate), prev_(isolate->context()) {
2500 isolate_->set_context(nullptr);
2501 }
2502 ~NullContextScope() { isolate_->set_context(prev_); }
2503
2504 private:
2505 Isolate* isolate_;
2506 Context* prev_;
2507 };
2508 } // namespace
2495 2509
2496 bool HeapSnapshotGenerator::GenerateSnapshot() { 2510 bool HeapSnapshotGenerator::GenerateSnapshot() {
2497 v8_heap_explorer_.TagGlobalObjects(); 2511 v8_heap_explorer_.TagGlobalObjects();
2498 2512
2499 // TODO(1562) Profiler assumes that any object that is in the heap after 2513 // TODO(1562) Profiler assumes that any object that is in the heap after
2500 // full GC is reachable from the root when computing dominators. 2514 // full GC is reachable from the root when computing dominators.
2501 // This is not true for weakly reachable objects. 2515 // This is not true for weakly reachable objects.
2502 // As a temporary solution we call GC twice. 2516 // As a temporary solution we call GC twice.
2503 heap_->CollectAllGarbage(Heap::kMakeHeapIterableMask, 2517 heap_->CollectAllGarbage(Heap::kMakeHeapIterableMask,
2504 GarbageCollectionReason::kHeapProfiler); 2518 GarbageCollectionReason::kHeapProfiler);
2505 heap_->CollectAllGarbage(Heap::kMakeHeapIterableMask, 2519 heap_->CollectAllGarbage(Heap::kMakeHeapIterableMask,
2506 GarbageCollectionReason::kHeapProfiler); 2520 GarbageCollectionReason::kHeapProfiler);
2507 2521
2522 NullContextScope null_context_scope(heap_->isolate());
2523
2508 #ifdef VERIFY_HEAP 2524 #ifdef VERIFY_HEAP
2509 Heap* debug_heap = heap_; 2525 Heap* debug_heap = heap_;
2510 if (FLAG_verify_heap) { 2526 if (FLAG_verify_heap) {
2511 debug_heap->Verify(); 2527 debug_heap->Verify();
2512 } 2528 }
2513 #endif 2529 #endif
2514 2530
2515 SetProgressTotal(2); // 2 passes. 2531 SetProgressTotal(2); // 2 passes.
2516 2532
2517 #ifdef VERIFY_HEAP 2533 #ifdef VERIFY_HEAP
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
3115 for (int i = 1; i < sorted_strings.length(); ++i) { 3131 for (int i = 1; i < sorted_strings.length(); ++i) {
3116 writer_->AddCharacter(','); 3132 writer_->AddCharacter(',');
3117 SerializeString(sorted_strings[i]); 3133 SerializeString(sorted_strings[i]);
3118 if (writer_->aborted()) return; 3134 if (writer_->aborted()) return;
3119 } 3135 }
3120 } 3136 }
3121 3137
3122 3138
3123 } // namespace internal 3139 } // namespace internal
3124 } // namespace v8 3140 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/inspector/heap-profiler/take-heap-snapshot-on-pause.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698