Commit Graph

167 Commits

Author SHA1 Message Date
ager@google.com ef3aeff677 Make sure to use the type-restricted selector when registering
what can be called in loops.

I don't expect a big impact, but it could reduce code size by
avoiding type-guard insertions for methods that cannot be hit
by a given call.

R=floitsch@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10693127

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9507 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-10 13:28:08 +00:00
sra@google.com d3a67e8016 Revert "Revert "Allow === and == to generate inputs at the use site when compiling to a single comparison.""
Fixed bug where subexpressions were visited twice.

Review URL: https://chromiumcodereview.appspot.com//10754012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9492 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-09 23:51:26 +00:00
sra@google.com 0777cd8cb7 Revert "Allow === and == to generate inputs at the use site when compiling to a single comparison."
Review URL: https://chromiumcodereview.appspot.com//10757009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9486 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-09 21:19:01 +00:00
sra@google.com 30b48d9fac Allow === and == to generate inputs at the use site when compiling to a single comparison.
We only need temps in the general case
x === y -->  (x == null ? y == null : x === y)

Review URL: https://chromiumcodereview.appspot.com//10695106

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9481 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-09 20:18:02 +00:00
sgjesse@google.com ffe443811f Collect the actual types for all field setters.
Before only boolean indicating whether the type was HType.INTEGER or
not was collected. Now collect the union of all types seen for setters
for each field.

R=floitsch@google.com, ager@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10694091

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9422 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-06 04:10:17 +00:00
ager@google.com 654dd80103 Track users through phi nodes to eliminate '>>> 0' for more bitops
whose results are only used in other bitops.

R=kasperl@google.com,sgjesse@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10695103

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9413 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-05 08:43:07 +00:00
podivilov@google.com 4fbf112cc9 Associate partial source map with each code block in Universe.generatedCode.
That way we can create partial source maps for individual functions in codegen,
and join them into a single map at the end.

Currently partial source maps contain only begin and end positions of all functions.

R=ahe@google.com

Review URL: https://chromiumcodereview.appspot.com//10668029

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9400 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-04 11:53:25 +00:00
ager@google.com 72b997b522 Reapply change to update dart2js operator equals semantics to follow the latest spec.
Changes since the version that was reverted are in patch set 2:

1. Fix one remaining dart2js test that relied on the old operator== behavior.

2. Fix type intersection operation to actually take null into account. Because of bounded types they should always use canBeNull.

R=floitsch@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10692087

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9396 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-04 11:29:47 +00:00
podivilov@google.com 43f93e9a6a Revert "Associate partial source map with each code block in Universe.generatedCode."
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9394 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-04 10:47:02 +00:00
podivilov@google.com 569dc5bff7 Associate partial source map with each code block in Universe.generatedCode.
That way we can create partial source maps for individual functions in codegen,
and join them into a single map at the end.

Currently partial source maps contain only begin and end positions of all functions.

R=ahe@google.com

Committed: https://code.google.com/p/dart/source/detail?r=9347

Committed: https://code.google.com/p/dart/source/detail?r=9351

Review URL: https://chromiumcodereview.appspot.com//10668029

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9390 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-04 10:12:50 +00:00
sgjesse@google.com 27e588647d Ignore setters in constructors when evaluating determining firect field access
Setters in constructors cannot mutate an object after construction.

Doesen't do much for preformance but simplifies some of the generated
code and shakes out a few getters.

R=floitsch@google.com, ager@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10703087

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9386 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-04 08:07:34 +00:00
ager@google.com 8bca3e8dcb Revert all the changes to equals operator. Causing buildbot trouble.
R=floitsch@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10698079

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9357 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-03 15:39:14 +00:00
podivilov@google.com f14b21a4a3 Revert "Associate partial source map with each code block in Universe.generatedCode."
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9353 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-03 14:19:54 +00:00
podivilov@google.com 82ce0b271c Associate partial source map with each code block in Universe.generatedCode.
That way we can create partial source maps for individual functions in codegen,
and join them into a single map at the end.

Currently partial source maps contain only begin and end positions of all functions.

R=ahe@google.com

Committed: https://code.google.com/p/dart/source/detail?r=9347

Review URL: https://chromiumcodereview.appspot.com//10668029

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9351 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-03 13:54:46 +00:00
podivilov@google.com 4dc7608dbc Revert "Associate partial source map with each code block in Universe.generatedCode."
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9349 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-03 13:39:38 +00:00
ager@google.com 6d5bb70430 Change dart2js to follow the new spec on the equality operator.
'null' is only equals to 'null' and nothing else. The user-defined
operator== is never called with null.

This also means that a 'a == null' and 'null == a' can always be
treated as a builtin when compiling to javascript.

Update the test expectations for co19. I will file co19 bugs about
updating the tests.

R=floitsch@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10697068

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9348 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-03 13:38:25 +00:00
podivilov@google.com c03d2957f5 Associate partial source map with each code block in Universe.generatedCode.
That way we can create partial source maps for individual functions in codegen,
and join them into a single map at the end.

Currently partial source maps contain only begin and end positions of all functions.

R=ahe@google.com

Review URL: https://chromiumcodereview.appspot.com//10668029

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9347 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-03 13:09:40 +00:00
floitsch@google.com b289effd04 remove HIf.hasElse.
An HIf always has an else. It might be empty, though.

Review URL: https://chromiumcodereview.appspot.com//10693059

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9285 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-02 13:57:42 +00:00
ager@google.com 87e2b277a2 Revert "Generate JS operators using helper functions with thunks for operands." because of buildbot failures.
R=lrn@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10702039

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9252 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-29 14:55:00 +00:00
lrn@google.com cc93bc38a5 Generate JS operators using helper functions with thunks for operands.
This removes a lot of boilerplate, yet complex, code with its occasional
inevitable errors.

Review URL: https://chromiumcodereview.appspot.com//10697031

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9250 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-29 14:20:24 +00:00
ager@google.com 1a3d31d5c4 Avoid generating '>>> 0' for bitops for which the result is only
used as input to other bitops.

Additionally, recognize HBitAnd with constants that will always
produce positive results.

R=floitsch@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10693028

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9234 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-29 00:03:43 +00:00
floitsch@google.com 90cdf86aab Distinguish statement and expression foreign code.
Review URL: https://chromiumcodereview.appspot.com//10668021

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9159 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-27 12:17:39 +00:00
floitsch@google.com 232fbebdfa Don't lose the expected precedence during && compilation.
When transforming if (foo) bar; to foo && bar make sure that
bar is compiled with the correct precedence.
In particular avoid foo && toto = 499;
instead of
foo && (toto = 499).

Fixes issue 3862.

Review URL: https://chromiumcodereview.appspot.com//10669035

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9157 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-27 11:40:55 +00:00
floitsch@google.com cf1ed8e24f Fix assert.
Review URL: https://chromiumcodereview.appspot.com//10660027

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9120 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-26 17:27:32 +00:00
floitsch@google.com f1147e96b0 Transitively mark inputs as live when they are generateAtUseSite.
Review URL: https://chromiumcodereview.appspot.com//10667013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9119 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-26 17:14:16 +00:00
lrn@google.com cadba87302 Implement 'as' operator.
This is a quick implementation with room for improvement.
It might work.

Review URL: https://chromiumcodereview.appspot.com//10540048

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9109 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-26 14:23:50 +00:00
floitsch@google.com 9f81c281c8 Make undefined and null equivalent.
Fixes issue 3328.

Review URL: https://chromiumcodereview.appspot.com//10533151

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9053 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-24 19:13:57 +00:00
sgjesse@google.com 9ab265364b Improve tracking of the type of fields after object construction
Based on the guarenteed types a field is initialized to in both the
initializer lists and constructor bodies give an optimistic type for
this field. Based on all the field setters and invoked setters for
that field turn this optimistic type into either a propagated type or
a guarenteed type.

R=kasperl@google.com, floitsch@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10638013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9019 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-22 09:29:41 +00:00
floitsch@google.com 3d5769cc8b Remove static fields in the namer.
Review URL: https://chromiumcodereview.appspot.com//10574046

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8965 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-21 09:35:08 +00:00
sgjesse@google.com 0192db763e Refactor the collection of initializer list types
Instead of storing a boolean to indicate whether a field is only
intialized to an integer store the propagated type instead. If
different types are encountered for the same field indicate this with
HType.UNKNOWN.

Also fix a bug in the checking, as potential single type initializers
is not the same as known single type initializers.

This is in preparation for information on other types than integers.

R=floitsch@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10584009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8963 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-21 08:51:24 +00:00
floitsch@google.com 11e613aadb Introduce HLocalValue and HLocalGet/Set.
Review URL: https://chromiumcodereview.appspot.com//10562041

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8854 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-19 15:56:50 +00:00
ahe@google.com 73b5ce042c Fix a bug in type assertions involving String supertypes.
Review URL: https://chromiumcodereview.appspot.com//10574015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8837 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-19 10:53:21 +00:00
kasperl@google.com a1d2f0187d Better bitwise and binary arithmetic when the left operand is known to be a primitive.
R=ager@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10558022

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8836 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-19 09:23:26 +00:00
ngeoffray@google.com aec0563c39 Revert r8800 some web tests are failing.
Review URL: https://chromiumcodereview.appspot.com//10544209

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8806 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-18 16:37:53 +00:00
ngeoffray@google.com 5afea1070a Generate nested else if:
if (a) {
} else if () {
}

instead of:

if (a) {
} else {
  if () {
  }
}
Review URL: https://chromiumcodereview.appspot.com//10541173

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8800 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-18 15:55:25 +00:00
sgjesse@google.com 1d39bb9c4d Track fields which are known to be always set to integer constants
For each field which is accessed directly in the generated JavaScript
code track whether all the setters are setting the field to an integer
constant. If that is the case the codegen will always generate ===
comparison when comparing to an integer constant.

To know for sure that only integer constants are assigned the
functions having the getters need to be recompiled.

This gives ~10% on Delta Blue.

R=ngeoffray@google.com, floitsch@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10539156

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8796 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-18 14:03:30 +00:00
kasperl@google.com feb05c33c3 Stop mapping indexOf/lastIndexOf directly to the JavaScript native on indexable primitives.
Fixes http://dartbug.com/3689.

R=ahe@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10553034

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8790 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-18 13:17:17 +00:00
floitsch@google.com b5acd09f81 Fix most warnings and other minor cleanups.
Review URL: https://chromiumcodereview.appspot.com//10557003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8719 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-15 13:26:35 +00:00
kasperl@google.com f179d6a4d5 Extend the {+,-,/,*}= support by allowing non-constants on the right side.
R=ager@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10562002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8713 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-15 12:06:21 +00:00
ngeoffray@google.com bd800b77ba Declare parameters of the bailout version in beginGraph, instead of setting them up in endGraph.
Review URL: https://chromiumcodereview.appspot.com//10541170

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8664 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-14 15:32:01 +00:00
ngeoffray@google.com a02d508dfd Only do the declaring of parameters in a non-bailout version. The bailout version has different set of parameters, that we need to deal with differently.
Review URL: https://chromiumcodereview.appspot.com//10545176

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8654 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-14 12:48:08 +00:00
ngeoffray@google.com d5ee660e41 Fix issue http://code.google.com/p/dart/issues/detail?id=3627 do not generate a 'var' for variables that have the same name as parameters.
Review URL: https://chromiumcodereview.appspot.com//10541164

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8652 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-14 12:26:23 +00:00
ngeoffray@google.com 5d6fdec055 Clean up code generation of guards.
Review URL: https://chromiumcodereview.appspot.com//10545173

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8644 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-14 08:57:20 +00:00
ngeoffray@google.com ac72db52b8 Reapply "Simplify generated code for trivial bailout methods".
Review URL: https://chromiumcodereview.appspot.com//10533128

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8642 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-14 08:13:58 +00:00
ngeoffray@google.com 274ca27fde Add a new magic element kind for annotating types that have Javascript array behavior.
Review URL: https://chromiumcodereview.appspot.com//10447088

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8611 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-13 15:20:41 +00:00
ngeoffray@google.com 4950631710 Revert r8592: failures on checked mode and some web tests.
Review URL: https://chromiumcodereview.appspot.com//10544132

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8594 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-13 08:34:13 +00:00
ngeoffray@google.com b652946a26 Simplify generated code for trivial bailout methods.
Review URL: https://chromiumcodereview.appspot.com//10539106

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8592 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-13 07:57:05 +00:00
ager@google.com 28a990fc32 Use simple loop tracking instead of size to determine if
speculative type assumptions should be used.

This seems like a better indication of hotness than the previous size + use count estimate.

R=ngeoffray@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10534109

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8538 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-12 11:24:45 +00:00
sgjesse@google.com fbae779b58 Reapply "Collect field getters and setters in the universe""
Added additional checks on the receiver instead of asserting that its
type was not null. HFieldSet and HFieldGet are used for other purposes
than instance fields.

R=ngeoffray@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10537118

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8534 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-12 10:29:00 +00:00
ngeoffray@google.com 5cc78aa9df Fix switch codegen: indentation is already added.
Review URL: https://chromiumcodereview.appspot.com//10542119

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8532 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-12 10:19:37 +00:00