Include count value to InvalidCountValue error message

This CL includes count value to InvalidCountValue error message to make
it easier to dignoise RangeError of String.prototype.repeat. When
InvalidCountValue error throw, we could not know it's
caused by which count value if count value is not included.

Bug: none
Change-Id: I16e6693da0fc3b181241cb90daca27957f59c77c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3593574
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80198}
This commit is contained in:
yufeng.freeman 2022-04-20 13:17:16 +08:00 committed by V8 LUCI CQ
parent 8b34a96582
commit 40605a3ddb
3 changed files with 13 additions and 2 deletions

View File

@ -108,6 +108,7 @@ Erich Ocean <erich.ocean@me.com>
Evan Lucas <evan.lucas@help.com>
Fedor Indutny <fedor@indutny.com>
Felix Geisendörfer <haimuiba@gmail.com>
Feng Yu <f3n67u@gmail.com>
Filipe David Manana <fdmanana@gmail.com>
Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Gao Sheng <gaosheng08@meituan.com>

View File

@ -357,7 +357,7 @@ namespace internal {
T(InvalidAtomicAccessIndex, "Invalid atomic access index") \
T(InvalidCalendar, "Invalid calendar specified: %") \
T(InvalidCodePoint, "Invalid code point %") \
T(InvalidCountValue, "Invalid count value") \
T(InvalidCountValue, "Invalid count value: %") \
T(InvalidDataViewAccessorOffset, \
"Offset is outside the bounds of the DataView") \
T(InvalidDataViewLength, "Invalid DataView length %") \

View File

@ -543,7 +543,17 @@ test(function() {
// kInvalidCountValue
test(function() {
"a".repeat(-1);
}, "Invalid count value", RangeError);
}, "Invalid count value: -1", RangeError);
// kInvalidCountValue
test(function() {
"a".repeat(Infinity);
}, "Invalid count value: Infinity", RangeError);
// kInvalidCountValue
test(function() {
"a".repeat(-Infinity);
}, "Invalid count value: -Infinity", RangeError);
// kInvalidArrayBufferLength
test(function() {