Commit 4f03ccdf authored by Peter Marshall's avatar Peter Marshall Committed by Commit Bot

[errors] Add the requested length to the TypedArray length error.

Why not?

Bug: v8:6215
Change-Id: I29f3731cbd0d03af6858eb475a1df8b8988cb89f
Reviewed-on: https://chromium-review.googlesource.com/469848Reviewed-by: 's avatarFranziska Hinkelmann <franzih@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44452}
parent 1ccf6c09
......@@ -354,7 +354,7 @@ TF_BUILTIN(TypedArrayConstructByLength, TypedArrayBuiltinsAssembler) {
BIND(&invalid_length);
{
CallRuntime(Runtime::kThrowRangeError, context,
SmiConstant(MessageTemplate::kInvalidTypedArrayLength));
SmiConstant(MessageTemplate::kInvalidTypedArrayLength), length);
Unreachable();
}
}
......@@ -495,7 +495,7 @@ TF_BUILTIN(TypedArrayConstructByArrayBuffer, TypedArrayBuiltinsAssembler) {
BIND(&invalid_length);
{
CallRuntime(Runtime::kThrowRangeError, context,
SmiConstant(MessageTemplate::kInvalidTypedArrayLength));
SmiConstant(MessageTemplate::kInvalidTypedArrayLength), length);
Unreachable();
}
}
......@@ -536,7 +536,7 @@ compiler::Node* TypedArrayBuiltinsAssembler::ByteLengthIsValid(
TF_BUILTIN(TypedArrayConstructByArrayLike, TypedArrayBuiltinsAssembler) {
Node* const holder = Parameter(Descriptor::kHolder);
Node* const array_like = Parameter(Descriptor::kArrayLike);
Node* length = Parameter(Descriptor::kLength);
Node* initial_length = Parameter(Descriptor::kLength);
Node* const element_size = Parameter(Descriptor::kElementSize);
CSA_ASSERT(this, TaggedIsSmi(element_size));
Node* const context = Parameter(Descriptor::kContext);
......@@ -547,7 +547,7 @@ TF_BUILTIN(TypedArrayConstructByArrayLike, TypedArrayBuiltinsAssembler) {
Label invalid_length(this), fill(this), fast_copy(this);
// The caller has looked up length on array_like, which is observable.
length = ToSmiLength(length, context, &invalid_length);
Node* length = ToSmiLength(initial_length, context, &invalid_length);
InitializeBasedOnLength(holder, length, element_size, byte_offset, initialize,
context);
......@@ -597,7 +597,8 @@ TF_BUILTIN(TypedArrayConstructByArrayLike, TypedArrayBuiltinsAssembler) {
BIND(&invalid_length);
{
CallRuntime(Runtime::kThrowRangeError, context,
SmiConstant(MessageTemplate::kInvalidTypedArrayLength));
SmiConstant(MessageTemplate::kInvalidTypedArrayLength),
initial_length);
Unreachable();
}
}
......
......@@ -525,7 +525,7 @@ class ErrorUtils : public AllStatic {
T(InvalidTimeValue, "Invalid time value") \
T(InvalidTypedArrayAlignment, "% of % should be a multiple of %") \
T(InvalidTypedArrayIndex, "Invalid typed array index") \
T(InvalidTypedArrayLength, "Invalid typed array length") \
T(InvalidTypedArrayLength, "Invalid typed array length: %") \
T(LetInLexicalBinding, "let is disallowed as a lexically bound name") \
T(LocaleMatcher, "Illegal value for localeMatcher:%") \
T(NormalizationForm, "The normalization form should be one of %.") \
......
......@@ -417,7 +417,7 @@ test(function() {
// kInvalidArrayBufferLength
test(function() {
new Uint16Array(-1);
}, "Invalid typed array length", RangeError);
}, "Invalid typed array length: -1", RangeError);
// kNormalizationForm
test(function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment