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

Unified Diff: src/heap/remembered-set.h

Issue 2826593004: [heap] Reland: Take page lock when scavenging old to new references in Scavenger. (Closed)
Patch Set: Use recursive mutex. Created 3 years, 8 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 | « src/heap/mark-compact.cc ('k') | src/heap/spaces.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/remembered-set.h
diff --git a/src/heap/remembered-set.h b/src/heap/remembered-set.h
index 37439bfa62d023a63a55cc6274b1f8bd90220729..b60cd451ee7166a97ded9c17682a2364b29d8c53 100644
--- a/src/heap/remembered-set.h
+++ b/src/heap/remembered-set.h
@@ -13,6 +13,8 @@
namespace v8 {
namespace internal {
+enum RememberedSetIterationMode { SYNCHRONIZED, NON_SYNCHRONIZED };
+
// TODO(ulan): Investigate performance of de-templatizing this class.
template <RememberedSetType type>
class RememberedSet : public AllStatic {
@@ -98,9 +100,13 @@ class RememberedSet : public AllStatic {
// Iterates and filters the remembered set with the given callback.
// The callback should take (Address slot) and return SlotCallbackResult.
template <typename Callback>
- static void Iterate(Heap* heap, Callback callback) {
- IterateMemoryChunks(
- heap, [callback](MemoryChunk* chunk) { Iterate(chunk, callback); });
+ static void Iterate(Heap* heap, RememberedSetIterationMode mode,
+ Callback callback) {
+ IterateMemoryChunks(heap, [mode, callback](MemoryChunk* chunk) {
+ if (mode == SYNCHRONIZED) chunk->mutex()->Lock();
+ Iterate(chunk, callback);
+ if (mode == SYNCHRONIZED) chunk->mutex()->Unlock();
+ });
}
// Iterates over all memory chunks that contains non-empty slot sets.
@@ -177,9 +183,12 @@ class RememberedSet : public AllStatic {
// The callback should take (SlotType slot_type, SlotAddress slot) and return
// SlotCallbackResult.
template <typename Callback>
- static void IterateTyped(Heap* heap, Callback callback) {
- IterateMemoryChunks(heap, [callback](MemoryChunk* chunk) {
+ static void IterateTyped(Heap* heap, RememberedSetIterationMode mode,
+ Callback callback) {
+ IterateMemoryChunks(heap, [mode, callback](MemoryChunk* chunk) {
+ if (mode == SYNCHRONIZED) chunk->mutex()->Lock();
IterateTyped(chunk, callback);
+ if (mode == SYNCHRONIZED) chunk->mutex()->Unlock();
});
}
« no previous file with comments | « src/heap/mark-compact.cc ('k') | src/heap/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698