diff options
Diffstat (limited to 'src/passes/StringLowering.cpp')
-rw-r--r-- | src/passes/StringLowering.cpp | 40 |
1 files changed, 6 insertions, 34 deletions
diff --git a/src/passes/StringLowering.cpp b/src/passes/StringLowering.cpp index 5b5a5b551..27f4e9c07 100644 --- a/src/passes/StringLowering.cpp +++ b/src/passes/StringLowering.cpp @@ -269,12 +269,8 @@ struct StringLowering : public StringGathering { void updateTypes(Module* module) { TypeMapper::TypeUpdates updates; - // There is no difference between strings and views with imported strings: - // they are all just JS strings, so they all turn into externref. + // Strings turn into externref. updates[HeapType::string] = HeapType::ext; - updates[HeapType::stringview_wtf8] = HeapType::ext; - updates[HeapType::stringview_wtf16] = HeapType::ext; - updates[HeapType::stringview_iter] = HeapType::ext; // The module may have its own array16 type inside a big rec group, but // imported strings expects that type in its own rec group as part of the @@ -397,18 +393,6 @@ struct StringLowering : public StringGathering { lowering.concatImport, {curr->left, curr->right}, lowering.nnExt)); } - void visitStringAs(StringAs* curr) { - // There is no difference between strings and views with imported - // strings: they are all just JS strings, so no conversion is needed. - // However, we must keep the same nullability: the output of StringAs - // must be non-nullable. - auto* ref = curr->ref; - if (ref->type.isNullable()) { - ref = Builder(*getModule()).makeRefAs(RefAsNonNull, ref); - } - replaceCurrent(ref); - } - void visitStringEncode(StringEncode* curr) { Builder builder(*getModule()); switch (curr->op) { @@ -440,14 +424,8 @@ struct StringLowering : public StringGathering { void visitStringMeasure(StringMeasure* curr) { Builder builder(*getModule()); - switch (curr->op) { - case StringMeasureWTF16View: - replaceCurrent( - builder.makeCall(lowering.lengthImport, {curr->ref}, Type::i32)); - return; - default: - WASM_UNREACHABLE("invalid string.measure*"); - } + replaceCurrent( + builder.makeCall(lowering.lengthImport, {curr->ref}, Type::i32)); } void visitStringWTF16Get(StringWTF16Get* curr) { @@ -458,15 +436,9 @@ struct StringLowering : public StringGathering { void visitStringSliceWTF(StringSliceWTF* curr) { Builder builder(*getModule()); - switch (curr->op) { - case StringSliceWTF16: - replaceCurrent(builder.makeCall(lowering.substringImport, - {curr->ref, curr->start, curr->end}, - lowering.nnExt)); - return; - default: - WASM_UNREACHABLE("TODO: all string.slice*"); - } + replaceCurrent(builder.makeCall(lowering.substringImport, + {curr->ref, curr->start, curr->end}, + lowering.nnExt)); } }; |