File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -2293,6 +2293,14 @@ void BinaryInstWriter::visitRefAs(RefAs* curr) {
22932293}
22942294
22952295void BinaryInstWriter::visitStringNew (StringNew* curr) {
2296+ if (curr->ptr ->type .isNull ()) {
2297+ // This is a bottom type, so this is an array-receiving operation that does
2298+ // not receive an array. The spec allows this, but V8 does not, see
2299+ // https://github.com/WebAssembly/stringref/issues/66
2300+ // For now, just emit an unreachable here as this will definitely trap.
2301+ emitUnreachable ();
2302+ return ;
2303+ }
22962304 o << int8_t (BinaryConsts::GCPrefix);
22972305 switch (curr->op ) {
22982306 case StringNewUTF8:
@@ -2371,6 +2379,11 @@ void BinaryInstWriter::visitStringMeasure(StringMeasure* curr) {
23712379}
23722380
23732381void BinaryInstWriter::visitStringEncode (StringEncode* curr) {
2382+ if (curr->ptr ->type .isNull ()) {
2383+ // See visitStringNew.
2384+ emitUnreachable ();
2385+ return ;
2386+ }
23742387 o << int8_t (BinaryConsts::GCPrefix);
23752388 switch (curr->op ) {
23762389 case StringEncodeUTF8:
You can’t perform that action at this time.
0 commit comments