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

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

Issue 2013173002: Lock CrossThreadPersistentRegion until end of weak processing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: compile fix Created 4 years, 7 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 346f33227e00d53297554272e1b9652f9c46cb2f..ee413e695dab42c9d65cfeb5edc415998d87b52f 100644
--- a/third_party/WebKit/Source/platform/heap/Heap.cpp
+++ b/third_party/WebKit/Source/platform/heap/Heap.cpp
@@ -516,18 +516,27 @@ void ThreadHeap::collectGarbage(BlinkGC::StackState stackState, BlinkGC::GCType
if (gcType != BlinkGC::TakeSnapshot)
state->heap().resetHeapCounters();
- // 1. Trace persistent roots.
- state->heap().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.
+ state->heap().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.
- state->heap().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.
+ state->heap().visitStackRoots(visitor.get());
- // 3. Transitive closure to trace objects including ephemerons.
- state->heap().processMarkingStack(visitor.get());
+ // 3. Transitive closure to trace objects including ephemerons.
+ state->heap().processMarkingStack(visitor.get());
- state->heap().postMarkingProcessing(visitor.get());
- state->heap().globalWeakProcessing(visitor.get());
+ state->heap().postMarkingProcessing(visitor.get());
+ state->heap().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