Commit a3e97c41 authored by Tobias Tebbi's avatar Tobias Tebbi Committed by Commit Bot

[torque] improve formatting of try-label

Bug: v8:10421, v8:7793
Change-Id: If11fc7666f04ed0914f5fdfcdaa87acb8655d956
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2169100
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67591}
parent 1ed76a3c
...@@ -134,13 +134,11 @@ namespace array { ...@@ -134,13 +134,11 @@ namespace array {
try { try {
return FastArrayEvery(o, len, callbackfn, thisArg) return FastArrayEvery(o, len, callbackfn, thisArg)
otherwise Bailout; otherwise Bailout;
} } label Bailout(kValue: Smi) deferred {
label Bailout(kValue: Smi) deferred {
return ArrayEveryLoopContinuation( return ArrayEveryLoopContinuation(
o, callbackfn, thisArg, Undefined, o, kValue, len, Undefined); o, callbackfn, thisArg, Undefined, o, kValue, len, Undefined);
} }
} } label TypeError deferred {
label TypeError deferred {
ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]); ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]);
} }
} }
......
...@@ -122,8 +122,7 @@ namespace array { ...@@ -122,8 +122,7 @@ namespace array {
fastOutputW.Recheck() otherwise SlowStore; fastOutputW.Recheck() otherwise SlowStore;
if (fastOutputW.Get().length != to) goto SlowStore; if (fastOutputW.Get().length != to) goto SlowStore;
fastOutputW.Push(value) otherwise SlowStore; fastOutputW.Push(value) otherwise SlowStore;
} } label SlowStore {
label SlowStore {
FastCreateDataProperty(fastOutputW.stable, to, value); FastCreateDataProperty(fastOutputW.stable, to, value);
} }
to = to + 1; to = to + 1;
...@@ -182,20 +181,17 @@ namespace array { ...@@ -182,20 +181,17 @@ namespace array {
FastArrayFilter(fastO, smiLen, callbackfn, thisArg, fastOutput) FastArrayFilter(fastO, smiLen, callbackfn, thisArg, fastOutput)
otherwise Bailout; otherwise Bailout;
return output; return output;
} } label Bailout(kValue: Number, toValue: Number) deferred {
label Bailout(kValue: Number, toValue: Number) deferred {
k = kValue; k = kValue;
to = toValue; to = toValue;
} }
} } label SlowSpeciesCreate {
label SlowSpeciesCreate {
output = ArraySpeciesCreate(context, receiver, 0); output = ArraySpeciesCreate(context, receiver, 0);
} }
return ArrayFilterLoopContinuation( return ArrayFilterLoopContinuation(
o, callbackfn, thisArg, output, o, k, len, to); o, callbackfn, thisArg, output, o, k, len, to);
} } label TypeError deferred {
label TypeError deferred {
ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]); ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]);
} }
} }
......
...@@ -142,12 +142,10 @@ namespace array { ...@@ -142,12 +142,10 @@ namespace array {
try { try {
return FastArrayFind(o, len, callbackfn, thisArg) return FastArrayFind(o, len, callbackfn, thisArg)
otherwise Bailout; otherwise Bailout;
} } label Bailout(k: Smi) deferred {
label Bailout(k: Smi) deferred {
return ArrayFindLoopContinuation(o, callbackfn, thisArg, o, k, len); return ArrayFindLoopContinuation(o, callbackfn, thisArg, o, k, len);
} }
} } label NotCallableError deferred {
label NotCallableError deferred {
ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]); ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]);
} }
} }
......
...@@ -143,13 +143,11 @@ namespace array { ...@@ -143,13 +143,11 @@ namespace array {
try { try {
return FastArrayFindIndex(o, len, callbackfn, thisArg) return FastArrayFindIndex(o, len, callbackfn, thisArg)
otherwise Bailout; otherwise Bailout;
} } label Bailout(k: Smi) deferred {
label Bailout(k: Smi) deferred {
return ArrayFindIndexLoopContinuation( return ArrayFindIndexLoopContinuation(
o, callbackfn, thisArg, o, k, len); o, callbackfn, thisArg, o, k, len);
} }
} } label NotCallableError deferred {
label NotCallableError deferred {
ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]); ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]);
} }
} }
......
...@@ -116,15 +116,13 @@ namespace array { ...@@ -116,15 +116,13 @@ namespace array {
try { try {
return FastArrayForEach(o, len, callbackfn, thisArg) return FastArrayForEach(o, len, callbackfn, thisArg)
otherwise Bailout; otherwise Bailout;
} } label Bailout(kValue: Smi) deferred {
label Bailout(kValue: Smi) deferred {
k = kValue; k = kValue;
} }
return ArrayForEachLoopContinuation( return ArrayForEachLoopContinuation(
o, callbackfn, thisArg, Undefined, o, k, len, Undefined); o, callbackfn, thisArg, Undefined, o, k, len, Undefined);
} } label TypeError deferred {
label TypeError deferred {
ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]); ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]);
} }
} }
......
...@@ -14,8 +14,7 @@ namespace array { ...@@ -14,8 +14,7 @@ namespace array {
if (arguments.length == 1 && receiver == GetArrayFunction()) { if (arguments.length == 1 && receiver == GetArrayFunction()) {
try { try {
return iterator::FastIterableToList(arguments[0]) otherwise Slow; return iterator::FastIterableToList(arguments[0]) otherwise Slow;
} } label Slow {
label Slow {
// fall through // fall through
} }
} }
...@@ -128,8 +127,7 @@ namespace array { ...@@ -128,8 +127,7 @@ namespace array {
k += 1; k += 1;
} }
unreachable; unreachable;
} } label IteratorIsUndefined {
label IteratorIsUndefined {
// 6. NOTE: items is not an Iterable so assume it is an array-like object. // 6. NOTE: items is not an Iterable so assume it is an array-like object.
// 7. Let arrayLike be ! ToObject(items). // 7. Let arrayLike be ! ToObject(items).
const arrayLike = ToObject_Inline(context, items); const arrayLike = ToObject_Inline(context, items);
...@@ -176,8 +174,7 @@ namespace array { ...@@ -176,8 +174,7 @@ namespace array {
array::SetPropertyLength(a, len); array::SetPropertyLength(a, len);
// 14. Return A. // 14. Return A.
return a; return a;
} } label IteratorNotCallable(_value: JSAny) deferred {
label IteratorNotCallable(_value: JSAny) deferred {
ThrowTypeError(MessageTemplate::kIteratorSymbolNonCallable); ThrowTypeError(MessageTemplate::kIteratorSymbolNonCallable);
} }
} }
......
...@@ -23,11 +23,9 @@ namespace array { ...@@ -23,11 +23,9 @@ namespace array {
try { try {
return BasicLoadNumberDictionaryElement(dict, Signed(k)) return BasicLoadNumberDictionaryElement(dict, Signed(k))
otherwise IfNoData, IfHole; otherwise IfNoData, IfHole;
} } label IfNoData deferred {
label IfNoData deferred {
return GetProperty(receiver, Convert<Number>(k)); return GetProperty(receiver, Convert<Number>(k));
} } label IfHole {
label IfHole {
return kEmptyString; return kEmptyString;
} }
} }
...@@ -75,8 +73,7 @@ namespace array { ...@@ -75,8 +73,7 @@ namespace array {
result = Call(context, callable, element, locales, options); result = Call(context, callable, element, locales, options);
} }
return ToString_Inline(result); return ToString_Inline(result);
} } label TypeError {
label TypeError {
ThrowTypeError(MessageTemplate::kCalledNonCallable, prop); ThrowTypeError(MessageTemplate::kCalledNonCallable, prop);
} }
} }
...@@ -115,8 +112,7 @@ namespace array { ...@@ -115,8 +112,7 @@ namespace array {
const length: intptr = TryIntPtrAdd(lenA, lenB) otherwise IfOverflow; const length: intptr = TryIntPtrAdd(lenA, lenB) otherwise IfOverflow;
if (length > kStringMaxLength) goto IfOverflow; if (length > kStringMaxLength) goto IfOverflow;
return length; return length;
} } label IfOverflow deferred {
label IfOverflow deferred {
ThrowInvalidStringLength(context); ThrowInvalidStringLength(context);
} }
} }
...@@ -351,8 +347,7 @@ namespace array { ...@@ -351,8 +347,7 @@ namespace array {
const nofSeparators: Smi = const nofSeparators: Smi =
Cast<Smi>(lenNumber - 1) otherwise IfNotSmi; Cast<Smi>(lenNumber - 1) otherwise IfNotSmi;
return StringRepeat(context, sep, nofSeparators); return StringRepeat(context, sep, nofSeparators);
} } label IfNotSmi {
label IfNotSmi {
ThrowInvalidStringLength(context); ThrowInvalidStringLength(context);
} }
} else { } else {
...@@ -362,8 +357,7 @@ namespace array { ...@@ -362,8 +357,7 @@ namespace array {
else { else {
goto IfSlowPath; goto IfSlowPath;
} }
} } label IfSlowPath {
label IfSlowPath {
loadFn = LoadJoinElement<array::GenericElementsAccessor>; loadFn = LoadJoinElement<array::GenericElementsAccessor>;
} }
return ArrayJoinImpl<JSArray>( return ArrayJoinImpl<JSArray>(
...@@ -473,8 +467,7 @@ namespace array { ...@@ -473,8 +467,7 @@ namespace array {
deferred { deferred {
return false; return false;
} }
} } label IfUninitialized {
label IfUninitialized {
const stack: FixedArray = const stack: FixedArray =
AllocateFixedArrayWithHoles(kMinJoinStackSize, AllocationFlag::kNone); AllocateFixedArrayWithHoles(kMinJoinStackSize, AllocationFlag::kNone);
stack.objects[0] = receiver; stack.objects[0] = receiver;
...@@ -607,8 +600,7 @@ namespace array { ...@@ -607,8 +600,7 @@ namespace array {
// 4. Return ? Call(func, array). // 4. Return ? Call(func, array).
return Call(context, func, array); return Call(context, func, array);
} } label NotCallable {
label NotCallable {
return ObjectToString(context, array); return ObjectToString(context, array);
} }
} }
......
...@@ -47,8 +47,7 @@ namespace array { ...@@ -47,8 +47,7 @@ namespace array {
assert(Is<FastJSArray>(array)); assert(Is<FastJSArray>(array));
return k; return k;
} }
} } label Hole {} // Do nothing for holes.
label Hole {} // Do nothing for holes.
--k; --k;
} }
...@@ -148,8 +147,7 @@ namespace array { ...@@ -148,8 +147,7 @@ namespace array {
try { try {
return TryFastArrayLastIndexOf(context, object, searchElement, from) return TryFastArrayLastIndexOf(context, object, searchElement, from)
otherwise Baseline; otherwise Baseline;
} } label Baseline {
label Baseline {
return GenericArrayLastIndexOf(context, object, searchElement, from); return GenericArrayLastIndexOf(context, object, searchElement, from);
} }
} }
......
...@@ -206,15 +206,13 @@ namespace array { ...@@ -206,15 +206,13 @@ namespace array {
const result: JSAny = const result: JSAny =
Call(context, callbackfn, thisArg, value, k, fastOW.Get()); Call(context, callbackfn, thisArg, value, k, fastOW.Get());
vector.StoreResult(k, result); vector.StoreResult(k, result);
} } label FoundHole {
label FoundHole {
// Our output array must necessarily be holey because of holes in // Our output array must necessarily be holey because of holes in
// the input array. // the input array.
vector.ReportSkippedElement(); vector.ReportSkippedElement();
} }
} }
} } label PrepareBailout(k: Smi) deferred {
label PrepareBailout(k: Smi) deferred {
// Transform {vector} into a JSArray and bail out. // Transform {vector} into a JSArray and bail out.
goto Bailout(vector.CreateJSArray(k), k); goto Bailout(vector.CreateJSArray(k), k);
} }
...@@ -255,18 +253,15 @@ namespace array { ...@@ -255,18 +253,15 @@ namespace array {
return FastArrayMap(o, smiLength, callbackfn, thisArg) return FastArrayMap(o, smiLength, callbackfn, thisArg)
otherwise Bailout; otherwise Bailout;
} } label SlowSpeciesCreate {
label SlowSpeciesCreate {
array = ArraySpeciesCreate(context, receiver, len); array = ArraySpeciesCreate(context, receiver, len);
} } label Bailout(output: JSArray, kValue: Smi) deferred {
label Bailout(output: JSArray, kValue: Smi) deferred {
array = output; array = output;
k = kValue; k = kValue;
} }
return ArrayMapLoopContinuation(o, callbackfn, thisArg, array, o, k, len); return ArrayMapLoopContinuation(o, callbackfn, thisArg, array, o, k, len);
} } label TypeError deferred {
label TypeError deferred {
ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]); ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]);
} }
} }
......
...@@ -187,13 +187,11 @@ namespace array { ...@@ -187,13 +187,11 @@ namespace array {
try { try {
return FastArrayReduceRight(o, len, callbackfn, initialValue) return FastArrayReduceRight(o, len, callbackfn, initialValue)
otherwise Bailout; otherwise Bailout;
} } label Bailout(value: Number, accumulator: JSAny|TheHole) {
label Bailout(value: Number, accumulator: JSAny|TheHole) {
return ArrayReduceRightLoopContinuation( return ArrayReduceRightLoopContinuation(
o, callbackfn, accumulator, o, value, len); o, callbackfn, accumulator, o, value, len);
} }
} } label NoCallableError deferred {
label NoCallableError deferred {
ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]); ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]);
} }
} }
......
...@@ -186,13 +186,11 @@ namespace array { ...@@ -186,13 +186,11 @@ namespace array {
try { try {
return FastArrayReduce(o, len, callbackfn, initialValue) return FastArrayReduce(o, len, callbackfn, initialValue)
otherwise Bailout; otherwise Bailout;
} } label Bailout(value: Number, accumulator: JSAny|TheHole) {
label Bailout(value: Number, accumulator: JSAny|TheHole) {
return ArrayReduceLoopContinuation( return ArrayReduceLoopContinuation(
o, callbackfn, accumulator, o, value, len); o, callbackfn, accumulator, o, value, len);
} }
} } label NoCallableError deferred {
label NoCallableError deferred {
ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]); ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]);
} }
} }
......
...@@ -169,8 +169,7 @@ namespace array { ...@@ -169,8 +169,7 @@ namespace array {
try { try {
TryFastPackedArrayReverse(receiver) otherwise Baseline; TryFastPackedArrayReverse(receiver) otherwise Baseline;
return receiver; return receiver;
} } label Baseline {
label Baseline {
return GenericArrayReverse(context, receiver); return GenericArrayReverse(context, receiver);
} }
} }
......
...@@ -99,11 +99,9 @@ namespace array { ...@@ -99,11 +99,9 @@ namespace array {
receiver: JSAny)(...arguments): JSAny { receiver: JSAny)(...arguments): JSAny {
try { try {
return TryFastArrayShift(receiver) otherwise Slow, Runtime; return TryFastArrayShift(receiver) otherwise Slow, Runtime;
} } label Slow {
label Slow {
return GenericArrayShift(receiver); return GenericArrayShift(receiver);
} } label Runtime {
label Runtime {
tail ArrayShift( tail ArrayShift(
context, LoadTargetFromFrame(), Undefined, context, LoadTargetFromFrame(), Undefined,
Convert<int32>(arguments.length)); Convert<int32>(arguments.length));
......
...@@ -125,8 +125,7 @@ namespace array { ...@@ -125,8 +125,7 @@ namespace array {
goto Bailout; goto Bailout;
} }
} }
} } label HandleSimpleArgumentsSlice(a: JSArgumentsObjectWithLength) {
label HandleSimpleArgumentsSlice(a: JSArgumentsObjectWithLength) {
return HandleSimpleArgumentsSlice(context, a, start, count) return HandleSimpleArgumentsSlice(context, a, start, count)
otherwise Bailout; otherwise Bailout;
} }
...@@ -185,8 +184,7 @@ namespace array { ...@@ -185,8 +184,7 @@ namespace array {
try { try {
return HandleFastSlice(context, o, k, count) return HandleFastSlice(context, o, k, count)
otherwise Slow; otherwise Slow;
} } label Slow {}
label Slow {}
// 8. Let A be ? ArraySpeciesCreate(O, count). // 8. Let A be ? ArraySpeciesCreate(O, count).
const a: JSReceiver = ArraySpeciesCreate(context, o, count); const a: JSReceiver = ArraySpeciesCreate(context, o, count);
......
...@@ -134,13 +134,11 @@ namespace array { ...@@ -134,13 +134,11 @@ namespace array {
try { try {
return FastArraySome(o, len, callbackfn, thisArg) return FastArraySome(o, len, callbackfn, thisArg)
otherwise Bailout; otherwise Bailout;
} } label Bailout(kValue: Smi) deferred {
label Bailout(kValue: Smi) deferred {
return ArraySomeLoopContinuation( return ArraySomeLoopContinuation(
o, callbackfn, thisArg, Undefined, o, kValue, len, Undefined); o, callbackfn, thisArg, Undefined, o, kValue, len, Undefined);
} }
} } label TypeError deferred {
label TypeError deferred {
ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]); ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]);
} }
} }
......
...@@ -413,8 +413,7 @@ namespace array { ...@@ -413,8 +413,7 @@ namespace array {
return FastArraySplice( return FastArraySplice(
context, arguments, o, len, actualStart, insertCount, context, arguments, o, len, actualStart, insertCount,
actualDeleteCount) otherwise Bailout; actualDeleteCount) otherwise Bailout;
} } label Bailout {}
label Bailout {}
// If the fast case fails, just continue with the slow, correct, // If the fast case fails, just continue with the slow, correct,
// spec-compliant case. // spec-compliant case.
......
...@@ -91,8 +91,7 @@ namespace array { ...@@ -91,8 +91,7 @@ namespace array {
tail ArrayUnshift( tail ArrayUnshift(
context, LoadTargetFromFrame(), Undefined, context, LoadTargetFromFrame(), Undefined,
Convert<int32>(arguments.length)); Convert<int32>(arguments.length));
} } label Slow {
label Slow {
return GenericArrayUnshift(context, receiver, arguments); return GenericArrayUnshift(context, receiver, arguments);
} }
} }
......
...@@ -1258,8 +1258,7 @@ macro ChangeUintPtrNumberToUintPtr(value: Number): uintptr { ...@@ -1258,8 +1258,7 @@ macro ChangeUintPtrNumberToUintPtr(value: Number): uintptr {
try { try {
return TryNumberToUintPtr(value, kModeValueIsSafeIntegerUintPtr) return TryNumberToUintPtr(value, kModeValueIsSafeIntegerUintPtr)
otherwise InvalidValue, InvalidValue, InvalidValue; otherwise InvalidValue, InvalidValue, InvalidValue;
} } label InvalidValue {
label InvalidValue {
unreachable; unreachable;
} }
} }
...@@ -1270,8 +1269,7 @@ macro ChangeSafeIntegerNumberToUintPtr(value: Number): ...@@ -1270,8 +1269,7 @@ macro ChangeSafeIntegerNumberToUintPtr(value: Number):
try { try {
return TryNumberToUintPtr(value, kModeValueIsSafeInteger) return TryNumberToUintPtr(value, kModeValueIsSafeInteger)
otherwise InvalidValue, IfUIntPtrOverflow, InvalidValue; otherwise InvalidValue, IfUIntPtrOverflow, InvalidValue;
} } label InvalidValue {
label InvalidValue {
unreachable; unreachable;
} }
} }
...@@ -1317,8 +1315,7 @@ transitioning macro GetLengthProperty(implicit context: Context)(o: JSAny): ...@@ -1317,8 +1315,7 @@ transitioning macro GetLengthProperty(implicit context: Context)(o: JSAny):
goto ToLength(GetProperty(o, kLengthString)); goto ToLength(GetProperty(o, kLengthString));
} }
} }
} } label ToLength(length: JSAny) deferred {
label ToLength(length: JSAny) deferred {
return ToLength_Inline(length); return ToLength_Inline(length);
} }
} }
...@@ -1338,8 +1335,7 @@ transitioning macro GetMethod(implicit context: Context)( ...@@ -1338,8 +1335,7 @@ transitioning macro GetMethod(implicit context: Context)(
o: JSAny, name: String): Callable labels IfNullOrUndefined { o: JSAny, name: String): Callable labels IfNullOrUndefined {
try { try {
return GetMethod(o, name) otherwise IfNullOrUndefined, IfMethodNotCallable; return GetMethod(o, name) otherwise IfNullOrUndefined, IfMethodNotCallable;
} } label IfMethodNotCallable(value: JSAny) deferred {
label IfMethodNotCallable(value: JSAny) deferred {
ThrowTypeError(MessageTemplate::kPropertyNotFunction, value, name, o); ThrowTypeError(MessageTemplate::kPropertyNotFunction, value, name, o);
} }
} }
...@@ -1554,8 +1550,7 @@ transitioning builtin FastCreateDataProperty(implicit context: Context)( ...@@ -1554,8 +1550,7 @@ transitioning builtin FastCreateDataProperty(implicit context: Context)(
elements[index] = value; elements[index] = value;
} }
} }
} } label Slow {
label Slow {
CreateDataProperty(receiver, key, value); CreateDataProperty(receiver, key, value);
} }
return Undefined; return Undefined;
......
...@@ -72,8 +72,7 @@ namespace bigint { ...@@ -72,8 +72,7 @@ namespace bigint {
sign: uint32, length: intptr): MutableBigInt { sign: uint32, length: intptr): MutableBigInt {
try { try {
return AllocateEmptyBigIntNoThrow(sign, length) otherwise BigIntTooBig; return AllocateEmptyBigIntNoThrow(sign, length) otherwise BigIntTooBig;
} } label BigIntTooBig {
label BigIntTooBig {
ThrowRangeError(MessageTemplate::kBigIntTooBig); ThrowRangeError(MessageTemplate::kBigIntTooBig);
} }
} }
...@@ -160,8 +159,7 @@ namespace bigint { ...@@ -160,8 +159,7 @@ namespace bigint {
Numeric { Numeric {
try { try {
return BigIntAddImpl(x, y) otherwise BigIntTooBig; return BigIntAddImpl(x, y) otherwise BigIntTooBig;
} } label BigIntTooBig {
label BigIntTooBig {
// Smi sentinal is used to signal BigIntTooBig exception. // Smi sentinal is used to signal BigIntTooBig exception.
return Convert<Smi>(0); return Convert<Smi>(0);
} }
...@@ -174,11 +172,9 @@ namespace bigint { ...@@ -174,11 +172,9 @@ namespace bigint {
const y = Cast<BigInt>(yNum) otherwise MixedTypes; const y = Cast<BigInt>(yNum) otherwise MixedTypes;
return BigIntAddImpl(x, y) otherwise BigIntTooBig; return BigIntAddImpl(x, y) otherwise BigIntTooBig;
} } label MixedTypes {
label MixedTypes {
ThrowTypeError(MessageTemplate::kBigIntMixedTypes); ThrowTypeError(MessageTemplate::kBigIntMixedTypes);
} } label BigIntTooBig {
label BigIntTooBig {
ThrowRangeError(MessageTemplate::kBigIntTooBig); ThrowRangeError(MessageTemplate::kBigIntTooBig);
} }
} }
...@@ -205,8 +201,7 @@ namespace bigint { ...@@ -205,8 +201,7 @@ namespace bigint {
Context)(x: BigInt, y: BigInt): Numeric { Context)(x: BigInt, y: BigInt): Numeric {
try { try {
return BigIntSubtractImpl(x, y) otherwise BigIntTooBig; return BigIntSubtractImpl(x, y) otherwise BigIntTooBig;
} } label BigIntTooBig {
label BigIntTooBig {
// Smi sentinal is used to signal BigIntTooBig exception. // Smi sentinal is used to signal BigIntTooBig exception.
return Convert<Smi>(0); return Convert<Smi>(0);
} }
...@@ -219,11 +214,9 @@ namespace bigint { ...@@ -219,11 +214,9 @@ namespace bigint {
const y = Cast<BigInt>(yNum) otherwise MixedTypes; const y = Cast<BigInt>(yNum) otherwise MixedTypes;
return BigIntSubtractImpl(x, y) otherwise BigIntTooBig; return BigIntSubtractImpl(x, y) otherwise BigIntTooBig;
} } label MixedTypes {
label MixedTypes {
ThrowTypeError(MessageTemplate::kBigIntMixedTypes); ThrowTypeError(MessageTemplate::kBigIntMixedTypes);
} } label BigIntTooBig {
label BigIntTooBig {
ThrowRangeError(MessageTemplate::kBigIntTooBig); ThrowRangeError(MessageTemplate::kBigIntTooBig);
} }
} }
......
...@@ -100,12 +100,10 @@ namespace string { ...@@ -100,12 +100,10 @@ namespace string {
try { try {
GenerateStringAt(receiver, position, 'String.prototype.charAt') GenerateStringAt(receiver, position, 'String.prototype.charAt')
otherwise IfInBounds, IfOutOfBounds; otherwise IfInBounds, IfOutOfBounds;
} } label IfInBounds(string: String, index: uintptr, _length: uintptr) {
label IfInBounds(string: String, index: uintptr, _length: uintptr) {
const code: int32 = StringCharCodeAt(string, index); const code: int32 = StringCharCodeAt(string, index);
return StringFromSingleCharCode(code); return StringFromSingleCharCode(code);
} } label IfOutOfBounds {
label IfOutOfBounds {
return kEmptyString; return kEmptyString;
} }
} }
...@@ -117,12 +115,10 @@ namespace string { ...@@ -117,12 +115,10 @@ namespace string {
try { try {
GenerateStringAt(receiver, position, 'String.prototype.charCodeAt') GenerateStringAt(receiver, position, 'String.prototype.charCodeAt')
otherwise IfInBounds, IfOutOfBounds; otherwise IfInBounds, IfOutOfBounds;
} } label IfInBounds(string: String, index: uintptr, _length: uintptr) {
label IfInBounds(string: String, index: uintptr, _length: uintptr) {
const code: int32 = StringCharCodeAt(string, index); const code: int32 = StringCharCodeAt(string, index);
return Convert<Smi>(code); return Convert<Smi>(code);
} } label IfOutOfBounds {
label IfOutOfBounds {
return kNaN; return kNaN;
} }
} }
...@@ -134,15 +130,13 @@ namespace string { ...@@ -134,15 +130,13 @@ namespace string {
try { try {
GenerateStringAt(receiver, position, 'String.prototype.codePointAt') GenerateStringAt(receiver, position, 'String.prototype.codePointAt')
otherwise IfInBounds, IfOutOfBounds; otherwise IfInBounds, IfOutOfBounds;
} } label IfInBounds(string: String, index: uintptr, length: uintptr) {
label IfInBounds(string: String, index: uintptr, length: uintptr) {
// This is always a call to a builtin from Javascript, so we need to // This is always a call to a builtin from Javascript, so we need to
// produce UTF32. // produce UTF32.
const code: int32 = LoadSurrogatePairAt( const code: int32 = LoadSurrogatePairAt(
string, Signed(length), Signed(index), UnicodeEncoding::UTF32); string, Signed(length), Signed(index), UnicodeEncoding::UTF32);
return Convert<Smi>(code); return Convert<Smi>(code);
} } label IfOutOfBounds {
label IfOutOfBounds {
return Undefined; return Undefined;
} }
} }
......
...@@ -47,8 +47,7 @@ namespace collections { ...@@ -47,8 +47,7 @@ namespace collections {
KeyValuePair { KeyValuePair {
try { try {
return LoadKeyValuePairNoSideEffects(o) otherwise Generic; return LoadKeyValuePairNoSideEffects(o) otherwise Generic;
} } label Generic {
label Generic {
return KeyValuePair{ return KeyValuePair{
key: GetProperty(o, Convert<Smi>(0)), key: GetProperty(o, Convert<Smi>(0)),
value: GetProperty(o, Convert<Smi>(1)) value: GetProperty(o, Convert<Smi>(1))
......
...@@ -66,8 +66,7 @@ namespace data_view { ...@@ -66,8 +66,7 @@ namespace data_view {
JSDataView { JSDataView {
try { try {
return Cast<JSDataView>(o) otherwise CastError; return Cast<JSDataView>(o) otherwise CastError;
} } label CastError {
label CastError {
ThrowTypeError(MessageTemplate::kIncompatibleMethodReceiver, method); ThrowTypeError(MessageTemplate::kIncompatibleMethodReceiver, method);
} }
} }
...@@ -423,8 +422,7 @@ namespace data_view { ...@@ -423,8 +422,7 @@ namespace data_view {
} else { } else {
unreachable; unreachable;
} }
} } label RangeError {
label RangeError {
ThrowRangeError(MessageTemplate::kInvalidDataViewAccessorOffset); ThrowRangeError(MessageTemplate::kInvalidDataViewAccessorOffset);
} }
} }
...@@ -750,8 +748,7 @@ namespace data_view { ...@@ -750,8 +748,7 @@ namespace data_view {
} }
} }
return Undefined; return Undefined;
} } label RangeError {
label RangeError {
ThrowRangeError(MessageTemplate::kInvalidDataViewAccessorOffset); ThrowRangeError(MessageTemplate::kInvalidDataViewAccessorOffset);
} }
} }
......
...@@ -39,8 +39,7 @@ namespace math { ...@@ -39,8 +39,7 @@ namespace math {
MathAbs(js-implicit context: NativeContext)(x: JSAny): Number { MathAbs(js-implicit context: NativeContext)(x: JSAny): Number {
try { try {
ReduceToSmiOrFloat64(x) otherwise SmiResult, Float64Result; ReduceToSmiOrFloat64(x) otherwise SmiResult, Float64Result;
} } label SmiResult(s: Smi) {
label SmiResult(s: Smi) {
try { try {
if constexpr (IsIntPtrAbsWithOverflowSupported()) { if constexpr (IsIntPtrAbsWithOverflowSupported()) {
const result: Smi = TrySmiAbs(s) const result: Smi = TrySmiAbs(s)
...@@ -54,12 +53,10 @@ namespace math { ...@@ -54,12 +53,10 @@ namespace math {
return result; return result;
} }
} }
} } label SmiOverflow {
label SmiOverflow {
return NumberConstant(kSmiMaxValuePlusOne); return NumberConstant(kSmiMaxValuePlusOne);
} }
} } label Float64Result(f: float64) {
label Float64Result(f: float64) {
return Convert<Number>(Float64Abs(f)); return Convert<Number>(Float64Abs(f));
} }
} }
...@@ -70,11 +67,9 @@ namespace math { ...@@ -70,11 +67,9 @@ namespace math {
MathCeil(js-implicit context: NativeContext)(x: JSAny): Number { MathCeil(js-implicit context: NativeContext)(x: JSAny): Number {
try { try {
ReduceToSmiOrFloat64(x) otherwise SmiResult, Float64Result; ReduceToSmiOrFloat64(x) otherwise SmiResult, Float64Result;
} } label SmiResult(s: Smi) {
label SmiResult(s: Smi) {
return s; return s;
} } label Float64Result(f: float64) {
label Float64Result(f: float64) {
return Convert<Number>(Float64Ceil(f)); return Convert<Number>(Float64Ceil(f));
} }
} }
...@@ -85,11 +80,9 @@ namespace math { ...@@ -85,11 +80,9 @@ namespace math {
MathFloor(js-implicit context: NativeContext)(x: JSAny): Number { MathFloor(js-implicit context: NativeContext)(x: JSAny): Number {
try { try {
ReduceToSmiOrFloat64(x) otherwise SmiResult, Float64Result; ReduceToSmiOrFloat64(x) otherwise SmiResult, Float64Result;
} } label SmiResult(s: Smi) {
label SmiResult(s: Smi) {
return s; return s;
} } label Float64Result(f: float64) {
label Float64Result(f: float64) {
return Convert<Number>(Float64Floor(f)); return Convert<Number>(Float64Floor(f));
} }
} }
...@@ -100,11 +93,9 @@ namespace math { ...@@ -100,11 +93,9 @@ namespace math {
MathRound(js-implicit context: NativeContext)(x: JSAny): Number { MathRound(js-implicit context: NativeContext)(x: JSAny): Number {
try { try {
ReduceToSmiOrFloat64(x) otherwise SmiResult, Float64Result; ReduceToSmiOrFloat64(x) otherwise SmiResult, Float64Result;
} } label SmiResult(s: Smi) {
label SmiResult(s: Smi) {
return s; return s;
} } label Float64Result(f: float64) {
label Float64Result(f: float64) {
return Convert<Number>(Float64Round(f)); return Convert<Number>(Float64Round(f));
} }
} }
...@@ -115,11 +106,9 @@ namespace math { ...@@ -115,11 +106,9 @@ namespace math {
MathTrunc(js-implicit context: NativeContext)(x: JSAny): Number { MathTrunc(js-implicit context: NativeContext)(x: JSAny): Number {
try { try {
ReduceToSmiOrFloat64(x) otherwise SmiResult, Float64Result; ReduceToSmiOrFloat64(x) otherwise SmiResult, Float64Result;
} } label SmiResult(s: Smi) {
label SmiResult(s: Smi) {
return s; return s;
} } label Float64Result(f: float64) {
label Float64Result(f: float64) {
return Convert<Number>(Float64Trunc(f)); return Convert<Number>(Float64Trunc(f));
} }
} }
......
...@@ -39,8 +39,7 @@ namespace object { ...@@ -39,8 +39,7 @@ namespace object {
try { try {
if (IsNullOrUndefined(iterable)) goto Throw; if (IsNullOrUndefined(iterable)) goto Throw;
return ObjectFromEntriesFastCase(iterable) otherwise IfSlow; return ObjectFromEntriesFastCase(iterable) otherwise IfSlow;
} } label IfSlow {
label IfSlow {
const result: JSObject = NewJSObject(); const result: JSObject = NewJSObject();
const fastIteratorResultMap: Map = GetIteratorResultMap(); const fastIteratorResultMap: Map = GetIteratorResultMap();
let i: iterator::IteratorRecord = iterator::GetIterator(iterable); let i: iterator::IteratorRecord = iterator::GetIterator(iterable);
...@@ -60,8 +59,7 @@ namespace object { ...@@ -60,8 +59,7 @@ namespace object {
} catch (e) deferred { } catch (e) deferred {
iterator::IteratorCloseOnException(i, e); iterator::IteratorCloseOnException(i, e);
} }
} } label Throw deferred {
label Throw deferred {
ThrowTypeError(MessageTemplate::kNotIterable); ThrowTypeError(MessageTemplate::kNotIterable);
} }
} }
......
...@@ -131,8 +131,7 @@ namespace object { ...@@ -131,8 +131,7 @@ namespace object {
} }
} }
return AllocateJSObjectFromMap(map, properties); return AllocateJSObjectFromMap(map, properties);
} } label Runtime deferred {
label Runtime deferred {
return runtime::ObjectCreate(prototype, Undefined); return runtime::ObjectCreate(prototype, Undefined);
} }
} }
......
...@@ -68,8 +68,7 @@ namespace promise { ...@@ -68,8 +68,7 @@ namespace promise {
Undefined): Context { Undefined): Context {
try { try {
return ExtractHandlerContextInternal(handler) otherwise NotFound; return ExtractHandlerContextInternal(handler) otherwise NotFound;
} } label NotFound deferred {
label NotFound deferred {
return context; return context;
} }
} }
...@@ -79,11 +78,9 @@ namespace promise { ...@@ -79,11 +78,9 @@ namespace promise {
primary: Callable|Undefined, secondary: Callable|Undefined): Context { primary: Callable|Undefined, secondary: Callable|Undefined): Context {
try { try {
return ExtractHandlerContextInternal(primary) otherwise NotFound; return ExtractHandlerContextInternal(primary) otherwise NotFound;
} } label NotFound deferred {
label NotFound deferred {
return ExtractHandlerContextInternal(secondary) otherwise Default; return ExtractHandlerContextInternal(secondary) otherwise Default;
} } label Default deferred {
label Default deferred {
return context; return context;
} }
} }
......
...@@ -272,8 +272,7 @@ namespace promise { ...@@ -272,8 +272,7 @@ namespace promise {
} catch (e) deferred { } catch (e) deferred {
iterator::IteratorCloseOnException(iter, e) otherwise Reject; iterator::IteratorCloseOnException(iter, e) otherwise Reject;
} }
} } label Done {}
label Done {}
// Set iteratorRecord.[[Done]] to true. // Set iteratorRecord.[[Done]] to true.
// Set remainingElementsCount.[[Value]] to // Set remainingElementsCount.[[Value]] to
...@@ -348,8 +347,7 @@ namespace promise { ...@@ -348,8 +347,7 @@ namespace promise {
createRejectElementFunctor) otherwise Reject; createRejectElementFunctor) otherwise Reject;
} catch (e) deferred { } catch (e) deferred {
goto Reject(e); goto Reject(e);
} } label Reject(e: Object) deferred {
label Reject(e: Object) deferred {
// Exception must be bound to a JS value. // Exception must be bound to a JS value.
const e = UnsafeCast<JSAny>(e); const e = UnsafeCast<JSAny>(e);
const reject = UnsafeCast<JSAny>(capability.reject); const reject = UnsafeCast<JSAny>(capability.reject);
......
...@@ -273,8 +273,7 @@ namespace promise { ...@@ -273,8 +273,7 @@ namespace promise {
} catch (e) deferred { } catch (e) deferred {
iterator::IteratorCloseOnException(iteratorRecord, e) iterator::IteratorCloseOnException(iteratorRecord, e)
otherwise Reject; otherwise Reject;
} } label Done {}
label Done {}
// (8.d) // (8.d)
// i. Set iteratorRecord.[[Done]] to true. // i. Set iteratorRecord.[[Done]] to true.
...@@ -348,8 +347,7 @@ namespace promise { ...@@ -348,8 +347,7 @@ namespace promise {
} catch (e) deferred { } catch (e) deferred {
goto Reject(e); goto Reject(e);
} }
} } label Reject(e: Object) deferred {
label Reject(e: Object) deferred {
// Exception must be bound to a JS value. // Exception must be bound to a JS value.
assert(e != TheHole); assert(e != TheHole);
Call( Call(
......
...@@ -263,13 +263,11 @@ namespace promise { ...@@ -263,13 +263,11 @@ namespace promise {
} }
} }
} }
} } label CallRuntime deferred {
label CallRuntime deferred {
const result = runtime::AllowDynamicFunction(promiseConstructor); const result = runtime::AllowDynamicFunction(promiseConstructor);
if (result != True) { if (result != True) {
goto IfNoAccess; goto IfNoAccess;
} }
} } label HasAccess {}
label HasAccess {}
} }
} }
...@@ -119,8 +119,7 @@ namespace promise { ...@@ -119,8 +119,7 @@ namespace promise {
} catch (e) deferred { } catch (e) deferred {
iterator::IteratorCloseOnException(i, e) otherwise Reject; iterator::IteratorCloseOnException(i, e) otherwise Reject;
} }
} } label Reject(exception: Object) deferred {
label Reject(exception: Object) deferred {
Call( Call(
context, UnsafeCast<JSAny>(reject), Undefined, context, UnsafeCast<JSAny>(reject), Undefined,
UnsafeCast<JSAny>(exception)); UnsafeCast<JSAny>(exception));
......
...@@ -52,15 +52,13 @@ namespace promise { ...@@ -52,15 +52,13 @@ namespace promise {
// native Promise. // native Promise.
if (promiseFun != constructor) goto SlowConstructor; if (promiseFun != constructor) goto SlowConstructor;
return value; return value;
} } label SlowConstructor deferred {
label SlowConstructor deferred {
// At this point, value or/and constructor are not native promises, but // At this point, value or/and constructor are not native promises, but
// they could be of the same subclass. // they could be of the same subclass.
const valueConstructor = GetProperty(value, kConstructorString); const valueConstructor = GetProperty(value, kConstructorString);
if (valueConstructor != constructor) goto NeedToAllocate; if (valueConstructor != constructor) goto NeedToAllocate;
return value; return value;
} } label NeedToAllocate {
label NeedToAllocate {
if (promiseFun == constructor) { if (promiseFun == constructor) {
// This adds a fast path for native promises that don't need to // This adds a fast path for native promises that don't need to
// create NewPromiseCapability. // create NewPromiseCapability.
...@@ -154,8 +152,7 @@ namespace promise { ...@@ -154,8 +152,7 @@ namespace promise {
goto Enqueue; goto Enqueue;
} }
goto Slow; goto Slow;
} } label Slow deferred {
label Slow deferred {
// 9. Let then be Get(resolution, "then"). // 9. Let then be Get(resolution, "then").
// 10. If then is an abrupt completion, then // 10. If then is an abrupt completion, then
try { try {
...@@ -172,8 +169,7 @@ namespace promise { ...@@ -172,8 +169,7 @@ namespace promise {
return FulfillPromise(promise, resolution); return FulfillPromise(promise, resolution);
} }
goto Enqueue; goto Enqueue;
} } label Enqueue {
label Enqueue {
// 13. Let job be NewPromiseResolveThenableJob(promise, resolution, // 13. Let job be NewPromiseResolveThenableJob(promise, resolution,
// thenAction). // thenAction).
const task = NewPromiseResolveThenableJobTask( const task = NewPromiseResolveThenableJobTask(
......
...@@ -46,8 +46,7 @@ namespace promise { ...@@ -46,8 +46,7 @@ namespace promise {
resultPromiseOrCapability = promiseCapability; resultPromiseOrCapability = promiseCapability;
resultPromise = promiseCapability.promise; resultPromise = promiseCapability.promise;
} }
} } label AllocateAndInit {
label AllocateAndInit {
const resultJSPromise = NewJSPromise(promise); const resultJSPromise = NewJSPromise(promise);
resultPromiseOrCapability = resultJSPromise; resultPromiseOrCapability = resultJSPromise;
resultPromise = resultJSPromise; resultPromise = resultJSPromise;
......
...@@ -38,8 +38,7 @@ namespace proxy { ...@@ -38,8 +38,7 @@ namespace proxy {
// 9. Set P.[[ProxyHandler]] to handler. // 9. Set P.[[ProxyHandler]] to handler.
// 10. Return P. // 10. Return P.
return AllocateProxy(targetJSReceiver, handlerJSReceiver); return AllocateProxy(targetJSReceiver, handlerJSReceiver);
} } label ThrowProxyNonObject deferred {
label ThrowProxyNonObject deferred {
ThrowTypeError(MessageTemplate::kProxyNonObject); ThrowTypeError(MessageTemplate::kProxyNonObject);
} }
} }
......
...@@ -59,12 +59,10 @@ namespace proxy { ...@@ -59,12 +59,10 @@ namespace proxy {
// 15. Return true. // 15. Return true.
return True; return True;
} } label TrapUndefined(target: JSAny) {
label TrapUndefined(target: JSAny) {
// 7.a. Return ? target.[[Delete]](P). // 7.a. Return ? target.[[Delete]](P).
return DeleteProperty(target, name, languageMode); return DeleteProperty(target, name, languageMode);
} } label ThrowProxyHandlerRevoked deferred {
label ThrowProxyHandlerRevoked deferred {
ThrowTypeError(MessageTemplate::kProxyRevoked, kTrapName); ThrowTypeError(MessageTemplate::kProxyRevoked, kTrapName);
} }
} }
......
...@@ -55,15 +55,12 @@ namespace proxy { ...@@ -55,15 +55,12 @@ namespace proxy {
return handlerProto; return handlerProto;
} }
ThrowTypeError(MessageTemplate::kProxyGetPrototypeOfNonExtensible); ThrowTypeError(MessageTemplate::kProxyGetPrototypeOfNonExtensible);
} } label TrapUndefined(target: JSAny) {
label TrapUndefined(target: JSAny) {
// 6.a. Return ? target.[[GetPrototypeOf]](). // 6.a. Return ? target.[[GetPrototypeOf]]().
return object::ObjectGetPrototypeOfImpl(target); return object::ObjectGetPrototypeOfImpl(target);
} } label ThrowProxyHandlerRevoked deferred {
label ThrowProxyHandlerRevoked deferred {
ThrowTypeError(MessageTemplate::kProxyRevoked, kTrapName); ThrowTypeError(MessageTemplate::kProxyRevoked, kTrapName);
} } label ThrowProxyGetPrototypeOfInvalid deferred {
label ThrowProxyGetPrototypeOfInvalid deferred {
ThrowTypeError(MessageTemplate::kProxyGetPrototypeOfInvalid); ThrowTypeError(MessageTemplate::kProxyGetPrototypeOfInvalid);
} }
} }
......
...@@ -45,12 +45,10 @@ namespace proxy { ...@@ -45,12 +45,10 @@ namespace proxy {
} }
CheckHasTrapResult(target, proxy, name); CheckHasTrapResult(target, proxy, name);
return False; return False;
} } label TrapUndefined(target: JSAny) {
label TrapUndefined(target: JSAny) {
// 7.a. Return ? target.[[HasProperty]](P). // 7.a. Return ? target.[[HasProperty]](P).
tail HasProperty(target, name); tail HasProperty(target, name);
} } label ThrowProxyHandlerRevoked deferred {
label ThrowProxyHandlerRevoked deferred {
ThrowTypeError(MessageTemplate::kProxyRevoked, 'has'); ThrowTypeError(MessageTemplate::kProxyRevoked, 'has');
} }
} }
......
...@@ -45,12 +45,10 @@ namespace proxy { ...@@ -45,12 +45,10 @@ namespace proxy {
} }
// 10. Return booleanTrapResult. // 10. Return booleanTrapResult.
return SelectBooleanConstant(trapResult); return SelectBooleanConstant(trapResult);
} } label TrapUndefined(target: JSAny) {
label TrapUndefined(target: JSAny) {
// 6.a. Return ? IsExtensible(target). // 6.a. Return ? IsExtensible(target).
return object::ObjectIsExtensibleImpl(target); return object::ObjectIsExtensibleImpl(target);
} } label ThrowProxyHandlerRevoked deferred {
label ThrowProxyHandlerRevoked deferred {
ThrowTypeError(MessageTemplate::kProxyRevoked, kTrapName); ThrowTypeError(MessageTemplate::kProxyRevoked, kTrapName);
} }
} }
......
...@@ -51,15 +51,13 @@ namespace proxy { ...@@ -51,15 +51,13 @@ namespace proxy {
// 9. Return booleanTrapResult. // 9. Return booleanTrapResult.
return True; return True;
} } label TrapUndefined(target: JSAny) {
label TrapUndefined(target: JSAny) {
// 6.a. Return ? target.[[PreventExtensions]](). // 6.a. Return ? target.[[PreventExtensions]]().
if (doThrow == True) { if (doThrow == True) {
return object::ObjectPreventExtensionsThrow(target); return object::ObjectPreventExtensionsThrow(target);
} }
return object::ObjectPreventExtensionsDontThrow(target); return object::ObjectPreventExtensionsDontThrow(target);
} } label ThrowProxyHandlerRevoked deferred {
label ThrowProxyHandlerRevoked deferred {
ThrowTypeError(MessageTemplate::kProxyRevoked, kTrapName); ThrowTypeError(MessageTemplate::kProxyRevoked, kTrapName);
} }
} }
......
...@@ -33,8 +33,7 @@ namespace proxy { ...@@ -33,8 +33,7 @@ namespace proxy {
// 7. Perform CreateDataProperty(result, "revoke", revoker). // 7. Perform CreateDataProperty(result, "revoke", revoker).
// 8. Return result. // 8. Return result.
return NewJSProxyRevocableResult(proxy, revoke); return NewJSProxyRevocableResult(proxy, revoke);
} } label ThrowProxyNonObject deferred {
label ThrowProxyNonObject deferred {
ThrowTypeError(MessageTemplate::kProxyNonObject, 'Proxy.revocable'); ThrowTypeError(MessageTemplate::kProxyNonObject, 'Proxy.revocable');
} }
} }
......
...@@ -76,13 +76,11 @@ namespace proxy { ...@@ -76,13 +76,11 @@ namespace proxy {
SmiConstant(MessageTemplate::kProxyTrapReturnedFalsishFor), 'set', SmiConstant(MessageTemplate::kProxyTrapReturnedFalsishFor), 'set',
name); name);
return value; return value;
} } label TrapUndefined(target: Object) {
label TrapUndefined(target: Object) {
// 7.a. Return ? target.[[Set]](P, V, Receiver). // 7.a. Return ? target.[[Set]](P, V, Receiver).
SetPropertyWithReceiver(target, name, value, receiverValue); SetPropertyWithReceiver(target, name, value, receiverValue);
return value; return value;
} } label ThrowProxyHandlerRevoked deferred {
label ThrowProxyHandlerRevoked deferred {
ThrowTypeError(MessageTemplate::kProxyRevoked, 'set'); ThrowTypeError(MessageTemplate::kProxyRevoked, 'set');
} }
} }
......
...@@ -63,15 +63,13 @@ namespace proxy { ...@@ -63,15 +63,13 @@ namespace proxy {
return True; return True;
} }
ThrowTypeError(MessageTemplate::kProxySetPrototypeOfNonExtensible); ThrowTypeError(MessageTemplate::kProxySetPrototypeOfNonExtensible);
} } label TrapUndefined(target: JSAny, proto: JSReceiver|Null) {
label TrapUndefined(target: JSAny, proto: JSReceiver|Null) {
// 7.a. Return ? target.[[SetPrototypeOf]](). // 7.a. Return ? target.[[SetPrototypeOf]]().
if (doThrow == True) { if (doThrow == True) {
return object::ObjectSetPrototypeOfThrow(target, proto); return object::ObjectSetPrototypeOfThrow(target, proto);
} }
return object::ObjectSetPrototypeOfDontThrow(target, proto); return object::ObjectSetPrototypeOfDontThrow(target, proto);
} } label ThrowProxyHandlerRevoked deferred {
label ThrowProxyHandlerRevoked deferred {
ThrowTypeError(MessageTemplate::kProxyRevoked, kTrapName); ThrowTypeError(MessageTemplate::kProxyRevoked, kTrapName);
} }
} }
......
...@@ -218,8 +218,7 @@ namespace regexp { ...@@ -218,8 +218,7 @@ namespace regexp {
// b. Return ! CreateIterResultObject(undefined, true). // b. Return ! CreateIterResultObject(undefined, true).
goto ReturnEmptyDoneResult; goto ReturnEmptyDoneResult;
} }
} } label ReturnEmptyDoneResult {
label ReturnEmptyDoneResult {
return AllocateJSIteratorResult(Undefined, True); return AllocateJSIteratorResult(Undefined, True);
} }
} }
......
...@@ -82,11 +82,9 @@ namespace regexp { ...@@ -82,11 +82,9 @@ namespace regexp {
match = ToString_Inline(GetProperty(resultTemp, SmiConstant(0))); match = ToString_Inline(GetProperty(resultTemp, SmiConstant(0)));
} }
goto IfDidMatch; goto IfDidMatch;
} } label IfDidNotMatch {
label IfDidNotMatch {
return array.length == 0 ? Null : array.ToJSArray(); return array.length == 0 ? Null : array.ToJSArray();
} } label IfDidMatch {
label IfDidMatch {
// Store the match, growing the fixed array if needed. // Store the match, growing the fixed array if needed.
array.Push(match); array.Push(match);
......
...@@ -203,8 +203,7 @@ namespace regexp { ...@@ -203,8 +203,7 @@ namespace regexp {
} }
return RegExpReplaceFastString(fastRegexp, string, replaceString); return RegExpReplaceFastString(fastRegexp, string, replaceString);
} } label Runtime deferred {
label Runtime deferred {
return RegExpReplaceRT(context, stableRegexp, string, replaceString); return RegExpReplaceRT(context, stableRegexp, string, replaceString);
} }
} }
...@@ -253,8 +252,7 @@ namespace regexp { ...@@ -253,8 +252,7 @@ namespace regexp {
try { try {
const fastRx: FastJSRegExp = Cast<FastJSRegExp>(rx) otherwise Runtime; const fastRx: FastJSRegExp = Cast<FastJSRegExp>(rx) otherwise Runtime;
return RegExpReplace(fastRx, s, replaceValue); return RegExpReplace(fastRx, s, replaceValue);
} } label Runtime deferred {
label Runtime deferred {
IncrementUseCounter( IncrementUseCounter(
context, SmiConstant(kRegExpReplaceCalledOnSlowRegExp)); context, SmiConstant(kRegExpReplaceCalledOnSlowRegExp));
return RegExpReplaceRT(context, rx, s, replaceValue); return RegExpReplaceRT(context, rx, s, replaceValue);
......
...@@ -31,8 +31,7 @@ namespace regexp { ...@@ -31,8 +31,7 @@ namespace regexp {
// Return the index of the match. // Return the index of the match.
return UnsafeCast<Smi>( return UnsafeCast<Smi>(
matchIndices.objects[kRegExpMatchInfoFirstCaptureIndex]); matchIndices.objects[kRegExpMatchInfoFirstCaptureIndex]);
} } label DidNotMatch {
label DidNotMatch {
// Reset last index and return -1. // Reset last index and return -1.
FastStoreLastIndex(regexp, previousLastIndex); FastStoreLastIndex(regexp, previousLastIndex);
return SmiConstant(-1); return SmiConstant(-1);
......
...@@ -71,8 +71,7 @@ namespace string { ...@@ -71,8 +71,7 @@ namespace string {
// Fast Path: If both strings are direct and relevant indices are Smis. // Fast Path: If both strings are direct and relevant indices are Smis.
return TryFastStringCompareSequence( return TryFastStringCompareSequence(
string, searchStr, start, searchLength) otherwise Slow; string, searchStr, start, searchLength) otherwise Slow;
} } label Slow {
label Slow {
// Slow Path: If either of the string is indirect, bail into runtime. // Slow Path: If either of the string is indirect, bail into runtime.
return StringCompareSequence( return StringCompareSequence(
context, string, searchStr, Convert<Number>(start)); context, string, searchStr, Convert<Number>(start));
......
...@@ -64,14 +64,11 @@ namespace string { ...@@ -64,14 +64,11 @@ namespace string {
goto InvalidStringLength; goto InvalidStringLength;
} }
} }
} } label EmptyString {
label EmptyString {
return kEmptyString; return kEmptyString;
} } label InvalidCount deferred {
label InvalidCount deferred {
ThrowRangeError(MessageTemplate::kInvalidCountValue, count); ThrowRangeError(MessageTemplate::kInvalidCountValue, count);
} } label InvalidStringLength deferred {
label InvalidStringLength deferred {
ThrowInvalidStringLength(context); ThrowInvalidStringLength(context);
} }
} }
......
...@@ -56,8 +56,7 @@ namespace string { ...@@ -56,8 +56,7 @@ namespace string {
try { try {
return TryFastAbstractStringIndexOf(string, searchString, fromIndex) return TryFastAbstractStringIndexOf(string, searchString, fromIndex)
otherwise Slow; otherwise Slow;
} } label Slow {
label Slow {
for (let i: intptr = SmiUntag(fromIndex); for (let i: intptr = SmiUntag(fromIndex);
i + searchStringLength <= stringLength; i++) { i + searchStringLength <= stringLength; i++) {
if (StringCompareSequence( if (StringCompareSequence(
...@@ -119,8 +118,7 @@ namespace string { ...@@ -119,8 +118,7 @@ namespace string {
const replacer = GetMethod(searchValue, ReplaceSymbolConstant()) const replacer = GetMethod(searchValue, ReplaceSymbolConstant())
otherwise ReplaceSymbolIsNullOrUndefined; otherwise ReplaceSymbolIsNullOrUndefined;
return Call(context, replacer, searchValue, receiver, replaceValue); return Call(context, replacer, searchValue, receiver, replaceValue);
} } label ReplaceSymbolIsNullOrUndefined {}
label ReplaceSymbolIsNullOrUndefined {}
} }
// 3. Let string be ? ToString(O). // 3. Let string be ? ToString(O).
......
...@@ -51,8 +51,7 @@ namespace string { ...@@ -51,8 +51,7 @@ namespace string {
// Fast Path: If both strings are direct and relevant indices are Smis. // Fast Path: If both strings are direct and relevant indices are Smis.
return TryFastStringCompareSequence( return TryFastStringCompareSequence(
string, searchStr, start, searchLength) otherwise Slow; string, searchStr, start, searchLength) otherwise Slow;
} } label Slow {
label Slow {
// Slow Path: If either of the string is indirect, bail into runtime. // Slow Path: If either of the string is indirect, bail into runtime.
return StringCompareSequence( return StringCompareSequence(
context, string, searchStr, Convert<Number>(start)); context, string, searchStr, Convert<Number>(start));
......
...@@ -97,16 +97,14 @@ namespace typed_array { ...@@ -97,16 +97,14 @@ namespace typed_array {
} }
return typedArray; return typedArray;
} } label AllocateOffHeap {
label AllocateOffHeap {
if constexpr (initialize) { if constexpr (initialize) {
goto AttachOffHeapBuffer(Construct(defaultConstructor, byteLengthNum)); goto AttachOffHeapBuffer(Construct(defaultConstructor, byteLengthNum));
} else { } else {
goto AttachOffHeapBuffer(Call( goto AttachOffHeapBuffer(Call(
context, GetArrayBufferNoInitFunction(), Undefined, byteLengthNum)); context, GetArrayBufferNoInitFunction(), Undefined, byteLengthNum));
} }
} } label AttachOffHeapBuffer(bufferObj: Object) {
label AttachOffHeapBuffer(bufferObj: Object) {
const buffer = Cast<JSArrayBuffer>(bufferObj) otherwise unreachable; const buffer = Cast<JSArrayBuffer>(bufferObj) otherwise unreachable;
const isOnHeap: constexpr bool = false; const isOnHeap: constexpr bool = false;
return AllocateTypedArray( return AllocateTypedArray(
...@@ -126,8 +124,7 @@ namespace typed_array { ...@@ -126,8 +124,7 @@ namespace typed_array {
return TypedArrayInitialize( return TypedArrayInitialize(
initialize, map, length, elementsInfo, defaultConstructor) initialize, map, length, elementsInfo, defaultConstructor)
otherwise RangeError; otherwise RangeError;
} } label RangeError deferred {
label RangeError deferred {
ThrowRangeError(MessageTemplate::kInvalidTypedArrayLength, lengthObj); ThrowRangeError(MessageTemplate::kInvalidTypedArrayLength, lengthObj);
} }
} }
...@@ -160,16 +157,14 @@ namespace typed_array { ...@@ -160,16 +157,14 @@ namespace typed_array {
typed_array::CallCMemcpy( typed_array::CallCMemcpy(
typedArray.data_ptr, src.data_ptr, byteLength); typedArray.data_ptr, src.data_ptr, byteLength);
} }
} } label IfSlow deferred {
label IfSlow deferred {
if (length > 0) { if (length > 0) {
TypedArrayCopyElements( TypedArrayCopyElements(
context, typedArray, arrayLike, Convert<Number>(length)); context, typedArray, arrayLike, Convert<Number>(length));
} }
} }
return typedArray; return typedArray;
} } label RangeError deferred {
label RangeError deferred {
ThrowRangeError( ThrowRangeError(
MessageTemplate::kInvalidTypedArrayLength, Convert<Number>(length)); MessageTemplate::kInvalidTypedArrayLength, Convert<Number>(length));
} }
...@@ -270,14 +265,11 @@ namespace typed_array { ...@@ -270,14 +265,11 @@ namespace typed_array {
const isOnHeap: constexpr bool = false; const isOnHeap: constexpr bool = false;
return AllocateTypedArray( return AllocateTypedArray(
isOnHeap, map, buffer, offset, newByteLength, newLength); isOnHeap, map, buffer, offset, newByteLength, newLength);
} } label IfInvalidAlignment(problemString: String) deferred {
label IfInvalidAlignment(problemString: String) deferred {
ThrowInvalidTypedArrayAlignment(map, problemString); ThrowInvalidTypedArrayAlignment(map, problemString);
} } label IfInvalidLength deferred {
label IfInvalidLength deferred {
ThrowRangeError(MessageTemplate::kInvalidTypedArrayLength, length); ThrowRangeError(MessageTemplate::kInvalidTypedArrayLength, length);
} } label IfInvalidOffset deferred {
label IfInvalidOffset deferred {
ThrowRangeError(MessageTemplate::kInvalidOffset, byteOffset); ThrowRangeError(MessageTemplate::kInvalidOffset, byteOffset);
} }
} }
...@@ -323,8 +315,7 @@ namespace typed_array { ...@@ -323,8 +315,7 @@ namespace typed_array {
otherwise IfIteratorUndefined, IfIteratorNotCallable; otherwise IfIteratorUndefined, IfIteratorNotCallable;
ConstructByIterable(obj, iteratorMethod) ConstructByIterable(obj, iteratorMethod)
otherwise IfConstructByArrayLike; otherwise IfConstructByArrayLike;
} } label IfIteratorUndefined {
label IfIteratorUndefined {
const lengthObj: JSAny = GetProperty(obj, kLengthString); const lengthObj: JSAny = GetProperty(obj, kLengthString);
const lengthNumber: Number = ToLength_Inline(lengthObj); const lengthNumber: Number = ToLength_Inline(lengthObj);
// Throw RangeError here if the length does not fit in uintptr because // Throw RangeError here if the length does not fit in uintptr because
...@@ -333,11 +324,9 @@ namespace typed_array { ...@@ -333,11 +324,9 @@ namespace typed_array {
const length: uintptr = ChangeSafeIntegerNumberToUintPtr(lengthNumber) const length: uintptr = ChangeSafeIntegerNumberToUintPtr(lengthNumber)
otherwise goto IfInvalidLength(lengthNumber); otherwise goto IfInvalidLength(lengthNumber);
goto IfConstructByArrayLike(obj, length, GetArrayBufferFunction()); goto IfConstructByArrayLike(obj, length, GetArrayBufferFunction());
} } label IfInvalidLength(length: Number) {
label IfInvalidLength(length: Number) {
ThrowRangeError(MessageTemplate::kInvalidTypedArrayLength, length); ThrowRangeError(MessageTemplate::kInvalidTypedArrayLength, length);
} } label IfIteratorNotCallable(_value: JSAny) deferred {
label IfIteratorNotCallable(_value: JSAny) deferred {
ThrowTypeError(MessageTemplate::kIteratorSymbolNonCallable); ThrowTypeError(MessageTemplate::kIteratorSymbolNonCallable);
} }
} }
...@@ -376,11 +365,9 @@ namespace typed_array { ...@@ -376,11 +365,9 @@ namespace typed_array {
goto IfConstructByLength(lengthObj); goto IfConstructByLength(lengthObj);
} }
} }
} } label IfConstructByLength(length: JSAny) {
label IfConstructByLength(length: JSAny) {
return ConstructByLength(map, length, elementsInfo); return ConstructByLength(map, length, elementsInfo);
} } label IfConstructByArrayLike(
label IfConstructByArrayLike(
arrayLike: JSReceiver, length: uintptr, bufferConstructor: JSReceiver) { arrayLike: JSReceiver, length: uintptr, bufferConstructor: JSReceiver) {
return ConstructByArrayLike( return ConstructByArrayLike(
map, arrayLike, length, elementsInfo, bufferConstructor); map, arrayLike, length, elementsInfo, bufferConstructor);
...@@ -405,8 +392,7 @@ namespace typed_array { ...@@ -405,8 +392,7 @@ namespace typed_array {
assert(!IsDetachedBuffer(typedArray.buffer)); assert(!IsDetachedBuffer(typedArray.buffer));
return typedArray; return typedArray;
} } label IfSlow deferred {
label IfSlow deferred {
const constructor = const constructor =
Cast<Constructor>(SpeciesConstructor(exemplar, defaultConstructor)) Cast<Constructor>(SpeciesConstructor(exemplar, defaultConstructor))
otherwise unreachable; otherwise unreachable;
......
...@@ -42,14 +42,11 @@ namespace typed_array { ...@@ -42,14 +42,11 @@ namespace typed_array {
const callbackfn = Cast<Callable>(arguments[0]) otherwise NotCallable; const callbackfn = Cast<Callable>(arguments[0]) otherwise NotCallable;
const thisArg = arguments[1]; const thisArg = arguments[1];
return EveryAllElements(uarray, callbackfn, thisArg); return EveryAllElements(uarray, callbackfn, thisArg);
} } label NotCallable deferred {
label NotCallable deferred {
ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]); ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]);
} } label NotTypedArray deferred {
label NotTypedArray deferred {
ThrowTypeError(MessageTemplate::kNotTypedArray, kBuiltinNameEvery); ThrowTypeError(MessageTemplate::kNotTypedArray, kBuiltinNameEvery);
} } label IsDetached deferred {
label IsDetached deferred {
ThrowTypeError(MessageTemplate::kDetachedOperation, kBuiltinNameEvery); ThrowTypeError(MessageTemplate::kDetachedOperation, kBuiltinNameEvery);
} }
} }
......
...@@ -79,8 +79,7 @@ namespace typed_array { ...@@ -79,8 +79,7 @@ namespace typed_array {
// 13. Return A. // 13. Return A.
return typedArray; return typedArray;
} } label IsDetached deferred {
label IsDetached deferred {
ThrowTypeError(MessageTemplate::kDetachedOperation, kBuiltinNameFilter); ThrowTypeError(MessageTemplate::kDetachedOperation, kBuiltinNameFilter);
} }
} }
......
...@@ -42,14 +42,11 @@ namespace typed_array { ...@@ -42,14 +42,11 @@ namespace typed_array {
const callbackfn = Cast<Callable>(arguments[0]) otherwise NotCallable; const callbackfn = Cast<Callable>(arguments[0]) otherwise NotCallable;
const thisArg = arguments[1]; const thisArg = arguments[1];
return FindAllElements(uarray, callbackfn, thisArg); return FindAllElements(uarray, callbackfn, thisArg);
} } label NotCallable deferred {
label NotCallable deferred {
ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]); ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]);
} } label NotTypedArray deferred {
label NotTypedArray deferred {
ThrowTypeError(MessageTemplate::kNotTypedArray, kBuiltinNameFind); ThrowTypeError(MessageTemplate::kNotTypedArray, kBuiltinNameFind);
} } label IsDetached deferred {
label IsDetached deferred {
ThrowTypeError(MessageTemplate::kDetachedOperation, kBuiltinNameFind); ThrowTypeError(MessageTemplate::kDetachedOperation, kBuiltinNameFind);
} }
} }
......
...@@ -45,14 +45,11 @@ namespace typed_array { ...@@ -45,14 +45,11 @@ namespace typed_array {
const callbackfn = Cast<Callable>(arguments[0]) otherwise NotCallable; const callbackfn = Cast<Callable>(arguments[0]) otherwise NotCallable;
const thisArg = arguments[1]; const thisArg = arguments[1];
return FindIndexAllElements(uarray, callbackfn, thisArg); return FindIndexAllElements(uarray, callbackfn, thisArg);
} } label NotCallable deferred {
label NotCallable deferred {
ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]); ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]);
} } label NotTypedArray deferred {
label NotTypedArray deferred {
ThrowTypeError(MessageTemplate::kNotTypedArray, kBuiltinNameFindIndex); ThrowTypeError(MessageTemplate::kNotTypedArray, kBuiltinNameFindIndex);
} } label IsDetached deferred {
label IsDetached deferred {
ThrowTypeError( ThrowTypeError(
MessageTemplate::kDetachedOperation, kBuiltinNameFindIndex); MessageTemplate::kDetachedOperation, kBuiltinNameFindIndex);
} }
......
...@@ -42,14 +42,11 @@ namespace typed_array { ...@@ -42,14 +42,11 @@ namespace typed_array {
const callbackfn = Cast<Callable>(arguments[0]) otherwise NotCallable; const callbackfn = Cast<Callable>(arguments[0]) otherwise NotCallable;
const thisArg = arguments[1]; const thisArg = arguments[1];
return ForEachAllElements(uarray, callbackfn, thisArg); return ForEachAllElements(uarray, callbackfn, thisArg);
} } label NotCallable deferred {
label NotCallable deferred {
ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]); ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]);
} } label NotTypedArray deferred {
label NotTypedArray deferred {
ThrowTypeError(MessageTemplate::kNotTypedArray, kBuiltinNameForEach); ThrowTypeError(MessageTemplate::kNotTypedArray, kBuiltinNameForEach);
} } label IsDetached deferred {
label IsDetached deferred {
ThrowTypeError(MessageTemplate::kDetachedOperation, kBuiltinNameForEach); ThrowTypeError(MessageTemplate::kDetachedOperation, kBuiltinNameForEach);
} }
} }
......
...@@ -98,8 +98,7 @@ namespace typed_array { ...@@ -98,8 +98,7 @@ namespace typed_array {
// in TypedArrayCopyElements // in TypedArrayCopyElements
finalLength = sourceTypedArray.length; finalLength = sourceTypedArray.length;
finalSource = source; finalSource = source;
} } label UseUserProvidedIterator {
label UseUserProvidedIterator {
// 6. If usingIterator is not undefined, then // 6. If usingIterator is not undefined, then
// a. Let values be ? IterableToList(source, usingIterator). // a. Let values be ? IterableToList(source, usingIterator).
// b. Let len be the number of elements in values. // b. Let len be the number of elements in values.
...@@ -108,8 +107,7 @@ namespace typed_array { ...@@ -108,8 +107,7 @@ namespace typed_array {
finalLength = Convert<uintptr>(values.length); finalLength = Convert<uintptr>(values.length);
finalSource = values; finalSource = values;
} }
} } label IteratorIsUndefined {
label IteratorIsUndefined {
// 7. NOTE: source is not an Iterable so assume it is already an // 7. NOTE: source is not an Iterable so assume it is already an
// array-like object. // array-like object.
...@@ -123,12 +121,10 @@ namespace typed_array { ...@@ -123,12 +121,10 @@ namespace typed_array {
finalLength = ChangeSafeIntegerNumberToUintPtr(length) finalLength = ChangeSafeIntegerNumberToUintPtr(length)
otherwise IfInvalidLength; otherwise IfInvalidLength;
finalSource = arrayLike; finalSource = arrayLike;
} } label IfInvalidLength deferred {
label IfInvalidLength deferred {
ThrowRangeError(MessageTemplate::kInvalidTypedArrayLength, length); ThrowRangeError(MessageTemplate::kInvalidTypedArrayLength, length);
} }
} } label IteratorNotCallable(_value: JSAny) deferred {
label IteratorNotCallable(_value: JSAny) deferred {
ThrowTypeError(MessageTemplate::kIteratorSymbolNonCallable); ThrowTypeError(MessageTemplate::kIteratorSymbolNonCallable);
} }
...@@ -181,11 +177,9 @@ namespace typed_array { ...@@ -181,11 +177,9 @@ namespace typed_array {
// 12f. Set k to k + 1. (done by the loop). // 12f. Set k to k + 1. (done by the loop).
} }
return targetObj; return targetObj;
} } label NotConstructor deferred {
label NotConstructor deferred {
ThrowTypeError(MessageTemplate::kNotConstructor, receiver); ThrowTypeError(MessageTemplate::kNotConstructor, receiver);
} } label IfDetached deferred {
label IfDetached deferred {
ThrowTypeError(MessageTemplate::kDetachedOperation, kBuiltinNameFrom); ThrowTypeError(MessageTemplate::kDetachedOperation, kBuiltinNameFrom);
} }
} }
......
...@@ -45,11 +45,9 @@ namespace typed_array { ...@@ -45,11 +45,9 @@ namespace typed_array {
// 8. Return newObj. // 8. Return newObj.
return newObj; return newObj;
} } label NotConstructor deferred {
label NotConstructor deferred {
ThrowTypeError(MessageTemplate::kNotConstructor, receiver); ThrowTypeError(MessageTemplate::kNotConstructor, receiver);
} } label IfDetached deferred {
label IfDetached deferred {
ThrowTypeError(MessageTemplate::kDetachedOperation, kBuiltinNameOf); ThrowTypeError(MessageTemplate::kDetachedOperation, kBuiltinNameOf);
} }
} }
......
...@@ -55,14 +55,11 @@ namespace typed_array { ...@@ -55,14 +55,11 @@ namespace typed_array {
const callbackfn = Cast<Callable>(arguments[0]) otherwise NotCallable; const callbackfn = Cast<Callable>(arguments[0]) otherwise NotCallable;
const initialValue = arguments.length >= 2 ? arguments[1] : TheHole; const initialValue = arguments.length >= 2 ? arguments[1] : TheHole;
return ReduceAllElements(uarray, callbackfn, initialValue); return ReduceAllElements(uarray, callbackfn, initialValue);
} } label NotCallable deferred {
label NotCallable deferred {
ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]); ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]);
} } label NotTypedArray deferred {
label NotTypedArray deferred {
ThrowTypeError(MessageTemplate::kNotTypedArray, kBuiltinNameReduce); ThrowTypeError(MessageTemplate::kNotTypedArray, kBuiltinNameReduce);
} } label IsDetached deferred {
label IsDetached deferred {
ThrowTypeError(MessageTemplate::kDetachedOperation, kBuiltinNameReduce); ThrowTypeError(MessageTemplate::kDetachedOperation, kBuiltinNameReduce);
} }
} }
......
...@@ -58,14 +58,11 @@ namespace typed_array { ...@@ -58,14 +58,11 @@ namespace typed_array {
const initialValue = arguments.length >= 2 ? arguments[1] : TheHole; const initialValue = arguments.length >= 2 ? arguments[1] : TheHole;
return ReduceRightAllElements(uarray, callbackfn, initialValue); return ReduceRightAllElements(uarray, callbackfn, initialValue);
} } label NotCallable deferred {
label NotCallable deferred {
ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]); ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]);
} } label NotTypedArray deferred {
label NotTypedArray deferred {
ThrowTypeError(MessageTemplate::kNotTypedArray, kBuiltinNameReduceRight); ThrowTypeError(MessageTemplate::kNotTypedArray, kBuiltinNameReduceRight);
} } label IsDetached deferred {
label IsDetached deferred {
ThrowTypeError( ThrowTypeError(
MessageTemplate::kDetachedOperation, kBuiltinNameReduceRight); MessageTemplate::kDetachedOperation, kBuiltinNameReduceRight);
} }
......
...@@ -42,8 +42,7 @@ namespace typed_array { ...@@ -42,8 +42,7 @@ namespace typed_array {
// 3. Perform ? RequireInternalSlot(target, [[TypedArrayName]]). // 3. Perform ? RequireInternalSlot(target, [[TypedArrayName]]).
// 4. Assert: target has a [[ViewedArrayBuffer]] internal slot. // 4. Assert: target has a [[ViewedArrayBuffer]] internal slot.
target = Cast<JSTypedArray>(receiver) otherwise NotTypedArray; target = Cast<JSTypedArray>(receiver) otherwise NotTypedArray;
} } label NotTypedArray deferred {
label NotTypedArray deferred {
ThrowTypeError(MessageTemplate::kNotTypedArray, kBuiltinNameSet); ThrowTypeError(MessageTemplate::kNotTypedArray, kBuiltinNameSet);
} }
...@@ -61,8 +60,7 @@ namespace typed_array { ...@@ -61,8 +60,7 @@ namespace typed_array {
// On UintPtr or SafeInteger range overflow throw RangeError after // On UintPtr or SafeInteger range overflow throw RangeError after
// performing observable steps to follow the spec. // performing observable steps to follow the spec.
OffsetOverflow, OffsetOverflow; OffsetOverflow, OffsetOverflow;
} } label OffsetOverflow {
label OffsetOverflow {
targetOffsetOverflowed = true; targetOffsetOverflowed = true;
} }
} else { } else {
...@@ -95,18 +93,15 @@ namespace typed_array { ...@@ -95,18 +93,15 @@ namespace typed_array {
utarget, utypedArray, targetOffset, targetOffsetOverflowed) utarget, utypedArray, targetOffset, targetOffsetOverflowed)
otherwise OffsetOutOfBounds; otherwise OffsetOutOfBounds;
return Undefined; return Undefined;
} } label NotTypedArray deferred {
label NotTypedArray deferred {
TypedArrayPrototypeSetArray( TypedArrayPrototypeSetArray(
utarget, overloadedArg, targetOffset, targetOffsetOverflowed) utarget, overloadedArg, targetOffset, targetOffsetOverflowed)
otherwise OffsetOutOfBounds, IsDetached; otherwise OffsetOutOfBounds, IsDetached;
return Undefined; return Undefined;
} }
} } label OffsetOutOfBounds deferred {
label OffsetOutOfBounds deferred {
ThrowRangeError(MessageTemplate::kTypedArraySetOffsetOutOfBounds); ThrowRangeError(MessageTemplate::kTypedArraySetOffsetOutOfBounds);
} } label IsDetached deferred {
label IsDetached deferred {
ThrowTypeError(MessageTemplate::kDetachedOperation, kBuiltinNameSet); ThrowTypeError(MessageTemplate::kDetachedOperation, kBuiltinNameSet);
} }
} }
...@@ -128,8 +123,7 @@ namespace typed_array { ...@@ -128,8 +123,7 @@ namespace typed_array {
// ignoring the call, so that users know they did something wrong. // ignoring the call, so that users know they did something wrong.
// (Consistent with Firefox and Blink/WebKit) // (Consistent with Firefox and Blink/WebKit)
ThrowTypeError(MessageTemplate::kInvalidArgument); ThrowTypeError(MessageTemplate::kInvalidArgument);
} } label NotNumber {
label NotNumber {
// Proceed to step 14. // Proceed to step 14.
} }
...@@ -187,8 +181,7 @@ namespace typed_array { ...@@ -187,8 +181,7 @@ namespace typed_array {
} else { } else {
goto IfSlow; goto IfSlow;
} }
} } label IfSlow deferred {
label IfSlow deferred {
TypedArraySet( TypedArraySet(
context, target, src, srcLengthNum, Convert<Number>(targetOffset)); context, target, src, srcLengthNum, Convert<Number>(targetOffset));
} }
...@@ -290,8 +283,7 @@ namespace typed_array { ...@@ -290,8 +283,7 @@ namespace typed_array {
// iii. Set srcByteIndex to srcByteIndex + 1. // iii. Set srcByteIndex to srcByteIndex + 1.
// iv. Set targetByteIndex to targetByteIndex + 1. // iv. Set targetByteIndex to targetByteIndex + 1.
CallCMemmove(dstPtr, typedArray.data_ptr, countBytes); CallCMemmove(dstPtr, typedArray.data_ptr, countBytes);
} } label IfSlow deferred {
label IfSlow deferred {
// 22. If target.[[ContentType]] is not equal to // 22. If target.[[ContentType]] is not equal to
// typedArray.[[ContentType]], throw a TypeError exception. // typedArray.[[ContentType]], throw a TypeError exception.
if (IsBigInt64ElementsKind(srcKind) != if (IsBigInt64ElementsKind(srcKind) !=
......
...@@ -92,11 +92,9 @@ namespace typed_array { ...@@ -92,11 +92,9 @@ namespace typed_array {
const srcAttached = typed_array::EnsureAttached(src) const srcAttached = typed_array::EnsureAttached(src)
otherwise IfDetached; otherwise IfDetached;
FastCopy(srcAttached, dest, k, count) otherwise IfSlow; FastCopy(srcAttached, dest, k, count) otherwise IfSlow;
} } label IfDetached deferred {
label IfDetached deferred {
ThrowTypeError(MessageTemplate::kDetachedOperation, kBuiltinNameSlice); ThrowTypeError(MessageTemplate::kDetachedOperation, kBuiltinNameSlice);
} } label IfSlow deferred {
label IfSlow deferred {
SlowCopy(src, dest, k, final); SlowCopy(src, dest, k, final);
} }
} }
......
...@@ -42,14 +42,11 @@ namespace typed_array { ...@@ -42,14 +42,11 @@ namespace typed_array {
const callbackfn = Cast<Callable>(arguments[0]) otherwise NotCallable; const callbackfn = Cast<Callable>(arguments[0]) otherwise NotCallable;
const thisArg = arguments[1]; const thisArg = arguments[1];
return SomeAllElements(uarray, callbackfn, thisArg); return SomeAllElements(uarray, callbackfn, thisArg);
} } label NotCallable deferred {
label NotCallable deferred {
ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]); ThrowTypeError(MessageTemplate::kCalledNonCallable, arguments[0]);
} } label NotTypedArray deferred {
label NotTypedArray deferred {
ThrowTypeError(MessageTemplate::kNotTypedArray, kBuiltinNameSome); ThrowTypeError(MessageTemplate::kNotTypedArray, kBuiltinNameSome);
} } label IsDetached deferred {
label IsDetached deferred {
ThrowTypeError(MessageTemplate::kDetachedOperation, kBuiltinNameSome); ThrowTypeError(MessageTemplate::kDetachedOperation, kBuiltinNameSome);
} }
} }
......
...@@ -265,8 +265,7 @@ namespace typed_array { ...@@ -265,8 +265,7 @@ namespace typed_array {
StoreJSTypedArrayElementFromTagged( StoreJSTypedArrayElementFromTagged(
context, typedArray, index, value, KindForArrayType<T>()) context, typedArray, index, value, KindForArrayType<T>())
otherwise IfDetached; otherwise IfDetached;
} } label IfDetached {
label IfDetached {
return kStoreFailureArrayDetached; return kStoreFailureArrayDetached;
} }
return kStoreSucceded; return kStoreSucceded;
......
...@@ -63,17 +63,14 @@ namespace wasm { ...@@ -63,17 +63,14 @@ namespace wasm {
TaggedToHeapObject<HeapObject>(entry) otherwise ReturnEntry; TaggedToHeapObject<HeapObject>(entry) otherwise ReturnEntry;
if (IsTuple2Map(entryObject.map)) goto CallRuntime; if (IsTuple2Map(entryObject.map)) goto CallRuntime;
goto ReturnEntry; goto ReturnEntry;
} } label ReturnEntry {
label ReturnEntry {
return entry; return entry;
} }
} } label CallRuntime deferred {
label CallRuntime deferred {
tail runtime::WasmFunctionTableGet( tail runtime::WasmFunctionTableGet(
LoadContextFromInstance(instance), instance, LoadContextFromInstance(instance), instance,
SmiFromIntPtr(tableIndex), SmiFromIntPtr(entryIndex)); SmiFromIntPtr(tableIndex), SmiFromIntPtr(entryIndex));
} } label IndexOutOfRange deferred {
label IndexOutOfRange deferred {
tail runtime::ThrowWasmError( tail runtime::ThrowWasmError(
LoadContextFromInstance(instance), LoadContextFromInstance(instance),
SmiConstant(MessageTemplate::kWasmTrapTableOutOfBounds)); SmiConstant(MessageTemplate::kWasmTrapTableOutOfBounds));
...@@ -103,13 +100,11 @@ namespace wasm { ...@@ -103,13 +100,11 @@ namespace wasm {
const entries: FixedArray = table.entries; const entries: FixedArray = table.entries;
StoreFixedArrayElement(entries, entryIndex, value); StoreFixedArrayElement(entries, entryIndex, value);
return Undefined; return Undefined;
} } label CallRuntime deferred {
label CallRuntime deferred {
tail runtime::WasmFunctionTableSet( tail runtime::WasmFunctionTableSet(
LoadContextFromInstance(instance), instance, LoadContextFromInstance(instance), instance,
SmiFromIntPtr(tableIndex), SmiFromIntPtr(entryIndex), value); SmiFromIntPtr(tableIndex), SmiFromIntPtr(entryIndex), value);
} } label IndexOutOfRange deferred {
label IndexOutOfRange deferred {
tail runtime::ThrowWasmError( tail runtime::ThrowWasmError(
LoadContextFromInstance(instance), LoadContextFromInstance(instance),
SmiConstant(MessageTemplate::kWasmTrapTableOutOfBounds)); SmiConstant(MessageTemplate::kWasmTrapTableOutOfBounds));
...@@ -125,8 +120,7 @@ namespace wasm { ...@@ -125,8 +120,7 @@ namespace wasm {
const result: Object = LoadFixedArrayElement(table, functionIndex); const result: Object = LoadFixedArrayElement(table, functionIndex);
if (result == Undefined) goto CallRuntime; if (result == Undefined) goto CallRuntime;
return result; return result;
} } label CallRuntime deferred {
label CallRuntime deferred {
tail runtime::WasmRefFunc( tail runtime::WasmRefFunc(
LoadContextFromInstance(instance), instance, SmiFromUint32(index)); LoadContextFromInstance(instance), instance, SmiFromUint32(index));
} }
......
...@@ -176,8 +176,7 @@ struct FastJSArrayWitness { ...@@ -176,8 +176,7 @@ struct FastJSArrayWitness {
macro LoadElementOrUndefined(implicit context: Context)(k: Smi): JSAny { macro LoadElementOrUndefined(implicit context: Context)(k: Smi): JSAny {
try { try {
return this.LoadElementNoHole(k) otherwise FoundHole; return this.LoadElementNoHole(k) otherwise FoundHole;
} } label FoundHole {
label FoundHole {
return Undefined; return Undefined;
} }
} }
......
...@@ -79,8 +79,7 @@ macro GetDerivedMap(implicit context: Context)( ...@@ -79,8 +79,7 @@ macro GetDerivedMap(implicit context: Context)(
} }
return map; return map;
} } label SlowPath {
label SlowPath {
return runtime::GetDerivedMap(context, target, newTarget); return runtime::GetDerivedMap(context, target, newTarget);
} }
} }
......
...@@ -68,8 +68,7 @@ namespace test { ...@@ -68,8 +68,7 @@ namespace test {
macro TestGotoLabel(): Boolean { macro TestGotoLabel(): Boolean {
try { try {
LabelTestHelper1() otherwise Label1; LabelTestHelper1() otherwise Label1;
} } label Label1 {
label Label1 {
return True; return True;
} }
} }
...@@ -78,8 +77,7 @@ namespace test { ...@@ -78,8 +77,7 @@ namespace test {
macro TestGotoLabelWithOneParameter(): Boolean { macro TestGotoLabelWithOneParameter(): Boolean {
try { try {
LabelTestHelper2() otherwise Label2; LabelTestHelper2() otherwise Label2;
} } label Label2(smi: Smi) {
label Label2(smi: Smi) {
check(smi == 42); check(smi == 42);
return True; return True;
} }
...@@ -89,8 +87,7 @@ namespace test { ...@@ -89,8 +87,7 @@ namespace test {
macro TestGotoLabelWithTwoParameters(): Boolean { macro TestGotoLabelWithTwoParameters(): Boolean {
try { try {
LabelTestHelper3() otherwise Label3; LabelTestHelper3() otherwise Label3;
} } label Label3(o: Oddball, smi: Smi) {
label Label3(o: Oddball, smi: Smi) {
check(o == Null); check(o == Null);
check(smi == 7); check(smi == 7);
return True; return True;
...@@ -125,11 +122,9 @@ namespace test { ...@@ -125,11 +122,9 @@ namespace test {
macro CallLabelTestHelper4(flag: constexpr bool): bool { macro CallLabelTestHelper4(flag: constexpr bool): bool {
try { try {
LabelTestHelper4(flag) otherwise Label4, Label5; LabelTestHelper4(flag) otherwise Label4, Label5;
} } label Label4 {
label Label4 {
return true; return true;
} } label Label5 {
label Label5 {
return false; return false;
} }
} }
...@@ -177,10 +172,8 @@ namespace test { ...@@ -177,10 +172,8 @@ namespace test {
check((GenericMacroTestWithLabels<Smi>(0) otherwise Fail) == Undefined); check((GenericMacroTestWithLabels<Smi>(0) otherwise Fail) == Undefined);
try { try {
GenericMacroTestWithLabels<Object>(False) otherwise Expected; GenericMacroTestWithLabels<Object>(False) otherwise Expected;
} } label Expected {}
label Expected {} } label Fail {
}
label Fail {
unreachable; unreachable;
} }
} }
...@@ -357,8 +350,7 @@ namespace test { ...@@ -357,8 +350,7 @@ namespace test {
macro CallTestStructInLabel(implicit context: Context)() { macro CallTestStructInLabel(implicit context: Context)() {
try { try {
TestStructInLabel() otherwise Foo; TestStructInLabel() otherwise Foo;
} } label Foo(_s: TestStructA) {}
label Foo(_s: TestStructA) {}
} }
// This macro tests different versions of the for-loop where some parts // This macro tests different versions of the for-loop where some parts
...@@ -452,8 +444,7 @@ namespace test { ...@@ -452,8 +444,7 @@ namespace test {
for (;;) { for (;;) {
if (++j == 10) goto Exit; if (++j == 10) goto Exit;
} }
} } label Exit {
label Exit {
check(j == 10); check(j == 10);
} }
...@@ -598,8 +589,7 @@ namespace test { ...@@ -598,8 +589,7 @@ namespace test {
let s: Smi = 1; let s: Smi = 1;
try { try {
TestCall(10) otherwise goto B(++s); TestCall(10) otherwise goto B(++s);
} } label B(v1: Smi) {
label B(v1: Smi) {
v = v1; v = v1;
} }
assert(v == 2); assert(v == 2);
...@@ -628,11 +618,9 @@ namespace test { ...@@ -628,11 +618,9 @@ namespace test {
macro TestForwardLabel() { macro TestForwardLabel() {
try { try {
goto A; goto A;
} } label A {
label A {
goto B(5); goto B(5);
} } label B(b: Smi) {
label B(b: Smi) {
assert(b == 5); assert(b == 5);
} }
} }
...@@ -684,8 +672,7 @@ namespace test { ...@@ -684,8 +672,7 @@ namespace test {
} catch (_e) { } catch (_e) {
r = 2; r = 2;
return r; return r;
} } label Abort {
label Abort {
return -1; return -1;
} }
} }
...@@ -709,8 +696,7 @@ namespace test { ...@@ -709,8 +696,7 @@ namespace test {
const _t7: JSArray = iterator::IterableToList(t1, t1); const _t7: JSArray = iterator::IterableToList(t1, t1);
iterator::IteratorCloseOnException(t2, t5); iterator::IteratorCloseOnException(t2, t5);
} } label Fail {}
label Fail {}
} }
@export @export
......
...@@ -116,8 +116,7 @@ namespace array { ...@@ -116,8 +116,7 @@ namespace array {
if (clampedReceiverLength > kSmiMaxValue) { if (clampedReceiverLength > kSmiMaxValue) {
clampedReceiverLength = kSmiMaxValue; clampedReceiverLength = kSmiMaxValue;
} }
} } label UIntPtrOverflow {
label UIntPtrOverflow {
clampedReceiverLength = kSmiMaxValue; clampedReceiverLength = kSmiMaxValue;
} }
...@@ -132,8 +131,7 @@ namespace array { ...@@ -132,8 +131,7 @@ namespace array {
if (elementsLength != 0) { if (elementsLength != 0) {
workArrayLength = IntPtrMin(workArrayLength, elementsLength); workArrayLength = IntPtrMin(workArrayLength, elementsLength);
} }
} } label NoJsObject {}
label NoJsObject {}
return workArrayLength; return workArrayLength;
} }
...@@ -172,8 +170,7 @@ namespace array { ...@@ -172,8 +170,7 @@ namespace array {
deleteFn = Delete<FastObjectElements>; deleteFn = Delete<FastObjectElements>;
canUseSameAccessorFn = CanUseSameAccessor<FastObjectElements>; canUseSameAccessorFn = CanUseSameAccessor<FastObjectElements>;
} }
} } label Slow {
label Slow {
loadFn = Load<GenericElementsAccessor>; loadFn = Load<GenericElementsAccessor>;
storeFn = Store<GenericElementsAccessor>; storeFn = Store<GenericElementsAccessor>;
deleteFn = Delete<GenericElementsAccessor>; deleteFn = Delete<GenericElementsAccessor>;
...@@ -261,8 +258,7 @@ namespace array { ...@@ -261,8 +258,7 @@ namespace array {
const elements = UnsafeCast<FixedDoubleArray>(object.elements); const elements = UnsafeCast<FixedDoubleArray>(object.elements);
const value = elements.floats[index].Value() otherwise IfHole; const value = elements.floats[index].Value() otherwise IfHole;
return AllocateHeapNumberWithValue(value); return AllocateHeapNumberWithValue(value);
} } label IfHole {
label IfHole {
return TheHole; return TheHole;
} }
} }
...@@ -1009,13 +1005,11 @@ namespace array { ...@@ -1009,13 +1005,11 @@ namespace array {
++minGallop; // Penalize it for leaving galloping mode ++minGallop; // Penalize it for leaving galloping mode
sortState.minGallop = minGallop; sortState.minGallop = minGallop;
} }
} } label Succeed {
label Succeed {
if (lengthA > 0) { if (lengthA > 0) {
Copy(tempArray, cursorTemp, workArray, dest, lengthA); Copy(tempArray, cursorTemp, workArray, dest, lengthA);
} }
} } label CopyB {
label CopyB {
assert(lengthA == 1 && lengthB > 0); assert(lengthA == 1 && lengthB > 0);
// The last element of run A belongs at the end of the merge. // The last element of run A belongs at the end of the merge.
Copy(workArray, cursorB, workArray, dest, lengthB); Copy(workArray, cursorB, workArray, dest, lengthB);
...@@ -1147,14 +1141,12 @@ namespace array { ...@@ -1147,14 +1141,12 @@ namespace array {
++minGallop; ++minGallop;
sortState.minGallop = minGallop; sortState.minGallop = minGallop;
} }
} } label Succeed {
label Succeed {
if (lengthB > 0) { if (lengthB > 0) {
assert(lengthA == 0); assert(lengthA == 0);
Copy(tempArray, 0, workArray, dest - (lengthB - 1), lengthB); Copy(tempArray, 0, workArray, dest - (lengthB - 1), lengthB);
} }
} } label CopyA {
label CopyA {
assert(lengthB == 1 && lengthA > 0); assert(lengthB == 1 && lengthA > 0);
// The first element of run B belongs at the front of the merge. // The first element of run B belongs at the front of the merge.
...@@ -1377,8 +1369,7 @@ namespace array { ...@@ -1377,8 +1369,7 @@ namespace array {
// The comparison function or toString might have changed the // The comparison function or toString might have changed the
// receiver, if that is the case, we switch to the slow path. // receiver, if that is the case, we switch to the slow path.
sortState.CheckAccessor() otherwise Slow; sortState.CheckAccessor() otherwise Slow;
} } label Slow deferred {
label Slow deferred {
sortState.ResetToGenericAccessor(); sortState.ResetToGenericAccessor();
} }
......
...@@ -73,6 +73,7 @@ def postprocess(output): ...@@ -73,6 +73,7 @@ def postprocess(output):
r"@export", output) r"@export", output)
output = re.sub(r'jS_iMpLiCiT_', output = re.sub(r'jS_iMpLiCiT_',
r"js-implicit ", output) r"js-implicit ", output)
output = re.sub(r'}\n *label ', r'} label ', output);
output = re.sub(kPercentEscape, r'%', output) output = re.sub(kPercentEscape, r'%', output)
......
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