Commit bcfc82ef authored by Nico Hartmann's avatar Nico Hartmann Committed by V8 LUCI CQ

[Torque] Provide a specialization of Cast<Context|Zero|Undefined>

Bug: v8:11727
Change-Id: Id78995e250e16f43687db1c7ce97a59c635b5424
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2871459
Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Auto-Submit: Nico Hartmann <nicohartmann@chromium.org>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74358}
parent 799fa7b0
...@@ -329,6 +329,24 @@ Cast<Number|TheHole>(o: Object): Number|TheHole labels CastError { ...@@ -329,6 +329,24 @@ Cast<Number|TheHole>(o: Object): Number|TheHole labels CastError {
} }
} }
Cast<Context|Zero|Undefined>(o: Object): Context|Zero|Undefined
labels CastError {
typeswitch (o) {
case (o: Context): {
return o;
}
case (o: Zero): {
return o;
}
case (o: Undefined): {
return o;
}
case (Object): {
goto CastError;
}
}
}
macro Cast<A : type extends HeapObject>(o: HeapObject): A macro Cast<A : type extends HeapObject>(o: HeapObject): A
labels CastError; labels 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