[wasm-gc] Fix type equivalence for rtts

Bug: v8:7748
Change-Id: I6087c02aab93ba44b8029f3d1a0c99fd6a4da6f8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2250248
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68423}
This commit is contained in:
Manos Koukoutos 2020-06-19 03:49:38 +00:00 committed by Commit Bot
parent 6680837c8a
commit bbc23b4412

View File

@ -65,6 +65,12 @@ bool IsStructTypeEquivalent(uint32_t type_index_1, uint32_t type_index_2,
bool IsEquivalent(ValueType type1, ValueType type2, const WasmModule* module) {
if (type1 == type2) return true;
if (type1.kind() != type2.kind()) return false;
// At this point, the types can only be both rtts, refs, or optrefs,
// but with different indexed types.
// Rtts need to have the same depth.
if (type1.has_depth() && type1.depth() != type2.depth()) return false;
// In all three cases, the indexed types have to be equivalent.
if (module->is_cached_equivalent_type(type1.ref_index(), type2.ref_index())) {
return true;
}