diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-05-10 17:29:00 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-05-10 17:33:23 -0700 |
commit | 32444e9c75d082c97c6ee7fbca2ca53982a54957 (patch) | |
tree | ed84a25f56c1abb5037391783acad55f266b7da1 /tools | |
parent | 945c2fcf445e0cc1bf62c43383f902d3a7bdb04c (diff) |
only recurse on decreasing uses on locals, and clear out names to avoid confusion later
Diffstat (limited to 'tools')
-rw-r--r-- | tools/eliminator/asm-eliminator-test-output.js | 12 | ||||
-rw-r--r-- | tools/eliminator/asm-eliminator-test.js | 29 | ||||
-rw-r--r-- | tools/js-optimizer.js | 11 |
3 files changed, 47 insertions, 5 deletions
diff --git a/tools/eliminator/asm-eliminator-test-output.js b/tools/eliminator/asm-eliminator-test-output.js index 747783a7..25ab23e4 100644 --- a/tools/eliminator/asm-eliminator-test-output.js +++ b/tools/eliminator/asm-eliminator-test-output.js @@ -348,4 +348,16 @@ function _org_apache_harmony_luni_util_NumberConverter_freeFormat__($me) { STACKTOP = __stackBase__; return $82 | 0; } +function __ZN23b2EdgeAndPolygonContact8EvaluateEP10b2ManifoldRK11b2TransformS4_($this, $manifold, $xfA, $xfB) { + $this = $this | 0; + $manifold = $manifold | 0; + $xfA = $xfA | 0; + $xfB = $xfB | 0; + var __stackBase__ = 0; + __stackBase__ = STACKTOP; + STACKTOP = STACKTOP + 256 | 0; + __ZN12b2EPCollider7CollideEP10b2ManifoldPK11b2EdgeShapeRK11b2TransformPK14b2PolygonShapeS7_(__stackBase__ | 0, $manifold, HEAP32[((HEAP32[($this + 48 | 0) >> 2] | 0) + 12 | 0) >> 2] | 0, $xfA, HEAP32[((HEAP32[($this + 52 | 0) >> 2] | 0) + 12 | 0) >> 2] | 0, $xfB); + STACKTOP = __stackBase__; + return; +} diff --git a/tools/eliminator/asm-eliminator-test.js b/tools/eliminator/asm-eliminator-test.js index e6384bf0..e068e860 100644 --- a/tools/eliminator/asm-eliminator-test.js +++ b/tools/eliminator/asm-eliminator-test.js @@ -561,5 +561,32 @@ function _org_apache_harmony_luni_util_NumberConverter_freeFormat__($me) { STACKTOP = __stackBase__; return $82 | 0; } -// EMSCRIPTEN_GENERATED_FUNCTIONS: ["asm", "__Z11printResultPiS_j", "_segment_holding", "__ZN5identC2EiPKcPci", "_vec2Length", "exc", "label", "confuusion", "tempDouble", "_org_apache_harmony_luni_util_NumberConverter_freeFormat__"] +function __ZN23b2EdgeAndPolygonContact8EvaluateEP10b2ManifoldRK11b2TransformS4_($this, $manifold, $xfA, $xfB) { + $this = $this | 0; + $manifold = $manifold | 0; + $xfA = $xfA | 0; + $xfB = $xfB | 0; + var $collider_i = 0, $1 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0; + var $8 = 0, $9 = 0, $10 = 0, $11 = 0; + var label = 0; + var __stackBase__ = 0; + __stackBase__ = STACKTOP; + STACKTOP = STACKTOP + 256 | 0; + $collider_i = __stackBase__ | 0; + $1 = $this + 48 | 0; + $2 = HEAP32[$1 >> 2] | 0; + $3 = $2 + 12 | 0; + $4 = HEAP32[$3 >> 2] | 0; + $5 = $4; + $6 = $this + 52 | 0; + $7 = HEAP32[$6 >> 2] | 0; + $8 = $7 + 12 | 0; + $9 = HEAP32[$8 >> 2] | 0; + $10 = $9; + $11 = $collider_i; + __ZN12b2EPCollider7CollideEP10b2ManifoldPK11b2EdgeShapeRK11b2TransformPK14b2PolygonShapeS7_($collider_i, $manifold, $5, $xfA, $10, $xfB); + STACKTOP = __stackBase__; + return; +} +// EMSCRIPTEN_GENERATED_FUNCTIONS: ["asm", "__Z11printResultPiS_j", "_segment_holding", "__ZN5identC2EiPKcPci", "_vec2Length", "exc", "label", "confuusion", "tempDouble", "_org_apache_harmony_luni_util_NumberConverter_freeFormat__", "__ZN23b2EdgeAndPolygonContact8EvaluateEP10b2ManifoldRK11b2TransformS4_"] diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js index 0bb61eae..2d0d51f9 100644 --- a/tools/js-optimizer.js +++ b/tools/js-optimizer.js @@ -1876,10 +1876,13 @@ function eliminate(ast, memSafe) { traverse(value, function(node, type) { if (type == 'name') { var name = node[1]; - uses[name]--; // cannot be infinite recursion since we descend an energy function - assert(uses[name] >= 0); - unprocessVariable(name); - processVariable(name); + node[1] = ''; // we can remove this - it will never be shown, and should not be left to confuse us as we traverse + if (name in locals) { + uses[name]--; // cannot be infinite recursion since we descend an energy function + assert(uses[name] >= 0); + unprocessVariable(name); + processVariable(name); + } } }); } |