@@ -309,15 +309,15 @@ int Search(T* array, Name name, int valid_entries, int* out_insertion_index) {
309309double FixedDoubleArray::get_scalar (int index) {
310310 DCHECK (map () != GetReadOnlyRoots ().fixed_cow_array_map () &&
311311 map () != GetReadOnlyRoots ().fixed_array_map ());
312- DCHECK (index >= 0 && index < this -> length ());
312+ DCHECK_LT ( static_cast < unsigned >( index), static_cast < unsigned >( length () ));
313313 DCHECK (!is_the_hole (index));
314314 return ReadField<double >(kHeaderSize + index * kDoubleSize );
315315}
316316
317317uint64_t FixedDoubleArray::get_representation (int index) {
318318 DCHECK (map () != GetReadOnlyRoots ().fixed_cow_array_map () &&
319319 map () != GetReadOnlyRoots ().fixed_array_map ());
320- DCHECK (index >= 0 && index < this -> length ());
320+ DCHECK_LT ( static_cast < unsigned >( index), static_cast < unsigned >( length () ));
321321 int offset = kHeaderSize + index * kDoubleSize ;
322322 // Bug(v8:8875): Doubles may be unaligned.
323323 return base::ReadUnalignedValue<uint64_t >(field_address (offset));
@@ -335,6 +335,7 @@ Handle<Object> FixedDoubleArray::get(FixedDoubleArray array, int index,
335335void FixedDoubleArray::set (int index, double value) {
336336 DCHECK (map () != GetReadOnlyRoots ().fixed_cow_array_map () &&
337337 map () != GetReadOnlyRoots ().fixed_array_map ());
338+ DCHECK_LT (static_cast <unsigned >(index), static_cast <unsigned >(length ()));
338339 int offset = kHeaderSize + index * kDoubleSize ;
339340 if (std::isnan (value)) {
340341 WriteField<double >(offset, std::numeric_limits<double >::quiet_NaN ());
@@ -351,6 +352,7 @@ void FixedDoubleArray::set_the_hole(Isolate* isolate, int index) {
351352void FixedDoubleArray::set_the_hole (int index) {
352353 DCHECK (map () != GetReadOnlyRoots ().fixed_cow_array_map () &&
353354 map () != GetReadOnlyRoots ().fixed_array_map ());
355+ DCHECK_LT (static_cast <unsigned >(index), static_cast <unsigned >(length ()));
354356 int offset = kHeaderSize + index * kDoubleSize ;
355357 base::WriteUnalignedValue<uint64_t >(field_address (offset), kHoleNanInt64 );
356358}
0 commit comments