summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/TypedArray/large-arrays.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--js/src/tests/non262/TypedArray/large-arrays.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/js/src/tests/non262/TypedArray/large-arrays.js b/js/src/tests/non262/TypedArray/large-arrays.js
new file mode 100644
index 0000000000..feb0e05ac6
--- /dev/null
+++ b/js/src/tests/non262/TypedArray/large-arrays.js
@@ -0,0 +1,24 @@
+// |reftest| skip-if(!xulRuntime.shell)
+
+// Test that we can access TypedArrays beyond the 4GB mark, if large buffers are
+// supported.
+
+const gb = 1024 * 1024 * 1024;
+
+if (largeArrayBufferSupported()) {
+ for (let TA of typedArrayConstructors) {
+ let ta = new TA(6*gb / TA.BYTES_PER_ELEMENT);
+
+ // Set element at the 5GB mark
+ ta[5*gb / TA.BYTES_PER_ELEMENT] = 37;
+
+ // Check that it was set
+ assertEq(ta[5*gb / TA.BYTES_PER_ELEMENT], 37);
+
+ // Check that we're not operating mod 4GB
+ assertEq(ta[1*gb / TA.BYTES_PER_ELEMENT], 0);
+ }
+}
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);