Commit 6ca9eec5 authored by Tobias Tebbi's avatar Tobias Tebbi Committed by Commit Bot

[torque] allow casting from MaybeObject

Bug: v8:7793
Change-Id: Ief280b44f4fe74e2b38fc649e4d61b5e4146234a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2204097
Auto-Submit: Tobias Tebbi <tebbi@chromium.org>
Commit-Queue: Bill Budge <bbudge@chromium.org>
Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67828}
parent e5c3dd59
......@@ -90,7 +90,17 @@ macro Cast<A : type extends WeakHeapObject>(o: A|Object): A labels CastError {
return %RawDownCast<A>(o);
}
macro Cast<A: type>(o: MaybeObject): A labels CastError;
macro Cast<A : type extends Object>(implicit context: Context)(o: MaybeObject):
A labels CastError {
typeswitch (o) {
case (WeakHeapObject): {
goto CastError;
}
case (o: Object): {
return Cast<A>(o) otherwise CastError;
}
}
}
Cast<Undefined>(o: MaybeObject): Undefined labels CastError {
if (TaggedNotEqual(o, Undefined)) goto CastError;
......
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