summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/multi-memory
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /js/src/jit-test/tests/wasm/multi-memory
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jit-test/tests/wasm/multi-memory')
-rw-r--r--js/src/jit-test/tests/wasm/multi-memory/directives.txt2
-rw-r--r--js/src/jit-test/tests/wasm/multi-memory/memory_copy.js45
2 files changed, 47 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/wasm/multi-memory/directives.txt b/js/src/jit-test/tests/wasm/multi-memory/directives.txt
new file mode 100644
index 0000000000..44374e8ceb
--- /dev/null
+++ b/js/src/jit-test/tests/wasm/multi-memory/directives.txt
@@ -0,0 +1,2 @@
+|jit-test| --wasm-multi-memory; test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; include:wasm.js; skip-if: !wasmMultiMemoryEnabled()
+
diff --git a/js/src/jit-test/tests/wasm/multi-memory/memory_copy.js b/js/src/jit-test/tests/wasm/multi-memory/memory_copy.js
new file mode 100644
index 0000000000..e619200337
--- /dev/null
+++ b/js/src/jit-test/tests/wasm/multi-memory/memory_copy.js
@@ -0,0 +1,45 @@
+
+// A simple test case for memory.copy between different memories.
+// See bug 1861267.
+
+let i = wasmEvalText(
+`(module
+ (memory $$mem0 (data "staubfaenger"))
+ (memory $$mem1 (data "\\ee\\22\\55\\ff"))
+ (memory $$mem2 (data "\\dd\\33\\66\\00"))
+ (memory $$mem3 (data "schnickschnack"))
+
+ (func (export "copy0to3") (param i32 i32 i32)
+ (memory.copy $$mem3 $$mem0
+ (local.get 0)
+ (local.get 1)
+ (local.get 2))
+ )
+ (func (export "copy3to0") (param i32 i32 i32)
+ (memory.copy $$mem0 $$mem3
+ (local.get 0)
+ (local.get 1)
+ (local.get 2))
+ )
+
+ (func (export "read0") (param i32) (result i32)
+ (i32.load8_u $$mem0 (local.get 0))
+ )
+ (func (export "read3") (param i32) (result i32)
+ (i32.load8_u $$mem3 (local.get 0))
+ )
+)`);
+
+i.exports.copy0to3(4, 5, 6);
+let s = "";
+for (let ix = 0; ix < 14; ix++) {
+ s = s + String.fromCharCode(i.exports.read3(ix));
+}
+
+i.exports.copy3to0(8, 2, 7);
+s = s + "_";
+for (let ix = 0; ix < 12; ix++) {
+ s = s + String.fromCharCode(i.exports.read0(ix));
+}
+
+assertEq(s, "schnfaengenack_staubfaehnfa");