Skip to content

Commit a970eed

Browse files
jakobkummerowV8 LUCI CQ
authored andcommitted
[wasm] Fix CanonicalEquality::EqualValueType
For indexed types, the non-index bits also need to be equal. Fixed: 422313191 Change-Id: I09489081cca4953aff0d642721376f24cf40bda5 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6621628 Reviewed-by: Matthias Liedtke <[email protected]> Commit-Queue: Matthias Liedtke <[email protected]> Auto-Submit: Jakob Kummerow <[email protected]> Cr-Commit-Position: refs/heads/main@{#100693}
1 parent a6e10f5 commit a970eed

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

src/wasm/canonical-types.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,8 @@ class TypeCanonicalizer {
359359
const bool indexed = type1.has_index();
360360
if (indexed != type2.has_index()) return false;
361361
if (indexed) {
362-
return EqualTypeIndex(type1.ref_index(), type2.ref_index());
362+
return type1.is_equal_except_index(type2) &&
363+
EqualTypeIndex(type1.ref_index(), type2.ref_index());
363364
}
364365
return type1 == type2;
365366
}

src/wasm/value-type.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,6 +1068,10 @@ class CanonicalValueType : public ValueTypeBase {
10681068
return bit_field_ == other.bit_field_;
10691069
}
10701070

1071+
constexpr bool is_equal_except_index(CanonicalValueType other) const {
1072+
return (bit_field_ & ~kIndexBits) == (other.bit_field_ & ~kIndexBits);
1073+
}
1074+
10711075
constexpr bool IsFunctionType() const {
10721076
return ref_type_kind() == RefTypeKind::kFunction;
10731077
}

0 commit comments

Comments
 (0)