Commit Graph

358 Commits

Author SHA1 Message Date
karlklose@google.com aeafe0fdda Add erroneous elements for function types and use them to allow unresolvable constructors to be handled in the backend.
This is the first step towards runtime error handling of unresolvable constructors, library prefixes and constructor names in new-expressions.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11042 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-21 13:40:07 +00:00
ngeoffray@google.com a13af7eb1f When replacing an instruction with another in GVN-like optimizations, try to find a better user of it, that knows more about the type.
Review URL: https://chromiumcodereview.appspot.com//10831404

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11039 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-21 13:19:10 +00:00
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 5e0a986566 If an instruction is known to already by a number, the integer check will try to make it an integer.
Review URL: https://chromiumcodereview.appspot.com//10831392

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11014 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-21 07:39:00 +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
ngeoffray@google.com 2e1e48a4ed Add an optional parameter to the dominatedUsers function in case we want to analyze the whole block, and not only from an instruction. Fixes bug 4069.
Review URL: https://chromiumcodereview.appspot.com//10824371

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10957 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-20 13:32:50 +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
karlklose@google.com 9c75cd73a3 Remove cached constructor elements from the resolver. They are already stored in the resolution world.
Review URL: https://chromiumcodereview.appspot.com//10834358

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10871 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-17 08:12:29 +00:00
floitsch@google.com ceef740993 Fix tracer type.
Review URL: https://chromiumcodereview.appspot.com//10825398

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10863 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-16 21:05:28 +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 ecae19772f Fix field-accesses for private fields that were "shadowed" by other private fields.
Review URL: https://chromiumcodereview.appspot.com//10827359

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10827 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-16 16:16:17 +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
sgjesse@google.com d2b9f3f2c1 Fix wrong optimization for private fields
R=floitsch@google.com

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10719 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-15 12:49:38 +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
ahe@google.com d47c99d041 Support for new catch syntax in dart2js
Committing on behalft of: Alexander Aprelev <aprelev@gmail.com>

BUG=3758

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10704 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-15 09:51:18 +00:00
floitsch@google.com cc40f8ec3f Make the closure-to-class translator more accessible. It can now be
used by the type-inference algorithm.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10648 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-14 14:16:50 +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
ajohnsen@google.com a262657ca0 Fix bugs found in checked mode.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10636 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-14 12:08:31 +00:00
ahe@google.com 26f63f029a Ensure supertypes are loaded safely.
Review URL: https://chromiumcodereview.appspot.com//10855125

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10586 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-13 16:42:41 +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 8995503241 Start moving the JavaScript backend related code into a separate library
R=ahe@google.com, floitsch@google.com

BUG=

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10482 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-10 08:49:27 +00:00
sgjesse@google.com 756de4bf83 Revert "Start moving the JavaScript backend related code into a separate library"
TBR=floitsch@google.com

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10481 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-10 08:28:43 +00:00
sgjesse@google.com 783902b9be Start moving the JavaScript backend related code into a separate library
R=ahe@google.com, floitsch@google.com

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10479 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-10 08:10:38 +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 989f51565f Fix mistake in previous commit r10383
Should fix failing test and actually turn on the optimizations.

TBR=ahe@google.com

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10386 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-08 14:21:28 +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
ahe@google.com b0d78c8728 Infer guaranteed types for static calls that are only called once.
Committed: https://code.google.com/p/dart/source/detail?r=10341

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10376 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-08 12:32:08 +00:00
ahe@google.com ce034bf0c2 Revert "Infer guaranteed types for static calls that are only called once."
Revert "Change type annotation to unbreak build."

This reverts revision 10343 and 10341.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10344 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-07 16:04:32 +00:00
ahe@google.com ae83d50367 Infer guaranteed types for static calls that are only called once.
Review URL: https://chromiumcodereview.appspot.com//10855020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10341 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-07 15:31:47 +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
ahe@google.com 071f2a2d58 Basic type inference skeleton
Review URL: https://chromiumcodereview.appspot.com//10823184

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10328 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-07 08:37:29 +00:00
floitsch@google.com 8dc1bbf516 Fix dominatedUsers for phis.
Review URL: https://chromiumcodereview.appspot.com//10855004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10288 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-06 14:12:21 +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
kasperl@google.com 9125b3451e Refactor the way we emit no such method handlers so it's easier to optimize it later.
Avoid adding duplicate JavaScript functions (may occur if we have
multiple different typed selectors in play or if the same library
shows up multiple times in the library map).

R=floitsch@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10162 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-02 13:18:17 +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
floitsch@google.com e63ebe892b Reenable GVN for fields.
GVN for fields was disabled in r9735 (issue 4086). Turns out that the fix was not too complicated.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9801 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-23 09:14:34 +00:00
floitsch@google.com e41b8bf041 Don't create new nodes if we don't need to.
Review URL: https://chromiumcodereview.appspot.com//10808050

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9800 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-23 08:37:02 +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 a3cccc46b8 Attach source map positions to returns, sends, and some operators.
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9758 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-19 14:10:20 +00:00
floitsch@google.com 8e7c66ac79 Disable GVN for interceptors and fields.
Fixes issue 4086.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9735 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-18 11:41:46 +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
floitsch@google.com 82d2bfd9f7 Fix loop-invariant code motion.
We did not take the changes-flags of the instructions in the current
block into account.

Fixes issue 4075.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9695 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-17 11:10:50 +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