Commit Graph

4835 Commits

Author SHA1 Message Date
johnniwinther@google.com 091c7eddae Add ConstantConstructor to ConstantExpression system.
BUG=
R=karlklose@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45681 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-11 12:46:17 +00:00
karlklose@google.com 0eaa4d4717 cps-ir: Support compilation of methods that use interceptor calling convention.
This is a modified version of sra@'s CL https://codereview.chromium.org/1020243002/ with kmillikin@'s comments addressed.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45680 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-11 12:38:14 +00:00
asgerf@google.com 9630163eaf dart2js cps: Handle error cases.
A new IR node CreateInvocationMirror has been introduced, which is
needed for creating calls to noSuchMethod. The main reason for this node
is that the JS constructor for Invocation objects require the internal
(minified) name of the target, which the builder does not know.
I don't think the IR pipeline should depend on the Namer, so the IR node
is preserved all the way to codegen.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45678 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-11 09:06:12 +00:00
sigurdm@google.com 8a609d2ac3 Add missing implementations.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45642 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-08 11:02:13 +00:00
herhut@google.com 8704402c63 dart2js: Properly track descriptor asts for dumpinfo.
BUG=
R=johnniwinther@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45639 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-08 10:27:31 +00:00
sigurdm@google.com 1ce5158350 Insert the right checks for redirecting factories to deferred constructors.
BUG=https://code.google.com/p/dart/issues/detail?id=23399
R=johnniwinther@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45637 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-08 09:18:00 +00:00
kmillikin@google.com 6ab3c55366 Fix an assertion failure in dart2js.
In the CPS translation we assert that a mutable variable added to the CPS
term belongs to the function currently being compiled, which is reasonable.
However, in the JS backend this didn't work as written.  The variable
element can report that it belongs to a Dart function, and the function
currently being compiled can be a synthesized .call method of a closure
class representing that Dart function.

The solution presented here is to plumb the mapping from Dart function to
closure class .call methods through to where the mutable variables are
created.  It might be better, but a lot more complicated, to make the
variable elements able to correctly report their owner after closure
conversion.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45636 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-08 08:58:00 +00:00
herhut@google.com 76694b7cdd dart2js: Use JavaScript asts instead of CodeBuffers when assembling output units.
BUG=
R=johnniwinther@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45635 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-08 08:57:50 +00:00
kmillikin@google.com 638a5ba35f Support 'on T' catch clauses and multiple clauses.
The sequence of clauses is translated into the corresponding nested if-else
statements.  The last else is the catch-all clause (no 'on T') if there is
one or implicitly 'rethrow' otherwise.

If there is a catch-all clause (no 'on T'), then any clauses after it
are unreachable.  The language specification allows such unreachable
clauses without an error.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45634 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-08 08:49:26 +00:00
sra@google.com 6ab9b2ceb2 Optimize DateTime properties
Several small pieces fit together to improve calendar arithmetic code in a customer's app.

1. Mark DateTime primitives that return small integers as returning uint31.

2. uint31 + uint31 -> uint32 in type inference.

3. uint32 / N can be generated as (uint32 / N) | 0 when N >= 2.

R=floitsch@google.com

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45625 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-08 00:52:29 +00:00
sra@google.com 532a7948d8 Optimize DateTime properties
Several small pieces fit together to improve calendar arithmetic code in a customer's app.

1. Mark DateTime primitives that return small integers as returning uint31.

2. uint31 + uint31 -> uint32 in type inference.

3. uint32 / N can be generated as (uint32 / N) | 0 when N >= 2.

R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45621 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-07 21:39:17 +00:00
sigmund@google.com d0002db5ed Avoid reparsing metadata expressions
BUG= http://dartbug.com/23404
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45600 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-07 17:07:04 +00:00
johnniwinther@google.com f238761664 Improve resolution/codegen separation invariant.
BUG=
R=asgerf@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45593 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-07 13:30:05 +00:00
johnniwinther@google.com 065b2163e3 Differentiate between unresolved class and constructor.
BUG=
R=asgerf@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45591 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-07 13:02:49 +00:00
het@google.com acfd54f53a Report malformed URIs in library dependencies as errors.
For instance: "import '../../Udyn[mic ils/expect.dart';" used to cause an internal compiler error. The error is now caught and the compiler reports the invalid import.

BUG=http://dartbug.com/23228
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45580 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-07 00:11:47 +00:00
sra@google.com ac0f1ade9e Recognize unmodifiable lists
Add a new type, JSUnmodifiableArray, that is the type returned by
List.unmodifiable and the type of const list literals.

R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45575 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-06 21:25:25 +00:00
floitsch@google.com 067bdb8331 dart2js: Access to metadata and types goes through builtins.
Instead of exposing an embedded constant "METADATA" and "TYPES" provide a builtin-function that reads these values.
This allows us to implement the metadata and types table differently. In particular we want to be able to generate them lazily.

R=sra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45574 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-06 21:20:17 +00:00
herhut@google.com a37bc208f1 dartjs: Remove unused isFromMainOutputUnit.
BUG=
R=sigurdm@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45559 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-06 10:13:29 +00:00
herhut@google.com a79c250c13 dart2js: Inline across deferred output units if that leads to reduced size.
BUG=
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45553 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-06 08:37:54 +00:00
floitsch@google.com 10d128dc5e dart2js: add builtin 'isSubtype'.
R=sra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45546 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-06 00:52:04 +00:00
floitsch@google.com ceabb95bd6 dart2js: add classNameFromIsCheckProperty to compiler builtins.
R=sra@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45537 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-05 19:32:19 +00:00
johnniwinther@google.com ed0fead09e Fix dart2dart
BUG=
R=asgerf@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45491 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-04 15:02:30 +00:00
johnniwinther@google.com af1b401714 Handle default values on constant redirecting factories.
BUG=
R=sigurdm@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45490 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-04 13:39:14 +00:00
asgerf@google.com 5a2bb3b761 cps-ir: Remove redundant identical() calls in type propagation.
Also, use the inferred type from dynamic method calls.

Changed the file from a "part of" to a re-exported file
so the imports are not polluting the other optimization passes.

R=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45488 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-04 12:14:17 +00:00
zarah@google.com 654c29d329 Revert "dart2js: add type arguments to constructor in case the class needs rti."
This reverts commit -r45485.

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45487 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-04 11:45:31 +00:00
asgerf@google.com 5522990c4f tree-ir: Move labeled statements outside loops.
BUG=
R=kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45486 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-04 11:26:23 +00:00
zarah@google.com 53d47da67a dart2js: add type arguments to constructor in case the class needs rti.
R=herhut@google.com

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

Reverted: https://code.google.com/p/dart/source/detail?r=45281

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45485 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-04 09:37:58 +00:00
karlklose@google.com 6abb79a95b cps-ir: Implement type tests for interface types without type arguments.
R=sigurdm@google.com, kmillikin@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45484 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-04 07:58:38 +00:00
sigurdm@google.com 1e723f68d1 Allow use of deferred type-literals in non-constant contexts.
BUG= dartbug.com/22893
R=johnniwinther@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45459 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-30 11:38:54 +00:00
karlklose@google.com 3164951779 Change code to remove two warnings that are reported when running build.py.
R=johnniwinther@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45458 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-30 09:48:46 +00:00
johnniwinther@google.com 8361a9a7f0 Refactor to make visitDynamicSend deprecated.
BUG=
R=karlklose@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45456 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-30 09:15:53 +00:00
herhut@google.com fb553a3e20 dart2js: Do not emit closure classes if their instantiation is dead code.
BUG=
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45454 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-29 19:19:37 +00:00
johnniwinther@google.com 5c208f4880 Fix deferred_not_loaded_check_test.
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45451 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-29 12:44:34 +00:00
johnniwinther@google.com 60f79ad841 Refactor SimpleTypeInferrer.visitGetterSend and visitStaticSend.
BUG=
R=karlklose@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45450 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-29 11:58:40 +00:00
johnniwinther@google.com d9b0cc7da2 Refactor SsaBuilder.visitStaticSend and visitGetterSend.
BUG=
R=karlklose@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45449 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-29 11:44:05 +00:00
rmacnak@google.com a6e42c48b5 Deal with deferred loading in the VM mirrors.
- Invalidate MirrorSystem.libraries when a load completes.
- Recheck if a deferred import's target has been loaded before failing.
- Allow loading libraries from a LibraryDepedencyMirror.
- Propogate compile-time error when attempting to reflect a deferred type.

BUG=http://dartbug.com/22592
R=asiva@google.com, gbracha@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45444 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-28 23:47:45 +00:00
johnniwinther@google.com 121c7f91fc Use Map<FieldElement, ConstantValue> for fields in ConstructedConstantValue.
BUG=
R=karlklose@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45441 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-28 10:48:30 +00:00
johnniwinther@google.com 3d8faf261f Refactor SimpleTypeInferrer.visitSuperSend and deprecate ResolvedVisitor.visitSuperSend.
BUG=
R=karlklose@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45440 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-28 09:19:40 +00:00
johnniwinther@google.com e464269f96 Refactor SsaBuilder.visitSuperSend.
BUG=
R=karlklose@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45439 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-28 08:23:58 +00:00
johnniwinther@google.com 92a21dbe79 Deprecate ResolvedVisitor.visitClosureSend.
R=karlklose@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45420 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-27 08:37:48 +00:00
kmillikin@google.com f44f9c78ac Support rethrow in the dart2js JS backend.
The approach is simple: translate rethrow to a throw of the enclosing
catch block's JS exception.  There is already an assert that the JS
backend does not see rethrow at code generation time.

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45397 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-24 11:23:09 +00:00
johnniwinther@google.com 1eea9e39d1 Deprecate ResolvedVisitor.visitOperatorSend.
BUG=
R=karlklose@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45374 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-23 13:52:50 +00:00
floitsch@google.com 17ecf6b954 dart2js: Fix new emitter.
Review URL: https://codereview.chromium.org//1103523003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45350 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-22 14:33:41 +00:00
floitsch@google.com eb20073478 dart2js: add compiler builtins to the core-runtime.
WIP.

R=johnniwinther@google.com, sra@google.com

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45347 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-22 13:44:39 +00:00
johnniwinther@google.com 3fbdff8783 Add structural equality to ConstantExpression.
BUG=
R=karlklose@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45344 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-22 13:03:57 +00:00
johnniwinther@google.com cfc2e8017c Deprecate ResolvedVisitor.visitTypeLiteralSend.
BUG=
R=karlklose@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45341 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-22 11:57:54 +00:00
johnniwinther@google.com c467b33a6e Refactor SourceMapBuilder to allow for post-processing.
BUG=
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45339 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-22 11:23:11 +00:00
kmillikin@google.com ed699ec05d Mark a dart2js test that fails in --use-cps-ir mode.
R=karlklose@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45337 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-22 11:08:39 +00:00
kmillikin@google.com 4f7c1d3d54 Clean up handling of constants in the CPS backend.
Before: constant-valued expressions were usually compiled by the JS constant
compiler task, which surprisingly produces a Dart (not JS) constant.

After: use the already computed constant value of a constant-valued
expression.  This is looked up in one of two ways depending on whether the
expression is an identifier or not.  For primitive constants (Booleans,
doubles, integers, strings, and null) simply construct them as they have not
had a value computed.

Also, fix a variety of small bugs.  In some case the fix is disabling an
incorrect code path and bailing out of the compiler.

BUG=
R=johnniwinther@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45335 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-22 10:59:03 +00:00
johnniwinther@google.com bd10ba7f11 Refactor visitOperatorSend to used SemanticSendVisitor methods.
BUG=
R=karlklose@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45329 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-22 09:23:17 +00:00