From ee0564088c7f89814bf951cc5936aa096538e38f Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Fri, 16 Aug 2019 10:16:28 -0700 Subject: wasm2js: Fix switch lowering, don't fall through after the hoisted parts (#2301) The switch lowering will "hoist" blocks of code into the JS switch when it can. If it can hoist some but not others, it must not fall through into those others (while it can fall through the hoisted ones - they began as nested blocks with falling-through between them). To fix this, after the hoisted ones issue a break out of the switch (which now contains all the hoisted code, so breaking out of it gets to the code right after the hoisted ones). fixes #2300 --- test/wasm2js/br_table_hoisting.2asm.js.opt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test/wasm2js/br_table_hoisting.2asm.js.opt') diff --git a/test/wasm2js/br_table_hoisting.2asm.js.opt b/test/wasm2js/br_table_hoisting.2asm.js.opt index 44c9d0417..f28214760 100644 --- a/test/wasm2js/br_table_hoisting.2asm.js.opt +++ b/test/wasm2js/br_table_hoisting.2asm.js.opt @@ -100,6 +100,7 @@ function asmFunc(global, env, buffer) { } zed(-1); zed(-2); + break; case 0: break a; case 1: @@ -140,6 +141,7 @@ function asmFunc(global, env, buffer) { } zed(-1); zed(-2); + break; case 0: break a; case 1: -- cgit v1.2.3