| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_REMEMBERED_SET_H | 5 #ifndef V8_REMEMBERED_SET_H |
| 6 #define V8_REMEMBERED_SET_H | 6 #define V8_REMEMBERED_SET_H |
| 7 | 7 |
| 8 #include "src/assembler.h" | 8 #include "src/assembler.h" |
| 9 #include "src/heap/heap.h" | 9 #include "src/heap/heap.h" |
| 10 #include "src/heap/slot-set.h" | 10 #include "src/heap/slot-set.h" |
| 11 #include "src/heap/spaces.h" | 11 #include "src/heap/spaces.h" |
| 12 | 12 |
| 13 namespace v8 { | 13 namespace v8 { |
| 14 namespace internal { | 14 namespace internal { |
| 15 | 15 |
| 16 enum PointerDirection { OLD_TO_OLD, OLD_TO_NEW }; | 16 enum PointerDirection { OLD_TO_OLD, OLD_TO_NEW }; |
| 17 | 17 |
| 18 // TODO(ulan): Investigate performance of de-templatizing this class. | 18 // TODO(ulan): Investigate performance of de-templatizing this class. |
| 19 template <PointerDirection direction> | 19 template <PointerDirection direction> |
| 20 class RememberedSet { | 20 class RememberedSet : public AllStatic { |
| 21 public: | 21 public: |
| 22 // Given a page and a slot in that page, this function adds the slot to the | 22 // Given a page and a slot in that page, this function adds the slot to the |
| 23 // remembered set. | 23 // remembered set. |
| 24 static void Insert(MemoryChunk* chunk, Address slot_addr) { | 24 static void Insert(MemoryChunk* chunk, Address slot_addr) { |
| 25 DCHECK(chunk->Contains(slot_addr)); | 25 DCHECK(chunk->Contains(slot_addr)); |
| 26 SlotSet* slot_set = GetSlotSet(chunk); | 26 SlotSet* slot_set = GetSlotSet(chunk); |
| 27 if (slot_set == nullptr) { | 27 if (slot_set == nullptr) { |
| 28 slot_set = AllocateSlotSet(chunk); | 28 slot_set = AllocateSlotSet(chunk); |
| 29 } | 29 } |
| 30 uintptr_t offset = slot_addr - chunk->address(); | 30 uintptr_t offset = slot_addr - chunk->address(); |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 return DEBUG_TARGET_SLOT; | 390 return DEBUG_TARGET_SLOT; |
| 391 } | 391 } |
| 392 UNREACHABLE(); | 392 UNREACHABLE(); |
| 393 return CLEARED_SLOT; | 393 return CLEARED_SLOT; |
| 394 } | 394 } |
| 395 | 395 |
| 396 } // namespace internal | 396 } // namespace internal |
| 397 } // namespace v8 | 397 } // namespace v8 |
| 398 | 398 |
| 399 #endif // V8_REMEMBERED_SET_H | 399 #endif // V8_REMEMBERED_SET_H |
| OLD | NEW |