Emscripten generates code that allows the caller to provide the Wasm module (thorugh Module.instantiateWasm), with a fallback in case .instantiateWasm is not provided. We always define instantiateWasm, so we can hard-code the check and let our dead code elimination logic remove the unused fallback. This commit also improved the dead code elimination logic so that if a function declaration becomes unused as a result of removing dead code, the function itself is removed.
30 lines
284 B
JavaScript
30 lines
284 B
JavaScript
/* globals f0 */
|
|
function f1() {
|
|
/* head */
|
|
"1";
|
|
/* mid */
|
|
"2";
|
|
/* tail */
|
|
}
|
|
f1();
|
|
|
|
function f2() {
|
|
// head
|
|
"1";
|
|
// mid
|
|
"2";
|
|
// tail
|
|
}
|
|
f2();
|
|
|
|
function f3() {
|
|
if ("1") { // begin block
|
|
"1";
|
|
}
|
|
"2"; // trailing
|
|
if (/* s */"3"/*e*/) {
|
|
"4";
|
|
}
|
|
}
|
|
f3();
|