summaryrefslogtreecommitdiff
path: root/src/wasm/wasm.cpp
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2022-07-13 14:38:10 -0700
committerGitHub <noreply@github.com>2022-07-13 14:38:10 -0700
commit9671e95adbfcf0984a7e9800a7ea2ed33e1670ad (patch)
treed7273e64ed26429d18568439cdfb7b1fb6369645 /src/wasm/wasm.cpp
parent7b9c18b98c020f887aa9cb1750543751ebe5c530 (diff)
downloadbinaryen-9671e95adbfcf0984a7e9800a7ea2ed33e1670ad.tar.gz
binaryen-9671e95adbfcf0984a7e9800a7ea2ed33e1670ad.tar.bz2
binaryen-9671e95adbfcf0984a7e9800a7ea2ed33e1670ad.zip
[Strings] stringview access operations (#4798)
Diffstat (limited to 'src/wasm/wasm.cpp')
-rw-r--r--src/wasm/wasm.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp
index 6568c907e..c4a5f362a 100644
--- a/src/wasm/wasm.cpp
+++ b/src/wasm/wasm.cpp
@@ -1236,6 +1236,39 @@ void StringAs::finalize() {
}
}
+void StringWTF8Advance::finalize() {
+ if (ref->type == Type::unreachable || pos->type == Type::unreachable ||
+ bytes->type == Type::unreachable) {
+ type = Type::unreachable;
+ } else {
+ type = Type::i32;
+ }
+}
+
+void StringWTF16Get::finalize() {
+ if (ref->type == Type::unreachable || pos->type == Type::unreachable) {
+ type = Type::unreachable;
+ } else {
+ type = Type::i32;
+ }
+}
+
+void StringIterNext::finalize() {
+ if (ref->type == Type::unreachable) {
+ type = Type::unreachable;
+ } else {
+ type = Type::i32;
+ }
+}
+
+void StringIterMove::finalize() {
+ if (ref->type == Type::unreachable || num->type == Type::unreachable) {
+ type = Type::unreachable;
+ } else {
+ type = Type::i32;
+ }
+}
+
size_t Function::getNumParams() { return getParams().size(); }
size_t Function::getNumVars() { return vars.size(); }