Commit Graph

123 Commits

Author SHA1 Message Date
ajohnsen@google.com 999ab57823 Only add JS once, and not to very single patched library.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11078 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-21 17:39:07 +00:00
lrn@google.com d0145b687f Make patching of classes lazy.
Review URL: https://chromiumcodereview.appspot.com//10855262

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11036 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-21 12:53:53 +00:00
ager@google.com 000b295a00 Make sure that libraries loaded from dart:core gets dart:core implicitly loaded.
This is in preparation for deprecating the corelib Math object
in favor of the dart:math library.

R=ahe@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11032 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-21 11:24:23 +00:00
ahe@google.com 027e95f898 Fix dart2js_mirror breakage.
Review URL: https://chromiumcodereview.appspot.com//10831369

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10897 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-17 13:52:49 +00:00
lrn@google.com ed1ed6472d Make top-level patch injections be compilation unit under library.
Review URL: https://chromiumcodereview.appspot.com//10824347

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10895 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-17 13:08:00 +00:00
johnniwinther@google.com ac5a4808d8 Skeleton typedef type implementation
Review URL: https://chromiumcodereview.appspot.com//10832136

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10880 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-17 11:15:44 +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
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 404f888f83 Refactor Library/CompilationUnit and how we define local Scope.
This also collapses members and constructors of a class into the same
map.

BUG=

Original URL: https://chromiumcodereview.appspot.com//10832203

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10632 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-14 11:35:17 +00:00
sgjesse@google.com c888b57137 Fix type inference for self-recursive functions
If a self-recursive function calls itself with different argument
types that the ones currently expected the actual recompilation of the
function did not take place. This caused wrong JavaScript code to be
generated.

This change queues the generated JavaScript code to be invalidated to
after compiling the current function so that it itself can be
invalidated correctly.

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

BUG=dart:4492
TEST=tests/compiler/dart2js_extra/regress/4492_test.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10622 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-14 08:54:02 +00:00
ahe@google.com dbfb312dea Abort earlier on compilation errors
Review URL: https://chromiumcodereview.appspot.com//10823290

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10595 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-13 18:27:06 +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
lrn@google.com d134e7d052 Allow patch files to add declarations to the patched library.
Review URL: https://chromiumcodereview.appspot.com//10831262

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10562 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-13 11:58:48 +00:00
ajohnsen@google.com dd8585d5a2 Revert "Refactor Library/CompilationUnit and how we define local Scope."
This reverts commit 05718e680ca45ac26fcc0d0256fc98419fac1b2e.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10550 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-13 06:45:24 +00:00
ajohnsen@google.com ccc0ce3101 Refactor Library/CompilationUnit and how we define local Scope.
This also collapses members and constructors of a class into the same
map.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10549 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-13 06:22:24 +00:00
floitsch@google.com 63bce914b7 Implement call operator.
Committed: https://code.google.com/p/dart/source/detail?r=10495

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10507 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-10 14:19:31 +00:00
floitsch@google.com dafca6eb63 Revert "Implement call operator."
This reverts commit 10495.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10498 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-10 12:37:47 +00:00
floitsch@google.com 0feeece251 Implement call operator.
Review URL: https://chromiumcodereview.appspot.com//10834270

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10495 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-10 12:20:30 +00:00
ahe@google.com 3da6222373 Restore lazy parsing of classes.
Review URL: https://chromiumcodereview.appspot.com//10826243

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10491 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-10 11:37:58 +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
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
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
johnniwinther@google.com 3ce4405ced Revert "Skeleton typedef type implementation"
This reverts revision 10234.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10235 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-03 16:06:19 +00:00
johnniwinther@google.com 21855b3b1a Skeleton typedef type implementation
Review URL: https://chromiumcodereview.appspot.com//10832136

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10234 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-03 15:48:49 +00:00
ajohnsen@google.com 5b563a82dd Revert 'Port the remaining of dart:core to the unified corelib.'
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10159 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-02 11:07:49 +00:00
ajohnsen@google.com e029198035 Port the remaining of dart:core to the unified corelib.
This also adds support for injecting private fields and functions from
class patches.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10156 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-02 10:18:25 +00:00
ajohnsen@google.com fe4570dcc5 Create 'unified' version of Date, with a dart2js implementation.
VM implementation is pending.

This also fixes dart2js, so it correctly handles getters and setters in
patches.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10116 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-01 13:35:28 +00:00
johnniwinther@google.com 1dda757cf0 Parameters with function types supported + Added features in mirrors implementation
VariableListElement.computeType now handles function types.
Default value and function typed parameters supported in the mirror system.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9756 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-19 13:17:10 +00:00
lrn@google.com 2d58755073 Revert "Allow patch files to add top-level declarations to the patched library."
This reverts r9629.

TBR: floitsch

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9630 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-13 13:59:54 +00:00
lrn@google.com 7621533549 Allow patch files to add top-level declarations to the patched library.
The patch library is loaded normally, and then non-patch methods and classes
are cloned and added to the patched library. To support methods from other
compilation units, all elements now has a scriptOverride field that lets
them report a different script than the one of their enclosing element.
(For top-level elements that's already possible, as that's what #source does,
but for fields inside a class, we can't easily wrap a compilation unit element
around them.)

TBR: floitsch
(to get in before vacation, with reversion rights).

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9629 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-13 13:46:21 +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
johnniwinther@google.com fdbabb995e Dartdoc and Apidoc updated to use dart2js through the mirror system.
BUG=3414

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9584 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-12 08:52:19 +00:00
floitsch@google.com c8cd641308 Fix usage of UNKNOWN/CONFLICTING types for union.
Fixes issue 4033.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9547 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-11 10:34:58 +00:00
lrn@google.com 42f353fad1 Patch methods in classes.
Add math library in corelib/unified. Location subject to change.
Made _Random's implementation external and patched it to use JS random.
Made "external" marking acually work.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9544 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-11 08:47:24 +00:00
lrn@google.com aa8f2cf676 Recognize "patch" identifier in .dartp files.
Added more infrastructure to detect errors in the patch.
Still no ability to add an element from the patch to the original library.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9457 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-09 06:39:57 +00:00
sgjesse@google.com cd961fe372 Generalize the use of type information for setters and initializers
Instead of checking explicitly for integers just union the types
involved. This also led to some refactoring getting rid of an almost
duplicate method.

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

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9426 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-06 07:50:24 +00:00
sgjesse@google.com 2384d9a9a1 Fix checked mode errors
TBR=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9423 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-06 04:37:40 +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
lrn@google.com d1da93a393 Reapply "Make patch file import declarations apply to the patched library too."
This reapplies r9346 with the following fix:
Adds #library tag to tests containing #import.
The test web-driver tries to source the file if it doesn't contain
a #library declaration, which isn't valid if it contains #import.

R=floitsch

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9401 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-04 12:02:28 +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
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
lrn@google.com b5ce02776b Revert "Make patch file import declarations apply to the patched library too."
This reverts commit r9346.

TBR=floitsch

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9354 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-03 14:25:50 +00:00