diff options
Diffstat (limited to 'src/wasm/wasm-stack.cpp')
-rw-r--r-- | src/wasm/wasm-stack.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/wasm/wasm-stack.cpp b/src/wasm/wasm-stack.cpp index fb24dbb01..b63ea0fb0 100644 --- a/src/wasm/wasm-stack.cpp +++ b/src/wasm/wasm-stack.cpp @@ -2234,6 +2234,29 @@ void BinaryInstWriter::visitRefAs(RefAs* curr) { } } +void BinaryInstWriter::visitStringNew(StringNew* curr) { + o << int8_t(BinaryConsts::GCPrefix); + switch (curr->op) { + case StringNewUTF8: + o << U32LEB(BinaryConsts::StringNewWTF8) + << U32LEB(BinaryConsts::StringNewPolicy::UTF8); + break; + case StringNewWTF8: + o << U32LEB(BinaryConsts::StringNewWTF8) + << U32LEB(BinaryConsts::StringNewPolicy::WTF8); + break; + case StringNewReplace: + o << U32LEB(BinaryConsts::StringNewWTF8) + << U32LEB(BinaryConsts::StringNewPolicy::Replace); + break; + case StringNewWTF16: + o << U32LEB(BinaryConsts::StringNewWTF16); + break; + default: + WASM_UNREACHABLE("invalid string.new*"); + } +} + void BinaryInstWriter::emitScopeEnd(Expression* curr) { assert(!breakStack.empty()); breakStack.pop_back(); |