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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 } | 187 } |
188 return result; | 188 return result; |
189 } | 189 } |
190 | 190 |
191 void ReleaseBucket(int bucket_index) { | 191 void ReleaseBucket(int bucket_index) { |
192 DeleteArray<uint32_t>(bucket[bucket_index]); | 192 DeleteArray<uint32_t>(bucket[bucket_index]); |
193 bucket[bucket_index] = nullptr; | 193 bucket[bucket_index] = nullptr; |
194 } | 194 } |
195 | 195 |
196 void MaskCell(int bucket_index, int cell_index, uint32_t mask) { | 196 void MaskCell(int bucket_index, int cell_index, uint32_t mask) { |
197 uint32_t* cells = bucket[bucket_index]; | 197 if (bucket_index < kBuckets) { |
198 if (cells != nullptr && cells[cell_index] != 0) { | 198 uint32_t* cells = bucket[bucket_index]; |
199 cells[cell_index] &= mask; | 199 if (cells != nullptr && cells[cell_index] != 0) { |
| 200 cells[cell_index] &= mask; |
| 201 } |
| 202 } else { |
| 203 // GCC bug 59124: Emits wrong warnings |
| 204 // "array subscript is above array bounds" |
| 205 UNREACHABLE(); |
200 } | 206 } |
201 } | 207 } |
202 | 208 |
203 // Converts the slot offset into bucket/cell/bit index. | 209 // Converts the slot offset into bucket/cell/bit index. |
204 void SlotToIndices(int slot_offset, int* bucket_index, int* cell_index, | 210 void SlotToIndices(int slot_offset, int* bucket_index, int* cell_index, |
205 int* bit_index) { | 211 int* bit_index) { |
206 DCHECK_EQ(slot_offset % kPointerSize, 0); | 212 DCHECK_EQ(slot_offset % kPointerSize, 0); |
207 int slot = slot_offset >> kPointerSizeLog2; | 213 int slot = slot_offset >> kPointerSizeLog2; |
208 DCHECK(slot >= 0 && slot <= kMaxSlots); | 214 DCHECK(slot >= 0 && slot <= kMaxSlots); |
209 *bucket_index = slot >> kBitsPerBucketLog2; | 215 *bucket_index = slot >> kBitsPerBucketLog2; |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 }; | 355 }; |
350 | 356 |
351 Address page_start_; | 357 Address page_start_; |
352 Chunk* chunk_; | 358 Chunk* chunk_; |
353 }; | 359 }; |
354 | 360 |
355 } // namespace internal | 361 } // namespace internal |
356 } // namespace v8 | 362 } // namespace v8 |
357 | 363 |
358 #endif // V8_SLOT_SET_H | 364 #endif // V8_SLOT_SET_H |
OLD | NEW |