From 2b31aeb98a0fc8a5a505b3998d44990ed14e8c38 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 14 Jul 2022 17:10:15 -0700 Subject: [Strings] stringview_*.slice (#4805) Unfortunately one slice is the same as python [start:end], using 2 params, and the other slice is one param, [CURR:CURR+num] (where CURR is implied by the current state in the iter). So we can't use a single class here. Perhaps a different name would be good, like slice vs substring (like JS does), but I picked names to match the current spec. --- src/wasm-binary.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/wasm-binary.h') diff --git a/src/wasm-binary.h b/src/wasm-binary.h index 9c5d6cd98..ba8d547d8 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -1149,12 +1149,15 @@ enum ASTNodes { StringIsUSV = 0x8a, StringAsWTF8 = 0x90, StringViewWTF8Advance = 0x91, + StringViewWTF8Slice = 0x93, StringAsWTF16 = 0x98, StringViewWTF16GetCodePoint = 0x9a, + StringViewWTF16Slice = 0x9c, StringAsIter = 0xa0, StringViewIterNext = 0xa1, StringViewIterAdvance = 0xa2, StringViewIterRewind = 0xa3, + StringViewIterSlice = 0xa4, }; enum MemoryAccess { @@ -1746,6 +1749,8 @@ public: bool maybeVisitStringWTF16Get(Expression*& out, uint32_t code); bool maybeVisitStringIterNext(Expression*& out, uint32_t code); bool maybeVisitStringIterMove(Expression*& out, uint32_t code); + bool maybeVisitStringSliceWTF(Expression*& out, uint32_t code); + bool maybeVisitStringSliceIter(Expression*& out, uint32_t code); void visitSelect(Select* curr, uint8_t code); void visitReturn(Return* curr); void visitMemorySize(MemorySize* curr); -- cgit v1.2.3