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 @@
'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-exchange64-stress': [PASS, SLOW, NO_VARIANTS],
'wasm/stringrefs-exec': [PASS, SLOW],
# 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]],
......@@ -362,7 +361,6 @@
'es6/regress/regress-crbug-465671-null': [SKIP],
'regress/regress-148378': [SKIP],
'regress/regress-crbug-762472': [SKIP],
'wasm/stringrefs-exec': [PASS, ['arch == arm64 and simulator_run', SKIP]],
# BUG(v8:10035)
'compiler/deopt-array-builtins': [SKIP],
......@@ -1272,12 +1270,6 @@
'regress/wasm/regress-7785': [SKIP],
}], # 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', {
# Tests taking too long.
......
......@@ -35,18 +35,20 @@ function encodeWtf8(str) {
return out;
}
let interestingStrings = ['',
'ascii',
'latin \xa9 1',
'two \ucccc byte',
'surrogate \ud800\udc000 pair',
'isolated \ud800 leading',
'isolated \udc00 trailing',
'\ud800 isolated leading at beginning',
'\udc00 isolated trailing at beginning',
'isolated leading at end \ud800',
'isolated trailing at end \udc00',
'swapped surrogate \udc00\ud800 pair'];
let interestingStrings = [
'',
'ascii',
'latin\xa91', // Latin-1.
'2 \ucccc b', // Two-byte.
'a \ud800\udc00 b', // Proper surrogate pair.
'a \ud800 b', // Lone lead surrogate.
'a \udc00 b', // Lone trail surrogate.
'\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) {
return 0xD800 <= codepoint && codepoint <= 0xDFFF
......
......@@ -88,18 +88,23 @@ function decodeWtf8(wtf8, start, end) {
return result;
}
let interestingStrings = ['',
'ascii',
'latin \xa9 1',
'two \ucccc byte',
'surrogate \ud800\udc00 pair',
'isolated \ud800 leading',
'isolated \udc00 trailing',
'\ud800 isolated leading at beginning',
'\udc00 isolated trailing at beginning',
'isolated leading at end \ud800',
'isolated trailing at end \udc00',
'swapped surrogate \udc00\ud800 pair'];
// We iterate over every one of these strings and every substring of it,
// so to keep test execution times fast on slow platforms, keep both this
// list and the individual strings reasonably short.
let interestingStrings = [
'',
'ascii',
'latin\xa91', // Latin-1.
'2 \ucccc b', // Two-byte.
'a \ud800\udc00 b', // Proper surrogate pair.
'a \ud800 b', // Lone lead surrogate.
'a \udc00 b', // Lone trail surrogate.
'\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) {
return 0xD800 <= codepoint && codepoint <= 0xDFFF
......@@ -936,29 +941,29 @@ function makeWtf16TestDataSegment() {
}
}
function checkEncoding(variant, str, slice, start, length) {
let all_bytes = encodeWtf8(str);
let bytes = encodeWtf8(slice);
function clearMemory(low, high) {
for (let i = low; i < high; i++) {
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++) {
assertEquals(0, memory[i]);
}
}
function assertMemoryBytesZero(low, high) {
for (let i = low; i < high; i++) {
assertEquals(0, memory[i]);
}
function checkMemory(offset, bytes) {
let slop = 64;
assertMemoryBytesZero(Math.max(0, offset - slop), offset);
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));
}
function checkMemory(offset, bytes) {
let slop = 16;
assertMemoryBytesZero(Math.max(0, offset - slop), offset);
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));
}
function checkEncoding(variant, str, slice, start, length) {
let all_bytes = encodeWtf8(str);
let bytes = encodeWtf8(slice);
let encode = instance.exports[`encode_${variant}`];
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