Index: src/heap/slot-set.h |
diff --git a/src/heap/slot-set.h b/src/heap/slot-set.h |
index f374c1d684696213b3c7c9f3a7c1ad72c03d9a14..0f3e4b4b32a326cb0b7a7fda752b28ef47a0ff74 100644 |
--- a/src/heap/slot-set.h |
+++ b/src/heap/slot-set.h |
@@ -160,7 +160,7 @@ class SlotSet : public Malloced { |
if (current_bucket[i].Value()) { |
uint32_t cell = current_bucket[i].Value(); |
uint32_t old_cell = cell; |
- uint32_t new_cell = cell; |
+ uint32_t mask = 0; |
while (cell) { |
int bit_offset = base::bits::CountTrailingZeros32(cell); |
uint32_t bit_mask = 1u << bit_offset; |
@@ -168,10 +168,11 @@ class SlotSet : public Malloced { |
if (callback(page_start_ + slot) == KEEP_SLOT) { |
++in_bucket_count; |
} else { |
- new_cell ^= bit_mask; |
+ mask |= bit_mask; |
} |
cell ^= bit_mask; |
} |
+ uint32_t new_cell = old_cell & ~mask; |
if (old_cell != new_cell) { |
while (!current_bucket[i].TrySetValue(old_cell, new_cell)) { |
// If TrySetValue fails, the cell must have changed. We just |
@@ -180,7 +181,7 @@ class SlotSet : public Malloced { |
// method will only be called on the main thread and filtering |
// threads will only remove slots. |
old_cell = current_bucket[i].Value(); |
- new_cell &= old_cell; |
+ new_cell = old_cell & ~mask; |
} |
} |
} |