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

[torque] fix formatting of union types

The Torque formatter script did a hack to put spaces arount the | of
union types. This was broken when the inserted comment ended up on the
end of a line. For this reason, and since it doesn't make sense to
fight the Google-wide TypeScript style for union types, this CL reverts
to not putting spaces around union types.

Bug: v8:7793
Change-Id: Ic0acf9e1da82540432a8e21b58497a6a7d523b9c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1871604
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: 's avatarJoshua Litt <joshualitt@chromium.org>
Reviewed-by: 's avatarMichael Stanton <mvstanton@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64536}
parent 38da4d19
...@@ -67,7 +67,7 @@ namespace array { ...@@ -67,7 +67,7 @@ namespace array {
transitioning builtin ArrayReduceRightLoopContinuation(implicit context: transitioning builtin ArrayReduceRightLoopContinuation(implicit context:
Context)( Context)(
_receiver: JSReceiver, callbackfn: Callable, _receiver: JSReceiver, callbackfn: Callable,
initialAccumulator: JSAny | TheHole, o: JSReceiver, initialK: Number, initialAccumulator: JSAny|TheHole, o: JSReceiver, initialK: Number,
_length: Number): JSAny { _length: Number): JSAny {
let accumulator = initialAccumulator; let accumulator = initialAccumulator;
...@@ -118,8 +118,8 @@ namespace array { ...@@ -118,8 +118,8 @@ namespace array {
transitioning macro FastArrayReduceRight(implicit context: Context)( transitioning macro FastArrayReduceRight(implicit context: Context)(
o: JSReceiver, len: Number, callbackfn: Callable, o: JSReceiver, len: Number, callbackfn: Callable,
initialAccumulator: JSAny | TheHole): JSAny initialAccumulator: JSAny|TheHole): JSAny
labels Bailout(Number, JSAny | TheHole) { labels Bailout(Number, JSAny|TheHole) {
let accumulator = initialAccumulator; let accumulator = initialAccumulator;
const smiLen = Cast<Smi>(len) otherwise goto Bailout(len - 1, accumulator); const smiLen = Cast<Smi>(len) otherwise goto Bailout(len - 1, accumulator);
const fastO = Cast<FastJSArrayForRead>(o) const fastO = Cast<FastJSArrayForRead>(o)
...@@ -178,14 +178,14 @@ namespace array { ...@@ -178,14 +178,14 @@ namespace array {
// exception. (This case is handled at the end of // exception. (This case is handled at the end of
// ArrayReduceRightLoopContinuation). // ArrayReduceRightLoopContinuation).
const initialValue: JSAny | TheHole = const initialValue: JSAny|TheHole =
arguments.length > 1 ? arguments[1] : TheHole; arguments.length > 1 ? arguments[1] : TheHole;
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);
} }
......
...@@ -66,7 +66,7 @@ namespace array { ...@@ -66,7 +66,7 @@ namespace array {
transitioning builtin ArrayReduceLoopContinuation(implicit context: Context)( transitioning builtin ArrayReduceLoopContinuation(implicit context: Context)(
_receiver: JSReceiver, callbackfn: Callable, _receiver: JSReceiver, callbackfn: Callable,
initialAccumulator: JSAny | TheHole, o: JSReceiver, initialK: Number, initialAccumulator: JSAny|TheHole, o: JSReceiver, initialK: Number,
length: Number): JSAny { length: Number): JSAny {
let accumulator = initialAccumulator; let accumulator = initialAccumulator;
...@@ -117,8 +117,8 @@ namespace array { ...@@ -117,8 +117,8 @@ namespace array {
transitioning macro FastArrayReduce(implicit context: Context)( transitioning macro FastArrayReduce(implicit context: Context)(
o: JSReceiver, len: Number, callbackfn: Callable, o: JSReceiver, len: Number, callbackfn: Callable,
initialAccumulator: JSAny | TheHole): JSAny initialAccumulator: JSAny|TheHole): JSAny
labels Bailout(Number, JSAny | TheHole) { labels Bailout(Number, JSAny|TheHole) {
const k = 0; const k = 0;
let accumulator = initialAccumulator; let accumulator = initialAccumulator;
Cast<Smi>(len) otherwise goto Bailout(k, accumulator); Cast<Smi>(len) otherwise goto Bailout(k, accumulator);
...@@ -178,14 +178,14 @@ namespace array { ...@@ -178,14 +178,14 @@ namespace array {
// exception. (This case is handled at the end of // exception. (This case is handled at the end of
// ArrayReduceLoopContinuation). // ArrayReduceLoopContinuation).
const initialValue: JSAny | TheHole = const initialValue: JSAny|TheHole =
arguments.length > 1 ? arguments[1] : TheHole; arguments.length > 1 ? arguments[1] : TheHole;
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);
} }
......
This diff is collapsed.
...@@ -33,8 +33,8 @@ type FrameBase extends RawPtr constexpr 'void*'; ...@@ -33,8 +33,8 @@ type FrameBase extends RawPtr constexpr 'void*';
type StandardFrame extends FrameBase constexpr 'void*'; type StandardFrame extends FrameBase constexpr 'void*';
type ArgumentsAdaptorFrame extends FrameBase constexpr 'void*'; type ArgumentsAdaptorFrame extends FrameBase constexpr 'void*';
type StubFrame extends FrameBase constexpr 'void*'; type StubFrame extends FrameBase constexpr 'void*';
type FrameWithArguments = StandardFrame | ArgumentsAdaptorFrame; type FrameWithArguments = StandardFrame|ArgumentsAdaptorFrame;
type Frame = FrameWithArguments | StubFrame; type Frame = FrameWithArguments|StubFrame;
extern macro LoadFramePointer(): Frame; extern macro LoadFramePointer(): Frame;
extern macro LoadParentFramePointer(): Frame; extern macro LoadParentFramePointer(): Frame;
...@@ -67,7 +67,7 @@ operator '.caller' macro LoadCallerFromFrame(f: Frame): Frame { ...@@ -67,7 +67,7 @@ operator '.caller' macro LoadCallerFromFrame(f: Frame): Frame {
return %RawDownCast<Frame>(result); return %RawDownCast<Frame>(result);
} }
type ContextOrFrameType = Context | FrameType; type ContextOrFrameType = Context|FrameType;
Cast<ContextOrFrameType>(implicit context: Context)(o: Object): Cast<ContextOrFrameType>(implicit context: Context)(o: Object):
ContextOrFrameType ContextOrFrameType
labels CastError { labels CastError {
......
...@@ -48,7 +48,7 @@ namespace iterator { ...@@ -48,7 +48,7 @@ namespace iterator {
transitioning builtin GetIteratorWithFeedback( transitioning builtin GetIteratorWithFeedback(
context: Context, receiver: JSAny, loadSlot: Smi, callSlot: Smi, context: Context, receiver: JSAny, loadSlot: Smi, callSlot: Smi,
feedback: Undefined | FeedbackVector): JSAny { feedback: Undefined|FeedbackVector): JSAny {
let iteratorMethod: JSAny; let iteratorMethod: JSAny;
typeswitch (feedback) { typeswitch (feedback) {
case (Undefined): { case (Undefined): {
...@@ -65,7 +65,7 @@ namespace iterator { ...@@ -65,7 +65,7 @@ namespace iterator {
transitioning builtin CallIteratorWithFeedback( transitioning builtin CallIteratorWithFeedback(
context: Context, receiver: JSAny, iteratorMethod: JSAny, callSlot: Smi, context: Context, receiver: JSAny, iteratorMethod: JSAny, callSlot: Smi,
feedback: Undefined | FeedbackVector): JSAny { feedback: Undefined|FeedbackVector): JSAny {
const callSlotUnTagged: uintptr = Unsigned(SmiUntag(callSlot)); const callSlotUnTagged: uintptr = Unsigned(SmiUntag(callSlot));
CollectCallFeedback(iteratorMethod, context, feedback, callSlotUnTagged); CollectCallFeedback(iteratorMethod, context, feedback, callSlotUnTagged);
const iteratorCallable: Callable = Cast<Callable>(iteratorMethod) const iteratorCallable: Callable = Cast<Callable>(iteratorMethod)
......
...@@ -72,7 +72,7 @@ namespace object { ...@@ -72,7 +72,7 @@ namespace object {
transitioning macro transitioning macro
ObjectSetPrototypeOfThrow(implicit context: Context)( ObjectSetPrototypeOfThrow(implicit context: Context)(
object: JSAny, proto: JSReceiver | Null): JSAny { object: JSAny, proto: JSReceiver|Null): JSAny {
const objectJSReceiver = Cast<JSReceiver>(object) otherwise return object; const objectJSReceiver = Cast<JSReceiver>(object) otherwise return object;
const objectJSProxy = Cast<JSProxy>(objectJSReceiver) const objectJSProxy = Cast<JSProxy>(objectJSReceiver)
otherwise return runtime::JSReceiverSetPrototypeOfThrow( otherwise return runtime::JSReceiverSetPrototypeOfThrow(
...@@ -83,7 +83,7 @@ namespace object { ...@@ -83,7 +83,7 @@ namespace object {
transitioning macro transitioning macro
ObjectSetPrototypeOfDontThrow(implicit context: Context)( ObjectSetPrototypeOfDontThrow(implicit context: Context)(
object: JSAny, proto: JSReceiver | Null): JSAny { object: JSAny, proto: JSReceiver|Null): JSAny {
const objectJSReceiver = Cast<JSReceiver>(object) otherwise return False; const objectJSReceiver = Cast<JSReceiver>(object) otherwise return False;
const objectJSProxy = Cast<JSProxy>(objectJSReceiver) const objectJSProxy = Cast<JSProxy>(objectJSReceiver)
otherwise return runtime::JSReceiverSetPrototypeOfDontThrow( otherwise return runtime::JSReceiverSetPrototypeOfDontThrow(
...@@ -122,7 +122,7 @@ namespace object { ...@@ -122,7 +122,7 @@ namespace object {
// 5. If status is false, throw a TypeError exception. // 5. If status is false, throw a TypeError exception.
// 6. Return O. // 6. Return O.
typeswitch (proto) { typeswitch (proto) {
case (proto: JSReceiver | Null): { case (proto: JSReceiver|Null): {
return object::ObjectSetPrototypeOfThrow(object, proto); return object::ObjectSetPrototypeOfThrow(object, proto);
} }
case (JSAny): { case (JSAny): {
......
...@@ -7,8 +7,9 @@ ...@@ -7,8 +7,9 @@
// https://tc39.es/ecma262/#sec-promise-abstract-operations // https://tc39.es/ecma262/#sec-promise-abstract-operations
namespace promise { namespace promise {
extern macro PromiseBuiltinsAssembler::TriggerPromiseReactions( extern macro PromiseBuiltinsAssembler::TriggerPromiseReactions(
implicit context: Context)( implicit context:
Smi | PromiseReaction, JSAny, constexpr PromiseReactionType): void; Context)(Smi|PromiseReaction, JSAny, constexpr PromiseReactionType):
void;
// https://tc39.es/ecma262/#sec-fulfillpromise // https://tc39.es/ecma262/#sec-fulfillpromise
transitioning builtin transitioning builtin
......
...@@ -19,7 +19,7 @@ namespace proxy { ...@@ -19,7 +19,7 @@ namespace proxy {
// https://tc39.github.io/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receiver // https://tc39.github.io/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receiver
transitioning builtin transitioning builtin
ProxySetProperty(implicit context: Context)( ProxySetProperty(implicit context: Context)(
proxy: JSProxy, name: PropertyKey | PrivateSymbol, value: JSAny, proxy: JSProxy, name: PropertyKey|PrivateSymbol, value: JSAny,
receiverValue: JSAny): JSAny { receiverValue: JSAny): JSAny {
// 1. Assert: IsPropertyKey(P) is true. // 1. Assert: IsPropertyKey(P) is true.
assert(TaggedIsNotSmi(name)); assert(TaggedIsNotSmi(name));
......
...@@ -10,7 +10,7 @@ namespace proxy { ...@@ -10,7 +10,7 @@ namespace proxy {
// https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-setprototypeof-v // https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-setprototypeof-v
transitioning builtin transitioning builtin
ProxySetPrototypeOf(implicit context: Context)( ProxySetPrototypeOf(implicit context: Context)(
proxy: JSProxy, proto: Null | JSReceiver, doThrow: Boolean): JSAny { proxy: JSProxy, proto: Null|JSReceiver, doThrow: Boolean): JSAny {
PerformStackCheck(); PerformStackCheck();
const kTrapName: constexpr string = 'setPrototypeOf'; const kTrapName: constexpr string = 'setPrototypeOf';
try { try {
...@@ -63,7 +63,7 @@ namespace proxy { ...@@ -63,7 +63,7 @@ namespace proxy {
} }
ThrowTypeError(kProxySetPrototypeOfNonExtensible); ThrowTypeError(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);
......
...@@ -37,7 +37,7 @@ namespace reflect { ...@@ -37,7 +37,7 @@ namespace reflect {
const objectJSReceiver = Cast<JSReceiver>(object) const objectJSReceiver = Cast<JSReceiver>(object)
otherwise ThrowTypeError(kCalledOnNonObject, 'Reflect.setPrototypeOf'); otherwise ThrowTypeError(kCalledOnNonObject, 'Reflect.setPrototypeOf');
typeswitch (proto) { typeswitch (proto) {
case (proto: JSReceiver | Null): { case (proto: JSReceiver|Null): {
return object::ObjectSetPrototypeOfDontThrow(objectJSReceiver, proto); return object::ObjectSetPrototypeOfDontThrow(objectJSReceiver, proto);
} }
case (JSAny): { case (JSAny): {
......
...@@ -10,7 +10,7 @@ namespace regexp { ...@@ -10,7 +10,7 @@ namespace regexp {
SubString(implicit context: Context)(String, Smi, Smi): String; SubString(implicit context: Context)(String, Smi, Smi): String;
extern runtime RegExpExecMultiple(implicit context: Context)( extern runtime RegExpExecMultiple(implicit context: Context)(
JSRegExp, String, RegExpMatchInfo, JSArray): Null | JSArray; JSRegExp, String, RegExpMatchInfo, JSArray): Null|JSArray;
extern transitioning runtime extern transitioning runtime
RegExpReplaceRT(Context, JSReceiver, String, Object): String; RegExpReplaceRT(Context, JSReceiver, String, Object): String;
extern transitioning runtime extern transitioning runtime
...@@ -86,7 +86,7 @@ namespace regexp { ...@@ -86,7 +86,7 @@ namespace regexp {
const kInitialCapacity: Smi = 16; const kInitialCapacity: Smi = 16;
const kInitialLength: Smi = 0; const kInitialLength: Smi = 0;
const result: Null | JSArray = RegExpExecMultiple( const result: Null|JSArray = RegExpExecMultiple(
regexp, string, GetRegExpLastMatchInfo(), regexp, string, GetRegExpLastMatchInfo(),
AllocateJSArray( AllocateJSArray(
PACKED_ELEMENTS, GetFastPackedElementsJSArrayMap(), PACKED_ELEMENTS, GetFastPackedElementsJSArrayMap(),
......
...@@ -9,7 +9,7 @@ namespace typed_array { ...@@ -9,7 +9,7 @@ namespace typed_array {
transitioning macro ReduceAllElements(implicit context: Context)( transitioning macro ReduceAllElements(implicit context: Context)(
array: typed_array::AttachedJSTypedArray, callbackfn: Callable, array: typed_array::AttachedJSTypedArray, callbackfn: Callable,
initialValue: JSAny | TheHole): JSAny { initialValue: JSAny|TheHole): JSAny {
let witness = typed_array::NewAttachedJSTypedArrayWitness(array); let witness = typed_array::NewAttachedJSTypedArrayWitness(array);
const length: uintptr = witness.Get().length; const length: uintptr = witness.Get().length;
let accumulator = initialValue; let accumulator = initialValue;
......
...@@ -10,7 +10,7 @@ namespace typed_array { ...@@ -10,7 +10,7 @@ namespace typed_array {
transitioning macro ReduceRightAllElements(implicit context: Context)( transitioning macro ReduceRightAllElements(implicit context: Context)(
array: typed_array::AttachedJSTypedArray, callbackfn: Callable, array: typed_array::AttachedJSTypedArray, callbackfn: Callable,
initialValue: JSAny | TheHole): JSAny { initialValue: JSAny|TheHole): JSAny {
let witness = typed_array::NewAttachedJSTypedArrayWitness(array); let witness = typed_array::NewAttachedJSTypedArrayWitness(array);
const length: uintptr = witness.Get().length; const length: uintptr = witness.Get().length;
let accumulator = initialValue; let accumulator = initialValue;
......
...@@ -18,7 +18,7 @@ extern class JSDateTimeFormat extends JSObject { ...@@ -18,7 +18,7 @@ extern class JSDateTimeFormat extends JSObject {
icu_locale: Foreign; // Managed<icu::Locale> icu_locale: Foreign; // Managed<icu::Locale>
icu_simple_date_format: Foreign; // Managed<icu::SimpleDateFormat> icu_simple_date_format: Foreign; // Managed<icu::SimpleDateFormat>
icu_date_interval_format: Foreign; // Managed<icu::DateIntervalFormat> icu_date_interval_format: Foreign; // Managed<icu::DateIntervalFormat>
bound_format: JSFunction | Undefined; bound_format: JSFunction|Undefined;
flags: Smi; flags: Smi;
} }
...@@ -32,7 +32,7 @@ extern class JSNumberFormat extends JSObject { ...@@ -32,7 +32,7 @@ extern class JSNumberFormat extends JSObject {
locale: String; locale: String;
icu_number_formatter: icu_number_formatter:
Foreign; // Managed<icu::number::LocalizedNumberFormatter> Foreign; // Managed<icu::number::LocalizedNumberFormatter>
bound_format: JSFunction | Undefined; bound_format: JSFunction|Undefined;
flags: Smi; flags: Smi;
} }
...@@ -70,15 +70,15 @@ extern class JSV8BreakIterator extends JSObject { ...@@ -70,15 +70,15 @@ extern class JSV8BreakIterator extends JSObject {
locale: String; locale: String;
break_iterator: Foreign; // Managed<icu::BreakIterator>; break_iterator: Foreign; // Managed<icu::BreakIterator>;
unicode_string: Foreign; // Managed<icu::UnicodeString>; unicode_string: Foreign; // Managed<icu::UnicodeString>;
bound_adopt_text: Undefined | JSFunction; bound_adopt_text: Undefined|JSFunction;
bound_first: Undefined | JSFunction; bound_first: Undefined|JSFunction;
bound_next: Undefined | JSFunction; bound_next: Undefined|JSFunction;
bound_current: Undefined | JSFunction; bound_current: Undefined|JSFunction;
bound_break_type: Undefined | JSFunction; bound_break_type: Undefined|JSFunction;
break_iterator_type: Smi; break_iterator_type: Smi;
} }
extern class JSCollator extends JSObject { extern class JSCollator extends JSObject {
icu_collator: Foreign; // Managed<icu::Collator> icu_collator: Foreign; // Managed<icu::Collator>
bound_compare: Undefined | JSFunction; bound_compare: Undefined|JSFunction;
} }
...@@ -465,7 +465,7 @@ namespace test { ...@@ -465,7 +465,7 @@ namespace test {
} }
} }
type NumberOrFixedArray = Number | FixedArray; type NumberOrFixedArray = Number|FixedArray;
macro TypeswitchExample(implicit context: Context)(x: NumberOrFixedArray): macro TypeswitchExample(implicit context: Context)(x: NumberOrFixedArray):
int32 { int32 {
let result: int32 = 0; let result: int32 = 0;
......
...@@ -47,7 +47,7 @@ namespace array { ...@@ -47,7 +47,7 @@ namespace array {
initialReceiverLength: Number; initialReceiverLength: Number;
// If the user provided a comparison function, it is stored here. // If the user provided a comparison function, it is stored here.
userCmpFn: Undefined | Callable; userCmpFn: Undefined|Callable;
// Function pointer to the comparison function. This can either be a builtin // Function pointer to the comparison function. This can either be a builtin
// that calls the user-provided comparison function or "SortDefault", which // that calls the user-provided comparison function or "SortDefault", which
...@@ -132,7 +132,7 @@ namespace array { ...@@ -132,7 +132,7 @@ namespace array {
} }
transitioning macro NewSortState(implicit context: Context)( transitioning macro NewSortState(implicit context: Context)(
receiver: JSReceiver, comparefn: Undefined | Callable, receiver: JSReceiver, comparefn: Undefined|Callable,
initialReceiverLength: Number): SortState { initialReceiverLength: Number): SortState {
const sortComparePtr = const sortComparePtr =
comparefn != Undefined ? SortCompareUserFn : SortCompareDefault; comparefn != Undefined ? SortCompareUserFn : SortCompareDefault;
...@@ -214,7 +214,7 @@ namespace array { ...@@ -214,7 +214,7 @@ namespace array {
// it is first requested, but it has always at least this size. // it is first requested, but it has always at least this size.
const kSortStateTempSize: Smi = 32; const kSortStateTempSize: Smi = 32;
type LoadFn = builtin(Context, SortState, Smi) => (JSAny | TheHole); type LoadFn = builtin(Context, SortState, Smi) => (JSAny|TheHole);
type StoreFn = builtin(Context, SortState, Smi, JSAny) => Smi; type StoreFn = builtin(Context, SortState, Smi, JSAny) => Smi;
type DeleteFn = builtin(Context, SortState, Smi) => Smi; type DeleteFn = builtin(Context, SortState, Smi) => Smi;
type CanUseSameAccessorFn = builtin(Context, JSReceiver, Map, Number) => type CanUseSameAccessorFn = builtin(Context, JSReceiver, Map, Number) =>
...@@ -228,28 +228,28 @@ namespace array { ...@@ -228,28 +228,28 @@ namespace array {
// through a hole. // through a hole.
transitioning builtin Load<ElementsAccessor: type>( transitioning builtin Load<ElementsAccessor: type>(
context: Context, sortState: SortState, index: Smi): JSAny | TheHole { context: Context, sortState: SortState, index: Smi): JSAny|TheHole {
const receiver = sortState.receiver; const receiver = sortState.receiver;
if (!HasProperty_Inline(receiver, index)) return TheHole; if (!HasProperty_Inline(receiver, index)) return TheHole;
return GetProperty(receiver, index); return GetProperty(receiver, index);
} }
Load<FastSmiElements>(context: Context, sortState: SortState, index: Smi): Load<FastSmiElements>(context: Context, sortState: SortState, index: Smi):
JSAny | TheHole { JSAny|TheHole {
const object = UnsafeCast<JSObject>(sortState.receiver); const object = UnsafeCast<JSObject>(sortState.receiver);
const elements = UnsafeCast<FixedArray>(object.elements); const elements = UnsafeCast<FixedArray>(object.elements);
return UnsafeCast<(JSAny | TheHole)>(elements.objects[index]); return UnsafeCast<(JSAny | TheHole)>(elements.objects[index]);
} }
Load<FastObjectElements>(context: Context, sortState: SortState, index: Smi): Load<FastObjectElements>(context: Context, sortState: SortState, index: Smi):
JSAny | TheHole { JSAny|TheHole {
const object = UnsafeCast<JSObject>(sortState.receiver); const object = UnsafeCast<JSObject>(sortState.receiver);
const elements = UnsafeCast<FixedArray>(object.elements); const elements = UnsafeCast<FixedArray>(object.elements);
return UnsafeCast<(JSAny | TheHole)>(elements.objects[index]); return UnsafeCast<(JSAny | TheHole)>(elements.objects[index]);
} }
Load<FastDoubleElements>(context: Context, sortState: SortState, index: Smi): Load<FastDoubleElements>(context: Context, sortState: SortState, index: Smi):
JSAny | TheHole { JSAny|TheHole {
try { try {
const object = UnsafeCast<JSObject>(sortState.receiver); const object = UnsafeCast<JSObject>(sortState.receiver);
const elements = UnsafeCast<FixedDoubleArray>(object.elements); const elements = UnsafeCast<FixedDoubleArray>(object.elements);
...@@ -1306,7 +1306,7 @@ namespace array { ...@@ -1306,7 +1306,7 @@ namespace array {
// are ignored. // are ignored.
let numberOfUndefined: Smi = 0; let numberOfUndefined: Smi = 0;
for (let i: Smi = 0; i < receiverLength; ++i) { for (let i: Smi = 0; i < receiverLength; ++i) {
const element: JSAny | TheHole = loadFn(context, sortState, i); const element: JSAny|TheHole = loadFn(context, sortState, i);
if (element == TheHole) { if (element == TheHole) {
// Do nothing for holes. The result is that elements are // Do nothing for holes. The result is that elements are
......
...@@ -24,14 +24,6 @@ def preprocess(input): ...@@ -24,14 +24,6 @@ def preprocess(input):
input = re.sub(r'\bcase\s*(\([^{]*\))\s*:\s*deferred\s*{', r' if /*cAsEdEfF*/ \1 {', input) input = re.sub(r'\bcase\s*(\([^{]*\))\s*:\s*deferred\s*{', r' if /*cAsEdEfF*/ \1 {', input)
input = re.sub(r'\bcase\s*(\([^{]*\))\s*:\s*{', r' if /*cA*/ \1 {', input) input = re.sub(r'\bcase\s*(\([^{]*\))\s*:\s*{', r' if /*cA*/ \1 {', input)
# Add extra space around | operators to fix union types later.
while True:
old = input
input = re.sub(r'(\w+\s*)\|(\s*\w+)',
r'\1|/**/\2', input)
if old == input:
break;
input = re.sub(r'\bgenerates\s+\'([^\']+)\'\s*', input = re.sub(r'\bgenerates\s+\'([^\']+)\'\s*',
r'_GeNeRaTeS00_/*\1@*/', input) r'_GeNeRaTeS00_/*\1@*/', input)
input = re.sub(r'\bconstexpr\s+\'([^\']+)\'\s*', input = re.sub(r'\bconstexpr\s+\'([^\']+)\'\s*',
...@@ -77,13 +69,6 @@ def postprocess(output): ...@@ -77,13 +69,6 @@ def postprocess(output):
output = re.sub(r'jS_iMpLiCiT_', output = re.sub(r'jS_iMpLiCiT_',
r"js-implicit ", output) r"js-implicit ", output)
while True:
old = output
output = re.sub(r'(\w+)\s{0,1}\|\s{0,1}/\*\*/(\s*\w+)',
r'\1 |\2', output)
if old == output:
break;
output = re.sub(kPercentEscape, r'%', output) output = re.sub(kPercentEscape, r'%', output)
return output return 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