Commit Graph

191 Commits

Author SHA1 Message Date
kasperl@google.com 34ec097692 Get rid of the name in HInvokeDynamic (just use the selector instead).
This fixes issue 2620.

R=ngeoffray@google.com,karlklose@google.com
BUG=http://dartbug.com/2620

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11030 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-21 10:56:02 +00:00
ngeoffray@google.com 7ed266a293 Few tweaks to the generated code to avoid eg parenthesis.
Review URL: https://chromiumcodereview.appspot.com//10860036

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10982 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-20 15:38:09 +00:00
sgjesse@google.com 210cb22f51 Start inferring return types for static functions
Types propagated to the function exit are recorded in the code generator
and optimisticly used at call sites. If this optimistic assumption fails
the callers have to be recompiled.

R=kasperl, ngeoffray, floitsch

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10876 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-17 10:32:54 +00:00
regis@google.com d9b0276a4c Require two type arguments for map literals (issue 4522).
Spec has been changed back.
VM temporarily accepts a single type argument and emits a warning.
Update tests, dart2js source, dartdoc, etc...
Disable failing co19 tests (issue 175 filed).
Review URL: https://chromiumcodereview.appspot.com//10854191

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10861 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-16 20:44:32 +00:00
floitsch@google.com 1c89511be4 Move types out of the HInstructions.
Review URL: https://chromiumcodereview.appspot.com//10827180

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10823 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-16 14:25:00 +00:00
kasperl@google.com 3b87631a1c Make selector registration in the resolver and code generator more explicit.
Get rid of registerFieldClosureInvocations() in the enqueuer by explicit
registering the closure call selectors when we may be calling a getter in
the resolver and the code generator.

R=floitsch@google.com,ahe@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10805 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-16 11:52:44 +00:00
ahe@google.com fe6c6324d3 Implement super.foo = expression.
Review URL: https://chromiumcodereview.appspot.com//10854163

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10798 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-16 07:55:51 +00:00
sgjesse@google.com 90ef467e0e Track types for arguments passed to calls to static functions
This uses the same mechanism as is currently used for tracking the types of
arguments passed to non-static functions. The type collection has been
refactored to support both.

For static functions the type information for a function is invalidated if
the function is used for anything else than a direct call.

The test LibTest/core/int/operator_truncating_division_A01_t01 now has
the "problem" that the statement

  Expect.isTrue(actual is int);

never fails even though actual might not be an int in the generated JavaScript
even though the inferred type for actual is int.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10726 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-15 13:52:06 +00:00
lrn@google.com 640e0ee99b Clean-up of getCompilationUnit.
Fixes a few places that assumes libraries can be compilation units.
- VoidElement now belongs to the entry compilation unit of the core library.
- Abstract fields now belong to the compilation unit of the creating accessor.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10711 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-15 11:38:56 +00:00
kasperl@google.com e8268dd78a Add name and library to selectors.
This is the first step towards improving the Selector as an
abstraction used by the resolver, builder, and enqueur. The
intent is to have the resolver construct selectors that can
be used for method lookup, tree shaking, and for simplifying
the logic we use to build the correct SSA instructions for
sends (some of which are quite complex).

Next step is to get rid of more of the adhoc selector building
that's done outside of the resolver and clean up how we resolve
sends. After that, I'll start removing the need for passing
around both a name and a selector in a lot of places.

R=ahe@google.com,sgjesse@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10637 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-14 12:21:51 +00:00
floitsch@google.com 9dbe99dbf7 Add JavaScript AST.
Review URL: https://chromiumcodereview.appspot.com//10825180

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10506 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-10 13:59:16 +00:00
sgjesse@google.com b0a258d309 Reapply "Collect call site information and use that for estimating parameter types"
This reapplies r10386 and r10383 which was reverted in r10394

It also fixes the bug causing the revert. This is the line 1754 added
in codegen.dart.

Also added a regression test.

R=kasperl@google.com

BUG=4434

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10443 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-09 14:41:04 +00:00
lrn@google.com 97b4df393f Reduce usage of .enclosingElement to get enclosing class.
Currently code assumes that a member's immediate enclosingElement is
its class element.
If we introduce compilation unit override elements into the enclosing
chain, this will no longer be true.
This CL changes the places that assumes this to use isMember() or
getEnclosingClass(). The assumption is still in place in isMember(),
which will need to be modified when things change.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10438 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-09 12:47:42 +00:00
floitsch@google.com 748e94b7de Don't rely on the existence of an element in field gets.
Review URL: https://chromiumcodereview.appspot.com//10855026

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10417 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-08 19:30:27 +00:00
sgjesse@google.com 8861344f12 Revert "estimating parameter types" optimization due to failure on browser
test "samples/tests/samples/lib/view/view_test.dart"

Revert "Collect call site information and use that for estimating parameter types"

This reverts commit f0c42199df50d3d70a47d7ea7311b63b0e60cab0.

Revert "Fix mistake in previous commit r10383"

This reverts commit 571f6f3cdabecddecbeee9a0d3fca8b8c5ad61b0.

TBR=ahe@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10394 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-08 15:56:37 +00:00
sgjesse@google.com 74592b0457 Collect call site information and use that for estimating parameter types
The propagated types at call sites for dynamic invocations are
collected. When a functions is compiled it is checked whether
there is type information available from call sites. If so the
function is compiled with the asumption that these types will
always be provided. If these expected types change during the
rest of the compilation process the generated code for the
function will be flushed and the function scheduled for
compilation again.

Note that the scheduling for being compiled again is not using
the re-compilation queue. The Re-compilation queue is used for
re-compilation functions when all functions have been compile
once and type information will not change.

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

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10383 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-08 13:55:09 +00:00
floitsch@google.com 449c8dee83 Make field-get/set work without elements.
Review URL: https://chromiumcodereview.appspot.com//10831154

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10334 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-07 12:54:03 +00:00
johnniwinther@google.com 832a3f46a3 Unify ClassElement and TypedefElement.
Review URL: https://chromiumcodereview.appspot.com//10825177

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10221 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-03 11:10:38 +00:00
floitsch@google.com 1bfab03659 Split TypeGuard and BailoutTarget.
Review URL: https://chromiumcodereview.appspot.com//10807069

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9813 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-23 14:36:16 +00:00
floitsch@google.com c305fe4da8 Use 'default:' for the first bailout-case with more than one target.
Review URL: https://chromiumcodereview.appspot.com//10796084

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9805 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-23 13:04:28 +00:00
podivilov@google.com 04d600fdfc Add source mapping info to loops.
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9776 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-20 12:54:42 +00:00
podivilov@google.com e25b5101fc Associate AST nodes with HIstructions when building HGraph.
Then use this info in ssa codegen to provide source locations for generated code.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9711 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-17 16:45:28 +00:00
podivilov@google.com d637d0dce8 Introduce CodeBuffer as StringBuffer replacement in compiler.
CodeBuffer stores source location markers along with emitted JavaScript code.
When CodeBuffer content is added to another CodeBuffer, the markers are added as well.

CodeBuffers will be used to propagate source mappings from inside ssa codegen to emitter,
see https://chromiumcodereview.appspot.com/10695174/ for details.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9628 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-13 12:59:13 +00:00
ager@google.com 21a6eef938 Recognize simple numeric computations for field type recording.
R=floitsch@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9627 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-13 12:32:39 +00:00
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