Commit Graph

30 Commits

Author SHA1 Message Date
Anton Bannykh eabe21726c JS: improve switch elimination 2018-02-21 18:39:19 +03:00
Alexey Andreev 1be86e05ae JS: optimize range check for int and long
See KT-2218

Additionally, fix temporary variable elimination for && and ||
2017-11-03 17:35:17 +03:00
Alexey Andreev 6047746c90 Fix optimization in JS BE
Don't apply while condition folding when corresponding break
statement breaks outer loop.
2017-04-28 10:52:13 +03:00
Alexey Andreev d89ce80d97 Fix temporary variable elimination in JS BE
Don't eliminate temporary variable when between its usage and its
definition there's assignment to a non-local variable.

Fix KT-17540
2017-04-28 10:51:30 +03:00
Zalim Bashorov 678d2e7c21 KJS: transform labeled blocks to labeled do-while
It's a workaround for JDK-8177691.
Such code can appear during inline.
2017-04-26 13:07:33 +03:00
Alexey Andreev c1838d423b JS: transfer all empty statement simplifications RedundantLabelRemoval to EmptyStatementElimination, so that empty statements can be eliminated everywhere, not in labeled blocks only. 2017-01-24 12:26:21 +03:00
Alexey Andreev 7d170c0fcd JS: fix translation of reassignment of inline properties. See KT-15590 2017-01-12 18:12:38 +03:00
Alexey Andreev ee74342fbe JS: fix compiler crash when optimizing JS AST with empty do..while statement. See KT-15513 2017-01-12 18:12:37 +03:00
Alexey Andreev 8ef284daf4 JS: improve temporary variable elimination in some cases. Apply redundant statement elimination when statement in not synthetic, but its expression is 2016-12-22 17:19:23 +03:00
Alexey Andreev 35ab41e900 JS: when removing unused temporary variable, process its RHS value. Fix KT-15325 2016-12-22 17:19:22 +03:00
Alexey Andreev be196789d2 JS: fix bug in temporary variable elimination 2016-11-23 12:19:03 +03:00
Alexey Andreev d2fdc7ffc0 JS: when both clauses of if become empty during optimization, remove if entirely. Make condition and then clause of JsIf non-nullable. Fix #KT-13912 2016-11-17 12:20:37 +03:00
Alexey Andreev 0015f7518e JS: improve dead code elimination to handle switch case bodies 2016-11-16 19:29:35 +03:00
Alexey Andreev 05dd039151 KT-12275 Add JS optimization that transforms the following code
```
do {
    X
    if (B) break;
} while (A)
```

to

```
do {
    X
} while (!B && A)
```

Add inversion that takes boolean expression and applies negation to it, simplifying if possible (like !!a => a).
2016-07-25 18:46:46 +03:00
Alexey Andreev b3d29adad9 KT-12275 Add JS optimization that transforms the following code
```
do {
    guard: {
        // do something
        break guard;
        // do something
    }
} while (condition)
```

to

```
do {
    // do something
    continue;
    // do something
} while (condition)
```
2016-07-25 18:32:10 +03:00
Alexey Andreev b5f9287bfa JS: add tests for support of 'for' statement in TemporaryAssignmentElimination 2016-07-18 19:26:49 +03:00
Alexey Andreev e2b836db09 JS: refactor TemporaryVariableElimination 2016-07-14 18:00:34 +03:00
Alexey Andreev f0e64f8e38 JS/Inlining: rename IneffectiveStatementElimination to RedundantStatementElimination 2016-06-07 11:54:45 +03:00
Alexey Andreev 07d5a4506c JS/Inlining: minor improvements and clarifications after code review. Test whether expression without side effect does not prevent to relocate another expressions 2016-06-07 11:54:41 +03:00
Alexey Andreev 774efa4e70 JS/Inlining: improve test for removal of binary expresions without side effect, add tests for removal of a reference to a function parameter 2016-06-07 11:54:34 +03:00
Alexey Andreev a26c09ae81 JS/Inlining: refactor TemporaryAssignmentElimination, add more tests 2016-06-07 11:54:12 +03:00
Alexey Andreev 47cb0cde01 JS/Inlining: in temporary variable elimination improve moving of some expressions which are provably pure 2016-06-07 11:54:01 +03:00
Alexey Andreev 96532f1fc2 JS/Inlining: fix broken evaluation order after applying temporary variable elimination 2016-06-07 11:52:58 +03:00
Alexey Andreev 65876c36eb JS/Inlining: introduce removal of expression statements without side effects 2016-06-07 11:52:57 +03:00
Alexey Andreev 551ed28d84 JS/Inlining: introduce removal of unused variables 2016-06-07 11:52:56 +03:00
Alexey Andreev c11f2fe2d6 JS/Inlining: fix bug in temporary assignment elimination which causes excess removal of assignment statement. When there is a set of temporary variables that receive same value in different execution branches, remove them carefully so that at least one (and, preferably, at most) remains in each branch. 2016-06-07 11:52:55 +03:00
Alexey Andreev 4a53f5c0b8 Don't relocate temporary variable which receives property access, unless it's provable that this property don't have side effects 2016-04-05 14:40:25 +03:00
Alexey Andreev cfdce8eaca Rewrite temporary variable elimination 2016-04-05 14:40:25 +03:00
Alexey Andreev 8709289b0a Prohibit from eliminating non-local temporary variables 2016-04-05 14:40:24 +03:00
Alexey Andreev af7ddb4572 Adds test infrastructure for JS optimizer. Adds simple tests 2016-04-05 14:40:24 +03:00