| Index: src/heap/slot-set.h
|
| diff --git a/src/heap/slot-set.h b/src/heap/slot-set.h
|
| index eb2fbb9e5b2773df435a1a70993fd8954ed04bca..da61052b8a68f1554e1822af7df3c48ff1eeda5d 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,28 @@ 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);
|
| + if (upper_bound == invalid_ranges.begin()) continue;
|
| + // upper_bounds points to the invalid range after the given slot. Hence,
|
| + // we have to go to the previous element.
|
| + upper_bound--;
|
| + DCHECK_LE(upper_bound->first, host_offset);
|
| + if (upper_bound->second > host_offset) {
|
| + buffer[i].Clear();
|
| + }
|
| + }
|
| + chunk = chunk->next.Value();
|
| + }
|
| + }
|
| +
|
| private:
|
| static const int kInitialBufferSize = 100;
|
| static const int kMaxBufferSize = 16 * KB;
|
|
|