Chromium Code Reviews| Index: src/heap/slot-set.h |
| diff --git a/src/heap/slot-set.h b/src/heap/slot-set.h |
| index eb2fbb9e5b2773df435a1a70993fd8954ed04bca..4bfc65bd1d231c2dcaa059cca9b2b25483d8b743 100644 |
| --- a/src/heap/slot-set.h |
| +++ b/src/heap/slot-set.h |
| @@ -5,6 +5,7 @@ |
| #ifndef V8_SLOT_SET_H |
| #define V8_SLOT_SET_H |
| +#include <map> |
| #include <stack> |
| #include "src/allocation.h" |
| @@ -460,6 +461,27 @@ class TypedSlotSet { |
| } |
| } |
| + void RemoveInvaldSlots(std::map<uint32_t, uint32_t>& invalid_ranges) { |
| + Chunk* chunk = chunk_.Value(); |
| + while (chunk != nullptr) { |
| + TypedSlot* buffer = chunk->buffer.Value(); |
| + int count = chunk->count.Value(); |
| + for (int i = 0; i < count; i++) { |
| + uint32_t host_offset = buffer[i].host_offset(); |
| + std::map<uint32_t, uint32_t>::iterator upper_bound = |
| + invalid_ranges.upper_bound(host_offset); |
|
ulan
2016/10/20 15:48:19
if (upper_bound == invalid_ranges.begin()) continu
Hannes Payer (out of office)
2016/10/21 07:13:30
Done.
|
| + // upper_bounds points to the invalid range after the given slot. Hence, |
| + // we have to go to the previous element. |
| + upper_bound--; |
| + if (upper_bound->first <= host_offset && |
|
ulan
2016/10/20 15:48:19
DCHECK_LE(upper_bound->first, host_offset);
This s
Hannes Payer (out of office)
2016/10/21 07:13:29
Done.
|
| + upper_bound->second > host_offset) { |
| + buffer[i].Clear(); |
| + } |
| + } |
| + chunk = chunk->next.Value(); |
| + } |
| + } |
| + |
| private: |
| static const int kInitialBufferSize = 100; |
| static const int kMaxBufferSize = 16 * KB; |