diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2019-12-28 23:14:53 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-28 23:14:53 +0000 |
commit | d1a78920d9b85074fd4e9b0d07556a7a266631e8 (patch) | |
tree | 6d3be960b0406ce2f22ad7d679254eb87f53a03a /test/compress | |
parent | d9cd3d33c8f2b769da922d355373d466f8b30704 (diff) | |
download | tracifyjs-d1a78920d9b85074fd4e9b0d07556a7a266631e8.tar.gz tracifyjs-d1a78920d9b85074fd4e9b0d07556a7a266631e8.zip |
workaround firefox asm.js quirks (#3650)
fixes #3636
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/asm.js | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/test/compress/asm.js b/test/compress/asm.js index 1f00f8f2..0ea60874 100644 --- a/test/compress/asm.js +++ b/test/compress/asm.js @@ -166,3 +166,69 @@ asm_nested_functions: { } expect_exact: '0;function a(){"use asm";0.0}0;function b(){0;function c(){"use asm";0.0}0;function d(){0}0}0;' } + +issue_3636_1: { + mangle = {} + input: { + function n(stdlib, foreign, buffer) { + "use asm"; + function add(x, y) { + x = x | 0; + y = y | 0; + return x + y | 0; + } + return { + add: add + }; + } + console.log(new n().add("foo", 42)); + } + expect: { + function n(o, e, u) { + "use asm"; + function d(n, o) { + n = n | 0; + o = o | 0; + return n + o | 0; + } + return { + add: d + }; + } + console.log(new n().add("foo", 42)); + } + expect_stdout: "42" +} + +issue_3636_2: { + mangle = {} + input: { + var n = function(stdlib, foreign, buffer) { + "use asm"; + function add(x, y) { + x = x | 0; + y = y | 0; + return x + y | 0; + } + return { + add: add + }; + }; + console.log(new n().add("foo", 42)); + } + expect: { + var n = function(n, o, e) { + "use asm"; + function r(n, o) { + n = n | 0; + o = o | 0; + return n + o | 0; + } + return { + add: r + }; + }; + console.log(new n().add("foo", 42)); + } + expect_stdout: "42" +} |