Lines Matching refs:o
13 macro IsAccessorInfo(o: HeapObject): bool {
14 return Is<AccessorInfo>(o);
18 macro IsAccessorPair(o: HeapObject): bool {
19 return Is<AccessorPair>(o);
23 macro IsAllocationSite(o: HeapObject): bool {
24 return Is<AllocationSite>(o);
28 macro IsCell(o: HeapObject): bool {
29 return Is<Cell>(o);
33 macro IsCode(o: HeapObject): bool {
34 return Is<Code>(o);
38 macro IsContext(o: HeapObject): bool {
39 return Is<Context>(o);
43 macro IsCoverageInfo(o: HeapObject): bool {
44 return Is<CoverageInfo>(o);
48 macro IsDebugInfo(o: HeapObject): bool {
49 return Is<DebugInfo>(o);
53 macro IsFixedDoubleArray(o: HeapObject): bool {
54 return Is<FixedDoubleArray>(o);
58 macro IsFeedbackCell(o: HeapObject): bool {
59 return Is<FeedbackCell>(o);
63 macro IsFeedbackVector(o: HeapObject): bool {
64 return Is<FeedbackVector>(o);
68 macro IsHeapNumber(o: HeapObject): bool {
69 return Is<HeapNumber>(o);
73 macro IsNativeContext(o: HeapObject): bool {
74 return Is<NativeContext>(o);
78 macro IsNumber(o: Object): bool {
79 return Is<Number>(o);
83 macro IsPrivateSymbol(o: HeapObject): bool {
84 return Is<PrivateSymbol>(o);
88 macro IsPromiseCapability(o: HeapObject): bool {
89 return Is<PromiseCapability>(o);
93 macro IsPromiseFulfillReactionJobTask(o: HeapObject): bool {
94 return Is<PromiseFulfillReactionJobTask>(o);
98 macro IsPromiseReaction(o: HeapObject): bool {
99 return Is<PromiseReaction>(o);
103 macro IsPromiseRejectReactionJobTask(o: HeapObject): bool {
104 return Is<PromiseRejectReactionJobTask>(o);
108 macro IsSharedFunctionInfo(o: HeapObject): bool {
109 return Is<SharedFunctionInfo>(o);
113 macro IsSymbol(o: HeapObject): bool {
114 return Is<Symbol>(o);
133 macro Cast<A : type extends WeakHeapObject>(o: A|Object): A labels CastError {
134 if (!IsWeakOrCleared(o)) goto CastError;
135 return %RawDownCast<A>(o);
138 macro Cast<A : type extends Object>(implicit context: Context)(o: MaybeObject):
140 typeswitch (o) {
144 case (o: Object): {
145 return Cast<A>(o) otherwise CastError;
150 Cast<Undefined>(o: MaybeObject): Undefined labels CastError {
151 if (TaggedNotEqual(o, Undefined)) goto CastError;
152 return %RawDownCast<Undefined>(o);
155 macro Cast<A : type extends Object>(implicit context: Context)(o: Object): A
157 return Cast<A>(TaggedToHeapObject(o) otherwise CastError)
162 Cast<Smi>(o: Object): Smi
164 return TaggedToSmi(o) otherwise CastError;
167 Cast<PositiveSmi>(o: Object): PositiveSmi
169 return TaggedToPositiveSmi(o) otherwise CastError;
172 Cast<Zero>(o: Object): Zero labels CastError {
173 if (TaggedEqual(o, SmiConstant(0))) return %RawDownCast<Zero>(o);
177 Cast<Number>(o: Object): Number
179 typeswitch (o) {
192 Cast<Undefined>(o: Object): Undefined
194 const o: MaybeObject = o;
195 return Cast<Undefined>(o) otherwise CastError;
198 Cast<Numeric>(o: Object): Numeric labels CastError {
199 typeswitch (o) {
200 case (o: Number): {
201 return o;
203 case (o: BigInt): {
204 return o;
212 Cast<TheHole>(o: Object): TheHole labels CastError {
213 if (o == TheHole) return %RawDownCast<TheHole>(o);
217 Cast<TheHole>(o: HeapObject): TheHole labels CastError {
218 const o: Object = o;
219 return Cast<TheHole>(o) otherwise CastError;
222 Cast<True>(o: Object): True labels CastError {
223 if (o == True) return %RawDownCast<True>(o);
227 Cast<True>(o: HeapObject): True labels CastError {
228 const o: Object = o;
229 return Cast<True>(o) otherwise CastError;
232 Cast<False>(o: Object): False labels CastError {
233 if (o == False) return %RawDownCast<False>(o);
237 Cast<False>(o: HeapObject): False labels CastError {
238 const o: Object = o;
239 return Cast<False>(o) otherwise CastError;
242 Cast<Boolean>(o: Object): Boolean labels CastError {
243 typeswitch (o) {
244 case (o: True): {
245 return o;
247 case (o: False): {
248 return o;
256 Cast<Boolean>(o: HeapObject): Boolean labels CastError {
257 const o: Object = o;
258 return Cast<Boolean>(o) otherwise CastError;
264 Cast<JSPrimitive>(o: Object): JSPrimitive labels CastError {
265 typeswitch (o) {
266 case (o: Numeric): {
267 return o;
269 case (o: String): {
270 return o;
272 case (o: Symbol): {
273 return o;
275 case (o: Boolean): {
276 return o;
278 case (o: Undefined): {
279 return o;
281 case (o: Null): {
282 return o;
290 Cast<JSAny>(o: Object): JSAny labels CastError {
291 typeswitch (o) {
292 case (o: JSPrimitive): {
293 return o;
295 case (o: JSReceiver): {
296 return o;
304 Cast<JSAny|TheHole>(o: Object): JSAny|TheHole labels CastError {
305 typeswitch (o) {
306 case (o: JSAny): {
307 return o;
309 case (o: TheHole): {
310 return o;
318 Cast<Number|TheHole>(o: Object): Number|TheHole labels CastError {
319 typeswitch (o) {
320 case (o: Number): {
321 return o;
323 case (o: TheHole): {
324 return o;
332 macro Cast<A : type extends HeapObject>(o: HeapObject): A
335 Cast<HeapObject>(o: HeapObject): HeapObject
337 return o;
340 Cast<Null>(o: HeapObject): Null
342 if (o != Null) goto CastError;
343 return %RawDownCast<Null>(o);
346 Cast<Undefined>(o: HeapObject): Undefined
348 const o: MaybeObject = o;
349 return Cast<Undefined>(o) otherwise CastError;
352 Cast<EmptyFixedArray>(o: Object): EmptyFixedArray
354 if (o != kEmptyFixedArray) goto CastError;
355 return %RawDownCast<EmptyFixedArray>(o);
357 Cast<EmptyFixedArray>(o: HeapObject): EmptyFixedArray
359 const o: Object = o;
360 return Cast<EmptyFixedArray>(o) otherwise CastError;
363 Cast<(FixedDoubleArray | EmptyFixedArray)>(o: HeapObject): FixedDoubleArray|
365 typeswitch (o) {
366 case (o: EmptyFixedArray): {
367 return o;
369 case (o: FixedDoubleArray): {
370 return o;
378 Cast<Callable>(o: HeapObject): Callable
380 return HeapObjectToCallable(o) otherwise CastError;
383 Cast<Undefined|Callable>(o: HeapObject): Undefined|Callable
385 if (o == Undefined) return Undefined;
386 return HeapObjectToCallable(o) otherwise CastError;
389 macro Cast<T : type extends Symbol>(o: Symbol): T labels CastError;
398 Cast<PublicSymbol>(o: HeapObject): PublicSymbol labels CastError {
399 const s = Cast<Symbol>(o) otherwise CastError;
402 Cast<PrivateSymbol>(o: HeapObject): PrivateSymbol labels CastError {
403 const s = Cast<Symbol>(o) otherwise CastError;
407 Cast<DirectString>(o: HeapObject): DirectString
409 return TaggedToDirectString(o) otherwise CastError;
412 Cast<Constructor>(o: HeapObject): Constructor
414 return HeapObjectToConstructor(o) otherwise CastError;
417 Cast<JSFunctionWithPrototypeSlot>(o: HeapObject): JSFunctionWithPrototypeSlot
419 return HeapObjectToJSFunctionWithPrototypeSlot(o) otherwise CastError;
422 Cast<BigInt>(o: HeapObject): BigInt labels CastError {
423 if (IsBigInt(o)) return %RawDownCast<BigInt>(o);
427 Cast<JSRegExpResult>(implicit context: Context)(o: HeapObject): JSRegExpResult
429 if (regexp::IsRegExpResult(o)) return %RawDownCast<JSRegExpResult>(o);
433 Cast<JSSloppyArgumentsObject>(implicit context: Context)(o: HeapObject):
436 const map: Map = o.map;
439 return %RawDownCast<JSSloppyArgumentsObject>(o);
444 Cast<JSStrictArgumentsObject>(implicit context: Context)(o: HeapObject):
447 const map: Map = o.map;
449 return %RawDownCast<JSStrictArgumentsObject>(o);
452 Cast<JSArgumentsObjectWithLength>(implicit context: Context)(o: HeapObject):
455 typeswitch (o) {
456 case (o: JSStrictArgumentsObject): {
457 return o;
459 case (o: JSSloppyArgumentsObject): {
460 return o;
468 Cast<FastJSRegExp>(implicit context: Context)(o: HeapObject): FastJSRegExp
474 if (regexp::IsFastRegExpStrict(o)) {
475 return %RawDownCast<FastJSRegExp>(o);
480 Cast<FastJSArray>(implicit context: Context)(o: HeapObject): FastJSArray
484 if (!Is<JSArray>(o)) goto CastError;
487 const map: Map = o.map;
495 return %RawDownCast<FastJSArray>(o);
498 Cast<FastJSArrayForRead>(implicit context: Context)(o: HeapObject):
501 if (!Is<JSArray>(o)) goto CastError;
504 const map: Map = o.map;
514 return %RawDownCast<FastJSArrayForRead>(o);
517 Cast<FastJSArrayForCopy>(implicit context: Context)(o: HeapObject):
521 const a = Cast<FastJSArray>(o) otherwise CastError;
526 o: HeapObject): FastJSArrayWithNoCustomIteration
529 const a = Cast<FastJSArray>(o) otherwise CastError;
534 o: HeapObject): FastJSArrayForReadWithNoCustomIteration
537 const a = Cast<FastJSArrayForRead>(o) otherwise CastError;
541 Cast<SeqOneByteString>(o: HeapObject): SeqOneByteString labels CastError {
542 if (!IsSeqOneByteString(o)) goto CastError;
543 return %RawDownCast<SeqOneByteString>(o);
546 Cast<JSReceiver|Null>(o: HeapObject): JSReceiver|Null
548 typeswitch (o) {
549 case (o: Null): {
550 return o;
552 case (o: JSReceiver): {
553 return o;
561 Cast<Smi|PromiseReaction>(o: Object): Smi|PromiseReaction labels CastError {
562 typeswitch (o) {
563 case (o: Smi): {
564 return o;
566 case (o: PromiseReaction): {
567 return o;
575 Cast<String|Callable>(implicit context: Context)(o: Object): String|
577 typeswitch (o) {
578 case (o: String): {
579 return o;
581 case (o: Callable): {
582 return o;
590 Cast<Zero|PromiseReaction>(implicit context: Context)(o: Object): Zero|
592 typeswitch (o) {
593 case (o: Zero): {
594 return o;
596 case (o: PromiseReaction): {
597 return o;
605 Cast<JSFunction|JSBoundFunction>(implicit context: Context)(o: Object):
607 typeswitch (o) {
608 case (o: JSFunction): {
609 return o;
611 case (o: JSBoundFunction): {
612 return o;
620 Cast<FixedArray|Undefined>(o: HeapObject): FixedArray|
622 typeswitch (o) {
623 case (o: Undefined): {
624 return o;
626 case (o: FixedArray): {
627 return o;
635 Cast<JSProxy|Null>(o: HeapObject): JSProxy|Null labels CastError {
636 typeswitch (o) {
637 case (o: Null): {
638 return o;
640 case (o: JSProxy): {
641 return o;
650 implicit context: Context)(o: B): bool {
651 Cast<A>(o) otherwise return false;
655 macro UnsafeCast<A : type extends Object>(implicit context: Context)(o: Object):
657 assert(Is<A>(o));
658 return %RawDownCast<A>(o);
665 UnsafeCast<RegExpMatchInfo>(implicit context: Context)(o: Object):
667 assert(Is<FixedArray>(o));
668 return %RawDownCast<RegExpMatchInfo>(o);
671 macro UnsafeCast<A : type extends WeakHeapObject>(o: A|Object): A {
672 assert(IsWeakOrCleared(o));
673 return %RawDownCast<A>(o);
683 Cast<Object>(o: Object): Object
685 return o;