[wasm-gc][liftoff] Optimize final-type checks

This is a follow-up to crrev.com/c/v8/v8/+/4096478. Similarly to
Turbofan, we reduce type-checks for final types in Liftoff to type
identity.

Bug: v8:7748
Change-Id: I095880a7718bd2d675dd119f1f14869c97d641b7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4128522
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#85135}
This commit is contained in:
Manos Koukoutos 2023-01-02 13:01:40 +01:00 committed by V8 LUCI CQ
parent 521a399d35
commit 0ab8a7a111

View File

@ -5943,6 +5943,11 @@ class LiftoffCompiler {
__ LoadMap(tmp1, obj_reg);
// {tmp1} now holds the object's map.
if (module->types[rtt_type.ref_index()].is_final) {
// In this case, simply check for map equality.
__ emit_cond_jump(kUnequal, no_match, rtt_type.kind(), tmp1, rtt_reg,
frozen);
} else {
// Check for rtt equality, and if not, check if the rtt is a struct/array
// rtt.
__ emit_cond_jump(kEqual, &match, rtt_type.kind(), tmp1, rtt_reg, frozen);
@ -5981,6 +5986,7 @@ class LiftoffCompiler {
rtt_depth * kTaggedSize));
__ emit_cond_jump(kUnequal, no_match, rtt_type.kind(), tmp1, rtt_reg,
frozen);
}
// Fall through to {match}.
__ bind(&match);