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 {
transitioning builtin ArrayReduceRightLoopContinuation(implicit context:
Context)(
_receiver: JSReceiver, callbackfn: Callable,
initialAccumulator: JSAny | TheHole, o: JSReceiver, initialK: Number,
initialAccumulator: JSAny|TheHole, o: JSReceiver, initialK: Number,
_length: Number): JSAny {
let accumulator = initialAccumulator;
......@@ -118,8 +118,8 @@ namespace array {
transitioning macro FastArrayReduceRight(implicit context: Context)(
o: JSReceiver, len: Number, callbackfn: Callable,
initialAccumulator: JSAny | TheHole): JSAny
labels Bailout(Number, JSAny | TheHole) {
initialAccumulator: JSAny|TheHole): JSAny
labels Bailout(Number, JSAny|TheHole) {
let accumulator = initialAccumulator;
const smiLen = Cast<Smi>(len) otherwise goto Bailout(len - 1, accumulator);
const fastO = Cast<FastJSArrayForRead>(o)
......@@ -178,14 +178,14 @@ namespace array {
// exception. (This case is handled at the end of
// ArrayReduceRightLoopContinuation).
const initialValue: JSAny | TheHole =
const initialValue: JSAny|TheHole =
arguments.length > 1 ? arguments[1] : TheHole;
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);
}
......
......@@ -66,7 +66,7 @@ namespace array {
transitioning builtin ArrayReduceLoopContinuation(implicit context: Context)(
_receiver: JSReceiver, callbackfn: Callable,
initialAccumulator: JSAny | TheHole, o: JSReceiver, initialK: Number,
initialAccumulator: JSAny|TheHole, o: JSReceiver, initialK: Number,
length: Number): JSAny {
let accumulator = initialAccumulator;
......@@ -117,8 +117,8 @@ namespace array {
transitioning macro FastArrayReduce(implicit context: Context)(
o: JSReceiver, len: Number, callbackfn: Callable,
initialAccumulator: JSAny | TheHole): JSAny
labels Bailout(Number, JSAny | TheHole) {
initialAccumulator: JSAny|TheHole): JSAny
labels Bailout(Number, JSAny|TheHole) {
const k = 0;
let accumulator = initialAccumulator;
Cast<Smi>(len) otherwise goto Bailout(k, accumulator);
......@@ -178,14 +178,14 @@ namespace array {
// exception. (This case is handled at the end of
// ArrayReduceLoopContinuation).
const initialValue: JSAny | TheHole =
const initialValue: JSAny|TheHole =
arguments.length > 1 ? arguments[1] : TheHole;
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);
}
......
......@@ -41,11 +41,11 @@ extern class HeapObject extends Tagged {
map: Map;
}
type Object = Smi | HeapObject;
type Object = Smi|HeapObject;
// Defined to coincide with https://tc39.es/ecma262/#sec-ispropertykey
// Doesn't include PrivateSymbol.
type PropertyKey = String | PublicSymbol;
type PropertyKey = String|PublicSymbol;
// TODO(tebbi): PrivateSymbol is only exposed to JavaScript through the debugger
// API. We should reconsider this and try not to expose it at all. Then JSAny
......@@ -53,18 +53,16 @@ type PropertyKey = String | PublicSymbol;
// A JavaScript primitive value as defined in
// https://tc39.es/ecma262/#sec-primitive-value.
type JSPrimitive = Numeric | String | Symbol | Boolean |
Null | Undefined;
type JSPrimitive = Numeric|String|Symbol|Boolean|Null|Undefined;
// A user-exposed JavaScript value, as opposed to V8-internal values like
// TheHole or FixedArray.
type JSAny = JSReceiver | JSPrimitive;
type JSAny = JSReceiver|JSPrimitive;
type JSAnyNotNumber = BigInt | String | Symbol | Boolean |
Null | Undefined | JSReceiver;
type JSAnyNotNumber = BigInt|String|Symbol|Boolean|Null|Undefined|JSReceiver;
// This is the intersection of JSAny and HeapObject.
type JSAnyNotSmi = JSAnyNotNumber | HeapNumber;
type JSAnyNotSmi = JSAnyNotNumber|HeapNumber;
type int32 generates 'TNode<Int32T>' constexpr 'int32_t';
type uint32 generates 'TNode<Uint32T>' constexpr 'uint32_t';
......@@ -145,8 +143,8 @@ extern class Oddball extends PrimitiveHeapObject {
}
extern class HeapNumber extends PrimitiveHeapObject { value: float64; }
type Number = Smi | HeapNumber;
type Numeric = Number | BigInt;
type Number = Smi|HeapNumber;
type Numeric = Number|BigInt;
@abstract
@generateCppClass
......@@ -155,7 +153,7 @@ extern class Name extends PrimitiveHeapObject {
}
// This is the same as Name, but with the information that there are no other
// kinds of names.
type AnyName = PrivateSymbol | PublicSymbol | String;
type AnyName = PrivateSymbol|PublicSymbol|String;
@generateCppClass
extern class Symbol extends Name {
......@@ -305,11 +303,10 @@ extern class Map extends HeapObject {
@if(V8_DOUBLE_FIELDS_UNBOXING) layout_descriptor: LayoutDescriptor;
@ifnot(V8_DOUBLE_FIELDS_UNBOXING) layout_descriptor: void;
dependent_code: DependentCode;
prototype_validity_cell: Smi | Cell;
prototype_validity_cell: Smi|Cell;
// TODO(v8:9108): Misusing "weak" keyword; type should be
// Map | Weak<Map> | TransitionArray | PrototypeInfo | Smi.
weak transitions_or_prototype_info: Map | TransitionArray |
PrototypeInfo | Smi;
weak transitions_or_prototype_info: Map|TransitionArray|PrototypeInfo|Smi;
}
@generatePrint
......@@ -379,7 +376,7 @@ intrinsic
@abstract
@highestInstanceTypeWithinParentClassRange
extern class JSReceiver extends HeapObject {
properties_or_hash: FixedArrayBase | PropertyArray | Smi;
properties_or_hash: FixedArrayBase|PropertyArray|Smi;
}
type Constructor extends JSReceiver;
......@@ -473,13 +470,13 @@ extern class JSFunction extends JSFunctionOrBoundFunction {
weak code: Code;
// Space for the following field may or may not be allocated.
@noVerifier weak prototype_or_initial_map: JSReceiver | Map;
@noVerifier weak prototype_or_initial_map: JSReceiver|Map;
}
@generateCppClass
extern class JSProxy extends JSReceiver {
target: JSReceiver | Null;
handler: JSReceiver | Null;
target: JSReceiver|Null;
handler: JSReceiver|Null;
}
// Just a starting shape for JSObject; properties can move after initialization.
......@@ -592,8 +589,8 @@ type NoSharedNameSentinel extends Smi;
@generateCppClass
extern class CallHandlerInfo extends Struct {
callback: NonNullForeign | Undefined | Zero;
js_callback: NonNullForeign | Undefined | Zero;
callback: NonNullForeign|Undefined|Zero;
js_callback: NonNullForeign|Undefined|Zero;
data: Object;
}
......@@ -602,7 +599,7 @@ extern class Module extends HeapObject {
exports: ObjectHashTable;
hash: Smi;
status: Smi;
module_namespace: JSModuleNamespace | Undefined;
module_namespace: JSModuleNamespace|Undefined;
exception: Object;
}
......@@ -611,8 +608,7 @@ type SourceTextModuleInfo extends FixedArray;
@generateCppClass
extern class SourceTextModule extends Module {
// The code representing this module, or an abstraction thereof.
code: SharedFunctionInfo | JSFunction |
JSGeneratorObject | SourceTextModuleInfo;
code: SharedFunctionInfo|JSFunction|JSGeneratorObject|SourceTextModuleInfo;
// Arrays of cells corresponding to regular exports and regular imports.
// A cell's position in the array is determined by the cell index of the
......@@ -632,9 +628,9 @@ extern class SourceTextModule extends Module {
// The value of import.meta inside of this module.
// Lazily initialized on first access. It's the hole before first access and
// a JSObject afterwards.
import_meta: TheHole | JSObject;
import_meta: TheHole|JSObject;
async_parent_modules: ArrayList;
top_level_capability: JSPromise | Undefined;
top_level_capability: JSPromise|Undefined;
dfs_index: Smi;
dfs_ancestor_index: Smi;
pending_async_dependencies: Smi;
......@@ -702,7 +698,7 @@ extern class JSMessageObject extends JSObject {
arguments: Object;
script: Script;
stack_frames: Object;
shared_info: SharedFunctionInfo | Undefined;
shared_info: SharedFunctionInfo|Undefined;
// Raw data fields.
// TODO(ishell): store as int32 instead of Smi.
......@@ -720,12 +716,12 @@ extern class WeakArrayList extends HeapObject {
}
extern class PrototypeInfo extends Struct {
js_module_namespace: JSModuleNamespace | Undefined;
prototype_users: WeakArrayList | Zero;
js_module_namespace: JSModuleNamespace|Undefined;
prototype_users: WeakArrayList|Zero;
registry_slot: Smi;
validity_cell: Object;
// TODO(v8:9108): Should be Weak<Map> | Undefined.
@noVerifier object_create_map: Map | Undefined;
@noVerifier object_create_map: Map|Undefined;
bit_field: Smi;
}
......@@ -739,7 +735,7 @@ extern class Script extends Struct {
line_ends: Object;
id: Smi;
eval_from_shared_or_wrapped_arguments: Object;
eval_from_position: Smi | Foreign; // Smi or Managed<wasm::NativeModule>
eval_from_position: Smi|Foreign; // Smi or Managed<wasm::NativeModule>
shared_function_infos: Object;
flags: Smi;
source_url: Object;
......@@ -768,9 +764,9 @@ extern class InterpreterData extends Struct {
extern class SharedFunctionInfo extends HeapObject {
weak function_data: Object;
name_or_scope_info: String | NoSharedNameSentinel | ScopeInfo;
name_or_scope_info: String|NoSharedNameSentinel|ScopeInfo;
outer_scope_info_or_feedback_metadata: HeapObject;
script_or_debug_info: Script | DebugInfo | Undefined;
script_or_debug_info: Script|DebugInfo|Undefined;
length: int16;
formal_parameter_count: uint16;
// Currently set to uint16, can be set to uint8 to save space.
......@@ -810,7 +806,7 @@ extern class JSBoundFunction extends JSFunctionOrBoundFunction {
bound_target_function: Callable;
// The value that is always passed as the this value when calling the wrapped
// function.
bound_this: JSAny | SourceTextModule;
bound_this: JSAny|SourceTextModule;
// A list of values whose elements are used as the first arguments to any call
// to the wrapped function.
bound_arguments: FixedArray;
......@@ -828,8 +824,7 @@ type CallableApiObject extends JSObject;
// A JSProxy with the callable bit set.
type CallableJSProxy extends JSProxy;
type Callable =
JSFunction | JSBoundFunction | CallableJSProxy | CallableApiObject;
type Callable = JSFunction|JSBoundFunction|CallableJSProxy|CallableApiObject;
extern operator '.length_intptr' macro LoadAndUntagFixedArrayBaseLength(
FixedArrayBase): intptr;
......@@ -838,7 +833,7 @@ type SloppyArgumentsElements extends FixedArray;
extern class FreeSpace extends HeapObject {
size: Smi;
next: FreeSpace | Uninitialized;
next: FreeSpace|Uninitialized;
}
// %RawDownCast should *never* be used anywhere in Torque code except for
......@@ -904,7 +899,7 @@ extern class JSArrayBufferView extends JSObject {
extern class JSTypedArray extends JSArrayBufferView {
length: uintptr;
external_pointer: RawPtr;
base_pointer: ByteArray | Smi;
base_pointer: ByteArray|Smi;
}
@abstract
......@@ -928,17 +923,17 @@ extern class JSDate extends JSObject {
value: NumberOrUndefined;
// Cached values:
year: Undefined | Smi | NaN;
month: Undefined | Smi | NaN;
day: Undefined | Smi | NaN;
weekday: Undefined | Smi | NaN;
hour: Undefined | Smi | NaN;
min: Undefined | Smi | NaN;
sec: Undefined | Smi | NaN;
year: Undefined|Smi|NaN;
month: Undefined|Smi|NaN;
day: Undefined|Smi|NaN;
weekday: Undefined|Smi|NaN;
hour: Undefined|Smi|NaN;
min: Undefined|Smi|NaN;
sec: Undefined|Smi|NaN;
// Sample of the date cache stamp at the moment when chached fields were
// cached.
cache_stamp: Undefined | Smi | NaN;
cache_stamp: Undefined|Smi|NaN;
}
extern class JSGlobalObject extends JSSpecialObject {
......@@ -1063,22 +1058,22 @@ extern class Foreign extends HeapObject {
@generateCppClass
extern class InterceptorInfo extends Struct {
getter: NonNullForeign | Zero | Undefined;
setter: NonNullForeign | Zero | Undefined;
query: NonNullForeign | Zero | Undefined;
descriptor: NonNullForeign | Zero | Undefined;
deleter: NonNullForeign | Zero | Undefined;
enumerator: NonNullForeign | Zero | Undefined;
definer: NonNullForeign | Zero | Undefined;
getter: NonNullForeign|Zero|Undefined;
setter: NonNullForeign|Zero|Undefined;
query: NonNullForeign|Zero|Undefined;
descriptor: NonNullForeign|Zero|Undefined;
deleter: NonNullForeign|Zero|Undefined;
enumerator: NonNullForeign|Zero|Undefined;
definer: NonNullForeign|Zero|Undefined;
data: Object;
flags: Smi;
}
@generateCppClass
extern class AccessCheckInfo extends Struct {
callback: Foreign | Zero | Undefined;
named_interceptor: InterceptorInfo | Zero | Undefined;
indexed_interceptor: InterceptorInfo | Zero | Undefined;
callback: Foreign|Zero|Undefined;
named_interceptor: InterceptorInfo|Zero|Undefined;
indexed_interceptor: InterceptorInfo|Zero|Undefined;
data: Object;
}
......@@ -1100,8 +1095,8 @@ extern class Cell extends HeapObject {
@abstract
extern class DataHandler extends Struct {
smi_handler: Smi | Code;
validity_cell: Smi | Cell;
smi_handler: Smi|Code;
validity_cell: Smi|Cell;
// Space for the following fields may or may not be allocated.
// TODO(v8:9108): Misusing "weak" keyword; should be MaybeObject.
......@@ -1178,7 +1173,7 @@ extern class JSPromise extends JSObject {
// Smi 0 terminated list of PromiseReaction objects in case the JSPromise was
// not settled yet, otherwise the result.
reactions_or_result: Smi | PromiseReaction | JSAny;
reactions_or_result: Smi|PromiseReaction|JSAny;
flags: Smi;
}
......@@ -1204,14 +1199,14 @@ extern class StackFrameInfo extends Struct {
column_number: Smi;
promise_all_index: Smi;
script_id: Smi;
script_name: String | Null | Undefined;
script_name_or_source_url: String | Null | Undefined;
function_name: String | Null | Undefined;
method_name: String | Null | Undefined;
type_name: String | Null | Undefined;
eval_origin: String | Null | Undefined;
wasm_module_name: String | Null | Undefined;
wasm_instance: WasmInstanceObject | Null | Undefined;
script_name: String|Null|Undefined;
script_name_or_source_url: String|Null|Undefined;
function_name: String|Null|Undefined;
method_name: String|Null|Undefined;
type_name: String|Null|Undefined;
eval_origin: String|Null|Undefined;
wasm_module_name: String|Null|Undefined;
wasm_instance: WasmInstanceObject|Null|Undefined;
flag: Smi;
}
......@@ -1219,9 +1214,9 @@ type FrameArray extends FixedArray;
@generateCppClass
extern class StackTraceFrame extends Struct {
frame_array: FrameArray | Undefined;
frame_array: FrameArray|Undefined;
frame_index: Smi;
frame_info: StackFrameInfo | Undefined;
frame_info: StackFrameInfo|Undefined;
id: Smi;
}
......@@ -1241,7 +1236,7 @@ extern class WasmExportedFunctionData extends Struct {
// The remaining fields are for fast calling from C++. The contract is
// that they are lazily populated, and either all will be present or none.
c_wrapper_code: Object;
wasm_call_target: Smi | Foreign;
wasm_call_target: Smi|Foreign;
packed_args_size: Smi;
}
......@@ -1266,17 +1261,17 @@ extern class WasmIndirectFunctionTable extends Struct {
@ifnot(TAGGED_SIZE_8_BYTES) optional_padding: void;
sig_ids: RawPtr;
targets: RawPtr;
managed_native_allocations: Foreign | Undefined;
managed_native_allocations: Foreign|Undefined;
refs: FixedArray;
}
extern class WasmDebugInfo extends Struct {
instance: WasmInstanceObject;
interpreter_handle: Foreign | Undefined;
interpreter_handle: Foreign|Undefined;
interpreter_reference_stack: Cell;
locals_names: FixedArray | Undefined;
c_wasm_entries: FixedArray | Undefined;
c_wasm_entry_map: Foreign | Undefined; // Managed<wasm::SignatureMap>
locals_names: FixedArray|Undefined;
c_wasm_entries: FixedArray|Undefined;
c_wasm_entry_map: Foreign|Undefined; // Managed<wasm::SignatureMap>
}
@generateCppClass
......@@ -1467,9 +1462,9 @@ type Undefined extends Oddball;
type True extends Oddball;
type False extends Oddball;
type EmptyString extends String;
type Boolean = True | False;
type Boolean = True|False;
type NumberOrUndefined = Number | Undefined;
type NumberOrUndefined = Number|Undefined;
extern macro TheHoleConstant(): TheHole;
extern macro NullConstant(): Null;
......@@ -1506,7 +1501,7 @@ const UNSAFE_SKIP_WRITE_BARRIER:
@generateCppClass
extern class AsyncGeneratorRequest extends Struct {
next: AsyncGeneratorRequest | Undefined;
next: AsyncGeneratorRequest|Undefined;
resume_mode: Smi;
value: Object;
promise: JSPromise;
......@@ -1514,9 +1509,9 @@ extern class AsyncGeneratorRequest extends Struct {
@generateCppClass
extern class SourceTextModuleInfoEntry extends Struct {
export_name: String | Undefined;
local_name: String | Undefined;
import_name: String | Undefined;
export_name: String|Undefined;
local_name: String|Undefined;
import_name: String|Undefined;
module_request: Smi;
cell_index: Smi;
beg_pos: Smi;
......@@ -1525,7 +1520,7 @@ extern class SourceTextModuleInfoEntry extends Struct {
@generateCppClass
extern class PromiseCapability extends Struct {
promise: JSReceiver | Undefined;
promise: JSReceiver|Undefined;
resolve: Object;
reject: Object;
}
......@@ -1537,12 +1532,12 @@ const kPromiseReactionFulfill: constexpr PromiseReactionType
@generateCppClass
extern class PromiseReaction extends Struct {
next: PromiseReaction | Zero;
reject_handler: Callable | Undefined;
fulfill_handler: Callable | Undefined;
next: PromiseReaction|Zero;
reject_handler: Callable|Undefined;
fulfill_handler: Callable|Undefined;
// Either a JSPromise (in case of native promises), a PromiseCapability
// (general case), or undefined (in case of await).
promise_or_capability: JSPromise | PromiseCapability | Undefined;
promise_or_capability: JSPromise|PromiseCapability|Undefined;
}
@abstract
......@@ -1550,10 +1545,10 @@ extern class PromiseReaction extends Struct {
extern class PromiseReactionJobTask extends Microtask {
argument: Object;
context: Context;
handler: Callable | Undefined;
handler: Callable|Undefined;
// Either a JSPromise (in case of native promises), a PromiseCapability
// (general case), or undefined (in case of await).
promise_or_capability: JSPromise | PromiseCapability | Undefined;
promise_or_capability: JSPromise|PromiseCapability|Undefined;
}
@generateCppClass
......@@ -1574,9 +1569,9 @@ extern class PromiseResolveThenableJobTask extends Microtask {
@generateCppClass
extern class JSRegExp extends JSObject {
data: FixedArray | Undefined;
source: String | Undefined;
flags: Smi | Undefined;
data: FixedArray|Undefined;
source: String|Undefined;
flags: Smi|Undefined;
}
extern transitioning macro AllocateJSIteratorResult(implicit context: Context)(
......@@ -1606,8 +1601,8 @@ extern class JSRegExpResult extends JSArray {
groups: JSAny;
// The below fields are for internal use only.
cached_indices_or_match_info: JSRegExpResultIndices | RegExpMatchInfo;
names: FixedArray | Undefined;
cached_indices_or_match_info: JSRegExpResultIndices|RegExpMatchInfo;
names: FixedArray|Undefined;
}
@hasSameInstanceTypeAsParent
......@@ -1658,9 +1653,9 @@ extern class AccessorInfo extends Struct {
name: Object;
flags: Smi;
expected_receiver_type: Object;
setter: NonNullForeign | Zero;
getter: NonNullForeign | Zero;
js_getter: NonNullForeign | Zero;
setter: NonNullForeign|Zero;
getter: NonNullForeign|Zero;
js_getter: NonNullForeign|Zero;
data: Object;
}
......@@ -1683,17 +1678,17 @@ extern class DebugInfo extends Struct {
shared: SharedFunctionInfo;
debugger_hints: Smi;
// Script field from shared function info.
script: Undefined | Script;
script: Undefined|Script;
// The original uninstrumented bytecode array for functions with break
// points - the instrumented bytecode is held in the shared function info.
original_bytecode_array: Undefined | BytecodeArray;
original_bytecode_array: Undefined|BytecodeArray;
// The debug instrumented bytecode array for functions with break points
// - also pointed to by the shared function info.
debug_bytecode_array: Undefined | BytecodeArray;
debug_bytecode_array: Undefined|BytecodeArray;
// Fixed array holding status information for each active break point.
break_points: FixedArray;
flags: Smi;
coverage_info: CoverageInfo | Undefined;
coverage_info: CoverageInfo|Undefined;
}
extern class FeedbackVector extends HeapObject {
......@@ -1712,7 +1707,7 @@ extern class FeedbackVector extends HeapObject {
@generateCppClass
extern class FeedbackCell extends Struct {
value: Undefined | FeedbackVector | FixedArray;
value: Undefined|FeedbackVector|FixedArray;
interrupt_budget: int32;
}
......@@ -1727,12 +1722,12 @@ extern class WasmModuleObject extends JSObject {
native_module: Foreign;
export_wrappers: FixedArray;
script: Script;
asm_js_offset_table: ByteArray | Undefined;
asm_js_offset_table: ByteArray|Undefined;
}
extern class WasmTableObject extends JSObject {
entries: FixedArray;
maximum_length: Smi | HeapNumber | Undefined;
maximum_length: Smi|HeapNumber|Undefined;
dispatch_tables: FixedArray;
raw_type: Smi;
}
......@@ -1740,12 +1735,12 @@ extern class WasmTableObject extends JSObject {
extern class WasmMemoryObject extends JSObject {
array_buffer: JSArrayBuffer;
maximum_pages: Smi;
instances: WeakArrayList | Undefined;
instances: WeakArrayList|Undefined;
}
extern class WasmGlobalObject extends JSObject {
untagged_buffer: JSArrayBuffer | Undefined;
tagged_buffer: FixedArray | Undefined;
untagged_buffer: JSArrayBuffer|Undefined;
tagged_buffer: FixedArray|Undefined;
offset: Smi;
flags: Smi;
}
......@@ -1767,10 +1762,10 @@ extern class AsmWasmData extends Struct {
extern class JSFinalizationGroup extends JSObject {
native_context: NativeContext;
cleanup: Object;
active_cells: Undefined | WeakCell;
cleared_cells: Undefined | WeakCell;
active_cells: Undefined|WeakCell;
cleared_cells: Undefined|WeakCell;
key_map: Object;
next: Undefined | JSFinalizationGroup;
next: Undefined|JSFinalizationGroup;
flags: Smi;
}
......@@ -1781,35 +1776,34 @@ extern class JSFinalizationGroupCleanupIterator extends JSObject {
@generateCppClass
extern class WeakCell extends HeapObject {
finalization_group: Undefined | JSFinalizationGroup;
target: Undefined | JSReceiver;
finalization_group: Undefined|JSFinalizationGroup;
target: Undefined|JSReceiver;
holdings: Object;
// For storing doubly linked lists of WeakCells in JSFinalizationGroup's
// "active_cells" and "cleared_cells" lists.
prev: Undefined | WeakCell;
next: Undefined | WeakCell;
prev: Undefined|WeakCell;
next: Undefined|WeakCell;
// For storing doubly linked lists of WeakCells per key in
// JSFinalizationGroup's key-based hashmap. WeakCell also needs to know its
// key, so that we can remove the key from the key_map when we remove the last
// WeakCell associated with it.
key: Object;
key_list_prev: Undefined | WeakCell;
key_list_next: Undefined | WeakCell;
key_list_prev: Undefined|WeakCell;
key_list_next: Undefined|WeakCell;
}
@generateCppClass
extern class JSWeakRef extends JSObject {
target: Undefined | JSReceiver;
target: Undefined|JSReceiver;
}
extern class BytecodeArray extends FixedArrayBase {
// TODO(v8:8983): bytecode array object sizes vary based on their contents.
constant_pool: FixedArray;
handler_table: ByteArray;
source_position_table: Undefined | ByteArray |
SourcePositionTableWithFrameCache;
source_position_table: Undefined|ByteArray|SourcePositionTableWithFrameCache;
frame_size: int32;
parameter_size: int32;
incoming_new_target_or_generator_register: int32;
......@@ -2073,8 +2067,7 @@ macro Float64IsNaN(n: float64): bool {
}
// The type of all tagged values that can safely be compared with TaggedEqual.
type TaggedWithIdentity =
JSReceiver | FixedArrayBase | Oddball | Map | EmptyString;
type TaggedWithIdentity = JSReceiver|FixedArrayBase|Oddball|Map|EmptyString;
extern operator '==' macro TaggedEqual(TaggedWithIdentity, Object): bool;
extern operator '==' macro TaggedEqual(Object, TaggedWithIdentity): bool;
......@@ -2391,7 +2384,7 @@ Cast<JSAny>(o: Object): JSAny labels CastError {
}
}
Cast<JSAny | TheHole>(o: Object): JSAny | TheHole labels CastError {
Cast<JSAny|TheHole>(o: Object): JSAny|TheHole labels CastError {
typeswitch (o) {
case (o: JSAny): {
return o;
......@@ -2405,7 +2398,7 @@ Cast<JSAny | TheHole>(o: Object): JSAny | TheHole labels CastError {
}
}
Cast<Number | TheHole>(o: Object): Number | TheHole labels CastError {
Cast<Number|TheHole>(o: Object): Number|TheHole labels CastError {
typeswitch (o) {
case (o: Number): {
return o;
......@@ -2494,7 +2487,7 @@ Cast<Callable>(o: HeapObject): Callable
return HeapObjectToCallable(o) otherwise CastError;
}
Cast<Undefined | Callable>(o: HeapObject): Undefined | Callable
Cast<Undefined|Callable>(o: HeapObject): Undefined|Callable
labels CastError {
if (o == Undefined) return Undefined;
return HeapObjectToCallable(o) otherwise CastError;
......@@ -2738,7 +2731,7 @@ Cast<CoverageInfo>(implicit context: Context)(o: HeapObject): CoverageInfo
goto CastError;
}
Cast<JSReceiver | Null>(o: HeapObject): JSReceiver | Null
Cast<JSReceiver|Null>(o: HeapObject): JSReceiver|Null
labels CastError {
typeswitch (o) {
case (o: Null): {
......@@ -2758,8 +2751,7 @@ Cast<PromiseReaction>(o: HeapObject): PromiseReaction labels CastError {
goto CastError;
}
Cast<Smi | PromiseReaction>(o: Object): Smi |
PromiseReaction labels CastError {
Cast<Smi|PromiseReaction>(o: Object): Smi|PromiseReaction labels CastError {
typeswitch (o) {
case (o: Smi): {
return o;
......@@ -3953,7 +3945,7 @@ builtin CheckNumberInRange(implicit context: Context)(
}
}
macro ReplaceTheHoleWithUndefined(o: JSAny | TheHole): JSAny {
macro ReplaceTheHoleWithUndefined(o: JSAny|TheHole): JSAny {
typeswitch (o) {
case (TheHole): {
return Undefined;
......
......@@ -33,8 +33,8 @@ type FrameBase extends RawPtr constexpr 'void*';
type StandardFrame extends FrameBase constexpr 'void*';
type ArgumentsAdaptorFrame extends FrameBase constexpr 'void*';
type StubFrame extends FrameBase constexpr 'void*';
type FrameWithArguments = StandardFrame | ArgumentsAdaptorFrame;
type Frame = FrameWithArguments | StubFrame;
type FrameWithArguments = StandardFrame|ArgumentsAdaptorFrame;
type Frame = FrameWithArguments|StubFrame;
extern macro LoadFramePointer(): Frame;
extern macro LoadParentFramePointer(): Frame;
......@@ -67,7 +67,7 @@ operator '.caller' macro LoadCallerFromFrame(f: Frame): Frame {
return %RawDownCast<Frame>(result);
}
type ContextOrFrameType = Context | FrameType;
type ContextOrFrameType = Context|FrameType;
Cast<ContextOrFrameType>(implicit context: Context)(o: Object):
ContextOrFrameType
labels CastError {
......
......@@ -48,7 +48,7 @@ namespace iterator {
transitioning builtin GetIteratorWithFeedback(
context: Context, receiver: JSAny, loadSlot: Smi, callSlot: Smi,
feedback: Undefined | FeedbackVector): JSAny {
feedback: Undefined|FeedbackVector): JSAny {
let iteratorMethod: JSAny;
typeswitch (feedback) {
case (Undefined): {
......@@ -65,7 +65,7 @@ namespace iterator {
transitioning builtin CallIteratorWithFeedback(
context: Context, receiver: JSAny, iteratorMethod: JSAny, callSlot: Smi,
feedback: Undefined | FeedbackVector): JSAny {
feedback: Undefined|FeedbackVector): JSAny {
const callSlotUnTagged: uintptr = Unsigned(SmiUntag(callSlot));
CollectCallFeedback(iteratorMethod, context, feedback, callSlotUnTagged);
const iteratorCallable: Callable = Cast<Callable>(iteratorMethod)
......
......@@ -72,7 +72,7 @@ namespace object {
transitioning macro
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 objectJSProxy = Cast<JSProxy>(objectJSReceiver)
otherwise return runtime::JSReceiverSetPrototypeOfThrow(
......@@ -83,7 +83,7 @@ namespace object {
transitioning macro
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 objectJSProxy = Cast<JSProxy>(objectJSReceiver)
otherwise return runtime::JSReceiverSetPrototypeOfDontThrow(
......@@ -122,7 +122,7 @@ namespace object {
// 5. If status is false, throw a TypeError exception.
// 6. Return O.
typeswitch (proto) {
case (proto: JSReceiver | Null): {
case (proto: JSReceiver|Null): {
return object::ObjectSetPrototypeOfThrow(object, proto);
}
case (JSAny): {
......
......@@ -7,8 +7,9 @@
// https://tc39.es/ecma262/#sec-promise-abstract-operations
namespace promise {
extern macro PromiseBuiltinsAssembler::TriggerPromiseReactions(
implicit context: Context)(
Smi | PromiseReaction, JSAny, constexpr PromiseReactionType): void;
implicit context:
Context)(Smi|PromiseReaction, JSAny, constexpr PromiseReactionType):
void;
// https://tc39.es/ecma262/#sec-fulfillpromise
transitioning builtin
......
......@@ -19,7 +19,7 @@ namespace proxy {
// https://tc39.github.io/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receiver
transitioning builtin
ProxySetProperty(implicit context: Context)(
proxy: JSProxy, name: PropertyKey | PrivateSymbol, value: JSAny,
proxy: JSProxy, name: PropertyKey|PrivateSymbol, value: JSAny,
receiverValue: JSAny): JSAny {
// 1. Assert: IsPropertyKey(P) is true.
assert(TaggedIsNotSmi(name));
......
......@@ -10,7 +10,7 @@ namespace proxy {
// https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-setprototypeof-v
transitioning builtin
ProxySetPrototypeOf(implicit context: Context)(
proxy: JSProxy, proto: Null | JSReceiver, doThrow: Boolean): JSAny {
proxy: JSProxy, proto: Null|JSReceiver, doThrow: Boolean): JSAny {
PerformStackCheck();
const kTrapName: constexpr string = 'setPrototypeOf';
try {
......@@ -63,7 +63,7 @@ namespace proxy {
}
ThrowTypeError(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);
......
......@@ -37,7 +37,7 @@ namespace reflect {
const objectJSReceiver = Cast<JSReceiver>(object)
otherwise ThrowTypeError(kCalledOnNonObject, 'Reflect.setPrototypeOf');
typeswitch (proto) {
case (proto: JSReceiver | Null): {
case (proto: JSReceiver|Null): {
return object::ObjectSetPrototypeOfDontThrow(objectJSReceiver, proto);
}
case (JSAny): {
......
......@@ -10,7 +10,7 @@ namespace regexp {
SubString(implicit context: Context)(String, Smi, Smi): String;
extern runtime RegExpExecMultiple(implicit context: Context)(
JSRegExp, String, RegExpMatchInfo, JSArray): Null | JSArray;
JSRegExp, String, RegExpMatchInfo, JSArray): Null|JSArray;
extern transitioning runtime
RegExpReplaceRT(Context, JSReceiver, String, Object): String;
extern transitioning runtime
......@@ -86,7 +86,7 @@ namespace regexp {
const kInitialCapacity: Smi = 16;
const kInitialLength: Smi = 0;
const result: Null | JSArray = RegExpExecMultiple(
const result: Null|JSArray = RegExpExecMultiple(
regexp, string, GetRegExpLastMatchInfo(),
AllocateJSArray(
PACKED_ELEMENTS, GetFastPackedElementsJSArrayMap(),
......
......@@ -9,7 +9,7 @@ namespace typed_array {
transitioning macro ReduceAllElements(implicit context: Context)(
array: typed_array::AttachedJSTypedArray, callbackfn: Callable,
initialValue: JSAny | TheHole): JSAny {
initialValue: JSAny|TheHole): JSAny {
let witness = typed_array::NewAttachedJSTypedArrayWitness(array);
const length: uintptr = witness.Get().length;
let accumulator = initialValue;
......
......@@ -10,7 +10,7 @@ namespace typed_array {
transitioning macro ReduceRightAllElements(implicit context: Context)(
array: typed_array::AttachedJSTypedArray, callbackfn: Callable,
initialValue: JSAny | TheHole): JSAny {
initialValue: JSAny|TheHole): JSAny {
let witness = typed_array::NewAttachedJSTypedArrayWitness(array);
const length: uintptr = witness.Get().length;
let accumulator = initialValue;
......
......@@ -18,7 +18,7 @@ extern class JSDateTimeFormat extends JSObject {
icu_locale: Foreign; // Managed<icu::Locale>
icu_simple_date_format: Foreign; // Managed<icu::SimpleDateFormat>
icu_date_interval_format: Foreign; // Managed<icu::DateIntervalFormat>
bound_format: JSFunction | Undefined;
bound_format: JSFunction|Undefined;
flags: Smi;
}
......@@ -32,7 +32,7 @@ extern class JSNumberFormat extends JSObject {
locale: String;
icu_number_formatter:
Foreign; // Managed<icu::number::LocalizedNumberFormatter>
bound_format: JSFunction | Undefined;
bound_format: JSFunction|Undefined;
flags: Smi;
}
......@@ -70,15 +70,15 @@ extern class JSV8BreakIterator extends JSObject {
locale: String;
break_iterator: Foreign; // Managed<icu::BreakIterator>;
unicode_string: Foreign; // Managed<icu::UnicodeString>;
bound_adopt_text: Undefined | JSFunction;
bound_first: Undefined | JSFunction;
bound_next: Undefined | JSFunction;
bound_current: Undefined | JSFunction;
bound_break_type: Undefined | JSFunction;
bound_adopt_text: Undefined|JSFunction;
bound_first: Undefined|JSFunction;
bound_next: Undefined|JSFunction;
bound_current: Undefined|JSFunction;
bound_break_type: Undefined|JSFunction;
break_iterator_type: Smi;
}
extern class JSCollator extends JSObject {
icu_collator: Foreign; // Managed<icu::Collator>
bound_compare: Undefined | JSFunction;
bound_compare: Undefined|JSFunction;
}
......@@ -465,7 +465,7 @@ namespace test {
}
}
type NumberOrFixedArray = Number | FixedArray;
type NumberOrFixedArray = Number|FixedArray;
macro TypeswitchExample(implicit context: Context)(x: NumberOrFixedArray):
int32 {
let result: int32 = 0;
......
......@@ -47,7 +47,7 @@ namespace array {
initialReceiverLength: Number;
// 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
// that calls the user-provided comparison function or "SortDefault", which
......@@ -132,7 +132,7 @@ namespace array {
}
transitioning macro NewSortState(implicit context: Context)(
receiver: JSReceiver, comparefn: Undefined | Callable,
receiver: JSReceiver, comparefn: Undefined|Callable,
initialReceiverLength: Number): SortState {
const sortComparePtr =
comparefn != Undefined ? SortCompareUserFn : SortCompareDefault;
......@@ -214,7 +214,7 @@ namespace array {
// it is first requested, but it has always at least this size.
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 DeleteFn = builtin(Context, SortState, Smi) => Smi;
type CanUseSameAccessorFn = builtin(Context, JSReceiver, Map, Number) =>
......@@ -228,28 +228,28 @@ namespace array {
// through a hole.
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;
if (!HasProperty_Inline(receiver, index)) return TheHole;
return GetProperty(receiver, index);
}
Load<FastSmiElements>(context: Context, sortState: SortState, index: Smi):
JSAny | TheHole {
JSAny|TheHole {
const object = UnsafeCast<JSObject>(sortState.receiver);
const elements = UnsafeCast<FixedArray>(object.elements);
return UnsafeCast<(JSAny | TheHole)>(elements.objects[index]);
}
Load<FastObjectElements>(context: Context, sortState: SortState, index: Smi):
JSAny | TheHole {
JSAny|TheHole {
const object = UnsafeCast<JSObject>(sortState.receiver);
const elements = UnsafeCast<FixedArray>(object.elements);
return UnsafeCast<(JSAny | TheHole)>(elements.objects[index]);
}
Load<FastDoubleElements>(context: Context, sortState: SortState, index: Smi):
JSAny | TheHole {
JSAny|TheHole {
try {
const object = UnsafeCast<JSObject>(sortState.receiver);
const elements = UnsafeCast<FixedDoubleArray>(object.elements);
......@@ -1306,7 +1306,7 @@ namespace array {
// are ignored.
let numberOfUndefined: Smi = 0;
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) {
// Do nothing for holes. The result is that elements are
......
......@@ -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*{', 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*',
r'_GeNeRaTeS00_/*\1@*/', input)
input = re.sub(r'\bconstexpr\s+\'([^\']+)\'\s*',
......@@ -77,13 +69,6 @@ def postprocess(output):
output = re.sub(r'jS_iMpLiCiT_',
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)
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