| 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();
|
| });
|
| }
|
|
|
|
|