Commit Graph

4835 Commits

Author SHA1 Message Date
Stephan Herhut 6cc3bd1124 Revert "dart2js: Do not emit type metadata for fields declared in non-reflectable classes."
This reverts commit 67537ffbd7.

BUG=
TBR=karlklose@google.com

Review URL: https://codereview.chromium.org//1148373004
2015-06-08 11:49:06 +02:00
Stephan Herhut cefd7f7d52 dart2js: Add comment in buildTypeArgumentRepresentations.
BUG=
R=floitsch@google.com

Review URL: https://codereview.chromium.org//1143243002
2015-06-08 11:31:12 +02:00
Stephan Herhut 67537ffbd7 dart2js: Do not emit type metadata for fields declared in non-reflectable classes.
BUG=
R=karlklose@google.com, zarah@google.com

Review URL: https://codereview.chromium.org//1169453005
2015-06-08 11:27:22 +02:00
Johnni Winther c03bbb79f9 Let Backend determine support for deferred loading.
BUG=
R=ajohnsen@google.com

Review URL: https://codereview.chromium.org//1149303006
2015-06-08 10:11:00 +02:00
Johnni Winther deb1697fa9 Test all methods in semantic_visitor_test.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1152013006
2015-06-07 10:30:55 +02:00
Harry Terkelsen fcd407b0cf Revert "Support Package Resolution Configuration files."
This reverts commit 36c29d05bc.

BUG=

Review URL: https://codereview.chromium.org//1165943005
2015-06-04 15:55:13 -07:00
Harry Terkelsen 36c29d05bc Support Package Resolution Configuration files.
BUG=http://dartbug.com/23371
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//1162363004
2015-06-04 15:15:09 -07:00
Karl Klose 0e1673ead0 cps_ir: Clean up BuilderTask.
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1149423009
2015-06-04 09:07:03 +02:00
Karl Klose e9656e8db1 Add type arguments to lists in the code generator and make them fixed length.
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//1164563005
2015-06-03 13:49:02 +02:00
Karl Klose 683743c9c5 Change more JS foreign methods to JS_GET_NAME.
R=herhut@google.com

Review URL: https://codereview.chromium.org//1154073004
2015-06-03 11:41:46 +02:00
Johnni Winther 4f969bbc3b Remove ConstantExpression.value
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1148343004
2015-06-02 15:23:16 +02:00
Asger Feldthaus c442bf5697 dart2js cps: Do not propagate impure expressions across null receiver.
If the receiver is null, the arguments are not evaluated.

Example:

Dart:
    var x = null;
    var y = bar();
    x.foo(y);

JS before:
    null.foo$1(bar());

JS after:
    var y = bar();
    null.foo$1(y);

If the receiver is known not be null, we still propagate into the
arguments, and "pure" expressions can always propagate even if the
receiver might be null.

InvokeMethod now has a field isReceiverNotNull, which carries a bit of
static type information. Another field like this is InvokeStatic.isPure.

I intentionally chose to pass along the *least* amount of information
that is sufficient for what we need in the tree optimizations.

That CPS type propagation was not very good at proving when things are
not null, so a couple of things missing from it have been filled in.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1159643005
2015-06-02 15:06:29 +02:00
Karl Klose add53e33e7 Optimize identical based on types.
R=asgerf@google.com

Review URL: https://codereview.chromium.org//1080003004
2015-06-02 13:01:42 +02:00
Johnni Winther 11eab3a917 Fix crash in deferred_constraint_constants_test.
BUG=

Review URL: https://codereview.chromium.org//1167713002
2015-06-02 12:05:54 +02:00
Johnni Winther 3250c8fd91 Add StringLengthConstantExpression
... and make .fromEnvironment name a ConstantExpression.

BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1166723002
2015-06-02 10:52:50 +02:00
Johnni Winther 411246ccc7 Handle .fromEnvironment and incompatible constructor invocations
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1161823004
2015-06-02 10:44:19 +02:00
Johnni Winther 5252749865 Reinsert registration of dependency.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org//1149743005
2015-06-01 16:34:38 +02:00
Johnni Winther 3b52900308 Element model cleanup + prepare for easier reimplementation.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1162603006
2015-06-01 15:00:48 +02:00
Johnni Winther 96efb7bde8 Introduce WorldImpact
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1146813009
2015-06-01 14:43:30 +02:00
Asger Feldthaus bd4e1d726f dart2js cps: Track underlying value of interceptors in type propagation.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1154173002
2015-06-01 11:19:36 +02:00
Karl Klose 207328a868 Disable failing assertion.
BUG= http://dartbug.com/23555

TBR=sra@google.com

Review URL: https://codereview.chromium.org//1157773009
2015-06-01 10:35:26 +02:00
Karl Klose 44f04fa0f7 Revert "Trust inferred type when propagating types in the SSA backend."
This uncovered a bug in optimizations that would introduce a return into an async* function.

This reverts commit 8a544b0754.

R=sigurdm@google.com

Review URL: https://codereview.chromium.org//1166653002
2015-06-01 10:27:45 +02:00
Sigmund Cherem 013897fe29 Add support for null-aware operators to the CPS-IR.
R=johnniwinther@google.com, kmillikin@google.com

Review URL: https://codereview.chromium.org//1160833003
2015-05-29 12:01:42 -07:00
Sigmund Cherem 7e2dc9eb2a Improve error for non-const implicit super constructor
BUG= http://dartbug.com/23543
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//1156923007
2015-05-29 09:24:00 -07:00
Asger Feldthaus ac4ab2b5b7 dart2js cps: Remove dart2dart from cps pipeline and clean up.
Removing dart2dart stuff is the most radical change, but there's also
a bunch of general clean up, some of it somewhat unrelated, but long
overdue.

I've focused on making the IR easier to read end-to-end.

For instance, I've stripped out a complicated assertion on InvokeMethod,
because it is distracting and hasn't paid off. AFAIK it never caught a
single bug, but a few times it has spuriously failed and needed
patching.

Some notable changes in the IR:
- Removed FieldDefinition, ConstructorDefinition, Initializers.
- Removed RootNode. There was only one subclass left.
- Removed Body. Has been inlined into FunctionDefinition.
- MutableVariable can no longer be a function parameter.
- Removed default parameter values and local constants from the IR.

I decided to keep nested functions for the time being because there is
a slight chance they might come in handy for async/await.
I'm not sure yet. We can strip them out later if they are not needed.

I've also left the subclassing JsIrBuilder <: IrBuilder for now,
even though the classes could be merged. Same with the visitor.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1155463005
2015-05-29 17:39:00 +02:00
Johnni Winther 073a202b06 Allow this?.foo (again)
BUG=

Review URL: https://codereview.chromium.org//1151063003
2015-05-29 16:16:23 +02:00
Johnni Winther 76728304e9 Compute more SendStructures on ResolverVisitor.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1157333003
2015-05-29 15:26:28 +02:00
Johnni Winther a6bbcc3c87 Support implicit super constructor invocation in SemanticDeclarationVisitor.
BUG=
R=ajohnsen@google.com, karlklose@google.com

Review URL: https://codereview.chromium.org//1160153002
2015-05-29 14:49:59 +02:00
Karl Klose 993338408e cps_ir: Handle malformed type arguments and type checks.
R=asgerf@google.com

Review URL: https://codereview.chromium.org//1156373008
2015-05-29 09:53:35 +02:00
Asger Feldthaus 5f97e22d80 dart2js cps: Change how type variables are accessed in constructors.
Previously there was a problem with type variables referenced inside
a closure inside a field initializer, like so:

class Foo<T> {
	var field = () => T;
}

The type variable cannot be accessed on 'this' because the closure is
created before 'this'. It also cannot be accessed as a parameter.

It is now properly treated as an unboxed free variable, and at
closure creation the value is taken from the constructor parameter
holding the type variable.

As with everything else during constructor build-up, the type variables
are now held in the IR builder's environment. It has proven to be a
robust way of doing things so far.

This simplifies the IR builder's role in this. The builder will not
detect how a type variable should be accessed (i.e. "if inside
a closure inside a field..."). If the type variable is in the
environment that's the one it will use, otherwise it defaults to
extract it from the receiver object.

Also, the closure conversion phase now detects type variables
mentioned in "on T catch()" clauses.

BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1158693003
2015-05-28 14:46:36 +02:00
Asger Feldthaus c29b7c6461 dart2js cps: 'is'-check directly against type variables.
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1160763002
2015-05-28 12:30:00 +02:00
Karl Klose 8a544b0754 Trust inferred type when propagating types in the SSA backend.
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//1159713003
2015-05-28 08:43:50 +02:00
Asger Feldthaus f1bbc3bb2d dart2js cps: 'is' checks on types with type arguments.
R=karlklose@google.com

Committed: https://github.com/dart-lang/sdk/commit/00c33fb1347fc5c44a324f9503c7c57969e88ca3

Reverted: https://github.com/dart-lang/sdk/commit/f0c4e31174996e6259fab283af14c49aa8faf28c

Review URL: https://codereview.chromium.org//1161683002
2015-05-27 14:14:07 +02:00
Asger Feldthaus f0c4e31174 Revert "dart2js cps: 'is' checks on types with type arguments."
This reverts commit 00c33fb134.

TBR=karlklose@google.com

BUG=

Review URL: https://codereview.chromium.org//1161793002
2015-05-27 13:54:07 +02:00
Asger Feldthaus 00c33fb134 dart2js cps: 'is' checks on types with type arguments.
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1161683002
2015-05-27 13:45:39 +02:00
Johnni Winther 9e68c2575b Update invariant for unresolved (static) get.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1154353003
2015-05-27 10:31:15 +02:00
Stephan Herhut 0b605a4762 dart2js: Minor cleanup in inlining heuristics.
BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org//1159813002
2015-05-27 10:20:44 +02:00
Karl Klose c0a14a9af2 Fix a bug when narrowing the result type of a field get.
This fixes an assertion failure that occured after the optimizations in 0ef007d00b, when we tried to rewrite a field get for a .length expression, where we already had a more specific type and used that in a truncating divide.

R=floitsch@google.com

Review URL: https://codereview.chromium.org//1148093005
2015-05-27 08:32:44 +02:00
Sigmund Cherem 6dc23373cd add deprecation message for output=dart
R=floitsch@google.com

Review URL: https://codereview.chromium.org//1143183003
2015-05-26 15:14:23 -07:00
Asger Feldthaus f42a0ef25c dart2js cps: Always use interceptors and type tags for 'is' checks.
"x is Foo" will become getInterceptor(x).$isFoo

Testing against a type with type arguments is still a giveup().

This test always works, but is not very fast. For instance, testing
against an int should be "typeof x === 'number' && Math.floor(x) === x".

Following an offline discussion with Karl, the plan is to rewrite
'is'-checks to more fine-grained tests in a CPS optimization pass,
probably the type propagator.

Concretely, we plan to introduce IR nodes like TypeOfTest, FloorTest,
InstanceofTest, etc, which optimization phases can introduce under the
right circumstances. That way, the code generation phase remains simple.

BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1144163004
2015-05-26 17:50:48 +02:00
Johnni Winther f14fa24a63 Fix invariant in ResolvedVisitor.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1154853004
2015-05-26 15:51:33 +02:00
Johnni Winther a50be4b0c1 Split resolution/members.dart into several parts.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1152963003
2015-05-26 11:45:31 +02:00
Johnni Winther 6399fdc786 Copy files for split of resolution/members.dart
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1156123003
2015-05-26 11:20:39 +02:00
Johnni Winther 45ec43770d Create SendStructure for unary and binary in resolution.
BUG=http://dartbug.com/21137
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1152903003
2015-05-26 11:11:46 +02:00
Karl Klose bef1049767 Refactor StatementRewriter: Extract method for rewriting a list left-to-right.
R=asgerf@google.com

Review URL: https://codereview.chromium.org//1142383005
2015-05-26 08:59:19 +02:00
Johnni Winther 083dce756b Allow return; in async method.
BUG=http://dartbug.com/23200
R=floitsch@google.com

Review URL: https://codereview.chromium.org//1158453002
2015-05-25 13:07:20 +02:00
Sigmund Cherem e095996b0e Fix inference bug of conditional sends
TBR= sra@google.com

Review URL: https://codereview.chromium.org//1157773002
2015-05-22 16:46:24 -07:00
Sigmund Cherem d105d1b63b Some minor fixes caught by the bots, suppress a test that needs more investigation
TBR= sra@google.com

Review URL: https://codereview.chromium.org//1153953002
2015-05-22 16:26:48 -07:00
Sigmund Cherem a8db3278e2 Implementation of null-aware operators.
This CL adds the implementation of all null-aware operators to dart2js. In
particular:

* a?.b: represented as 'isConditional' in the Send ast, and dispatched
  separately by the semantic visitor using visitIfNotNull* methods.

* a ?? b: represented as an operator, and dispatched separately by the semantic
  visitor using the `visitIfNull` method.

* a ??= b: represented as a compound operator.

All except 2 tests are passing with the SSA backend (those 2 tests fail for
unrelated reasons). I've marked the CPS ir tests as failing for now.

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

Review URL: https://codereview.chromium.org//1151163004
2015-05-22 15:44:41 -07:00
Kevin Moore 51a8f0751d Fix 56 hints in pkg/compiler
From 258 to 202

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

Review URL: https://codereview.chromium.org//1155633002
2015-05-22 08:45:12 -07:00