diff options
author | Mihai Bazon <mihai@bazon.net> | 2013-06-07 12:51:23 +0300 |
---|---|---|
committer | Mihai Bazon <mihai@bazon.net> | 2013-06-07 12:52:09 +0300 |
commit | 02a84385a02ccf4cf3a1ccca2fc5f6a90fb43487 (patch) | |
tree | 78a557ba0c74875603b20f4b2255f4dac48d37a4 /lib/compress.js | |
parent | a4889a0f2e4c5939bcda7d527843c8bf3bdedc81 (diff) | |
download | tracifyjs-02a84385a02ccf4cf3a1ccca2fc5f6a90fb43487.tar.gz tracifyjs-02a84385a02ccf4cf3a1ccca2fc5f6a90fb43487.zip |
Don't swap binary ops when "use asm" is in effect.
Refs #167
Diffstat (limited to 'lib/compress.js')
-rw-r--r-- | lib/compress.js | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/compress.js b/lib/compress.js index 57554fa5..9eed8280 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -1765,14 +1765,15 @@ merge(Compressor.prototype, { var commutativeOperators = makePredicate("== === != !== * & | ^"); OPT(AST_Binary, function(self, compressor){ - function reverse(op, force) { - if (force || !(self.left.has_side_effects() || self.right.has_side_effects())) { - if (op) self.operator = op; - var tmp = self.left; - self.left = self.right; - self.right = tmp; - } - }; + var reverse = compressor.has_directive("use asm") ? noop + : function(op, force) { + if (force || !(self.left.has_side_effects() || self.right.has_side_effects())) { + if (op) self.operator = op; + var tmp = self.left; + self.left = self.right; + self.right = tmp; + } + }; if (commutativeOperators(self.operator)) { if (self.right instanceof AST_Constant && !(self.left instanceof AST_Constant)) { |