Reviewers: ulan,

Message:
PTAL.

Description:
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=

Please review this at https://codereview.chromium.org/1270493002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+1, -1 lines):
  M src/heap/heap.cc


Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index b75c6f7bc6083d0990089dd6f3aec50e6b057b99..b4aecc28065a0014ebe69b076d01184d4e5efcc3 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -952,7 +952,7 @@ bool Heap::CollectGarbage(GarbageCollector collector, const char* gc_reason,
       isolate()->CheckDetachedContextsAfterGC();
     }

-    if (collector == MARK_COMPACTOR) {
+    if (collector == MARK_COMPACTOR && deserialization_complete_) {
       intptr_t committed_memory_after = CommittedOldGenerationMemory();
       intptr_t used_memory_after = PromotedSpaceSizeOfObjects();
       MemoryReducer::Event event;


--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to