summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wasm/wasm-type.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/wasm/wasm-type.cpp b/src/wasm/wasm-type.cpp
index 1b6313ad7..a63c66770 100644
--- a/src/wasm/wasm-type.cpp
+++ b/src/wasm/wasm-type.cpp
@@ -1049,6 +1049,10 @@ Type Type::get(unsigned byteSize, bool float_) {
}
bool Type::isSubType(Type left, Type right) {
+ // As an optimization, in the common case do not even construct a SubTyper.
+ if (left == right) {
+ return true;
+ }
return SubTyper().isSubType(left, right);
}
@@ -1220,6 +1224,10 @@ bool HeapType::isNominal() const {
}
bool HeapType::isSubType(HeapType left, HeapType right) {
+ // As an optimization, in the common case do not even construct a SubTyper.
+ if (left == right) {
+ return true;
+ }
return SubTyper().isSubType(left, right);
}