Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index b1165b3ae7ea74daef4df6ec236d76fdc3b2eaf7..b6e667700c488aacce53233cf5f19959ed9d54f1 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -3853,6 +3853,12 @@ inline Vector<const uc16> String::GetCharVector() { |
return flat.ToUC16Vector(); |
} |
+uint32_t String::ToValidIndex(Object* number) { |
+ uint32_t index = PositiveNumberToUint32(number); |
+ uint32_t length_value = static_cast<uint32_t>(length()); |
+ if (index > length_value) return length_value; |
+ return index; |
+} |
uint16_t SeqOneByteString::SeqOneByteStringGet(int index) { |
DCHECK(index >= 0 && index < length()); |