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