summaryrefslogtreecommitdiff
path: root/test/wasm-only.asm.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2017-01-12 15:40:02 -0800
committerGitHub <noreply@github.com>2017-01-12 15:40:02 -0800
commit370029bf981bee0c88dfdc7b9f4739959a1b8c05 (patch)
tree3b91956f40874b275dd38f4267e9b0be8302cc31 /test/wasm-only.asm.js
parentd908ea7ba67c3544bcaa7906ce8e61cb5bf0846d (diff)
downloadbinaryen-370029bf981bee0c88dfdc7b9f4739959a1b8c05.tar.gz
binaryen-370029bf981bee0c88dfdc7b9f4739959a1b8c05.tar.bz2
binaryen-370029bf981bee0c88dfdc7b9f4739959a1b8c05.zip
asm2wasm: when a switch is too big, create an if-else chain instead (#877)
Diffstat (limited to 'test/wasm-only.asm.js')
-rw-r--r--test/wasm-only.asm.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/wasm-only.asm.js b/test/wasm-only.asm.js
index 3adacf5be..371197173 100644
--- a/test/wasm-only.asm.js
+++ b/test/wasm-only.asm.js
@@ -248,6 +248,42 @@ function asm(global, env, buffer) {
}
return;
}
+ function switch64TOOMUCH($a444) {
+ $a444 = i64($a444);
+ var $waka = 0;
+ switch (i64($a444)) {
+ case i64_const(0,1073741824): // spread is huge here, we should not make a jump table!
+ case i64_const(0,2147483648): {
+ return 40;
+ }
+ default: {
+ $waka = 1;
+ }
+ }
+ switch (100) {
+ case 107374182: // similar, but 32-bit
+ case 214748364: {
+ return 41;
+ }
+ default: {
+ $waka = 1001;
+ }
+ }
+ // no defaults
+ switch (i64($a444)) {
+ case i64_const(0,1073741824): // spread is huge here, we should not make a jump table!
+ case i64_const(0,2147483648): {
+ return 42;
+ }
+ }
+ switch (100) {
+ case 107374182: // similar, but 32-bit
+ case 214748364: {
+ return 43;
+ }
+ }
+ return 44;
+ }
function keepAlive() {
loads();
stores();