Commit 2d4f043a authored by Jakob Kummerow's avatar Jakob Kummerow Committed by V8 LUCI CQ

[stringrefs][test] Speed up stringrefs-exec test

By about 10x-20x depending on platform and configuration.
Shorter test strings make the set of all possible substrings
considerably smaller.

Fixed: v8:13074
Bug: v8:12868
Change-Id: I46ae94fbcba43080d06b1b825feae6b2acf819d1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3763861Reviewed-by: 's avatarAndy Wingo <wingo@igalia.com>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81753}
parent ffd3a9d4
...@@ -167,7 +167,6 @@ ...@@ -167,7 +167,6 @@
'wasm/atomics64-stress': [PASS, SLOW, NO_VARIANTS, ['mode != release or dcheck_always_on', SKIP], ['tsan', SKIP]], 'wasm/atomics64-stress': [PASS, SLOW, NO_VARIANTS, ['mode != release or dcheck_always_on', SKIP], ['tsan', SKIP]],
'wasm/compare-exchange-stress': [PASS, SLOW, NO_VARIANTS], 'wasm/compare-exchange-stress': [PASS, SLOW, NO_VARIANTS],
'wasm/compare-exchange64-stress': [PASS, SLOW, NO_VARIANTS], 'wasm/compare-exchange64-stress': [PASS, SLOW, NO_VARIANTS],
'wasm/stringrefs-exec': [PASS, SLOW],
# Very slow on ARM, MIPS, RISCV and LOONG, contains no architecture dependent code. # Very slow on ARM, MIPS, RISCV and LOONG, contains no architecture dependent code.
'unicode-case-overoptimization0': [PASS, NO_VARIANTS, ['arch in (arm, arm64, mipsel, mips64el, mips64, mips, riscv64, loong64)', SKIP]], 'unicode-case-overoptimization0': [PASS, NO_VARIANTS, ['arch in (arm, arm64, mipsel, mips64el, mips64, mips, riscv64, loong64)', SKIP]],
...@@ -362,7 +361,6 @@ ...@@ -362,7 +361,6 @@
'es6/regress/regress-crbug-465671-null': [SKIP], 'es6/regress/regress-crbug-465671-null': [SKIP],
'regress/regress-148378': [SKIP], 'regress/regress-148378': [SKIP],
'regress/regress-crbug-762472': [SKIP], 'regress/regress-crbug-762472': [SKIP],
'wasm/stringrefs-exec': [PASS, ['arch == arm64 and simulator_run', SKIP]],
# BUG(v8:10035) # BUG(v8:10035)
'compiler/deopt-array-builtins': [SKIP], 'compiler/deopt-array-builtins': [SKIP],
...@@ -1272,12 +1270,6 @@ ...@@ -1272,12 +1270,6 @@
'regress/wasm/regress-7785': [SKIP], 'regress/wasm/regress-7785': [SKIP],
}], # variant == nooptimization }], # variant == nooptimization
##############################################################################
['variant in (nooptimization, turboshaft)', {
# Slow test:
'wasm/stringrefs-exec': [PASS, ['arch in (arm, arm64) and simulator_run and mode == debug', SKIP]],
}], # variant in (nooptimization, turboshaft)
############################################################################## ##############################################################################
['gcov_coverage', { ['gcov_coverage', {
# Tests taking too long. # Tests taking too long.
......
...@@ -35,18 +35,20 @@ function encodeWtf8(str) { ...@@ -35,18 +35,20 @@ function encodeWtf8(str) {
return out; return out;
} }
let interestingStrings = ['', let interestingStrings = [
'ascii', '',
'latin \xa9 1', 'ascii',
'two \ucccc byte', 'latin\xa91', // Latin-1.
'surrogate \ud800\udc000 pair', '2 \ucccc b', // Two-byte.
'isolated \ud800 leading', 'a \ud800\udc00 b', // Proper surrogate pair.
'isolated \udc00 trailing', 'a \ud800 b', // Lone lead surrogate.
'\ud800 isolated leading at beginning', 'a \udc00 b', // Lone trail surrogate.
'\udc00 isolated trailing at beginning', '\ud800 bc', // Lone lead surrogate at the start.
'isolated leading at end \ud800', '\udc00 bc', // Lone trail surrogate at the start.
'isolated trailing at end \udc00', 'ab \ud800', // Lone lead surrogate at the end.
'swapped surrogate \udc00\ud800 pair']; 'ab \udc00', // Lone trail surrogate at the end.
'a \udc00\ud800 b', // Swapped surrogate pair.
];
function IsSurrogate(codepoint) { function IsSurrogate(codepoint) {
return 0xD800 <= codepoint && codepoint <= 0xDFFF return 0xD800 <= codepoint && codepoint <= 0xDFFF
......
...@@ -88,18 +88,23 @@ function decodeWtf8(wtf8, start, end) { ...@@ -88,18 +88,23 @@ function decodeWtf8(wtf8, start, end) {
return result; return result;
} }
let interestingStrings = ['', // We iterate over every one of these strings and every substring of it,
'ascii', // so to keep test execution times fast on slow platforms, keep both this
'latin \xa9 1', // list and the individual strings reasonably short.
'two \ucccc byte', let interestingStrings = [
'surrogate \ud800\udc00 pair', '',
'isolated \ud800 leading', 'ascii',
'isolated \udc00 trailing', 'latin\xa91', // Latin-1.
'\ud800 isolated leading at beginning', '2 \ucccc b', // Two-byte.
'\udc00 isolated trailing at beginning', 'a \ud800\udc00 b', // Proper surrogate pair.
'isolated leading at end \ud800', 'a \ud800 b', // Lone lead surrogate.
'isolated trailing at end \udc00', 'a \udc00 b', // Lone trail surrogate.
'swapped surrogate \udc00\ud800 pair']; '\ud800 bc', // Lone lead surrogate at the start.
'\udc00 bc', // Lone trail surrogate at the start.
'ab \ud800', // Lone lead surrogate at the end.
'ab \udc00', // Lone trail surrogate at the end.
'a \udc00\ud800 b', // Swapped surrogate pair.
];
function IsSurrogate(codepoint) { function IsSurrogate(codepoint) {
return 0xD800 <= codepoint && codepoint <= 0xDFFF return 0xD800 <= codepoint && codepoint <= 0xDFFF
...@@ -936,29 +941,29 @@ function makeWtf16TestDataSegment() { ...@@ -936,29 +941,29 @@ function makeWtf16TestDataSegment() {
} }
} }
function checkEncoding(variant, str, slice, start, length) { function clearMemory(low, high) {
let all_bytes = encodeWtf8(str); for (let i = low; i < high; i++) {
let bytes = encodeWtf8(slice); memory[i] = 0;
function clearMemory(low, high) {
for (let i = low; i < high; i++) {
memory[i] = 0;
}
} }
function assertMemoryBytesZero(low, high) { }
for (let i = low; i < high; i++) { function assertMemoryBytesZero(low, high) {
assertEquals(0, memory[i]); for (let i = low; i < high; i++) {
} assertEquals(0, memory[i]);
} }
function checkMemory(offset, bytes) { }
let slop = 64; function checkMemory(offset, bytes) {
assertMemoryBytesZero(Math.max(0, offset - slop), offset); let slop = 16;
for (let i = 0; i < bytes.length; i++) { assertMemoryBytesZero(Math.max(0, offset - slop), offset);
assertEquals(bytes[i], memory[offset + i]); for (let i = 0; i < bytes.length; i++) {
} assertEquals(bytes[i], memory[offset + i]);
assertMemoryBytesZero(offset + bytes.length,
Math.min(memory.length,
offset + bytes.length + slop));
} }
assertMemoryBytesZero(offset + bytes.length,
Math.min(memory.length,
offset + bytes.length + slop));
}
function checkEncoding(variant, str, slice, start, length) {
let all_bytes = encodeWtf8(str);
let bytes = encodeWtf8(slice);
let encode = instance.exports[`encode_${variant}`]; let encode = instance.exports[`encode_${variant}`];
let expected_start = Wtf8PositionTreatment(all_bytes, start); let expected_start = Wtf8PositionTreatment(all_bytes, start);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment