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 { ...@@ -128,7 +128,7 @@ namespace array {
const callbackfn = Cast<Callable>(arguments[0]) otherwise TypeError; const callbackfn = Cast<Callable>(arguments[0]) otherwise TypeError;
// 4. If thisArg is present, let T be thisArg; else let T be undefined. // 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. // Special cases.
try { try {
......
...@@ -164,7 +164,7 @@ namespace array { ...@@ -164,7 +164,7 @@ namespace array {
const callbackfn = Cast<Callable>(arguments[0]) otherwise TypeError; const callbackfn = Cast<Callable>(arguments[0]) otherwise TypeError;
// 4. If thisArg is present, let T be thisArg; else let T be undefined. // 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; let output: JSReceiver;
// Special cases. // Special cases.
......
...@@ -136,7 +136,7 @@ namespace array { ...@@ -136,7 +136,7 @@ namespace array {
Cast<Callable>(arguments[0]) otherwise NotCallableError; Cast<Callable>(arguments[0]) otherwise NotCallableError;
// 4. If thisArg is present, let T be thisArg; else let T be undefined. // 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. // Special cases.
try { try {
......
...@@ -137,7 +137,7 @@ namespace array { ...@@ -137,7 +137,7 @@ namespace array {
Cast<Callable>(arguments[0]) otherwise NotCallableError; Cast<Callable>(arguments[0]) otherwise NotCallableError;
// 4. If thisArg is present, let T be thisArg; else let T be undefined. // 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. // Special cases.
try { try {
......
...@@ -109,7 +109,7 @@ namespace array { ...@@ -109,7 +109,7 @@ namespace array {
const callbackfn = Cast<Callable>(arguments[0]) otherwise TypeError; const callbackfn = Cast<Callable>(arguments[0]) otherwise TypeError;
// 4. If thisArg is present, let T be thisArg; else let T be undefined. // 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. // Special cases.
let k: Number = 0; let k: Number = 0;
......
...@@ -241,7 +241,7 @@ namespace array { ...@@ -241,7 +241,7 @@ namespace array {
const callbackfn = Cast<Callable>(arguments[0]) otherwise TypeError; const callbackfn = Cast<Callable>(arguments[0]) otherwise TypeError;
// 4. If thisArg is present, let T be thisArg; else let T be undefined. // 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 array: JSReceiver;
let k: Number = 0; let k: Number = 0;
......
...@@ -128,7 +128,7 @@ namespace array { ...@@ -128,7 +128,7 @@ namespace array {
const callbackfn = Cast<Callable>(arguments[0]) otherwise TypeError; const callbackfn = Cast<Callable>(arguments[0]) otherwise TypeError;
// 4. If thisArg is present, let T be thisArg; else let T be undefined. // 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. // Special cases.
try { try {
......
This diff is collapsed.
...@@ -61,14 +61,14 @@ namespace reflect { ...@@ -61,14 +61,14 @@ namespace reflect {
// ES6 section 26.1.6 Reflect.get // ES6 section 26.1.6 Reflect.get
transitioning javascript builtin transitioning javascript builtin
ReflectGet(js-implicit context: NativeContext)(...arguments): JSAny { ReflectGet(js-implicit context: NativeContext)(...arguments): JSAny {
const length = arguments.length; const object: JSAny = arguments[0];
const object: JSAny = length > 0 ? arguments[0] : Undefined;
const objectJSReceiver = Cast<JSReceiver>(object) const objectJSReceiver = Cast<JSReceiver>(object)
otherwise ThrowTypeError( otherwise ThrowTypeError(
MessageTemplate::kCalledOnNonObject, 'Reflect.get'); MessageTemplate::kCalledOnNonObject, 'Reflect.get');
const propertyKey: JSAny = length > 1 ? arguments[1] : Undefined; const propertyKey: JSAny = arguments[1];
const name: AnyName = ToName(propertyKey); const name: AnyName = ToName(propertyKey);
const receiver: JSAny = length > 2 ? arguments[2] : objectJSReceiver; const receiver: JSAny =
arguments.length > 2 ? arguments[2] : objectJSReceiver;
return GetPropertyWithReceiver( return GetPropertyWithReceiver(
objectJSReceiver, name, receiver, SmiConstant(kReturnUndefined)); objectJSReceiver, name, receiver, SmiConstant(kReturnUndefined));
} }
......
...@@ -91,7 +91,7 @@ namespace typed_array { ...@@ -91,7 +91,7 @@ namespace typed_array {
receiver: JSAny)(...arguments): JSTypedArray { receiver: JSAny)(...arguments): JSTypedArray {
// 1. If comparefn is not undefined and IsCallable(comparefn) is false, // 1. If comparefn is not undefined and IsCallable(comparefn) is false,
// throw a TypeError exception. // throw a TypeError exception.
const comparefnObj: JSAny = arguments.length > 0 ? arguments[0] : Undefined; const comparefnObj: JSAny = arguments[0];
if (comparefnObj != Undefined && !Is<Callable>(comparefnObj)) { if (comparefnObj != Undefined && !Is<Callable>(comparefnObj)) {
ThrowTypeError(MessageTemplate::kBadSortComparisonFunction, comparefnObj); ThrowTypeError(MessageTemplate::kBadSortComparisonFunction, comparefnObj);
} }
......
...@@ -30,12 +30,12 @@ namespace error { ...@@ -30,12 +30,12 @@ namespace error {
// b. Let msgDesc be the PropertyDescriptor { [[Value]]: _msg_, // b. Let msgDesc be the PropertyDescriptor { [[Value]]: _msg_,
// [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true* // [[Writable]]: *true*, [[Enumerable]]: *false*, [[Configurable]]: *true*
// c. Perform ! DefinePropertyOrThrow(_O_, *"message"*, _msgDesc_). // c. Perform ! DefinePropertyOrThrow(_O_, *"message"*, _msgDesc_).
const message: JSAny = arguments.length > 0 ? arguments[1] : Undefined; const message: JSAny = arguments[1];
const obj: JSAggregateError = const obj: JSAggregateError =
ConstructAggregateErrorHelper(context, target, newTarget, message); ConstructAggregateErrorHelper(context, target, newTarget, message);
// 4. Let errorsList be ? IterableToList(errors). // 4. Let errorsList be ? IterableToList(errors).
const errors: JSAny = arguments.length > 0 ? arguments[0] : Undefined; const errors: JSAny = arguments[0];
const errorsArray = const errorsArray =
iterator::IterableToFixedArrayWithSymbolLookupSlow(errors); iterator::IterableToFixedArrayWithSymbolLookupSlow(errors);
MakeFixedArrayCOW(errorsArray); 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