summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-12-07 15:50:59 -0800
committerAlon Zakai <alonzakai@gmail.com>2015-12-07 15:50:59 -0800
commit7c506037b668d4d4cc7c21534da4b325d3eae36c (patch)
treef70b0f63ab0e53e9ca58d717730ff46456be4f12
parente7e2fe18e406aae3cade9200884014eda1f41f51 (diff)
downloadbinaryen-7c506037b668d4d4cc7c21534da4b325d3eae36c.tar.gz
binaryen-7c506037b668d4d4cc7c21534da4b325d3eae36c.tar.bz2
binaryen-7c506037b668d4d4cc7c21534da4b325d3eae36c.zip
fix unit.asm.js testcase, table contained a method of the wrong type
-rw-r--r--test/unit.2asm.js8
-rw-r--r--test/unit.asm.js6
-rw-r--r--test/unit.wast14
3 files changed, 25 insertions, 3 deletions
diff --git a/test/unit.2asm.js b/test/unit.2asm.js
index 45ffe88f6..50cc1a866 100644
--- a/test/unit.2asm.js
+++ b/test/unit.2asm.js
@@ -201,6 +201,11 @@ function asmFunc(global, env, buffer) {
FUNCTION_TABLE_vf[((1 & 7 | 0) + 8 | 0) & 15](Math_fround(x));
}
+ function cneg(x) {
+ x = Math_fround(x);
+ FUNCTION_TABLE_vf[((1 & 7 | 0) + 8 | 0) & 15](Math_fround(x))
+ }
+
function ___syscall_ret() {
var $0 = 0;
($0 >>> 0 | 0) >>> 0 > 4294963200 >>> 0
@@ -215,7 +220,8 @@ function asmFunc(global, env, buffer) {
}
var FUNCTION_TABLE_d = [importedDoubles, importedDoubles, importedDoubles, importedDoubles, importedDoubles, importedDoubles, importedDoubles, importedDoubles, importedDoubles, importedDoubles, importedDoubles, importedDoubles, importedDoubles, importedDoubles, importedDoubles, importedDoubles];
- var FUNCTION_TABLE_v = [z, big_negative, z, z, w, w, z, w, z, neg, z, z, z, z, z, z];
+ var FUNCTION_TABLE_v = [z, big_negative, z, z, w, w, z, w, z, z, z, z, z, z, z, z];
+ var FUNCTION_TABLE_vf = [cneg, cneg, cneg, cneg, cneg, cneg, cneg, cneg, cneg, cneg, cneg, cneg, cneg, cneg, cneg, cneg];
return {
big_negative: big_negative
};
diff --git a/test/unit.asm.js b/test/unit.asm.js
index cef639837..c69428a05 100644
--- a/test/unit.asm.js
+++ b/test/unit.asm.js
@@ -112,6 +112,10 @@ function () {
x = -x;
FUNCTION_TABLE_c[1 & 7](x);
}
+ function cneg(x) {
+ x = Math_fround(x);
+ FUNCTION_TABLE_c[1 & 7](x);
+ }
function ___syscall_ret() {
var $0 = 0;
($0>>>0) > 4294963200; // -4096
@@ -124,7 +128,7 @@ function () {
var FUNCTION_TABLE_a = [ z, big_negative, z, z ];
var FUNCTION_TABLE_b = [ w, w, importedDoubles, w ];
- var FUNCTION_TABLE_c = [ z, neg ];
+ var FUNCTION_TABLE_c = [ z, cneg ];
return { big_negative: big_negative };
}
diff --git a/test/unit.wast b/test/unit.wast
index 0c08b39c8..bec862410 100644
--- a/test/unit.wast
+++ b/test/unit.wast
@@ -4,7 +4,7 @@
(import $f64-to-int "asm2wasm" "f64-to-int" (param f64) (result i32))
(import $f64-rem "asm2wasm" "f64-rem" (param f64 f64) (result f64))
(export "big_negative" $big_negative)
- (table $z $big_negative $z $z $w $w $importedDoubles $w $z $neg)
+ (table $z $big_negative $z $z $w $w $importedDoubles $w $z $cneg)
(func $big_negative
(local $temp f64)
(block
@@ -349,6 +349,18 @@
)
)
)
+ (func $cneg (param $x f32)
+ (call_indirect $FUNCSIG$vf
+ (i32.add
+ (i32.and
+ (i32.const 1)
+ (i32.const 7)
+ )
+ (i32.const 8)
+ )
+ (get_local $x)
+ )
+ )
(func $___syscall_ret
(local $$0 i32)
(i32.gt_u