@@ -309,15 +309,15 @@ int Search(T* array, Name name, int valid_entries, int* out_insertion_index) {
309
309
double FixedDoubleArray::get_scalar (int index) {
310
310
DCHECK (map () != GetReadOnlyRoots ().fixed_cow_array_map () &&
311
311
map () != GetReadOnlyRoots ().fixed_array_map ());
312
- DCHECK ( index >= 0 && index < this -> length ());
312
+ DCHECK_LT ( static_cast < unsigned >( index ), static_cast < unsigned >( length () ));
313
313
DCHECK (!is_the_hole (index ));
314
314
return ReadField<double >(kHeaderSize + index * kDoubleSize );
315
315
}
316
316
317
317
uint64_t FixedDoubleArray::get_representation (int index) {
318
318
DCHECK (map () != GetReadOnlyRoots ().fixed_cow_array_map () &&
319
319
map () != GetReadOnlyRoots ().fixed_array_map ());
320
- DCHECK ( index >= 0 && index < this -> length ());
320
+ DCHECK_LT ( static_cast < unsigned >( index ), static_cast < unsigned >( length () ));
321
321
int offset = kHeaderSize + index * kDoubleSize ;
322
322
// Bug(v8:8875): Doubles may be unaligned.
323
323
return base::ReadUnalignedValue<uint64_t >(field_address (offset));
@@ -335,6 +335,7 @@ Handle<Object> FixedDoubleArray::get(FixedDoubleArray array, int index,
335
335
void FixedDoubleArray::set (int index, double value) {
336
336
DCHECK (map () != GetReadOnlyRoots ().fixed_cow_array_map () &&
337
337
map () != GetReadOnlyRoots ().fixed_array_map ());
338
+ DCHECK_LT (static_cast <unsigned >(index ), static_cast <unsigned >(length ()));
338
339
int offset = kHeaderSize + index * kDoubleSize ;
339
340
if (std::isnan (value)) {
340
341
WriteField<double >(offset, std::numeric_limits<double >::quiet_NaN ());
@@ -351,6 +352,7 @@ void FixedDoubleArray::set_the_hole(Isolate* isolate, int index) {
351
352
void FixedDoubleArray::set_the_hole (int index) {
352
353
DCHECK (map () != GetReadOnlyRoots ().fixed_cow_array_map () &&
353
354
map () != GetReadOnlyRoots ().fixed_array_map ());
355
+ DCHECK_LT (static_cast <unsigned >(index ), static_cast <unsigned >(length ()));
354
356
int offset = kHeaderSize + index * kDoubleSize ;
355
357
base::WriteUnalignedValue<uint64_t >(field_address (offset), kHoleNanInt64 );
356
358
}
0 commit comments