Commit c80d049a authored by peterwmwong's avatar peterwmwong Committed by Commit Bot

[builtins] Change A.p.join invalid string length errors to use ThrowInvalidStringLength runtime.

This is to enable switching from throwing a JS exception (RangeError)
to an abort when the --abort_on_stack_or_string_length_overflow flag
is set.

Bug: chromium:901652
Change-Id: Ia3ff2ec55e77a4f60d715f0bc767e6180a5e001a
Reviewed-on: https://chromium-review.googlesource.com/c/1322312
Commit-Queue: Peter Wong <peter.wm.wong@gmail.com>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57307}
parent d1cb4ef4
......@@ -106,7 +106,7 @@ module array {
return length;
}
label IfOverflow deferred {
ThrowRangeError(context, kInvalidStringLength);
ThrowInvalidStringLength(context);
}
}
......@@ -203,7 +203,7 @@ module array {
// Detect integer overflow
// TODO(tebbi): Replace with overflow-checked multiplication.
if (sepsLen / separatorLength != nofSeparatorsInt) deferred {
ThrowRangeError(context, kInvalidStringLength);
ThrowInvalidStringLength(context);
}
const totalStringLength: intptr =
......@@ -348,7 +348,7 @@ module array {
return StringRepeat(context, sep, nofSeparators);
}
label IfNotSmi {
ThrowRangeError(context, kInvalidStringLength);
ThrowInvalidStringLength(context);
}
} else {
loadJoinElements = LoadJoinElement<DictionaryElements>;
......
......@@ -168,8 +168,6 @@ const kCalledNonCallable: constexpr MessageTemplate
generates 'MessageTemplate::kCalledNonCallable';
const kCalledOnNullOrUndefined: constexpr MessageTemplate
generates 'MessageTemplate::kCalledOnNullOrUndefined';
const kInvalidStringLength: constexpr MessageTemplate
generates 'MessageTemplate::kInvalidStringLength';
const kMaxSafeInteger: constexpr float64 generates 'kMaxSafeInteger';
const kStringMaxLength: constexpr int31 generates 'String::kMaxLength';
......@@ -303,6 +301,7 @@ extern builtin StringLessThan(Context, String, String): Boolean;
extern macro StrictEqual(Object, Object): Boolean;
extern macro SmiLexicographicCompare(Smi, Smi): Smi;
extern runtime ReThrow(Context, Object): never;
extern runtime ThrowInvalidStringLength(Context): never;
extern operator '<' macro Int32LessThan(int32, int32): bool;
extern operator '>' macro Int32GreaterThan(int32, int32): bool;
......
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