summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-binary.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm/wasm-binary.cpp')
-rw-r--r--src/wasm/wasm-binary.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index 65734e68d..cd5763c12 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -7184,7 +7184,13 @@ bool WasmBinaryBuilder::maybeVisitStringNew(Expression*& out, uint32_t code) {
Expression* length = nullptr;
Expression* start = nullptr;
Expression* end = nullptr;
- if (code == BinaryConsts::StringNewWTF8) {
+ bool try_ = false;
+ if (code == BinaryConsts::StringNewWTF8 ||
+ code == BinaryConsts::StringNewUTF8Try) {
+ if (code == BinaryConsts::StringNewUTF8Try) {
+ try_ = true;
+ }
+ // FIXME: the memory index should be an LEB like all other places
if (getInt8() != 0) {
throwError("Unexpected nonzero memory index");
}
@@ -7209,7 +7215,11 @@ bool WasmBinaryBuilder::maybeVisitStringNew(Expression*& out, uint32_t code) {
}
op = StringNewWTF16;
length = popNonVoidExpression();
- } else if (code == BinaryConsts::StringNewWTF8Array) {
+ } else if (code == BinaryConsts::StringNewWTF8Array ||
+ code == BinaryConsts::StringNewUTF8ArrayTry) {
+ if (code == BinaryConsts::StringNewUTF8ArrayTry) {
+ try_ = true;
+ }
auto policy = getU32LEB();
switch (policy) {
case BinaryConsts::StringPolicy::UTF8:
@@ -7230,14 +7240,16 @@ bool WasmBinaryBuilder::maybeVisitStringNew(Expression*& out, uint32_t code) {
op = StringNewWTF16Array;
end = popNonVoidExpression();
start = popNonVoidExpression();
+ } else if (code == BinaryConsts::StringFromCodePoint) {
+ op = StringNewFromCodePoint;
} else {
return false;
}
auto* ptr = popNonVoidExpression();
if (length) {
- out = Builder(wasm).makeStringNew(op, ptr, length);
+ out = Builder(wasm).makeStringNew(op, ptr, length, try_);
} else {
- out = Builder(wasm).makeStringNew(op, ptr, start, end);
+ out = Builder(wasm).makeStringNew(op, ptr, start, end, try_);
}
return true;
}