Commit Graph

4698 Commits

Author SHA1 Message Date
Stephan Herhut dfcadddb11 dart2js: Fix hints in code base.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1173403002.
2015-06-11 13:11:17 +02:00
Stephan Herhut e0e96624b9 dart2js: Use frequency of occurence to sort metadata indices.
BUG=
R=johnniwinther@google.com, karlklose@google.com, sigurdm@google.com, sra@google.com

Review URL: https://codereview.chromium.org//1153243003.
2015-06-11 10:13:32 +02:00
Stephen Adams 7fb7d0f011 Include all allocations in trivial dead-store elimination
This will eliminate dead scope boxes, e.g. https://github.com/dart-lang/sdk/issues/16816

R=sigmund@google.com

Review URL: https://codereview.chromium.org//1177603002.
2015-06-10 16:36:22 -07:00
Asger Feldthaus ff104736f2 dart2js cps: Handle type variables in factory constructors.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1179503002.
2015-06-10 15:04:43 +02:00
Asger Feldthaus 953a6fd75f dart2js cps: Clean up in type propagation.
Class names are no longer private. optimizers.dart whitelists the class
that needs to be exposed, so the privacy makes little difference.

Methods on AbstractValue that require access to the type system or
other "external thing" have been moved to ConstantPropagationLattice.
It should help readability and avoid parameter inflation when more
external things are suddenly needed to answer a query.

The UnitTypeSystem has been removed and TypeSystem has been merged
into TypeMaskSystem. The generic variable T has been removed as well.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1173563002.
2015-06-10 14:04:36 +02:00
Stephan Herhut f5db566371 dart2js: Avoid common prefix for frequent bad names.
BUG=
R=karlklose@google.com, sra@google.com

Review URL: https://codereview.chromium.org//1153363003.
2015-06-10 11:31:41 +02:00
Harry Terkelsen 63681d5b59 Support Package Resolution Configuration files.
BUG=http://dartbug.com/23371
R=johnniwinther@google.com

Committed: https://github.com/dart-lang/sdk/commit/36c29d05bcc1dfe43a2f95698df5b41857f93221

Review URL: https://codereview.chromium.org//1162363004.
2015-06-09 11:07:11 -07:00
Johnni Winther bac7481d3d Opt-in to generate code for compile-time error. Only supported for SSA.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1167353003
2015-06-09 14:36:38 +02:00
Karl Klose 183ae17958 Move IS_INDEXABLE_FIELD to JsGetName.
Also remove the old helper functions and references from js_helper and friends.

R=herhut@google.com

Review URL: https://codereview.chromium.org//1158423005.
2015-06-09 11:29:50 +02:00
Sigmund Cherem e20001a07f Don't crash when reporting an error
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//1157433014
2015-06-08 13:01:16 -07:00
Asger Feldthaus d01d394af7 dart2js cps: Type casts and related changes to type propagation.
We now optimize type casts that always fail or always pass.
Type propagation has been refactored a bit to make this work.

A new IR node Unreachable has been added. This is an node that is known
to be unreachable and is ultimately compiled to an empty statement.

BUG=
R=karlklose@google.com

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

Committed: https://github.com/dart-lang/sdk/commit/67537ffbd7657bf8e679f8d677d658d096e5c7af

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

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

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

Review URL: https://codereview.chromium.org//1169453005
2015-06-08 15:35:25 +02:00
Johnni Winther 6fc3592842 Refactoring resolution of local access and unqualified access of statics
BUG=
R=karlklose@google.com

Committed: https://github.com/dart-lang/sdk/commit/58896b74ce50615114a006282e5b353885eca385

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

Review URL: https://codereview.chromium.org//1149403009
2015-06-08 14:51:52 +02:00
Johnni Winther 4db19f3451 Begin to compute constant expressions in resolution.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1170673002
2015-06-08 14:42:35 +02:00
Stephan Herhut 5af9221e1b Revert "dart2js: Do not emit type metadata for fields declared in non-reflectable classes."
This reverts commit a1b630641e.

BUG=
TBR=karlklose@google.com

Review URL: https://codereview.chromium.org//1149323008
2015-06-08 14:25:36 +02:00
Johnni Winther 1807369aa1 Revert "Refactoring resolution of local access and unqualified access of statics"
This reverts commit 58896b74ce.

BUG=

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

Committed: https://github.com/dart-lang/sdk/commit/67537ffbd7657bf8e679f8d677d658d096e5c7af

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

Review URL: https://codereview.chromium.org//1169453005
2015-06-08 12:53:54 +02:00
Johnni Winther 58896b74ce Refactoring resolution of local access and unqualified access of statics
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1149403009
2015-06-08 11:53:59 +02:00
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