Commit Graph

1218 Commits

Author SHA1 Message Date
Dmitry Petrov d559212d70 Optimize out trivial INSTANCEOF checks
#KT-18157 Fixed Target versions 1.1.4
2017-05-31 16:48:14 +03:00
Alexey Andreev e6b0cc64bd Fix copying of non-abstract functions of interfaces in JS BE
Fix copying of non-abstract functions of interfaces to implementing
classes when implementing class inherits interface via 2+ paths.

See KT-18187
2017-05-31 11:21:13 +03:00
Alexey Andreev ed592452a3 Fix JS source maps for functions with expression body 2017-05-30 12:48:59 +03:00
Alexey Andreev 1014666937 Fix JS source maps for delegates and backing fields 2017-05-30 12:48:58 +03:00
Alexey Andreev 13795b47fb Fix JS source maps for initialization of variables captured by class 2017-05-30 12:48:58 +03:00
Alexey Andreev bfc3a9c2af Fix JS source maps for && expression with complex operands 2017-05-30 12:48:57 +03:00
Alexey Andreev 1111f2d5cd Fix JS source maps for while/do..while statements 2017-05-30 12:48:57 +03:00
Alexey Andreev 413ac40c25 Fix JS source maps for for statements 2017-05-30 12:48:56 +03:00
Alexey Andreev d7a10750e0 Fix JS source maps for lambdas 2017-05-30 12:48:55 +03:00
Alexey Andreev 82d37c0d57 Fix JS source maps for catch blocks 2017-05-30 12:48:55 +03:00
Alexey Andreev 6ad991adfb Fix JS source maps for "is" and "in" clauses in when expression 2017-05-30 12:48:54 +03:00
Alexey Andreev 9692c02f6e Fix JS source maps for string literals 2017-05-30 12:48:53 +03:00
Alexey Andreev 8dae399945 Fix generation of JS source maps for default parameters
(Of open member functions)
2017-05-30 12:48:52 +03:00
Alexey Andreev e1009622af Fix generation of JS source maps for call expressions 2017-05-30 12:48:52 +03:00
Alexey Andreev 6e489900cb Fix generation of JS source maps for long literals 2017-05-30 12:48:51 +03:00
Alexey Andreev 89e3fb7592 Keep JS AST source information after refreshing local names 2017-05-30 12:48:51 +03:00
Alexey Andreev ad89e5906f Fix JS source maps for increment expression used as statement 2017-05-30 12:48:50 +03:00
Alexey Andreev bad79dfa85 Fix JS source maps for return statement of inlined function 2017-05-30 12:48:49 +03:00
Alexey Andreev 5a4d3c5391 Generate JS source maps for object instance function 2017-05-30 12:48:49 +03:00
Alexey Andreev 77df0f28bf Fix generation of JS source maps for class properties 2017-05-30 12:48:48 +03:00
Alexey Andreev 6f8ccfb80d Add test for JS source maps for literals 2017-05-30 12:48:47 +03:00
Alexey Andreev e9a2c8c0f1 Prevent JS AST nodes of several types to be shared 2017-05-30 12:48:47 +03:00
Alexey Andreev 3077a0f640 Fix generation of JS source maps for suspend functions 2017-05-30 12:12:49 +03:00
Alexey Andreev 28140b0883 Fix generation of JS source maps for closures 2017-05-30 12:12:34 +03:00
Alexey Andreev 3a7df13440 Fix generation of source maps for synthetic code in enums in JS BE 2017-05-30 12:12:33 +03:00
Alexey Andreev fb3a864892 Fix generation of JS source maps for synthetic code in constructors 2017-05-30 12:12:32 +03:00
Alexey Andreev 4332f1cb2c Don't share instances of JsNameRef nodes to avoid wrong source maps
When to name references to the same name are represented by
a shared JS AST node, setting line number of the second usage may
override line number of the first usage.

Also, supply more JS AST nodes related to default parameters,
with corresponding source information.
2017-05-30 12:12:30 +03:00
Alexey Andreev e5662ac2ad Copy location info when copying JS AST subtrees
This is necessary to preserve source information of a function's body
after inlining.
2017-05-30 12:12:28 +03:00
Alexey Andreev 9218b61141 Add tests for source maps in JS BE 2017-05-30 12:12:27 +03:00
Alexey Andreev 4bb1130f3f Fix translation of labels with non-identifier names in JS BE
See KT-18027
2017-05-29 15:37:31 +03:00
Alexey Andreev 24c0a1e7ce Fix translation of delegated functions with default params in JS BE
See KT-17285
2017-05-29 15:30:28 +03:00
Denis Zharkov 2c98bd053a Fix super calls to suspend functions in abstract classes 2017-05-29 10:58:18 +03:00
Alexey Andreev dde50a34db Fix comparison of boolean values in JS BE
See KT-16984
2017-05-26 18:26:08 +03:00
Alexey Andreev f5510b8d66 Fix translation to JS of call to top-level fun with vararg and @JsModule
See KT-17871
2017-05-26 18:24:15 +03:00
Alexey Andreev e2fc808d83 Add simple test infrastructure for JS DCE
Add test infrastructure that allows to test handwritten JS
to test various small aspects of DCE, as opposed to box tests
which test kotlin stdlib + kotlin generated examples
2017-05-26 18:20:30 +03:00
Alexey Andreev e2c2fcf1ff Generate EXPECTED_REACHABLE_NODES directive on JS box tests 2017-05-26 18:20:20 +03:00
Alexey Andreev ab9b639652 Improve test infrastructure for JS DCE tool
Introduce directives to assert minification rate (MINIFIER_THRESHOLD)
and to skip DCE test at all (SKIP_MINIFIER).
Allow to run DCE on some of the box tests by default.
2017-05-26 18:20:19 +03:00
Alexey Andreev ca7062d776 Fix JS parser to properly handle "." <keyword> sequence 2017-05-26 18:20:16 +03:00
Alexey Andreev 9e89213d66 Prototyping DCE tool for JS 2017-05-26 18:20:15 +03:00
Alexey Andreev 0e31c14a86 Implement inlining of default parameters in JS BE
Fix KT-17910
2017-05-25 14:38:53 +03:00
qx bc14ce740a KT-15309 Don't apply "Fix with 'asDynamic'" to member extension funcitons 2017-05-22 18:34:27 +03:00
Denis Zharkov 52b2e632df Simplify generated code for rangeTo/concat intrinsics
The main reason is avoiding complicated operations like
dup + dup_x2 + pop2 for instances obtained by NEW instruction.

Otherwise it leads to problems in performRefinedTypeAnalysis
because code there has a sensible assumption that NEW instances
can be only dupped or stored into a local (rare cases)

 #KT-17457 Fixed
2017-05-22 14:51:04 +03:00
Anton Bannykh 419f12f1b7 JS: fix char to string convertion in string templates (#KT-17966 fixed) 2017-05-22 13:57:36 +03:00
Dmitry Petrov e1b41eee15 Specialize Comparable#compareTo for boxed primitives
Support Comparable#compareTo for boxed primitive in redundant
boxing/unboxing analysis, along with CHECKCAST to java.lang.Comparable.

Note that we can do that for Float and Double, too, because
Float#compareTo(Float) and Double#compareTo(Double) are delegated to
Float#compare(float, float) and Double#compare(double, double),
respectively.

Fuse specialized comparison for integers with conditional jumps
if possible (both for Comparable#compareTo and Intrinsics#areEqual).

 #KT-11959 Fixed
2017-05-22 11:57:20 +03:00
Dmitry Petrov 1dbd6453e0 Add more stub generator tests for external dependencies 2017-05-19 14:49:34 +03:00
Mikhael Bogdanov 47fec6c9d5 Wrap captured local delegated property into Delegate
#KT-16864 Fixed
2017-05-19 09:53:19 +02:00
Zalim Bashorov fb9d88315a Don't print unnecessary empty line separators when generate tests 2017-05-16 19:42:47 +03:00
Dmitry Petrov 495fba43c0 Fuse primitive equality with safe call to avoid boxing
In code like 'a?.b == 42', we can immediately generate equality
comparison result when receiver is null (false for '==', true for '!='),
since the primitive value is definitely non-null.
Otherwise unnecessary boxing/unboxing is generated to handle possibly
null result of 'a?.b'.
2017-05-16 17:28:43 +03:00
Denis Zharkov d24d3a73d7 Support open suspend members and super-calls
The problem was that the resume call (from doResume) for open members
was based on common INVOKEVIRTUAL to the original function
that lead to the invocation of the override when it was expected
to be the overridden (after super-call being suspended)

The solution is to generate method bodies for open members into
the special $suspendImpl synthetic function that may be called
from the doResume implementation

 #KT-17587 Fixed
2017-05-16 11:38:59 +03:00
Denis Zharkov e75b6c8404 Perform fix-stack transformation before method analysis
Otherwise it might fail on an "invalid" bytecode
2017-05-16 11:38:59 +03:00