aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
AgeCommit message (Collapse)Author
2012-11-14better solution for the last test in constant switch foldingMihai Bazon
2012-11-14optimize constant switch blocksMihai Bazon
ref. mishoo/UglifyJS#441
2012-11-13Merge branch 'optimize_concat' of https://github.com/rvanvelzen/UglifyJS2 ↵Mihai Bazon
into rvanvelzen-optimize_concat
2012-11-13don't change order in binary expressions if both operands have side effectsMihai Bazon
2012-11-12Add simple optimization for empty-string concats.Richard van Velzen
ref. #43
2012-11-12fix invalid AST produced by dropping unused variableMihai Bazon
close #44
2012-11-11convert x.toString() to ""+x instead of x+""Dan Wolff
In some places this can save one byte in whitespace, e.g. after return. Example: function f(arg) { // return""+arg - no space between return and "" return arg.toString(); }
2012-11-08AST_LabelRef no longer inherits from AST_SymbolRefMihai Bazon
2012-11-08optimization for if/break as first statement in a loop bodyMihai Bazon
for(...; x; ...) if (y) break; → for(...; x&&!y; ...); similarly for `while` and some combinations (i.e. the `break` appears in the `else` clause, etc.)
2012-11-05convert `while` into `for`Mihai Bazon
2012-11-05minorMihai Bazon
2012-11-05minor optimizationMihai Bazon
for `==` or `!=` against a constant, prefer to display the constant first. should help a bit after gzip, i.e.: typeof foo=="undefined" ^^^^^^ ^^^^^^^^^^^^^ vs: "undefined"==typeof foo ^^^^^^^^^^^^^^^^^^^ (longer sequence that could repeat) idea stolen from closure.
2012-11-02use a Dictionary object instead of plain object for hashesMihai Bazon
to mitigate the `__proto__` issue related to #30
2012-11-01it's safe to negate expression in !EXP only in boolean contextMihai Bazon
#kendo
2012-11-01added unsafe_comps for negating `<=` with `>`Mihai Bazon
since it has the potential to break code, let's keep it disabled by default
2012-11-01fix compressing UnaryPrefixMihai Bazon
only try negating the expression if the operator is `!` #kendo
2012-10-30don't move expressions containing the binary `in` operator into the `for` ↵Mihai Bazon
initializer (opera can't parse it) close #25
2012-10-24fix for `if (...) return; else return ...;`Mihai Bazon
(it was assumed that the first `return` always contains a value) close #22
2012-10-22more sequence optimizations (lift some sequences above binary/unary ↵Mihai Bazon
expressions so that we can avoid parens)
2012-10-19minor fix for dropping unused definitions.Mihai Bazon
function f(x, y) { var g = function() { return h() }; var h = function() { return g() }; return x + y; } now compresses to `function f(x, y) { return x + y }`
2012-10-18more optimizations for some break/continue casesMihai Bazon
2012-10-17more small optimizationsMihai Bazon
(unlikely to help for hand-written code)
2012-10-17define aborts on AST_If: true if both branches abortMihai Bazon
2012-10-17employ a better parser for command-line argumentsMihai Bazon
to support passing commas in strings in for example: uglifyjs2 -cd TEST="'a,b'" <<EOF console.log(TEST); EOF → console.log("a,b") close #14
2012-10-13drop unused function argumentsMihai Bazon
also add test for "drop_unused" (the last one fails for now)
2012-10-13fix compressing benchmark.js (it tried to evaluate a statement)Mihai Bazon
the following code in benchmark.js triggered the issue: support.decompilation = Function( 'return (' + (function(x) { return { 'x': '' + (1 + x) + '', 'y': 0 }; }) + ')' )()(0).x === '1'; technically that could be resolved into a constant expression, but seems it's being used here for browser bugs detection :-\
2012-10-12remove the $self hackMihai Bazon
operations are destructive anyway, so there's no point to clone the nodes in the transformer. speed++
2012-10-11cleanupMihai Bazon
- use prototype-less objects where feasible (minor speed improvement) - get rid of HOP
2012-10-10drop unused variableMihai Bazon
2012-10-09minorMihai Bazon
2012-10-09add AST_Infinity nodeMihai Bazon
2012-10-09added $propdoc to AST nodes and some cleanupsMihai Bazon
hopefully we can make the AST documentation self-generating
2012-10-09minor AST cleanup (AST_BlockStatement may inherit from AST_Block)Mihai Bazon
2012-10-09fix detecting symbols in useMihai Bazon
2012-10-08eliminate redundant directives in the same scopeMihai Bazon
2012-10-05minorMihai Bazon
2012-10-05replace `(function(){ ...no side effects ... })()` with `undefined`.Mihai Bazon
2012-10-04removed some unused variablesMihai Bazon
2012-10-03more cleanup (dropped AST_SwitchBlock)Mihai Bazon
2012-10-03AST cleanup (dropped AST_StatementBase)Mihai Bazon
2012-10-03added option for side-effect-free statements, fix testMihai Bazon
2012-10-03fix endless loop in testsMihai Bazon
2012-10-03fix for `a = !b && !c && !d && !e → a=!(b||c||d||e)`Mihai Bazon
2012-10-03disable `hoist_vars` by default and change `comparations` to `comparisons`Mihai Bazon
2012-10-02support definesMihai Bazon
2012-10-02"use strict";Mihai Bazon
2012-10-02more constant folding (for names defined with `const`)Mihai Bazon
2012-10-02drop more unused namesMihai Bazon
2012-10-02a shy attempt to obey `width` in the beautifier; added `bracketize` option ↵Mihai Bazon
to always print brackets around if/do/while/for statements; export more options via the CLI
2012-09-26removed the "squeeze" method (it's now effectively "transform")Mihai Bazon