summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/function-references
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /js/src/jit-test/tests/wasm/function-references
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz
firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jit-test/tests/wasm/function-references')
-rw-r--r--js/src/jit-test/tests/wasm/function-references/as-non-null.js2
-rw-r--r--js/src/jit-test/tests/wasm/function-references/binary.js2
-rw-r--r--js/src/jit-test/tests/wasm/function-references/br-non-null.js2
-rw-r--r--js/src/jit-test/tests/wasm/function-references/br-null.js2
-rw-r--r--js/src/jit-test/tests/wasm/function-references/call_ref.js2
-rw-r--r--js/src/jit-test/tests/wasm/function-references/directives.txt2
-rw-r--r--js/src/jit-test/tests/wasm/function-references/disabled.js4
-rw-r--r--js/src/jit-test/tests/wasm/function-references/nnl-test.js2
-rw-r--r--js/src/jit-test/tests/wasm/function-references/non-nullable-table.js38
-rw-r--r--js/src/jit-test/tests/wasm/function-references/non-nullable.js2
-rw-r--r--js/src/jit-test/tests/wasm/function-references/reftype-parse.js32
11 files changed, 34 insertions, 56 deletions
diff --git a/js/src/jit-test/tests/wasm/function-references/as-non-null.js b/js/src/jit-test/tests/wasm/function-references/as-non-null.js
index 1280c8ee06..6fd02d61ac 100644
--- a/js/src/jit-test/tests/wasm/function-references/as-non-null.js
+++ b/js/src/jit-test/tests/wasm/function-references/as-non-null.js
@@ -1,4 +1,4 @@
-// |jit-test| skip-if: !wasmFunctionReferencesEnabled()
+// |jit-test| skip-if: !wasmGcEnabled()
let {checkNonNull} = wasmEvalText(`(module
(func (export "checkNonNull") (param externref) (result (ref extern))
diff --git a/js/src/jit-test/tests/wasm/function-references/binary.js b/js/src/jit-test/tests/wasm/function-references/binary.js
index 91cf807dc4..0e64f0723e 100644
--- a/js/src/jit-test/tests/wasm/function-references/binary.js
+++ b/js/src/jit-test/tests/wasm/function-references/binary.js
@@ -1,4 +1,4 @@
-// |jit-test| skip-if: !wasmFunctionReferencesEnabled()
+// |jit-test| skip-if: !wasmGcEnabled()
load(libdir + "wasm-binary.js");
diff --git a/js/src/jit-test/tests/wasm/function-references/br-non-null.js b/js/src/jit-test/tests/wasm/function-references/br-non-null.js
index 371cdaa40a..6d359105fb 100644
--- a/js/src/jit-test/tests/wasm/function-references/br-non-null.js
+++ b/js/src/jit-test/tests/wasm/function-references/br-non-null.js
@@ -1,4 +1,4 @@
-// |jit-test| skip-if: !wasmFunctionReferencesEnabled()
+// |jit-test| skip-if: !wasmGcEnabled()
// br_on_non_null from constant
wasmValidateText(`(module
diff --git a/js/src/jit-test/tests/wasm/function-references/br-null.js b/js/src/jit-test/tests/wasm/function-references/br-null.js
index 26d1013de2..08728a3644 100644
--- a/js/src/jit-test/tests/wasm/function-references/br-null.js
+++ b/js/src/jit-test/tests/wasm/function-references/br-null.js
@@ -1,4 +1,4 @@
-// |jit-test| skip-if: !wasmFunctionReferencesEnabled()
+// |jit-test| skip-if: !wasmGcEnabled()
// br_on_null from constant
wasmValidateText(`(module
diff --git a/js/src/jit-test/tests/wasm/function-references/call_ref.js b/js/src/jit-test/tests/wasm/function-references/call_ref.js
index 514c3145d6..50bdfb6441 100644
--- a/js/src/jit-test/tests/wasm/function-references/call_ref.js
+++ b/js/src/jit-test/tests/wasm/function-references/call_ref.js
@@ -1,4 +1,4 @@
-// |jit-test| skip-if: !wasmFunctionReferencesEnabled()
+// |jit-test| skip-if: !wasmGcEnabled()
let { plusOne } = wasmEvalText(`(module
(; forward declaration so that ref.func works ;)
diff --git a/js/src/jit-test/tests/wasm/function-references/directives.txt b/js/src/jit-test/tests/wasm/function-references/directives.txt
index f7d2135421..293724e57a 100644
--- a/js/src/jit-test/tests/wasm/function-references/directives.txt
+++ b/js/src/jit-test/tests/wasm/function-references/directives.txt
@@ -1 +1 @@
-|jit-test| test-also=--wasm-compiler=optimizing --wasm-function-references; test-also=--wasm-compiler=baseline --wasm-function-references; include:wasm.js
+|jit-test| test-also=--setpref=wasm_gc=true; test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; include:wasm.js
diff --git a/js/src/jit-test/tests/wasm/function-references/disabled.js b/js/src/jit-test/tests/wasm/function-references/disabled.js
index 70a66a937d..6e67d2ce7f 100644
--- a/js/src/jit-test/tests/wasm/function-references/disabled.js
+++ b/js/src/jit-test/tests/wasm/function-references/disabled.js
@@ -1,8 +1,8 @@
-// |jit-test| skip-if: wasmFunctionReferencesEnabled()
+// |jit-test| skip-if: wasmGcEnabled()
const { CompileError, validate } = WebAssembly;
-const UNRECOGNIZED_OPCODE_OR_BAD_TYPE = /unrecognized opcode|bad type|\(ref T\) types not enabled/;
+const UNRECOGNIZED_OPCODE_OR_BAD_TYPE = /unrecognized opcode|bad type|gc not enabled/;
let simpleTests = [
`(module (func (param (ref 0)) (unreachable)))`,
diff --git a/js/src/jit-test/tests/wasm/function-references/nnl-test.js b/js/src/jit-test/tests/wasm/function-references/nnl-test.js
index 9436b970d5..df79a748a9 100644
--- a/js/src/jit-test/tests/wasm/function-references/nnl-test.js
+++ b/js/src/jit-test/tests/wasm/function-references/nnl-test.js
@@ -1,4 +1,4 @@
-// |jit-test| skip-if: !wasmFunctionReferencesEnabled()
+// |jit-test| skip-if: !wasmGcEnabled()
// Generates combinations of different block types and operations for
// non-defaultable locals (local.set / .tee / .get).
diff --git a/js/src/jit-test/tests/wasm/function-references/non-nullable-table.js b/js/src/jit-test/tests/wasm/function-references/non-nullable-table.js
index 97ab04713c..4efdfcd642 100644
--- a/js/src/jit-test/tests/wasm/function-references/non-nullable-table.js
+++ b/js/src/jit-test/tests/wasm/function-references/non-nullable-table.js
@@ -1,4 +1,4 @@
-// |jit-test| skip-if: !wasmFunctionReferencesEnabled()
+// |jit-test| skip-if: !wasmGcEnabled()
// non-null table initialization
var { get1, get2, get3, get4 } = wasmEvalText(`(module
@@ -40,25 +40,33 @@ for (let i of [
)`, /(type mismatch|table with non-nullable references requires initializer)/);
}
-var t1 = new WebAssembly.Table({initial: 10, element: {ref: 'func', nullable: false }}, sampleWasmFunction);
+let values = "10 funcref (ref.func $dummy)";
+let t1 = new wasmEvalText(`(module (func $dummy) (table (export "t1") ${values}))`).exports.t1;
assertEq(t1.get(2) != null, true);
-assertThrows(() => {
- new WebAssembly.Table({initial: 10, element: {ref: 'func', nullable: false }});
-});
-assertThrows(() => {
- new WebAssembly.Table({initial: 10, element: {ref: 'func', nullable: false }}, null);
-});
-var t2 = new WebAssembly.Table({initial: 6, maximum: 20, element: {ref: 'extern', nullable: false }}, {foo: "bar"});
-assertEq(t2.get(1).foo, "bar");
+wasmFailValidateText(`(module
+ (table $t 10 (ref func))
+)`, /table with non-nullable references requires initializer/);
+
+wasmFailValidateText(`
+(module
+ (func $dummy)
+ (table (export "t") 10 funcref (ref.null none))
+)`, /type mismatch/);
+
+const foo = "bar";
+const { t2, get } = wasmEvalText(`
+(module
+ (global (import "" "foo") externref)
+ (table (export "t2") 6 20 externref (global.get 0))
+)`, { "": { "foo": foo } }).exports;
+
+assertEq(t2.get(5), "bar");
assertThrows(() => { t2.get(7) });
-assertThrows(() => { t2.grow(9, null) });
+assertThrows(() => { t2.grow(30, null) });
t2.grow(8, {t: "test"});
-assertEq(t2.get(3).foo, "bar");
+assertEq(t2.get(3), "bar");
assertEq(t2.get(7).t, "test");
-assertThrows(() => {
- new WebAssembly.Table({initial: 10, element: {ref: 'extern', nullable: false }}, null);
-});
// Fail because tables come before globals in the binary format, so tables
// cannot refer to globals.
diff --git a/js/src/jit-test/tests/wasm/function-references/non-nullable.js b/js/src/jit-test/tests/wasm/function-references/non-nullable.js
index afe1d3cb43..653bbe7ab6 100644
--- a/js/src/jit-test/tests/wasm/function-references/non-nullable.js
+++ b/js/src/jit-test/tests/wasm/function-references/non-nullable.js
@@ -1,4 +1,4 @@
-// |jit-test| skip-if: !wasmFunctionReferencesEnabled()
+// |jit-test| skip-if: !wasmGcEnabled()
// non-null values are subtype of null values
wasmValidateText(`(module
diff --git a/js/src/jit-test/tests/wasm/function-references/reftype-parse.js b/js/src/jit-test/tests/wasm/function-references/reftype-parse.js
index 643f753ec8..f4cca7cb74 100644
--- a/js/src/jit-test/tests/wasm/function-references/reftype-parse.js
+++ b/js/src/jit-test/tests/wasm/function-references/reftype-parse.js
@@ -1,4 +1,4 @@
-// |jit-test| skip-if: !wasmFunctionReferencesEnabled()
+// |jit-test| skip-if: !wasmGcEnabled()
// RefType/ValueType as a simple string
const t01 = new WebAssembly.Table({element: 'funcref', initial: 3});
@@ -16,36 +16,6 @@ assertErrorMessage(
assertErrorMessage(
() => new WebAssembly.Table({element: true, initial: 1}),
TypeError, /bad value type/);
-
-// RefType/ValueType can be specified as an {ref: 'func', ...} object
-const t11 = new WebAssembly.Table({element: {ref: 'func', nullable: true}, initial: 3});
-const t12 = new WebAssembly.Table({element: {ref: 'extern', nullable: true}, initial: 3});
-const t13 = new WebAssembly.Table({element: {ref: 'extern', nullable: false}, initial: 3}, {});
-
-assertErrorMessage(
- () => new WebAssembly.Table({element: {ref: 'func', nullable: false}, initial: 1}, null),
- TypeError, /cannot pass null to non-nullable WebAssembly reference/);
-assertErrorMessage(
- () => new WebAssembly.Table({element: {ref: 'extern', nullable: false}, initial: 1}, null),
- TypeError, /cannot pass null to non-nullable WebAssembly reference/);
-
-assertErrorMessage(
- () => new WebAssembly.Table({element: {ref: 'bar', nullable: true}, initial: 1}),
- TypeError, /bad value type/);
-
-const g11 = new WebAssembly.Global({value: {ref: 'func', nullable: true}, mutable: true});
-const g12 = new WebAssembly.Global({value: {ref: 'extern', nullable: true}, mutable: true});
-const g13 = new WebAssembly.Global({value: {ref: 'extern', nullable: false}, mutable: true}, {});
-const g14 = new WebAssembly.Global({value: {ref: 'extern', nullable: false}, mutable: true});
-const g15 = new WebAssembly.Global({value: {ref: 'extern', nullable: false}, mutable: true}, void 0);
-
-assertErrorMessage(
- () => new WebAssembly.Global({value: {ref: 'func', nullable: false}, mutable: true}),
- TypeError, /cannot pass null to non-nullable WebAssembly reference/);
-assertErrorMessage(
- () => new WebAssembly.Global({value: {ref: 'extern', nullable: false}, mutable: true}, null),
- TypeError, /cannot pass null to non-nullable WebAssembly reference/);
-
assertErrorMessage(
() => new WebAssembly.Global({value: {ref: 'bar', nullable: true}, mutable: true}),
TypeError, /bad value type/);