// Cloned from memory.js but kept separate because it may have to be disabled on // some devices until bugs are fixed.
// Bug 1666747 - partially OOB unaligned stores are not handled correctly on ARM // and ARM64. The simulators don't implement the correct semantics anyhow, so // when the bug is fixed in the code generator they must remain excluded here. var excluded = getBuildConfiguration("arm64") ||
getBuildConfiguration("arm64-simulator") ||
getBuildConfiguration("arm") ||
getBuildConfiguration("arm-simulator"); var thirtytwobit = getBuildConfiguration("pointer-byte-size") == 4;
function storeModule(type, ext, offset, align, exportBox = null) {
let exports = wasmEvalText(storeModuleSrc(type, ext, offset, align)).exports; if (exportBox !== null)
exportBox.exports = exports; return exports;
}
function testStoreOOB(type, ext, base, offset, align, value) {
let exportBox = {}; if (type === 'i64') {
assertErrorMessage(() => wasmAssert(
storeModuleSrc(type, ext, offset, align),
[{type, func: '$store', args: [`i32.const ${base}`, `i64.const ${value}`]}],
{},
exportBox
), RuntimeError, /index out of bounds/);
} else {
assertErrorMessage(() => storeModule(type, ext, offset, align, exportBox).store(base, value),
RuntimeError,
/index out of bounds/);
}
// Check that there were no partial writes at the end of the memory.
let buf = new Int8Array(exportBox.exports.mem.buffer);
let len = buf.length; for ( let addr = base + offset ; addr < len; addr++ )
assertEq(buf[addr], 0);
}
// Test bounds checks and edge cases.
for (let align of [0,1,2,4]) {
for (let offset of [0, 1, 2, 3, 4, 8, 16, 41, 0xfff0, 0xfff8]) { // Accesses of 1 byte.
let lastValidIndex = 0x10000 - 1 - offset; if (align < 2 && !excluded) {
testStoreOOB('i32', '8', lastValidIndex + 1, offset, align, -42);
}
// On 32-bit platforms, a declared-aligned i64 store is implemented as two // presumed-aligned 32-bit stores. This tests that we don't store the low // word before the high word if the low word is in-bounds but the high word // is not. if (thirtytwobit) {
testStoreOOB('i64', '', 0x10000 - 4, 0, 0, '0x0123456789abcdef');
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.20 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.