Debian Codegraph @

js/src/tests/non262/TypedArray/large-arrays.js

raw
1 // |reftest| slow skip-if(!xulRuntime.shell)
2
3 // Test that we can access TypedArrays beyond the 4GB mark, if large buffers are
4 // supported.
5
6 const gb = 1024 * 1024 * 1024;
7
8 if (largeArrayBufferSupported()) {
9 for (let TA of typedArrayConstructors) {
10 let ta = new TA(6*gb / TA.BYTES_PER_ELEMENT);
11
12 // Set element at the 5GB mark
13 ta[5*gb / TA.BYTES_PER_ELEMENT] = 37;
14
15 // Check that it was set
16 assertEq(ta[5*gb / TA.BYTES_PER_ELEMENT], 37);
17
18 // Check that we're not operating mod 4GB
19 assertEq(ta[1*gb / TA.BYTES_PER_ELEMENT], 0);
20 }
21 }
22
23 if (typeof reportCompare === "function")
24 reportCompare(true, true);