| Index: src/profiler/heap-snapshot-generator.cc
|
| diff --git a/src/profiler/heap-snapshot-generator.cc b/src/profiler/heap-snapshot-generator.cc
|
| index 0a9fb03226b61013c8c0f04103ded28bc43ef206..df8167310fb1d261c4d46d915cf8730f8cd4c7bd 100644
|
| --- a/src/profiler/heap-snapshot-generator.cc
|
| +++ b/src/profiler/heap-snapshot-generator.cc
|
| @@ -2492,6 +2492,20 @@ HeapSnapshotGenerator::HeapSnapshotGenerator(
|
| heap_(heap) {
|
| }
|
|
|
| +namespace {
|
| +class NullContextScope {
|
| + public:
|
| + explicit NullContextScope(Isolate* isolate)
|
| + : isolate_(isolate), prev_(isolate->context()) {
|
| + isolate_->set_context(nullptr);
|
| + }
|
| + ~NullContextScope() { isolate_->set_context(prev_); }
|
| +
|
| + private:
|
| + Isolate* isolate_;
|
| + Context* prev_;
|
| +};
|
| +} // namespace
|
|
|
| bool HeapSnapshotGenerator::GenerateSnapshot() {
|
| v8_heap_explorer_.TagGlobalObjects();
|
| @@ -2505,6 +2519,8 @@ bool HeapSnapshotGenerator::GenerateSnapshot() {
|
| heap_->CollectAllGarbage(Heap::kMakeHeapIterableMask,
|
| GarbageCollectionReason::kHeapProfiler);
|
|
|
| + NullContextScope null_context_scope(heap_->isolate());
|
| +
|
| #ifdef VERIFY_HEAP
|
| Heap* debug_heap = heap_;
|
| if (FLAG_verify_heap) {
|
|
|