sigmund@google.com
fd35f3cbfe
Add fatal-warnings flag, that turns warnings into compilation errors (the name
...
fatal-warnings was choosen to match the flag in dartanalyzer)
BUG= http://dartbug.com/8803
R=johnniwinther@google.com , karlklose@google.com
Review URL: https://codereview.chromium.org//1077373003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45190 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-15 23:17:21 +00:00
sigmund@google.com
5d6b64dc49
Do not use erroneouselement unless the member is static
...
R=het@google.com , johnniwinther@google.com
Review URL: https://codereview.chromium.org//1089463003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45187 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-15 23:10:06 +00:00
floitsch@google.com
a004ca0767
Revert "dart2js: add compiler builtins to the core-runtime."
...
This reverts commit r45176.
Review URL: https://codereview.chromium.org//1091613003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45177 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-15 19:30:09 +00:00
floitsch@google.com
dfbe06beba
dart2js: add compiler builtins to the core-runtime.
...
WIP.
R=johnniwinther@google.com , sra@google.com
Review URL: https://codereview.chromium.org//954253002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45176 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-15 19:17:57 +00:00
kmillikin@google.com
1eea5f8799
Revert "Remove an unused field from one of the CPS translation classes."
...
This reverts SVN revision 45168. The return value of
IrBuilder.buildFunctionHeader is used in the JS backend for constructor type
parameters. It should be possible to do it a different way but it's too
tangled for a quick fix.
BUG=
Review URL: https://codereview.chromium.org//1059443008
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45171 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-15 16:10:36 +00:00
kmillikin@google.com
e375dac705
Remove an unused field from one of the CPS translation classes.
...
BUG=
R=asgerf@google.com
Review URL: https://codereview.chromium.org//1087243002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45168 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-15 15:13:22 +00:00
asgerf@google.com
99963809f5
tree-ir: Always declare captured variables.
...
BUG=
R=kmillikin@google.com
Review URL: https://codereview.chromium.org//1090593002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45166 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-15 13:36:20 +00:00
johnniwinther@google.com
19efd2cc96
Improve precision of JS printer callbacks (2nd try)
...
BUG=
R=floitsch@google.com , sra@google.com
Review URL: https://codereview.chromium.org//1081313003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45164 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-15 12:09:15 +00:00
asgerf@google.com
609e75a009
tree-ir: Treat getInterceptor and identical as effectively constant.
...
Calls to getInterceptor would often block another expression from
propagating, which in turn can block other optimizations.
Before:
while (true) {
v0 = foo();
if (P.identical(J.getInterceptor$n(i).$lt(i, v0), true)) { S1 }
else { S2 [no continue] }
The call to J.getInterceptor prevents v0 = foo() from inlining.
After:
while(P.identical(J.getInterceptor$n(i).$lt(i, foo()), true)) {
S1
}
S2
BUG=
R=kmillikin@google.com
Review URL: https://codereview.chromium.org//1084783004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45161 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-15 11:24:31 +00:00
asgerf@google.com
9fc58ee004
tree-ir: Do not merge captured parameters with other variables.
...
BUG=
R=kmillikin@google.com
Review URL: https://codereview.chromium.org//1055243006
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45160 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-15 11:19:44 +00:00
sigurdm@google.com
507e85ab61
Dart2js deferred loading. Follow types of functions when calculating dependencies.
...
This fixes part of dartbug.com/22995
Turns out that synthesized constructors not always have a type.
BUG=
R=johnniwinther@google.com
Committed: https://code.google.com/p/dart/source/detail?r=45086
Reverted in r45086
Committed: https://code.google.com/p/dart/source/detail?r=45101
Reverted in 45106
Review URL: https://codereview.chromium.org//1019923005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45159 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-15 10:55:39 +00:00
floitsch@google.com
1fd10697a8
dart2js: use Es6 maps when available.
...
R=herhut@google.com , sra@google.com
Committed: https://code.google.com/p/dart/source/detail?r=45105
Reverted: https://code.google.com/p/dart/source/detail?r=45107
Review URL: https://codereview.chromium.org//1032783003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45158 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-15 10:44:54 +00:00
johnniwinther@google.com
99f632049a
Deprecate visitAssertSend and visitTypePrefixSend
...
BUG=
R=karlklose@google.com
Review URL: https://codereview.chromium.org//1083063002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45157 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-15 10:44:13 +00:00
kmillikin@google.com
16fd8a7896
Make continuations last in CPS IR constructors.
...
Continuations are last in both printed representations, but first in
the IR constructors. For uniformity, make them last in the IR
constructors as well. This is a cosmetic refactoring.
BUG=
R=asgerf@google.com , karlklose@google.com
Review URL: https://codereview.chromium.org//1084153002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45155 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-15 09:21:16 +00:00
kmillikin@google.com
f79bc25ed8
Implement try/catch in the JS backend.
...
In the CPS IR, exception handlers initially have two parameters for
the exception and the stack trace. In JavaScript:
1. Unwrap the caught value to get the exception that was thrown and
use the unwrapped value in place of the exception parameter.
2. Get the stack trace from the (unwrapped) exception that was thrown.
3. Remove the stack trace parameter.
BUG=
R=asgerf@google.com
Review URL: https://codereview.chromium.org//1083663005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45152 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-15 07:56:41 +00:00
johnniwinther@google.com
8d6dd9cb48
Use CallStructure instead of Selector in SemanticSendVisitor.
...
BUG=
Review URL: https://codereview.chromium.org//1088933004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45150 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-15 07:43:07 +00:00
johnniwinther@google.com
a0613471aa
Handle SendSet and NewExpression through NewResolvedVisitor.
...
This allows for the handling assignment and new expression through the SemanticSendVisitor methods in SsaBuilder and InferrerVisitor(s).
BUG=
R=karlklose@google.com
Committed: https://code.google.com/p/dart/source/detail?r=45091
Reverted: https://code.google.com/p/dart/source/detail?r=45093
Review URL: https://codereview.chromium.org//1079533002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45138 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-14 12:56:33 +00:00
asgerf@google.com
ae1cf9f6d0
cps-ir: Register instantiated type at InvokeConstructor.
...
This is a symptom of a larger issue that will arise when we try to
inline InvokeConstructor invocations. I've left a TODO to consider when
we start to look at inlining.
BUG=
R=karlklose@google.com
Review URL: https://codereview.chromium.org//1083043002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45135 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-14 12:29:01 +00:00
asgerf@google.com
61863051e6
cps-ir: Merge variables based on the source variable's name.
...
Previously we would merge based on the element, but that is a poor
strategy when multiple locals have the same name. E.g:
for (int i = 0; i < X; ++i) {...}
for (int i = 0; i < Y; ++i) {...}
The two `i` variables should obviously be merged, but they have
different elements.
BUG=
R=kmillikin@google.com
Review URL: https://codereview.chromium.org//1087783002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45134 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-14 12:14:03 +00:00
zarah@google.com
f09447ebef
dartj2s: add constructor helpers for map literals with no type parameters.
...
R=herhut@google.com
Review URL: https://codereview.chromium.org//1051223003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45133 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-14 11:28:28 +00:00
asgerf@google.com
cddd5120a8
Assignment expressions in tree IR.
...
Assignments are propagated into their first use, e.g:
var x = foo(),
y = bar();
baz(x, y, y)
Becomes:
var y;
baz(foo(), y = bar(), y);
By itself, this usually degrades readability and is only a modest
improvement in code size (but it never degrades code size).
The main advantage is when it unlocks other optimizations such as
inlining of `x` in the above example.
The ability to rewrite ugly while(true) loops is one of the main wins
for this, but there are currently other things also blocking that, which
I will take in another CL.
Setters are also propagated to their use site, mostly to assist
introduction of compound operators in the future.
I'm considering if some of this should be enabled only when minifying
due to the unreadable output, but for now it's always on.
OVERVIEW OF CHANGES:
- Assign and SetField are now Expressions.
- VariableDeclaration is a new Dart-specific statement for declaring
captured variables inside loops
(previously handled by the `Assign.isDeclaration` field).
- StatementRewriter now propagates assignments into variable uses,
regardless of use count.
The assignment is then converted to a variable use if there are no
more uses of the variable. E.g:
{ x = foo(); bar(x); } ==> bar(x = foo()) ==> bar(foo())
- Combining statements and expressions now works a bit differently
so we can inline combined assignments into an inlined combined break
without risking reprocessing.
- New phase PullIntoInitializers moves assignment expressions back
into statements so they can be part of the variable initializer.
The StatementRewriter cannot be predict ahead of time whether
an assignment propagation is beneficial, so this phase cleans up
some bad propagations.
R=kmillikin@google.com
Review URL: https://codereview.chromium.org//1088493002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45132 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-14 11:16:27 +00:00
asgerf@google.com
7b9cc238b1
cps-ir: Handle factories and redirecting constructors with JS backend.
...
BUG=
R=karlklose@google.com
Review URL: https://codereview.chromium.org//1067533003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45128 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-14 08:25:26 +00:00
asgerf@google.com
677c9fad1c
cps-ir: Register IndexSet calls like other calls in JS codegen.
...
BUG=
R=karlklose@google.com
Review URL: https://codereview.chromium.org//1086643003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45126 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-14 08:22:17 +00:00
sigmund@google.com
968fcdc8c7
Make invalid to override method names for local nested functions
...
BUG= http://dartbug.com/19129
R=johnniwinther@google.com
Review URL: https://codereview.chromium.org//1073983003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45123 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-13 23:49:55 +00:00
sra@google.com
a64c72bc77
Make HForeignCode 'isAllocation' property available to optimization
...
The main difference seen is slightly better codegen around a few box allocations due to store-forwarding across calls because the allocation is now known to be unaliased.
R=floitsch@google.com
Review URL: https://codereview.chromium.org//1079803002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45118 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-13 19:29:23 +00:00
sigmund@google.com
b2c067a754
Report compile-time error if using this implicitly in initializers
...
BUG= http://dartbug.com/21210
R=johnniwinther@google.com
Review URL: https://codereview.chromium.org//1078873003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45114 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-13 17:56:32 +00:00
sra@google.com
9385aa2acd
Use native behavior for dead code elimination
...
- Unused pure instructions are removed
- noSuchMethod-on-null-guards
R=floitsch@google.com
Review URL: https://codereview.chromium.org//1079253002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45110 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-13 16:30:02 +00:00
floitsch@google.com
55dc5bcf42
Revert "dart2js: use Es6 maps when available."
...
This reverts commit r45105.
Review URL: https://codereview.chromium.org//1083733002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45107 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-13 15:24:34 +00:00
sigurdm@google.com
9be87a1899
Revert "Dart2js deferred loading. Follow types of functions when calculating dependencies."
...
This reverts commit r45101.
BUG=
Review URL: https://codereview.chromium.org//1086523003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45106 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-13 14:42:02 +00:00
floitsch@google.com
dbc6ae91ab
dart2js: use Es6 maps when available.
...
R=herhut@google.com
Review URL: https://codereview.chromium.org//1032783003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45105 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-13 14:27:25 +00:00
asgerf@google.com
1e264887c4
cps-ir: Don't bail on assert in unchecked mode.
...
BUG=
R=karlklose@google.com
Review URL: https://codereview.chromium.org//1087483003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45103 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-13 14:05:55 +00:00
sigurdm@google.com
0d3ef8dcd7
Dart2js deferred loading. Follow types of functions when calculating dependencies.
...
This fixes part of dartbug.com/22995
Turns out that synthesized constructors not always have a type.
BUG=
R=johnniwinther@google.com
Committed: https://code.google.com/p/dart/source/detail?r=45086
Review URL: https://codereview.chromium.org//1019923005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45101 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-13 13:53:13 +00:00
johnniwinther@google.com
03eb025f29
Copy OldResolver dispatch logic to SendVisitor and remove OldResolver.
...
BUG=
R=karlklose@google.com
Review URL: https://codereview.chromium.org//1083633002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45099 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-13 13:11:17 +00:00
johnniwinther@google.com
e06f96ae3a
Revert "Handle SendSet and NewExpression through NewResolvedVisitor."
...
This reverts commit r45091.
BUG=
Review URL: https://codereview.chromium.org//1086543002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45093 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-13 10:42:28 +00:00
johnniwinther@google.com
9557f010a4
Handle SendSet and NewExpression through NewResolvedVisitor.
...
This allows for the handling assignment and new expression through the SemanticSendVisitor methods in SsaBuilder and InferrerVisitor(s).
BUG=
R=karlklose@google.com
Review URL: https://codereview.chromium.org//1079533002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45091 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-13 09:47:54 +00:00
sigurdm@google.com
d0d07a565e
Revert "Dart2js deferred loading. Follow types of functions when calculating dependencies."
...
This reverts r45086
BUG=
R=karlklose@google.com
Review URL: https://codereview.chromium.org//1087473002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45087 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-13 08:47:08 +00:00
sigurdm@google.com
715f16fc53
Dart2js deferred loading. Follow types of functions when calculating dependencies.
...
This fixes part of dartbug.com/22995
Turns out that synthesized constructors not always have a type.
BUG=
R=johnniwinther@google.com
Review URL: https://codereview.chromium.org//1019923005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45086 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-13 07:56:35 +00:00
sra@google.com
a3271de525
Add unary arithmetic (+#, -#) to ThrowBehaviorVisitor
...
R=floitsch@google.com
TBR=floitsch@google.com
Review URL: https://codereview.chromium.org//1075283002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45082 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-10 22:21:29 +00:00
sigmund@google.com
de08c19261
Add --no-source-maps flag to dart2js executable
...
BUG= http://dartbug.com/21299
R=floitsch@google.com , johnniwinther@google.com
Review URL: https://codereview.chromium.org//1074903002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45071 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-10 16:53:00 +00:00
sra@google.com
9b730d6447
Compute default throwing behavior from JavaScript.
...
This change removes the heuristic that 'general effects imply may-throw behavior', replacing it with explicit throwing behavior.
A new JavaScript AST visitor provides the default throwing behavior.
R=floitsch@google.com
Review URL: https://codereview.chromium.org//1074043003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45070 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-10 16:00:02 +00:00
johnniwinther@google.com
f92e76929f
Add SemanticDeclVisitor.
...
BUG=
R=karlklose@google.com
Review URL: https://codereview.chromium.org//1047673002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45068 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-10 15:06:33 +00:00
johnniwinther@google.com
1596361d53
Handle local get through semantic visitor methods.
...
BUG=
R=karlklose@google.com
Review URL: https://codereview.chromium.org//1053673004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45066 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-10 14:17:23 +00:00
johnniwinther@google.com
16bfae7b27
Handle setter without getter for compounds in SemanticSendVisitor
...
+ fix status of dart2dart new_backend.
BUG=
R=asgerf@google.com
Review URL: https://codereview.chromium.org//1077103002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45065 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-10 14:00:15 +00:00
floitsch@google.com
ffeedc00bf
dart2js: retain constants that are used as annotations in constructors and setters.
...
BUG= http://dartbug.com/23128
R=herhut@google.com
Review URL: https://codereview.chromium.org//1072043002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45064 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-10 13:10:11 +00:00
zarah@google.com
bc1f440a42
dart2js: Add newline in minified mode.
...
R=herhut@google.com
Review URL: https://codereview.chromium.org//1077123002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45063 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-10 13:06:26 +00:00
zarah@google.com
a604c0d3ed
dart2js: create a 'types' table for each deferred unit.
...
This fixes part of dartbug.com/22995.
R=sigurdm@google.com
Review URL: https://codereview.chromium.org//1071133002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45061 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-10 11:21:10 +00:00
herhut@google.com
3a94963aee
Model 'await for' as an explicit node in tree and fix its handling.
...
BUG= http://dartbug.com/23119
R=floitsch@google.com , johnniwinther@google.com
Committed: https://code.google.com/p/dart/source/detail?r=45053
Reverted: https://code.google.com/p/dart/source/detail?r=45057
Review URL: https://codereview.chromium.org//1069983005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45059 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-10 10:24:57 +00:00
asgerf@google.com
cd822fd188
Pull JS assignments into var initializer.
...
E.g.
var x;
x = new Foo();
x.bar();
return x;
Becomes:
var x = new Foo();
x.bar();
return x;
BUG=
R=kmillikin@google.com
Review URL: https://codereview.chromium.org//1075113003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45058 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-10 09:42:19 +00:00
herhut@google.com
a1c9218994
Revert "Model 'await for' as an explicit node in tree and fix its handling."
...
This reverts revision r45053.
BUG=
TBR=johnniwinther@google.com
Review URL: https://codereview.chromium.org//1077093002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45057 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-10 09:35:29 +00:00
johnniwinther@google.com
9e95e04eb1
Fine-grain field, getter, setter, and function access in IrBuilder.
...
BUG=
R=karlklose@google.com
Review URL: https://codereview.chromium.org//1076793005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45055 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-10 08:41:00 +00:00