@@ -336,15 +336,15 @@ int Search(T* array, Name name, int valid_entries, int* out_insertion_index,
336
336
double FixedDoubleArray::get_scalar (int index) {
337
337
DCHECK (map () != GetReadOnlyRoots ().fixed_cow_array_map () &&
338
338
map () != GetReadOnlyRoots ().fixed_array_map ());
339
- DCHECK ( index >= 0 && index < this -> length ());
339
+ DCHECK_LT ( static_cast < unsigned >( index ), static_cast < unsigned >( length () ));
340
340
DCHECK (!is_the_hole (index ));
341
341
return ReadField<double >(kHeaderSize + index * kDoubleSize );
342
342
}
343
343
344
344
uint64_t FixedDoubleArray::get_representation (int index) {
345
345
DCHECK (map () != GetReadOnlyRoots ().fixed_cow_array_map () &&
346
346
map () != GetReadOnlyRoots ().fixed_array_map ());
347
- DCHECK ( index >= 0 && index < this -> length ());
347
+ DCHECK_LT ( static_cast < unsigned >( index ), static_cast < unsigned >( length () ));
348
348
int offset = kHeaderSize + index * kDoubleSize ;
349
349
// Bug(v8:8875): Doubles may be unaligned.
350
350
return base::ReadUnalignedValue<uint64_t >(field_address (offset));
@@ -362,6 +362,7 @@ Handle<Object> FixedDoubleArray::get(FixedDoubleArray array, int index,
362
362
void FixedDoubleArray::set (int index, double value) {
363
363
DCHECK (map () != GetReadOnlyRoots ().fixed_cow_array_map () &&
364
364
map () != GetReadOnlyRoots ().fixed_array_map ());
365
+ DCHECK_LT (static_cast <unsigned >(index ), static_cast <unsigned >(length ()));
365
366
int offset = kHeaderSize + index * kDoubleSize ;
366
367
if (std::isnan (value)) {
367
368
WriteField<double >(offset, std::numeric_limits<double >::quiet_NaN ());
@@ -378,6 +379,7 @@ void FixedDoubleArray::set_the_hole(Isolate* isolate, int index) {
378
379
void FixedDoubleArray::set_the_hole (int index) {
379
380
DCHECK (map () != GetReadOnlyRoots ().fixed_cow_array_map () &&
380
381
map () != GetReadOnlyRoots ().fixed_array_map ());
382
+ DCHECK_LT (static_cast <unsigned >(index ), static_cast <unsigned >(length ()));
381
383
int offset = kHeaderSize + index * kDoubleSize ;
382
384
base::WriteUnalignedValue<uint64_t >(field_address (offset), kHoleNanInt64 );
383
385
}
0 commit comments