From 3f5ee87d262080265b65a3789392b399c91f30ad Mon Sep 17 00:00:00 2001 From: Daniel Wirtz Date: Wed, 21 Feb 2018 23:22:11 +0100 Subject: Improve name mangling of asm.js identifiers (#1433) Also refactors mangling to its own file so it can be reused by generators and consumers, i.e., where it is important to know that an import must be named 'switch_' where it otherwise would be 'switch'. * Update tests and JS dist files --- test/forward.2asm.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'test/forward.2asm.js') diff --git a/test/forward.2asm.js b/test/forward.2asm.js index 00a15d035..7be5eba8a 100644 --- a/test/forward.2asm.js +++ b/test/forward.2asm.js @@ -14,32 +14,32 @@ function asmFunc(global, env, buffer) { var Math_clz32 = global.Math.clz32; function even(n) { n = n | 0; - var $$1 = 0, $$2 = 0, $$3 = 0, $$4 = 0, $$5 = 0, $$6 = 0, $$7 = 0; - if ((n | 0) == (0 | 0)) $$6 = 1; else $$6 = odd(n - 1 | 0 | 0) | 0; - return $$6 | 0; + var $1 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0; + if ((n | 0) == (0 | 0)) $6 = 1; else $6 = odd(n - 1 | 0 | 0) | 0; + return $6 | 0; } function odd(n) { n = n | 0; - var $$1 = 0, $$2 = 0, $$3 = 0, $$4 = 0, $$5 = 0, $$6 = 0, $$7 = 0; - if ((n | 0) == (0 | 0)) $$6 = 0; else $$6 = even(n - 1 | 0 | 0) | 0; - return $$6 | 0; + var $1 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0; + if ((n | 0) == (0 | 0)) $6 = 0; else $6 = even(n - 1 | 0 | 0) | 0; + return $6 | 0; } function __wasm_ctz_i32(x) { x = x | 0; - var $$1 = 0, $$2 = 0, $$3 = 0, $$4 = 0, $$5 = 0, $$6 = 0, $$7 = 0, $$8 = 0, $$9 = 0, $$10 = 0; - if ((x | 0) == (0 | 0)) $$9 = 32; else $$9 = 31 - Math_clz32(x ^ (x - 1 | 0) | 0) | 0; - return $$9 | 0; + var $1 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $10 = 0; + if ((x | 0) == (0 | 0)) $9 = 32; else $9 = 31 - Math_clz32(x ^ (x - 1 | 0) | 0) | 0; + return $9 | 0; } function __wasm_popcnt_i32(x) { x = x | 0; - var count = 0, $$2 = 0, $$3 = 0, $$4 = 0, $$5 = 0, $$6 = 0, $$7 = 0, $$8 = 0, $$9 = 0, $$10 = 0, $$11 = 0, $$12 = 0, $$13 = 0, $$14 = 0, $$15 = 0; + var count = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0; count = 0; b : { l : do { - $$5 = count; + $5 = count; if ((x | 0) == (0 | 0)) break b; x = x & (x - 1 | 0) | 0; count = count + 1 | 0; @@ -47,13 +47,13 @@ function asmFunc(global, env, buffer) { break l; } while (1); }; - return $$5 | 0; + return $5 | 0; } function __wasm_rotl_i32(x, k) { x = x | 0; k = k | 0; - var $$2 = 0, $$3 = 0, $$4 = 0, $$5 = 0, $$6 = 0, $$7 = 0, $$8 = 0, $$9 = 0, $$10 = 0, $$11 = 0, $$12 = 0, $$13 = 0, $$14 = 0, $$15 = 0, $$16 = 0, $$17 = 0, $$18 = 0, $$19 = 0, $$20 = 0, wasm2asm_i32$0 = 0; + var $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $20 = 0, wasm2asm_i32$0 = 0; return ((4294967295 >>> (k & 31 | 0) | 0) & x | 0) << (k & 31 | 0) | 0 | (((4294967295 << (32 - (k & 31 | 0) | 0) | 0) & x | 0) >>> (32 - (k & 31 | 0) | 0) | 0) | 0 | 0; return wasm2asm_i32$0 | 0; } @@ -61,7 +61,7 @@ function asmFunc(global, env, buffer) { function __wasm_rotr_i32(x, k) { x = x | 0; k = k | 0; - var $$2 = 0, $$3 = 0, $$4 = 0, $$5 = 0, $$6 = 0, $$7 = 0, $$8 = 0, $$9 = 0, $$10 = 0, $$11 = 0, $$12 = 0, $$13 = 0, $$14 = 0, $$15 = 0, $$16 = 0, $$17 = 0, $$18 = 0, $$19 = 0, $$20 = 0, wasm2asm_i32$0 = 0; + var $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $20 = 0, wasm2asm_i32$0 = 0; return ((4294967295 << (k & 31 | 0) | 0) & x | 0) >>> (k & 31 | 0) | 0 | (((4294967295 >>> (32 - (k & 31 | 0) | 0) | 0) & x | 0) << (32 - (k & 31 | 0) | 0) | 0) | 0 | 0; return wasm2asm_i32$0 | 0; } -- cgit v1.2.3