Skip to content

Commit 47681c7

Browse files
osa1Commit Queue
authored andcommitted
[dart2wasm] Simplify UTF-8 decoder flag scanning
Simplify the VM-specific `scan` function that assumes an instruction called `Utf8ScanInstr` and scans the input in chunks to be able to use the instruction. Instead scan the whole input in one loop. Change-Id: I9c796e0728e46687653b623effb214ebc93cc01c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/395960 Commit-Queue: Ömer Ağacan <[email protected]> Reviewed-by: Martin Kustermann <[email protected]>
1 parent 3b707d5 commit 47681c7

File tree

1 file changed

+0
-21
lines changed

1 file changed

+0
-21
lines changed

sdk/lib/_internal/wasm/lib/convert_patch.dart

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1980,13 +1980,6 @@ class _Utf8Decoder {
19801980
82, 82, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,
19811981
]);
19821982

1983-
/// Max chunk to scan at a time.
1984-
///
1985-
/// Avoids staying away from safepoints too long.
1986-
/// The Utf8ScanInstr relies on this being small enough to ensure the
1987-
/// decoded length stays within Smi range.
1988-
static const int scanChunkSize = 65536;
1989-
19901983
/// Reset the decoder to a state where it is ready to decode a new string but
19911984
/// will not skip a leading BOM. Used by the fused UTF-8 / JSON decoder.
19921985
void reset() {
@@ -1995,20 +1988,6 @@ class _Utf8Decoder {
19951988
}
19961989

19971990
int scan(Uint8List bytes, int start, int end) {
1998-
// Assumes 0 <= start <= end <= bytes.length
1999-
int size = 0;
2000-
_scanFlags = 0;
2001-
int localStart = start;
2002-
while (end - localStart > scanChunkSize) {
2003-
int localEnd = localStart + scanChunkSize;
2004-
size += _scan(bytes, localStart, localEnd);
2005-
localStart = localEnd;
2006-
}
2007-
size += _scan(bytes, localStart, end);
2008-
return size;
2009-
}
2010-
2011-
int _scan(Uint8List bytes, int start, int end) {
20121991
int size = 0;
20131992
int flags = 0;
20141993
for (int i = start; i < end; i++) {

0 commit comments

Comments
 (0)