Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1820)

Side by Side Diff: src/heap/slot-set.h

Issue 2256113002: Workaround for gcc array bound check issue (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: moved array bound check to MaskCell Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698