Commit Graph

4835 Commits

Author SHA1 Message Date
floitsch@google.com 3afd53946c dart2js: Add elements to the emitter's model.
R=zarah@google.com

Review URL: https://codereview.chromium.org//840553002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42638 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-06 17:25:04 +00:00
kmillikin@google.com e79c7e72bf Make scoping more prominent in the CPS IR's printed representation.
Before: LetPrim and LetCont had "internal define" scoping, extending to
the end of the body they were in.  After: they have "let" scoping, with a
body as a subexpression.

This change makes it easier to see scoping in the printed representation.
It also makes the printed representation more closely resemble the
internal representation.  Finally, it is an advantage if writing the IR
by hand because expressions are balanced (Emacs, for example, can copy or
cut a balances S-expression).

Argument lists are changed to be always nested (enclosed by parentheses).
The basic rule of thumb is that the syntactic forms of the IR should all
have fixed arity (matching the internal representation), so that variable
arity parts such as arguments are represented as a single list.

BUG=
R=asgerf@google.com, floitsch@google.com, sigurdm@google.com

Review URL: https://codereview.chromium.org//833353002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42630 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-06 12:49:28 +00:00
floitsch@google.com e43670cb84 dart2js: make "boilerplate" function in Native generator.
R=sra@google.com

Review URL: https://codereview.chromium.org//830923003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42629 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-06 12:34:14 +00:00
floitsch@google.com 96ca1b8488 dart2js: move native boilerplate code into a separate file.
R=sra@google.com, zarah@google.com

Review URL: https://codereview.chromium.org//829473003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42627 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-06 12:25:33 +00:00
zarah@google.com 5ff81ff6bd dart2js OldEmitter: name anonymous function so it does not need to be copied in deferred parts.
R=floitsch@google.com, sigurdm@google.com

Review URL: https://codereview.chromium.org//800903005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42626 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-06 12:05:14 +00:00
johnniwinther@google.com a2dddc825a Remove Compiler.assembledCode.
BUG=
R=floitsch@google.com

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

Review URL: https://codereview.chromium.org//832363002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42623 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-06 11:06:23 +00:00
floitsch@google.com 3456aa38e6 dart2js: Share nativeSuperclassTagName between runtime and compiler.
R=sra@google.com

Review URL: https://codereview.chromium.org//829083002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42622 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-06 10:37:15 +00:00
johnniwinther@google.com 62b0c9426d Improve message for import of part.
BUG=http://dartbug.com/21986
R=floitsch@google.com

Review URL: https://codereview.chromium.org//837473002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42621 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-06 10:23:15 +00:00
johnniwinther@google.com f4b878129c Revert "Remove Compiler.assembledCode."
This reverts commit r42592.

BUG=

Review URL: https://codereview.chromium.org//824103005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42594 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-05 14:38:00 +00:00
johnniwinther@google.com fbc1274183 Remove Compiler.assembledCode.
BUG=
R=floitsch@google.com

Review URL: https://codereview.chromium.org//832363002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42592 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-05 14:06:51 +00:00
floitsch@google.com f598816be1 dart2js: is-checks for the new emitter.
Also includes more fine-grained access to classes.

R=johnniwinther@google.com, kasperl@google.com, zarah@google.com

Review URL: https://codereview.chromium.org//809433004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42587 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-05 11:33:32 +00:00
zarah@google.com 2eabd2637a Fix error in csp output.
Review URL: https://codereview.chromium.org//804193004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42586 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-05 10:55:38 +00:00
zarah@google.com d6e525de1d dart2js OldEmitter: inline FinishClasses.
R=floitsch@google.com

Committed: https://code.google.com/p/dart/source/detail?r=42582
Reverted: https://code.google.com/p/dart/source/detail?r=42583

Review URL: https://codereview.chromium.org//819993003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42585 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-05 09:15:45 +00:00
zarah@google.com 12adfe9cfe Revert "dart2js OldEmitter: inline FinishClasses."
This reverts commit -r42582

Review URL: https://codereview.chromium.org//816113005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42583 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-02 10:33:04 +00:00
zarah@google.com 66bef0a48e dart2js OldEmitter: inline FinishClasses.
R=floitsch@google.com

Review URL: https://codereview.chromium.org//819993003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42582 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-02 09:29:51 +00:00
johnniwinther@google.com 2384a6fd8b Add CodeOutput to prepare for emission without in-memory buffers.
BUG=
R=floitsch@google.com

Review URL: https://codereview.chromium.org//812233004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42573 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-30 11:40:52 +00:00
zarah@google.com a56f7a94ff dart2js OldEmitter: Change to named holes in js output strings plus some extra clean-ups.
R=floitsch@google.com

Review URL: https://codereview.chromium.org//828753002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42572 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-30 10:04:00 +00:00
ahe@google.com e225e296db Update unit tests
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//789873003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42507 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-19 14:44:11 +00:00
ahe@google.com a7b3af240e Incremental compilation of libraries with multiple parts.
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//815123002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42506 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-19 13:43:54 +00:00
karlklose@google.com 9b4f58b0b5 Remove static state.
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//790023004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42504 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-19 12:15:12 +00:00
sigurdm@google.com ed041f149c dart2js: Fix crash with reference to type literal in static context.
BUG= dartbug.com/21566
R=karlklose@google.com

Review URL: https://codereview.chromium.org//816663002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42458 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-18 13:43:40 +00:00
ahe@google.com 743cd666d4 Recover from incorrectly ordered library tags.
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//811583004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42455 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-18 11:32:24 +00:00
sigurdm@google.com b66b280dcb Don't try to compile platform libraries with the new backend.
R=karlklose@google.com

Review URL: https://codereview.chromium.org//813013002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42454 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-18 10:32:21 +00:00
johnniwinther@google.com 2b9de73a47 Fix analyzer2dart end2end.
BUG=http://dartbug.com/21872
R=karlklose@google.com

Review URL: https://codereview.chromium.org//812333002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42453 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-18 10:19:40 +00:00
karlklose@google.com e4d05ef18c Support synthetic default constructors.
R=sigurdm@google.com

Review URL: https://codereview.chromium.org//810243002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42452 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-18 09:53:49 +00:00
zarah@google.com 834587d0e2 Emit either csp or non-csp versions of the program.
R=floitsch@google.com

Review URL: https://codereview.chromium.org//797513004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42451 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-18 09:22:14 +00:00
floitsch@google.com 194be91eaf dart2js: Add a pointer from the emitter's JS code to the encoding part.
This makes it easier to understand how things are encoded and why the generated code must do these splits. (In Dart-editor a ctrl-click navigates to the comment and the code that encodes the data).

R=karlklose@google.com

Review URL: https://codereview.chromium.org//813603002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42440 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-17 15:42:07 +00:00
floitsch@google.com 9c0e28ff6e dart2js: Remove builder dependency from type_test_generator.
R=karlklose@google.com

Review URL: https://codereview.chromium.org//812603004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42439 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-17 15:22:27 +00:00
kmillikin@google.com 9eac6999aa Change the S-expression representation of constant values.
Before we called toStructuredString, which made no guarantee to
produce something that could be parsed as an S-expression.  Instead
implement our own conversion to S-expressions.

R=karlklose@google.com
BUG=

Review URL: https://codereview.chromium.org//813753002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42438 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-17 15:18:59 +00:00
floitsch@google.com cbaddb1c06 dart2js: Change typedef encoding.
Currently typedefs have a descriptor field that looks like they don't have any super-class:

_Equality: {
  "^": ":58"
}

When we call finishClass we thus assume that it's the Dart Object class. While this didn't hurt (as far as I could tell), it feels wrong.

Since typedefs are only emitted when reflection is enabled I'm ok with adding more code to the output (not that it's that much).

The output now looks as follows:

  _Equality: {
    "^": "Object;",
    $typedefType: 58,
    $$isTypedef: true
  },

At the same time I removed the shared encoding class. It turns out that it doesn't give a lot of flexibility, and by using the shared embedded constant strings, the linkage is not too bad.

R=karlklose@google.com

Review URL: https://codereview.chromium.org//804423003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42437 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-17 15:17:58 +00:00
floitsch@google.com b3a6035ebc dart2js: Move type_test_emitter.
R=karlklose@google.com, zarah@google.com

Review URL: https://codereview.chromium.org//809483005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42436 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-17 15:07:53 +00:00
floitsch@google.com 79f0df2cc8 dart2js: put all type-test related properties on the prototype and not on the constructor.
R=karlklose@google.com

Committed: https://code.google.com/p/dart/source/detail?r=42392
Reverted: https://code.google.com/p/dart/source/detail?r=42408

Review URL: https://codereview.chromium.org//802653005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42435 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-17 15:05:15 +00:00
karlklose@google.com da140779fa Fix a type annotation.
R=sigurdm@google.com

Review URL: https://codereview.chromium.org//816463002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42434 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-17 14:56:12 +00:00
karlklose@google.com 192b33e17a Fix a merge error that was included in r42429.
R=sigurdm@google.com

Review URL: https://codereview.chromium.org//812803002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42431 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-17 14:42:28 +00:00
karlklose@google.com 09b61d8c7c Use CURRENT_ELEMENT_SPANNABLE in invariant.
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//812023002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42430 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-17 14:25:44 +00:00
karlklose@google.com a9ca8885bb Create a Tree IR builder for JavaScript specific nodes.
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//795933005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42429 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-17 14:14:52 +00:00
sigurdm@google.com b0e9fbedce Generative constructors in the new dart backend.
With super and field initializers.

Field initializers and the arguments to a super-initializer
are treated as zero-arg nested functions, and if they assign
to a parameter, that parameter is set to be a closure
variable.

Still no 'this' initializer redirections.

initializing formals (such as `C(this.x)` ) are translated
to field initializers. We might want to revisit this choice.

R=asgerf@google.com, kmillikin@google.com

Review URL: https://codereview.chromium.org//787603003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42427 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-17 10:34:21 +00:00
sra@google.com e9d2c4fb06 Do less inlining in lazy initializer expressions.
Lazy initializer expressions are executed at most once, so should be optimized for size rather than speed.
This currently means only inlining when the call is the only use of the function, sunce we don't really have the right information to do a good job in other cases.

Also use this heuristic to inline in throw expressions - this eliminates the constructor function for several exception classes that have a single throw site.

R=floitsch@google.com

Review URL: https://codereview.chromium.org//809603005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42420 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-17 01:49:31 +00:00
floitsch@google.com 348b557b79 Revert "dart2js: put all type-test related properties on the prototype and not on the constructor."
This reverts commit r42392.

Review URL: https://codereview.chromium.org//803103004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42408 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-16 20:02:24 +00:00
kmillikin@google.com 09ae999a45 Clean up FunctionDefinition in the IR S-expression representation.
Separate value parameters from the continuation for symmetry with
function invocations.  Do not make closure variables optional.  Do not
use '{' or '}', since it makes parsing more difficult and probably
screws up other tools that work with S-expressions.

Move closure variables after the parameters and just before the body,
since they are not part of the signature, do not appear at call sites,
and the implicit box creation happens at the beginning of the body
anyway.

R=asgerf@google.com, karlklose@google.com
BUG=

Review URL: https://codereview.chromium.org//810783002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42395 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-16 14:30:43 +00:00
johnniwinther@google.com e1b1d6e824 Add DartTypes to abstract Types.
BUG=

Review URL: https://codereview.chromium.org//792643003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42394 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-16 14:20:26 +00:00
floitsch@google.com e2c1631928 dart2js: put all type-test related properties on the prototype and not on the constructor.
R=karlklose@google.com

Review URL: https://codereview.chromium.org//802653005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42392 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-16 13:48:53 +00:00
karlklose@google.com 8a877247de cps-ir: Add support for intercepted calls.
Add an Interceptor IR node that encapsulates the receiver of a method call that (possibly) must be intercepted and replace the receiver of the call by the new node.

Currently we do no optimizations of the interceptor's intercepted class field based on type inference.

R=sigurdm@google.com

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

Review URL: https://codereview.chromium.org//806103003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42391 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-16 13:48:24 +00:00
sigurdm@google.com cf906beba3 dart2js: Fix of deferred static functions.
When deferred static functions go to a different output hunk than the
class they are defined in the emitter got problems with outputting them.

We could say that static functions always go to the same output-unit as
their class, and this is needed to support reflection. But we already
handle it that way when reflection is needed. In deferred_load.dart:

      void addLiveInstanceMember(Element element) {
        if (!compiler.enqueuer.resolution.hasBeenResolved(element)) return;
        if (!isMirrorUsage && !element.isInstanceMember) return;
        collectDependencies(element.implementation);
      }

R=floitsch@google.com

Review URL: https://codereview.chromium.org//810473003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42389 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-16 13:14:35 +00:00
karlklose@google.com 0a0f71fb09 Revert "cps-ir: Add support for intercepted calls."
This reverts commit r42385.

R=sigurdm@google.com

Review URL: https://codereview.chromium.org//808553004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42386 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-16 12:57:11 +00:00
karlklose@google.com ea6a8fa140 cps-ir: Add support for intercepted calls.
Add an Interceptor IR node that encapsulates the receiver of a method call that (possibly) must be intercepted and replace the receiver of the call by the new node.

Currently we do no optimizations of the interceptor's intercepted class field based on type inference.

R=sigurdm@google.com

Review URL: https://codereview.chromium.org//806103003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42385 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-16 12:29:05 +00:00
karlklose@google.com dda0e456e2 cps-ir: Give up on code generation of static getters and setters.
They are currently encoded as [InvokeStatic]s, but we cannot generate code for them.  We should create separate nodes for them and add type assertions for the elements.

R=sigurdm@google.com

Review URL: https://codereview.chromium.org//811763003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42383 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-16 10:29:31 +00:00
johnniwinther@google.com 7a05c2e412 Add CoreTypes interface.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//804333002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42382 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-16 10:26:50 +00:00
karlklose@google.com adddd8c1c6 Disable type propagation for the dart backend.
R=johnniwinther@google.com

BUG= http://dartbug.com/21880

Review URL: https://codereview.chromium.org//807443002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42361 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-15 14:13:17 +00:00
johnniwinther@google.com 7b8ed43d70 Remove computeMask from ConstantValue.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//756903005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42360 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-15 13:53:45 +00:00