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

Unified Diff: third_party/WebKit/Source/platform/heap/Heap.cpp

Issue 2065343002: Lock CrossThreadPersistentRegion until end of weak processing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/PersistentNode.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/heap/Heap.cpp
diff --git a/third_party/WebKit/Source/platform/heap/Heap.cpp b/third_party/WebKit/Source/platform/heap/Heap.cpp
index cb41196d3882fa8258cdde7a06406e22566b36eb..9efd299f876a1597c17684f9f34d72cdf7f08900 100644
--- a/third_party/WebKit/Source/platform/heap/Heap.cpp
+++ b/third_party/WebKit/Source/platform/heap/Heap.cpp
@@ -463,18 +463,27 @@ void Heap::collectGarbage(BlinkGC::StackState stackState, BlinkGC::GCType gcType
if (gcType != BlinkGC::TakeSnapshot)
Heap::resetHeapCounters();
- // 1. Trace persistent roots.
- ThreadState::visitPersistentRoots(visitor.get());
+ {
+ // Access to the CrossThreadPersistentRegion has to be prevented while
+ // marking and global weak processing is in progress. If not, threads
+ // not attached to Oilpan and participating in this GC are able
+ // to allocate & free PersistentNodes, something the marking phase isn't
+ // capable of handling.
+ CrossThreadPersistentRegion::LockScope persistentLock(ProcessHeap::crossThreadPersistentRegion());
+
+ // 1. Trace persistent roots.
+ ThreadState::visitPersistentRoots(visitor.get());
- // 2. Trace objects reachable from the stack. We do this independent of the
- // given stackState since other threads might have a different stack state.
- ThreadState::visitStackRoots(visitor.get());
+ // 2. Trace objects reachable from the stack. We do this independent of the
+ // given stackState since other threads might have a different stack state.
+ ThreadState::visitStackRoots(visitor.get());
- // 3. Transitive closure to trace objects including ephemerons.
- processMarkingStack(visitor.get());
+ // 3. Transitive closure to trace objects including ephemerons.
+ processMarkingStack(visitor.get());
- postMarkingProcessing(visitor.get());
- globalWeakProcessing(visitor.get());
+ postMarkingProcessing(visitor.get());
+ globalWeakProcessing(visitor.get());
+ }
// Now we can delete all orphaned pages because there are no dangling
// pointers to the orphaned pages. (If we have such dangling pointers,
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/PersistentNode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698