MCPcopy Create free account
hub / github.com/nodejs/node / VerifyBoundsCheck64

Function VerifyBoundsCheck64

deps/v8/test/mjsunit/wasm/atomics.js:114–129  ·  view source on GitHub ↗
(func, memtype_size)

Source from the content-addressed store, hash-verified

112}
113
114function VerifyBoundsCheck64(func, memtype_size) {
115 const kPageSize = 65536;
116 // Test out of bounds at boundary
117 for (let i = memory.buffer.byteLength - memtype_size + 1;
118 i < memory.buffer.byteLength + memtype_size + 4; i++) {
119 assertTrapsOneOf(
120 // If an underlying platform uses traps for a bounds check,
121 // kTrapUnalignedAccess will be thrown before kTrapMemOutOfBounds.
122 // Otherwise, kTrapMemOutOfBounds will be first.
123 [kTrapMemOutOfBounds, kTrapUnalignedAccess],
124 () => func(i, 5n, 10n)
125 );
126 }
127 // Test out of bounds at maximum + 1
128 assertTraps(kTrapMemOutOfBounds, () => func((maxSize + 1) * kPageSize, 5n, 1n));
129}
130
131function VerifyBoundsCheck(func, memtype_size) {
132 const kPageSize = 65536;

Callers 4

Test64OpFunction · 0.85
Test32Op64Function · 0.85
Test16Op64Function · 0.85
Test8Op64Function · 0.85

Calls 3

assertTrapsOneOfFunction · 0.85
funcFunction · 0.70
assertTrapsFunction · 0.70

Tested by

no test coverage detected