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_SLOT_SET_H | 5 #ifndef V8_SLOT_SET_H |
6 #define V8_SLOT_SET_H | 6 #define V8_SLOT_SET_H |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/utils.h" | 10 #include "src/utils.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 if (cell & bit_mask) { | 57 if (cell & bit_mask) { |
58 bucket[bucket_index][cell_index] ^= bit_mask; | 58 bucket[bucket_index][cell_index] ^= bit_mask; |
59 } | 59 } |
60 } | 60 } |
61 } | 61 } |
62 } | 62 } |
63 | 63 |
64 // The slot offsets specify a range of slots at addresses: | 64 // The slot offsets specify a range of slots at addresses: |
65 // [page_start_ + start_offset ... page_start_ + end_offset). | 65 // [page_start_ + start_offset ... page_start_ + end_offset). |
66 void RemoveRange(int start_offset, int end_offset) { | 66 void RemoveRange(int start_offset, int end_offset) { |
| 67 CHECK_LE(end_offset, 1 << kPageSizeBits); |
67 DCHECK_LE(start_offset, end_offset); | 68 DCHECK_LE(start_offset, end_offset); |
68 int start_bucket, start_cell, start_bit; | 69 int start_bucket, start_cell, start_bit; |
69 SlotToIndices(start_offset, &start_bucket, &start_cell, &start_bit); | 70 SlotToIndices(start_offset, &start_bucket, &start_cell, &start_bit); |
70 int end_bucket, end_cell, end_bit; | 71 int end_bucket, end_cell, end_bit; |
71 SlotToIndices(end_offset, &end_bucket, &end_cell, &end_bit); | 72 SlotToIndices(end_offset, &end_bucket, &end_cell, &end_bit); |
72 uint32_t start_mask = (1u << start_bit) - 1; | 73 uint32_t start_mask = (1u << start_bit) - 1; |
73 uint32_t end_mask = ~((1u << end_bit) - 1); | 74 uint32_t end_mask = ~((1u << end_bit) - 1); |
74 if (start_bucket == end_bucket && start_cell == end_cell) { | 75 if (start_bucket == end_bucket && start_cell == end_cell) { |
75 MaskCell(start_bucket, start_cell, start_mask | end_mask); | 76 MaskCell(start_bucket, start_cell, start_mask | end_mask); |
76 return; | 77 return; |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 }; | 349 }; |
349 | 350 |
350 Address page_start_; | 351 Address page_start_; |
351 Chunk* chunk_; | 352 Chunk* chunk_; |
352 }; | 353 }; |
353 | 354 |
354 } // namespace internal | 355 } // namespace internal |
355 } // namespace v8 | 356 } // namespace v8 |
356 | 357 |
357 #endif // V8_SLOT_SET_H | 358 #endif // V8_SLOT_SET_H |
OLD | NEW |