Skip to content

Commit 8ae236c

Browse files
cdai2Commit bot
authored andcommitted
Fix the failure when enabling v8 profiler or vtune profiler in chromium.
When enabling the v8 profiler (Using the following command parameters: --js-flags=--prof) or vtune profiling in chromium. it will break. This failure is introduced by this CL: https://codereview.chromium.org/1218863002. The reason is that V8 will enable the JITted code logging if --prof is set for V8. And under this condition, the function Logger::LogCodeObjects() will be invoked and it will trigger a mark-compact GC when deserializing the snapshot. This GC will use MemoryReducer to post a delay task by invoking V8Platform::CallDelayedOnForegroundThread() function. But at this point V8 isolation is still under initialization and the PerIsolationData of this isolation has not been created. (isolation_holder.cc:39~40 line). This leads to V8Platform::CallDelayedOnForegroundThread() failure because of segment fault. According to my understanding, I proposed the following fix. If the heap deserialization has not be completed, it does not post the delay task for next GC. BUG= Review URL: https://codereview.chromium.org/1270493002 Cr-Commit-Position: refs/heads/master@{#29937}
1 parent 47fce35 commit 8ae236c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/heap/heap.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,9 @@ bool Heap::CollectGarbage(GarbageCollector collector, const char* gc_reason,
966966
(committed_memory_before - committed_memory_after) > MB ||
967967
HasHighFragmentation(used_memory_after, committed_memory_after) ||
968968
(detached_contexts()->length() > 0);
969-
memory_reducer_.NotifyMarkCompact(event);
969+
if (deserialization_complete_) {
970+
memory_reducer_.NotifyMarkCompact(event);
971+
}
970972
}
971973

972974
tracer()->Stop(collector);

0 commit comments

Comments
 (0)