aboutsummaryrefslogtreecommitdiff
path: root/tools/js-optimizer.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-07-04 11:01:42 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-07-04 16:36:03 -0700
commit0d84667ad3017ec951e7fbe4b47182709b9568b0 (patch)
tree66ec721820d61733e10a7141538fe74ebb6d9ac9 /tools/js-optimizer.js
parentc9027f5ae501194eb3953c69d61280f64382c321 (diff)
comments
Diffstat (limited to 'tools/js-optimizer.js')
-rw-r--r--tools/js-optimizer.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js
index 1de06e4c..91064de4 100644
--- a/tools/js-optimizer.js
+++ b/tools/js-optimizer.js
@@ -2094,7 +2094,7 @@ function eliminate(ast, memSafe) {
if (hasSwitch && !asm) return;
var potentials = {}; // local variables with 1 definition and 1 use
- var sideEffectFree = {}; // whether a local variable has no side effects in its definition
+ var sideEffectFree = {}; // whether a local variable has no side effects in its definition. Only relevant when there are no uses
function unprocessVariable(name) {
if (name in potentials) delete potentials[name];
@@ -2105,7 +2105,7 @@ function eliminate(ast, memSafe) {
function processVariable(name) {
if (definitions[name] === 1 && uses[name] === 1) {
potentials[name] = 1;
- } else if (uses[name] === 0 && (!definitions[name] || definitions[name] <= 1)) { // no uses, no def or 1 def (cannot operate on phis, and the llvm optimizer will remove unneeded phis anyhow)
+ } else if (uses[name] === 0 && (!definitions[name] || definitions[name] <= 1)) { // no uses, no def or 1 def (cannot operate on phis, and the llvm optimizer will remove unneeded phis anyhow) (no definition means it is a function parameter, or a local with just |var x;| but no defining assignment)
var hasSideEffects = false;
var value = values[name];
if (value) {
@@ -2487,7 +2487,7 @@ function eliminate(ast, memSafe) {
node[i] = value[i];
}
} else {
- // empty it out in-place
+ // This has no side effects and no uses, empty it out in-place
node.length = 0;
node[0] = 'toplevel';
node[1] = [];