Commit Graph

17 Commits

Author SHA1 Message Date
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