Commit 5c05165d authored by Mike Stanton's avatar Mike Stanton Committed by Commit Bot

[Torque] Make Throw*Error() take context implicitly

Change-Id: I5f0d915351c24b9a2916b8ab1d4bafb4d7eb21c7
Reviewed-on: https://chromium-review.googlesource.com/c/1491217Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Michael Stanton <mvstanton@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59889}
parent 4422cc44
...@@ -142,11 +142,10 @@ namespace array { ...@@ -142,11 +142,10 @@ namespace array {
} }
} }
label TypeError deferred { label TypeError deferred {
ThrowTypeError(context, kCalledNonCallable, arguments[0]); ThrowTypeError(kCalledNonCallable, arguments[0]);
} }
label NullOrUndefinedError deferred { label NullOrUndefinedError deferred {
ThrowTypeError( ThrowTypeError(kCalledOnNullOrUndefined, 'Array.prototype.every');
context, kCalledOnNullOrUndefined, 'Array.prototype.every');
} }
} }
} }
...@@ -222,11 +222,10 @@ namespace array_filter { ...@@ -222,11 +222,10 @@ namespace array_filter {
o, callbackfn, thisArg, array, o, k, len, to); o, callbackfn, thisArg, array, o, k, len, to);
} }
label TypeError deferred { label TypeError deferred {
ThrowTypeError(context, kCalledNonCallable, arguments[0]); ThrowTypeError(kCalledNonCallable, arguments[0]);
} }
label NullOrUndefinedError deferred { label NullOrUndefinedError deferred {
ThrowTypeError( ThrowTypeError(kCalledOnNullOrUndefined, 'Array.prototype.filter');
context, kCalledOnNullOrUndefined, 'Array.prototype.filter');
} }
} }
} }
...@@ -141,11 +141,10 @@ namespace array_foreach { ...@@ -141,11 +141,10 @@ namespace array_foreach {
o, callbackfn, thisArg, Undefined, o, k, len, Undefined); o, callbackfn, thisArg, Undefined, o, k, len, Undefined);
} }
label TypeError deferred { label TypeError deferred {
ThrowTypeError(context, kCalledNonCallable, arguments[0]); ThrowTypeError(kCalledNonCallable, arguments[0]);
} }
label NullOrUndefinedError deferred { label NullOrUndefinedError deferred {
ThrowTypeError( ThrowTypeError(kCalledOnNullOrUndefined, 'Array.prototype.forEach');
context, kCalledOnNullOrUndefined, 'Array.prototype.forEach');
} }
} }
} }
...@@ -78,7 +78,7 @@ namespace array_join { ...@@ -78,7 +78,7 @@ namespace array_join {
return ToString_Inline(context, result); return ToString_Inline(context, result);
} }
label TypeError { label TypeError {
ThrowTypeError(context, kCalledNonCallable, prop); ThrowTypeError(kCalledNonCallable, prop);
} }
} }
...@@ -565,7 +565,7 @@ namespace array_join { ...@@ -565,7 +565,7 @@ namespace array_join {
// Only handle valid array lengths. Although the spec allows larger values, // Only handle valid array lengths. Although the spec allows larger values,
// this matches historical V8 behavior. // this matches historical V8 behavior.
if (len > kMaxArrayIndex + 1) ThrowTypeError(context, kInvalidArrayLength); if (len > kMaxArrayIndex + 1) ThrowTypeError(kInvalidArrayLength);
return CycleProtectedArrayJoin<JSArray>( return CycleProtectedArrayJoin<JSArray>(
false, o, len, separator, Undefined, Undefined); false, o, len, separator, Undefined, Undefined);
...@@ -585,7 +585,7 @@ namespace array_join { ...@@ -585,7 +585,7 @@ namespace array_join {
// Only handle valid array lengths. Although the spec allows larger values, // Only handle valid array lengths. Although the spec allows larger values,
// this matches historical V8 behavior. // this matches historical V8 behavior.
if (len > kMaxArrayIndex + 1) ThrowTypeError(context, kInvalidArrayLength); if (len > kMaxArrayIndex + 1) ThrowTypeError(kInvalidArrayLength);
return CycleProtectedArrayJoin<JSArray>( return CycleProtectedArrayJoin<JSArray>(
true, o, len, ',', locales, options); true, o, len, ',', locales, options);
......
...@@ -303,10 +303,10 @@ namespace array_map { ...@@ -303,10 +303,10 @@ namespace array_map {
o, callbackfn, thisArg, array, o, k, len, Undefined); o, callbackfn, thisArg, array, o, k, len, Undefined);
} }
label TypeError deferred { label TypeError deferred {
ThrowTypeError(context, kCalledNonCallable, arguments[0]); ThrowTypeError(kCalledNonCallable, arguments[0]);
} }
label NullOrUndefinedError deferred { label NullOrUndefinedError deferred {
ThrowTypeError(context, kCalledOnNullOrUndefined, 'Array.prototype.map'); ThrowTypeError(kCalledOnNullOrUndefined, 'Array.prototype.map');
} }
} }
} }
...@@ -100,7 +100,7 @@ namespace array { ...@@ -100,7 +100,7 @@ namespace array {
// If the accumulator is discovered with the sentinel hole value, // If the accumulator is discovered with the sentinel hole value,
// this means kPresent is false. // this means kPresent is false.
if (accumulator == Hole) { if (accumulator == Hole) {
ThrowTypeError(context, kReduceNoInitial, 'Array.prototype.reduceRight'); ThrowTypeError(kReduceNoInitial, 'Array.prototype.reduceRight');
} }
return accumulator; return accumulator;
} }
...@@ -127,7 +127,7 @@ namespace array { ...@@ -127,7 +127,7 @@ namespace array {
} }
} }
if (accumulator == Hole) { if (accumulator == Hole) {
ThrowTypeError(context, kReduceNoInitial, 'Array.prototype.reduceRight'); ThrowTypeError(kReduceNoInitial, 'Array.prototype.reduceRight');
} }
return accumulator; return accumulator;
} }
...@@ -186,11 +186,10 @@ namespace array { ...@@ -186,11 +186,10 @@ namespace array {
} }
} }
label NoCallableError deferred { label NoCallableError deferred {
ThrowTypeError(context, kCalledNonCallable, arguments[0]); ThrowTypeError(kCalledNonCallable, arguments[0]);
} }
label NullOrUndefinedError deferred { label NullOrUndefinedError deferred {
ThrowTypeError( ThrowTypeError(kCalledOnNullOrUndefined, 'Array.prototype.reduceRight');
context, kCalledOnNullOrUndefined, 'Array.prototype.reduceRight');
} }
} }
} }
...@@ -99,7 +99,7 @@ namespace array { ...@@ -99,7 +99,7 @@ namespace array {
// If the accumulator is discovered with the sentinel hole value, // If the accumulator is discovered with the sentinel hole value,
// this means kPresent is false. // this means kPresent is false.
if (accumulator == Hole) { if (accumulator == Hole) {
ThrowTypeError(context, kReduceNoInitial, 'Array.prototype.reduce'); ThrowTypeError(kReduceNoInitial, 'Array.prototype.reduce');
} }
return accumulator; return accumulator;
} }
...@@ -126,7 +126,7 @@ namespace array { ...@@ -126,7 +126,7 @@ namespace array {
} }
} }
if (accumulator == Hole) { if (accumulator == Hole) {
ThrowTypeError(context, kReduceNoInitial, 'Array.prototype.reduce'); ThrowTypeError(kReduceNoInitial, 'Array.prototype.reduce');
} }
return accumulator; return accumulator;
} }
...@@ -185,11 +185,10 @@ namespace array { ...@@ -185,11 +185,10 @@ namespace array {
} }
} }
label NoCallableError deferred { label NoCallableError deferred {
ThrowTypeError(context, kCalledNonCallable, arguments[0]); ThrowTypeError(kCalledNonCallable, arguments[0]);
} }
label NullOrUndefinedError deferred { label NullOrUndefinedError deferred {
ThrowTypeError( ThrowTypeError(kCalledOnNullOrUndefined, 'Array.prototype.reduce');
context, kCalledOnNullOrUndefined, 'Array.prototype.reduce');
} }
} }
} }
...@@ -141,10 +141,10 @@ namespace array { ...@@ -141,10 +141,10 @@ namespace array {
} }
} }
label TypeError deferred { label TypeError deferred {
ThrowTypeError(context, kCalledNonCallable, arguments[0]); ThrowTypeError(kCalledNonCallable, arguments[0]);
} }
label NullOrUndefinedError deferred { label NullOrUndefinedError deferred {
ThrowTypeError(context, kCalledOnNullOrUndefined, 'Array.prototype.some'); ThrowTypeError(kCalledOnNullOrUndefined, 'Array.prototype.some');
} }
} }
} }
...@@ -398,7 +398,7 @@ namespace array_splice { ...@@ -398,7 +398,7 @@ namespace array_splice {
// Bailout exception. // Bailout exception.
const newLength: Number = len + insertCount - actualDeleteCount; const newLength: Number = len + insertCount - actualDeleteCount;
if (newLength > kMaxSafeInteger) { if (newLength > kMaxSafeInteger) {
ThrowTypeError(context, kInvalidArrayLength, start); ThrowTypeError(kInvalidArrayLength, start);
} }
try { try {
......
...@@ -36,7 +36,7 @@ namespace array_unshift { ...@@ -36,7 +36,7 @@ namespace array_unshift {
if (argCount > 0) { if (argCount > 0) {
// a. If len + argCount > 2**53 - 1, throw a TypeError exception. // a. If len + argCount > 2**53 - 1, throw a TypeError exception.
if (length + argCount > kMaxSafeInteger) { if (length + argCount > kMaxSafeInteger) {
ThrowTypeError(context, kInvalidArrayLength); ThrowTypeError(kInvalidArrayLength);
} }
// b. Let k be len. // b. Let k be len.
......
...@@ -488,14 +488,18 @@ extern transitioning builtin HasProperty(implicit context: Context)( ...@@ -488,14 +488,18 @@ extern transitioning builtin HasProperty(implicit context: Context)(
extern transitioning macro HasProperty_Inline(implicit context: Context)( extern transitioning macro HasProperty_Inline(implicit context: Context)(
JSReceiver, Object): Boolean; JSReceiver, Object): Boolean;
extern macro ThrowRangeError(Context, constexpr MessageTemplate): never; extern macro ThrowRangeError(implicit context: Context)(
extern macro ThrowRangeError(Context, constexpr MessageTemplate, Object): never; constexpr MessageTemplate): never;
extern macro ThrowTypeError(Context, constexpr MessageTemplate): never; extern macro ThrowRangeError(implicit context: Context)(
extern macro ThrowTypeError( constexpr MessageTemplate, Object): never;
Context, constexpr MessageTemplate, constexpr string): never; extern macro ThrowTypeError(implicit context: Context)(
extern macro ThrowTypeError(Context, constexpr MessageTemplate, Object): never; constexpr MessageTemplate): never;
extern macro ThrowTypeError( extern macro ThrowTypeError(implicit context: Context)(
Context, constexpr MessageTemplate, Object, Object, Object): never; constexpr MessageTemplate, constexpr string): never;
extern macro ThrowTypeError(implicit context: Context)(
constexpr MessageTemplate, Object): never;
extern macro ThrowTypeError(implicit context: Context)(
constexpr MessageTemplate, Object, Object, Object): never;
extern macro ArraySpeciesCreate(Context, Object, Number): JSReceiver; extern macro ArraySpeciesCreate(Context, Object, Number): JSReceiver;
extern macro ArrayCreate(implicit context: Context)(Number): JSArray; extern macro ArrayCreate(implicit context: Context)(Number): JSArray;
extern macro BuildAppendJSArray( extern macro BuildAppendJSArray(
......
...@@ -37,7 +37,7 @@ namespace collections { ...@@ -37,7 +37,7 @@ namespace collections {
goto MayHaveSideEffects; goto MayHaveSideEffects;
} }
case (o: Object): deferred { case (o: Object): deferred {
ThrowTypeError(context, kIteratorValueNotAnObject, o); ThrowTypeError(kIteratorValueNotAnObject, o);
} }
} }
} }
......
...@@ -68,7 +68,7 @@ namespace data_view { ...@@ -68,7 +68,7 @@ namespace data_view {
return Cast<JSDataView>(o) otherwise CastError; return Cast<JSDataView>(o) otherwise CastError;
} }
label CastError { label CastError {
ThrowTypeError(context, kIncompatibleMethodReceiver, method); ThrowTypeError(kIncompatibleMethodReceiver, method);
} }
} }
...@@ -393,15 +393,14 @@ namespace data_view { ...@@ -393,15 +393,14 @@ namespace data_view {
getIndex = ToIndex(offset, context) otherwise RangeError; getIndex = ToIndex(offset, context) otherwise RangeError;
} }
label RangeError { label RangeError {
ThrowRangeError(context, kInvalidDataViewAccessorOffset); ThrowRangeError(kInvalidDataViewAccessorOffset);
} }
let littleEndian: bool = ToBoolean(requestedLittleEndian); let littleEndian: bool = ToBoolean(requestedLittleEndian);
let buffer: JSArrayBuffer = dataView.buffer; let buffer: JSArrayBuffer = dataView.buffer;
if (IsDetachedBuffer(buffer)) { if (IsDetachedBuffer(buffer)) {
ThrowTypeError( ThrowTypeError(kDetachedOperation, MakeDataViewGetterNameString(kind));
context, kDetachedOperation, MakeDataViewGetterNameString(kind));
} }
let getIndexFloat: float64 = Convert<float64>(getIndex); let getIndexFloat: float64 = Convert<float64>(getIndex);
...@@ -412,7 +411,7 @@ namespace data_view { ...@@ -412,7 +411,7 @@ namespace data_view {
let elementSizeFloat: float64 = DataViewElementSize(kind); let elementSizeFloat: float64 = DataViewElementSize(kind);
if (getIndexFloat + elementSizeFloat > viewSizeFloat) { if (getIndexFloat + elementSizeFloat > viewSizeFloat) {
ThrowRangeError(context, kInvalidDataViewAccessorOffset); ThrowRangeError(kInvalidDataViewAccessorOffset);
} }
let bufferIndex: uintptr = getIndexWord + viewOffsetWord; let bufferIndex: uintptr = getIndexWord + viewOffsetWord;
...@@ -671,7 +670,7 @@ namespace data_view { ...@@ -671,7 +670,7 @@ namespace data_view {
getIndex = ToIndex(offset, context) otherwise RangeError; getIndex = ToIndex(offset, context) otherwise RangeError;
} }
label RangeError { label RangeError {
ThrowRangeError(context, kInvalidDataViewAccessorOffset); ThrowRangeError(kInvalidDataViewAccessorOffset);
} }
let littleEndian: bool = ToBoolean(requestedLittleEndian); let littleEndian: bool = ToBoolean(requestedLittleEndian);
...@@ -683,8 +682,7 @@ namespace data_view { ...@@ -683,8 +682,7 @@ namespace data_view {
let bigIntValue: BigInt = ToBigInt(context, value); let bigIntValue: BigInt = ToBigInt(context, value);
if (IsDetachedBuffer(buffer)) { if (IsDetachedBuffer(buffer)) {
ThrowTypeError( ThrowTypeError(kDetachedOperation, MakeDataViewSetterNameString(kind));
context, kDetachedOperation, MakeDataViewSetterNameString(kind));
} }
let getIndexFloat: float64 = Convert<float64>(getIndex); let getIndexFloat: float64 = Convert<float64>(getIndex);
...@@ -695,7 +693,7 @@ namespace data_view { ...@@ -695,7 +693,7 @@ namespace data_view {
let elementSizeFloat: float64 = DataViewElementSize(kind); let elementSizeFloat: float64 = DataViewElementSize(kind);
if (getIndexFloat + elementSizeFloat > viewSizeFloat) { if (getIndexFloat + elementSizeFloat > viewSizeFloat) {
ThrowRangeError(context, kInvalidDataViewAccessorOffset); ThrowRangeError(kInvalidDataViewAccessorOffset);
} }
let bufferIndex: uintptr = getIndexWord + viewOffsetWord; let bufferIndex: uintptr = getIndexWord + viewOffsetWord;
...@@ -704,8 +702,7 @@ namespace data_view { ...@@ -704,8 +702,7 @@ namespace data_view {
let numValue: Number = ToNumber(context, value); let numValue: Number = ToNumber(context, value);
if (IsDetachedBuffer(buffer)) { if (IsDetachedBuffer(buffer)) {
ThrowTypeError( ThrowTypeError(kDetachedOperation, MakeDataViewSetterNameString(kind));
context, kDetachedOperation, MakeDataViewSetterNameString(kind));
} }
let getIndexFloat: float64 = Convert<float64>(getIndex); let getIndexFloat: float64 = Convert<float64>(getIndex);
...@@ -716,7 +713,7 @@ namespace data_view { ...@@ -716,7 +713,7 @@ namespace data_view {
let elementSizeFloat: float64 = DataViewElementSize(kind); let elementSizeFloat: float64 = DataViewElementSize(kind);
if (getIndexFloat + elementSizeFloat > viewSizeFloat) { if (getIndexFloat + elementSizeFloat > viewSizeFloat) {
ThrowRangeError(context, kInvalidDataViewAccessorOffset); ThrowRangeError(kInvalidDataViewAccessorOffset);
} }
let bufferIndex: uintptr = getIndexWord + viewOffsetWord; let bufferIndex: uintptr = getIndexWord + viewOffsetWord;
......
...@@ -63,7 +63,7 @@ namespace object { ...@@ -63,7 +63,7 @@ namespace object {
} }
} }
label Throw deferred { label Throw deferred {
ThrowTypeError(context, kNotIterable); ThrowTypeError(kNotIterable);
} }
} }
} // namespace object } // namespace object
...@@ -41,8 +41,7 @@ namespace string { ...@@ -41,8 +41,7 @@ namespace string {
// 3. Let isRegExp be ? IsRegExp(searchString). // 3. Let isRegExp be ? IsRegExp(searchString).
// 4. If isRegExp is true, throw a TypeError exception. // 4. If isRegExp is true, throw a TypeError exception.
if (IsRegExp(searchString)) { if (IsRegExp(searchString)) {
ThrowTypeError( ThrowTypeError(kFirstArgumentNotRegExp, 'String.prototype.endsWith');
context, kFirstArgumentNotRegExp, 'String.prototype.endsWith');
} }
// 5. Let searchStr be ? ToString(searchString). // 5. Let searchStr be ? ToString(searchString).
......
...@@ -12,8 +12,7 @@ namespace string { ...@@ -12,8 +12,7 @@ namespace string {
macro RequireObjectCoercible(implicit context: Context)(argument: Object): macro RequireObjectCoercible(implicit context: Context)(argument: Object):
Object { Object {
if (IsNullOrUndefined(argument)) { if (IsNullOrUndefined(argument)) {
ThrowTypeError( ThrowTypeError(kCalledOnNullOrUndefined, 'String.prototype.startsWith');
context, kCalledOnNullOrUndefined, 'String.prototype.startsWith');
} }
return argument; return argument;
} }
...@@ -33,8 +32,7 @@ namespace string { ...@@ -33,8 +32,7 @@ namespace string {
// 3. Let isRegExp be ? IsRegExp(searchString). // 3. Let isRegExp be ? IsRegExp(searchString).
// 4. If isRegExp is true, throw a TypeError exception. // 4. If isRegExp is true, throw a TypeError exception.
if (IsRegExp(searchString)) { if (IsRegExp(searchString)) {
ThrowTypeError( ThrowTypeError(kFirstArgumentNotRegExp, 'String.prototype.startsWith');
context, kFirstArgumentNotRegExp, 'String.prototype.startsWith');
} }
// 5. Let searchStr be ? ToString(searchString). // 5. Let searchStr be ? ToString(searchString).
......
...@@ -34,8 +34,8 @@ namespace typed_array_createtypedarray { ...@@ -34,8 +34,8 @@ namespace typed_array_createtypedarray {
initialize: constexpr bool, typedArray: JSTypedArray, length: PositiveSmi, initialize: constexpr bool, typedArray: JSTypedArray, length: PositiveSmi,
elementsInfo: typed_array::TypedArrayElementsInfo, elementsInfo: typed_array::TypedArrayElementsInfo,
bufferConstructor: JSReceiver): uintptr { bufferConstructor: JSReceiver): uintptr {
const byteLength = elementsInfo.CalculateByteLength( const byteLength = elementsInfo.CalculateByteLength(length)
length) otherwise ThrowRangeError(context, kInvalidArrayBufferLength); otherwise ThrowRangeError(kInvalidArrayBufferLength);
const byteLengthNum = Convert<Number>(byteLength); const byteLengthNum = Convert<Number>(byteLength);
const defaultConstructor = GetArrayBufferFunction(); const defaultConstructor = GetArrayBufferFunction();
...@@ -93,7 +93,7 @@ namespace typed_array_createtypedarray { ...@@ -93,7 +93,7 @@ namespace typed_array_createtypedarray {
// representation (which uses Smis). // representation (which uses Smis).
// TODO(7881): support larger-than-smi typed array lengths // TODO(7881): support larger-than-smi typed array lengths
const positiveLength: PositiveSmi = Cast<PositiveSmi>(convertedLength) const positiveLength: PositiveSmi = Cast<PositiveSmi>(convertedLength)
otherwise ThrowRangeError(context, kInvalidTypedArrayLength, length); otherwise ThrowRangeError(kInvalidTypedArrayLength, length);
const defaultConstructor: Constructor = GetArrayBufferFunction(); const defaultConstructor: Constructor = GetArrayBufferFunction();
const initialize: constexpr bool = true; const initialize: constexpr bool = true;
TypedArrayInitialize( TypedArrayInitialize(
...@@ -109,7 +109,7 @@ namespace typed_array_createtypedarray { ...@@ -109,7 +109,7 @@ namespace typed_array_createtypedarray {
bufferConstructor: JSReceiver): void { bufferConstructor: JSReceiver): void {
// The caller has looked up length on arrayLike, which is observable. // The caller has looked up length on arrayLike, which is observable.
const length: PositiveSmi = ToSmiLength(initialLength) const length: PositiveSmi = ToSmiLength(initialLength)
otherwise ThrowRangeError(context, kInvalidTypedArrayLength, initialLength); otherwise ThrowRangeError(kInvalidTypedArrayLength, initialLength);
const initialize: constexpr bool = false; const initialize: constexpr bool = false;
const byteLength = TypedArrayInitialize( const byteLength = TypedArrayInitialize(
initialize, typedArray, length, elementsInfo, bufferConstructor); initialize, typedArray, length, elementsInfo, bufferConstructor);
...@@ -118,7 +118,7 @@ namespace typed_array_createtypedarray { ...@@ -118,7 +118,7 @@ namespace typed_array_createtypedarray {
const src: JSTypedArray = Cast<JSTypedArray>(arrayLike) otherwise IfSlow; const src: JSTypedArray = Cast<JSTypedArray>(arrayLike) otherwise IfSlow;
if (IsDetachedBuffer(src.buffer)) { if (IsDetachedBuffer(src.buffer)) {
ThrowTypeError(context, kDetachedOperation, 'Construct'); ThrowTypeError(kDetachedOperation, 'Construct');
} else if (src.elements_kind != elementsInfo.kind) { } else if (src.elements_kind != elementsInfo.kind) {
goto IfSlow; goto IfSlow;
...@@ -197,7 +197,7 @@ namespace typed_array_createtypedarray { ...@@ -197,7 +197,7 @@ namespace typed_array_createtypedarray {
// 9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. // 9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
if (IsDetachedBuffer(buffer)) { if (IsDetachedBuffer(buffer)) {
ThrowTypeError(context, kDetachedOperation, 'Construct'); ThrowTypeError(kDetachedOperation, 'Construct');
} }
// 10. Let bufferByteLength be buffer.[[ArrayBufferByteLength]]. // 10. Let bufferByteLength be buffer.[[ArrayBufferByteLength]].
...@@ -242,13 +242,13 @@ namespace typed_array_createtypedarray { ...@@ -242,13 +242,13 @@ namespace typed_array_createtypedarray {
ThrowInvalidTypedArrayAlignment(typedArray.map, problemString); ThrowInvalidTypedArrayAlignment(typedArray.map, problemString);
} }
label IfInvalidByteLength deferred { label IfInvalidByteLength deferred {
ThrowRangeError(context, kInvalidArrayBufferLength); ThrowRangeError(kInvalidArrayBufferLength);
} }
label IfInvalidLength deferred { label IfInvalidLength deferred {
ThrowRangeError(context, kInvalidTypedArrayLength, length); ThrowRangeError(kInvalidTypedArrayLength, length);
} }
label IfInvalidOffset deferred { label IfInvalidOffset deferred {
ThrowRangeError(context, kInvalidOffset, byteOffset); ThrowRangeError(kInvalidOffset, byteOffset);
} }
} }
...@@ -260,7 +260,7 @@ namespace typed_array_createtypedarray { ...@@ -260,7 +260,7 @@ namespace typed_array_createtypedarray {
const iteratorMethod: Object = const iteratorMethod: Object =
GetIteratorMethod(obj) otherwise IfIteratorUndefined; GetIteratorMethod(obj) otherwise IfIteratorUndefined;
const iteratorFn: Callable = Cast<Callable>(iteratorMethod) const iteratorFn: Callable = Cast<Callable>(iteratorMethod)
otherwise ThrowTypeError(context, kIteratorSymbolNonCallable); otherwise ThrowTypeError(kIteratorSymbolNonCallable);
ConstructByIterable(array, obj, iteratorFn, elementsInfo) ConstructByIterable(array, obj, iteratorFn, elementsInfo)
otherwise IfConstructByArrayLike; otherwise IfConstructByArrayLike;
} }
...@@ -271,7 +271,7 @@ namespace typed_array_createtypedarray { ...@@ -271,7 +271,7 @@ namespace typed_array_createtypedarray {
goto IfConstructByArrayLike(obj, length, GetArrayBufferFunction()); goto IfConstructByArrayLike(obj, length, GetArrayBufferFunction());
} }
label IfInvalidLength(length: Object) { label IfInvalidLength(length: Object) {
ThrowRangeError(context, kInvalidTypedArrayLength, length); ThrowRangeError(kInvalidTypedArrayLength, length);
} }
} }
......
...@@ -128,8 +128,7 @@ namespace typed_array { ...@@ -128,8 +128,7 @@ namespace typed_array {
// b. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. // b. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
if (IsDetachedBuffer(array.buffer)) { if (IsDetachedBuffer(array.buffer)) {
ThrowTypeError( ThrowTypeError(kDetachedOperation, '%TypedArray%.prototype.sort');
context, kDetachedOperation, '%TypedArray%.prototype.sort');
} }
// c. If v is NaN, return +0. // c. If v is NaN, return +0.
...@@ -199,7 +198,7 @@ namespace typed_array { ...@@ -199,7 +198,7 @@ namespace typed_array {
const comparefnObj: Object = const comparefnObj: Object =
arguments.length > 0 ? arguments[0] : Undefined; arguments.length > 0 ? arguments[0] : Undefined;
if (comparefnObj != Undefined && !TaggedIsCallable(comparefnObj)) { if (comparefnObj != Undefined && !TaggedIsCallable(comparefnObj)) {
ThrowTypeError(context, kBadSortComparisonFunction, comparefnObj); ThrowTypeError(kBadSortComparisonFunction, comparefnObj);
} }
// 2. Let obj be the this value. // 2. Let obj be the this value.
......
...@@ -646,7 +646,7 @@ namespace test { ...@@ -646,7 +646,7 @@ namespace test {
macro TestCatch1(implicit context: Context)(): Smi { macro TestCatch1(implicit context: Context)(): Smi {
let r: Smi = 0; let r: Smi = 0;
try { try {
ThrowTypeError(context, kInvalidArrayLength); ThrowTypeError(kInvalidArrayLength);
} catch (e) { } catch (e) {
r = 1; r = 1;
return r; return r;
...@@ -654,7 +654,7 @@ namespace test { ...@@ -654,7 +654,7 @@ namespace test {
} }
macro TestCatch2Wrapper(implicit context: Context)(): never { macro TestCatch2Wrapper(implicit context: Context)(): never {
ThrowTypeError(context, kInvalidArrayLength); ThrowTypeError(kInvalidArrayLength);
} }
macro TestCatch2(implicit context: Context)(): Smi { macro TestCatch2(implicit context: Context)(): Smi {
...@@ -669,7 +669,7 @@ namespace test { ...@@ -669,7 +669,7 @@ namespace test {
macro TestCatch3WrapperWithLabel(implicit context: Context)(): never macro TestCatch3WrapperWithLabel(implicit context: Context)(): never
labels Abort { labels Abort {
ThrowTypeError(context, kInvalidArrayLength); ThrowTypeError(kInvalidArrayLength);
} }
macro TestCatch3(implicit context: Context)(): Smi { macro TestCatch3(implicit context: Context)(): Smi {
......
...@@ -301,7 +301,7 @@ namespace array { ...@@ -301,7 +301,7 @@ namespace array {
// as SetProperty would. // as SetProperty would.
const receiver = sortState.receiver; const receiver = sortState.receiver;
ThrowTypeError( ThrowTypeError(
context, kStrictReadOnlyProperty, index, Typeof(receiver), receiver); kStrictReadOnlyProperty, index, Typeof(receiver), receiver);
} }
label Fail { label Fail {
return Failure(sortState); return Failure(sortState);
...@@ -1401,7 +1401,7 @@ namespace array { ...@@ -1401,7 +1401,7 @@ namespace array {
// throw a TypeError exception. // throw a TypeError exception.
const comparefnObj: Object = arguments[0]; const comparefnObj: Object = arguments[0];
const comparefn = Cast<(Undefined | Callable)>(comparefnObj) otherwise const comparefn = Cast<(Undefined | Callable)>(comparefnObj) otherwise
ThrowTypeError(context, kBadSortComparisonFunction, comparefnObj); ThrowTypeError(kBadSortComparisonFunction, comparefnObj);
// 2. Let obj be ? ToObject(this value). // 2. Let obj be ? ToObject(this value).
const obj: JSReceiver = ToObject(context, receiver); const obj: JSReceiver = ToObject(context, receiver);
......
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