Commit 218fc557 authored by Marja Hölttä's avatar Marja Hölttä Committed by Commit Bot

[torque] Remove unnecessary arguments length checks

arguments[i] already returns undefined if arguments is not large
enough.

BUG=v8:10468

Change-Id: I0755014d0f1b61d5e3e2069ef4d14a9b51f2ebee
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2170092Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67467}
parent a596efcc
......@@ -128,7 +128,7 @@ namespace array {
const callbackfn = Cast<Callable>(arguments[0]) otherwise TypeError;
// 4. If thisArg is present, let T be thisArg; else let T be undefined.
const thisArg: JSAny = arguments.length > 1 ? arguments[1] : Undefined;
const thisArg: JSAny = arguments[1];
// Special cases.
try {
......
......@@ -164,7 +164,7 @@ namespace array {
const callbackfn = Cast<Callable>(arguments[0]) otherwise TypeError;
// 4. If thisArg is present, let T be thisArg; else let T be undefined.
const thisArg: JSAny = arguments.length > 1 ? arguments[1] : Undefined;
const thisArg: JSAny = arguments[1];
let output: JSReceiver;
// Special cases.
......
......@@ -136,7 +136,7 @@ namespace array {
Cast<Callable>(arguments[0]) otherwise NotCallableError;
// 4. If thisArg is present, let T be thisArg; else let T be undefined.
const thisArg: JSAny = arguments.length > 1 ? arguments[1] : Undefined;
const thisArg: JSAny = arguments[1];
// Special cases.
try {
......
......@@ -137,7 +137,7 @@ namespace array {
Cast<Callable>(arguments[0]) otherwise NotCallableError;
// 4. If thisArg is present, let T be thisArg; else let T be undefined.
const thisArg: JSAny = arguments.length > 1 ? arguments[1] : Undefined;
const thisArg: JSAny = arguments[1];
// Special cases.
try {
......
......@@ -109,7 +109,7 @@ namespace array {
const callbackfn = Cast<Callable>(arguments[0]) otherwise TypeError;
// 4. If thisArg is present, let T be thisArg; else let T be undefined.
const thisArg: JSAny = arguments.length > 1 ? arguments[1] : Undefined;
const thisArg: JSAny = arguments[1];
// Special cases.
let k: Number = 0;
......
......@@ -241,7 +241,7 @@ namespace array {
const callbackfn = Cast<Callable>(arguments[0]) otherwise TypeError;
// 4. If thisArg is present, let T be thisArg; else let T be undefined.
const thisArg: JSAny = arguments.length > 1 ? arguments[1] : Undefined;
const thisArg: JSAny = arguments[1];
let array: JSReceiver;
let k: Number = 0;
......
......@@ -128,7 +128,7 @@ namespace array {
const callbackfn = Cast<Callable>(arguments[0]) otherwise TypeError;
// 4. If thisArg is present, let T be thisArg; else let T be undefined.
const thisArg: JSAny = arguments.length > 1 ? arguments[1] : Undefined;
const thisArg: JSAny = arguments[1];
// Special cases.
try {
......
This diff is collapsed.
......@@ -61,14 +61,14 @@ namespace reflect {
// ES6 section 26.1.6 Reflect.get
transitioning javascript builtin
ReflectGet(js-implicit context: NativeContext)(...arguments): JSAny {
const length = arguments.length;
const object: JSAny = length > 0 ? arguments[0] : Undefined;
const object: JSAny = arguments[0];
const objectJSReceiver = Cast<JSReceiver>(object)
otherwise ThrowTypeError(
MessageTemplate::kCalledOnNonObject, 'Reflect.get');
const propertyKey: JSAny = length > 1 ? arguments[1] : Undefined;
const propertyKey: JSAny = arguments[1];
const name: AnyName = ToName(propertyKey);
const receiver: JSAny = length > 2 ? arguments[2] : objectJSReceiver;
const receiver: JSAny =
arguments.length > 2 ? arguments[2] : objectJSReceiver;
return GetPropertyWithReceiver(
objectJSReceiver, name, receiver, SmiConstant(kReturnUndefined));
}
......
......@@ -91,7 +91,7 @@ namespace typed_array {
receiver: JSAny)(...arguments): JSTypedArray {
// 1. If comparefn is not undefined and IsCallable(comparefn) is false,
// throw a TypeError exception.
const comparefnObj: JSAny = arguments.length > 0 ? arguments[0] : Undefined;
const comparefnObj: JSAny = arguments[0];
if (comparefnObj != Undefined && !Is<Callable>(comparefnObj)) {
ThrowTypeError(MessageTemplate::kBadSortComparisonFunction, comparefnObj);
}
......
......@@ -30,12 +30,12 @@ namespace error {
// b. Let msgDesc be the PropertyDescriptor { [[Value]]: _msg_,
// [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true*
// c. Perform ! DefinePropertyOrThrow(_O_, *"message"*, _msgDesc_).
const message: JSAny = arguments.length > 0 ? arguments[1] : Undefined;
const message: JSAny = arguments[1];
const obj: JSAggregateError =
ConstructAggregateErrorHelper(context, target, newTarget, message);
// 4. Let errorsList be ? IterableToList(errors).
const errors: JSAny = arguments.length > 0 ? arguments[0] : Undefined;
const errors: JSAny = arguments[0];
const errorsArray =
iterator::IterableToFixedArrayWithSymbolLookupSlow(errors);
MakeFixedArrayCOW(errorsArray);
......
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