summaryrefslogtreecommitdiff
path: root/src/ir/effects.h
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2024-05-15 12:07:34 -0700
committerGitHub <noreply@github.com>2024-05-15 12:07:34 -0700
commit6b43a5ef76149c92e216fddb0a1ee17f736b4b6e (patch)
tree7b2deb1e6924ba8f74e0b25c26cf2d9a63ad610a /src/ir/effects.h
parentef4b57c2a491a2193435dccdc9305f6a79965715 (diff)
downloadbinaryen-6b43a5ef76149c92e216fddb0a1ee17f736b4b6e.tar.gz
binaryen-6b43a5ef76149c92e216fddb0a1ee17f736b4b6e.tar.bz2
binaryen-6b43a5ef76149c92e216fddb0a1ee17f736b4b6e.zip
[Strings] Remove operations not included in imported strings (#6589)
The stringref proposal has been superseded by the imported JS strings proposal, but the former has many more operations than the latter. To reduce complexity, remove all operations that are part of stringref but not part of imported strings.
Diffstat (limited to 'src/ir/effects.h')
-rw-r--r--src/ir/effects.h36
1 files changed, 4 insertions, 32 deletions
diff --git a/src/ir/effects.h b/src/ir/effects.h
index 87b77601f..28de83850 100644
--- a/src/ir/effects.h
+++ b/src/ir/effects.h
@@ -941,23 +941,10 @@ private:
// cycle may be needed in some cases.
}
void visitStringNew(StringNew* curr) {
- // traps when out of bounds in linear memory or ref is null
+ // traps when ref is null
parent.implicitTrap = true;
- switch (curr->op) {
- case StringNewUTF8:
- case StringNewWTF8:
- case StringNewLossyUTF8:
- case StringNewWTF16:
- parent.readsMemory = true;
- break;
- case StringNewUTF8Array:
- case StringNewWTF8Array:
- case StringNewLossyUTF8Array:
- case StringNewWTF16Array:
- parent.readsArray = true;
- break;
- default: {
- }
+ if (curr->op != StringNewFromCodePoint) {
+ parent.readsArray = true;
}
}
void visitStringConst(StringConst* curr) {}
@@ -968,22 +955,7 @@ private:
void visitStringEncode(StringEncode* curr) {
// traps when ref is null or we write out of bounds.
parent.implicitTrap = true;
- switch (curr->op) {
- case StringEncodeUTF8:
- case StringEncodeLossyUTF8:
- case StringEncodeWTF8:
- case StringEncodeWTF16:
- parent.writesMemory = true;
- break;
- case StringEncodeUTF8Array:
- case StringEncodeLossyUTF8Array:
- case StringEncodeWTF8Array:
- case StringEncodeWTF16Array:
- parent.writesArray = true;
- break;
- default: {
- }
- }
+ parent.writesArray = true;
}
void visitStringConcat(StringConcat* curr) {
// traps when an input is null.