summaryrefslogtreecommitdiff
path: root/test/binaryen.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/binaryen.js')
-rw-r--r--test/binaryen.js/exception-handling.js.txt8
-rw-r--r--test/binaryen.js/expressions.js31
-rw-r--r--test/binaryen.js/expressions.js.txt6
-rw-r--r--test/binaryen.js/kitchen-sink.js9
-rw-r--r--test/binaryen.js/kitchen-sink.js.txt24
5 files changed, 69 insertions, 9 deletions
diff --git a/test/binaryen.js/exception-handling.js.txt b/test/binaryen.js/exception-handling.js.txt
index ab545aac9..a586691d3 100644
--- a/test/binaryen.js/exception-handling.js.txt
+++ b/test/binaryen.js/exception-handling.js.txt
@@ -28,7 +28,7 @@
)
)
-getExpressionInfo(throw) = {"id":44,"type":1,"event":"e"}
-getExpressionInfo(br_on_exn) = {"id":46,"type":9,"name":"l","event":"e"}
-getExpressionInfo(rethrow) = {"id":45,"type":1}
-getExpressionInfo(try) = {"id":43,"type":0}
+getExpressionInfo(throw) = {"id":45,"type":1,"event":"e"}
+getExpressionInfo(br_on_exn) = {"id":47,"type":9,"name":"l","event":"e"}
+getExpressionInfo(rethrow) = {"id":46,"type":1}
+getExpressionInfo(try) = {"id":44,"type":0}
diff --git a/test/binaryen.js/expressions.js b/test/binaryen.js/expressions.js
index b9a9a24fb..a97097afe 100644
--- a/test/binaryen.js/expressions.js
+++ b/test/binaryen.js/expressions.js
@@ -1400,6 +1400,37 @@ console.log("# RefFunc");
module.dispose();
})();
+console.log("# RefEq");
+(function testRefEq() {
+ const module = new binaryen.Module();
+
+ var left = module.local.get(0, binaryen.eqref);
+ var right = module.local.get(1, binaryen.eqref);
+ const theRefEq = binaryen.RefEq(module.ref.eq(left, right));
+ assert(theRefEq instanceof binaryen.RefEq);
+ assert(theRefEq instanceof binaryen.Expression);
+ assert(theRefEq.left === left);
+ assert(theRefEq.right === right);
+ assert(theRefEq.type === binaryen.i32);
+
+ theRefEq.left = left = module.local.get(2, binaryen.eqref);
+ assert(theRefEq.left === left);
+ theRefEq.right = right = module.local.get(3, binaryen.eqref);
+ assert(theRefEq.right === right);
+ theRefEq.type = binaryen.f64;
+ theRefEq.finalize();
+ assert(theRefEq.type === binaryen.i32);
+
+ console.log(theRefEq.toText());
+ assert(
+ theRefEq.toText()
+ ==
+ "(ref.eq\n (local.get $2)\n (local.get $3)\n)\n"
+ );
+
+ module.dispose();
+})();
+
console.log("# Try");
(function testTry() {
const module = new binaryen.Module();
diff --git a/test/binaryen.js/expressions.js.txt b/test/binaryen.js/expressions.js.txt
index a8946875a..22c4f2747 100644
--- a/test/binaryen.js/expressions.js.txt
+++ b/test/binaryen.js/expressions.js.txt
@@ -210,6 +210,12 @@
# RefFunc
(ref.func $b)
+# RefEq
+(ref.eq
+ (local.get $2)
+ (local.get $3)
+)
+
# Try
(try (result i32)
(do
diff --git a/test/binaryen.js/kitchen-sink.js b/test/binaryen.js/kitchen-sink.js
index 342315682..69c812bf7 100644
--- a/test/binaryen.js/kitchen-sink.js
+++ b/test/binaryen.js/kitchen-sink.js
@@ -155,11 +155,15 @@ function test_ids() {
console.log("DataDropId: " + binaryen.DataDropId);
console.log("MemoryCopyId: " + binaryen.MemoryCopyId);
console.log("MemoryFillId: " + binaryen.MemoryFillId);
+ console.log("PopId: " + binaryen.PopId);
+ console.log("RefNullId: " + binaryen.RefNullId);
+ console.log("RefIsNullId: " + binaryen.RefIsNullId);
+ console.log("RefFuncId: " + binaryen.RefFuncId);
+ console.log("RefEqId: " + binaryen.RefEqId);
console.log("TryId: " + binaryen.TryId);
console.log("ThrowId: " + binaryen.ThrowId);
console.log("RethrowId: " + binaryen.RethrowId);
console.log("BrOnExnId: " + binaryen.BrOnExnId);
- console.log("PopId: " + binaryen.PopId);
}
function test_core() {
@@ -521,6 +525,9 @@ function test_core() {
module.ref.is_null(module.ref.func("kitchen()sinker")),
module.select(temp10, module.ref.null(binaryen.funcref), module.ref.func("kitchen()sinker"), binaryen.funcref),
+ // GC
+ module.ref.eq(module.ref.null(binaryen.eqref), module.ref.null(binaryen.eqref)),
+
// Exception handling
module.try(
module.throw("a-event", [module.i32.const(0)]),
diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt
index 413a2236c..b94811be5 100644
--- a/test/binaryen.js/kitchen-sink.js.txt
+++ b/test/binaryen.js/kitchen-sink.js.txt
@@ -79,11 +79,15 @@ MemoryInitId: 35
DataDropId: 36
MemoryCopyId: 37
MemoryFillId: 38
-TryId: 43
-ThrowId: 44
-RethrowId: 45
-BrOnExnId: 46
PopId: 39
+RefNullId: 40
+RefIsNullId: 41
+RefFuncId: 42
+RefEqId: 43
+TryId: 44
+ThrowId: 45
+RethrowId: 46
+BrOnExnId: 47
getExpressionInfo={"id":15,"type":4,"op":6}
(f32.neg
(f32.const -33.61199951171875)
@@ -1841,6 +1845,12 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7}
(i32.const 1)
)
)
+ (drop
+ (ref.eq
+ (ref.null eq)
+ (ref.null eq)
+ )
+ )
(try
(do
(throw $a-event
@@ -3698,6 +3708,12 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7}
(i32.const 1)
)
)
+ (drop
+ (ref.eq
+ (ref.null eq)
+ (ref.null eq)
+ )
+ )
(try
(do
(throw $a-event