Commit Graph

4835 Commits

Author SHA1 Message Date
Asger Feldthaus 4a1e6c7966 dart2cps: Fix bug in constructors.
When visiting another constructor, the visitor must use another tree elements mapping (and source file info).

BUG=
R=floitsch@google.com

Review URL: https://codereview.chromium.org//1200823002.
2015-06-22 17:53:47 +02:00
Kevin Millikin 7a853ca634 Fix a bug in dart2js's shrinking reductions.
When a term is deleted, the algorithm searches for new redexes created
by the term's deletion.  Continuation beta redexes search up the term
between the redex and the continuation's binding to ensure that the
continuation is not moved into the scope of an exception handler.

This search fails if it first encounters the root of the deleted
subterm (i.e., the newly-created redex is in the deleted term).  Just
ignore the redex in that case, since the term is being deleted.

Also, update some triaged test expectations with their bug numbers.

R=asgerf@google.com

Review URL: https://codereview.chromium.org//1196323002.
2015-06-22 16:50:48 +02:00
Asger Feldthaus 2f3b889c7b dart2js cps: Replace getter/setter calls with direct field access.
.length on JS arrays are not introduced yet because that is not
seen as field accesses by our class hierarchy.

I've changed the contract on Primitives so they can have side effects,
depend on state, diverge, throw, anything goes. GetField on possibly
null receivers would not be allowed otherwise.

AFAIK there are no optimizations that actually used the contract on
primitives, it just seemed like a good idea at one point in the past,
so that change only affects a single doc comment.

I'll migrate some of the classes that can now be primitives in another
CL.

BuiltinOperators are still required to be pure, although that too may
possibly change soon.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1188253006.
2015-06-22 16:08:51 +02:00
Asger Feldthaus 919eadc29d dart2js cps: Overhaul PullIntoInitializers.
Fixes a bug where it would pull impure expressions out of branches.

It now uses a slightly more precise analysis to pull more things into
the initializer block (but never out of branch).

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1188783002.
2015-06-22 12:26:22 +02:00
Kevin Millikin bf595224d5 Implement simple switch statements as nested if/else.
Simple switch statements that do not have continue to labeled cases
are compiled into a chain if/else comparisons.

R=asgerf@google.com

Review URL: https://codereview.chromium.org//1191193005.
2015-06-22 11:29:31 +02:00
Karl Klose 48884abb2a cps_ir: ForeignCode is not a definition - don't record constness for it.
TBR=kmillikin@google.com

Review URL: https://codereview.chromium.org//1194843002.
2015-06-19 14:04:47 +02:00
Karl Klose 3f46181244 cps-ir: Support foreign code.
R=kmillikin@google.com

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

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

Review URL: https://codereview.chromium.org//1185633003.
2015-06-19 13:44:58 +02:00
Karl Klose 9fb192bbb0 Revert "Split TypedSelector into Selector and TypeMask."
This reverts commit fc42c0e3bd.

R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//1182053010.
2015-06-18 15:10:53 +02:00
Karl Klose 40ed0daaaf Revert "cps-ir: Support foreign code."
This reverts commit a120ee7c90.

TBR=kmillikin@google.com

Review URL: https://codereview.chromium.org//1196443002.
2015-06-18 13:37:52 +02:00
Karl Klose a120ee7c90 cps-ir: Support foreign code.
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1185633003.
2015-06-18 13:09:50 +02:00
Johnni Winther fc42c0e3bd Split TypedSelector into Selector and TypeMask.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1182913003.
2015-06-18 11:46:19 +02:00
Florian Loitsch 93c9fc6fae Wrap program into (function(){ <prog> })() instead of !function...().
V8 is much faster with the parenthesis (*5).

R=herhut@google.com

Review URL: https://codereview.chromium.org//1186503003.
2015-06-18 11:34:35 +02:00
Asger Feldthaus fb38d61dba dart2js cps: Support function types in 'is' and 'as' operators.
The generated code uses different helpers than the SSA. In SSA, there are calls to buildFunctionType and _isTest. The CPS uses checkSubtypeOfRuntimeType, the "one size fits all" method we also use to test against type variable types.

When the function type has no type variables in it we could hoist the function type into a constant, but the constant system does not support type representation constants at the moment. But it seems like an optimization we may want to add later.

BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1180973003.
2015-06-18 11:30:57 +02:00
Asger Feldthaus 14749489ef dart2js cps: Better 'is int' checks.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1184963006.
2015-06-18 11:24:57 +02:00
Johnni Winther ae507cfc6d Cleanup TypedSelector.appliesUnnamed
BUG=
R=herhut@google.com, karlklose@google.com

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

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

Review URL: https://codereview.chromium.org//1184853002.
2015-06-18 10:33:08 +02:00
Stephan Herhut fac25eb541 dart2js: Support frequency based metadata indices in new emitter.
R=floitsch@google.com
BUG=

Review URL: https://codereview.chromium.org//1189873005.
2015-06-18 09:42:24 +02:00
Florian Loitsch 0b7b7d156c Fix in-test (missing parenthesis).
IE does not have a "name" field on functions. Therefore we set it, if it's missing. However, the test doing that ("name" in constructor) was not using the right precedences.

Fixes #23623.

BUG= http://dartbug.com/23623
R=herhut@google.com

Review URL: https://codereview.chromium.org//1189983004.
2015-06-17 15:54:43 +02:00
Johnni Winther fff0be1d60 Revert "Cleanup TypedSelector.appliesUnnamed"
This reverts commit ddcac25117.

BUG=

Review URL: https://codereview.chromium.org//1183273004.
2015-06-17 15:41:20 +02:00
Johnni Winther ddcac25117 Cleanup TypedSelector.appliesUnnamed
BUG=
R=herhut@google.com

Review URL: https://codereview.chromium.org//1184853002.
2015-06-17 14:40:32 +02:00
Asger Feldthaus 9e5564c4eb dart2js cps: Fix bug in liveness analysis.
Rather embarrassingly, the CFG built for liveness analysis did not join
branches after a conditional, it just kept going out of the 'else'
branch.

BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1178703014.
2015-06-17 13:25:35 +02:00
Johnni Winther c4225fe216 Check for deferred access in static assignments.
BUG=

Review URL: https://codereview.chromium.org//1183283004.
2015-06-17 12:51:24 +02:00
Johnni Winther 2afbcc41cb Refactor SsaBuilder.handleSendSet; handle simple assignments directly.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1175393004.
2015-06-17 11:41:02 +02:00
Asger Feldthaus 2bf1da7ac2 dart2js cps: Use JS semantics for logical operators in the tree IR.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1185333002.
2015-06-16 15:21:30 +02:00
Karl Klose 551fa1fdaa Do not mark type variables as needing a box inside try; they are immutable.
Closes #23650

R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1188103002.
2015-06-16 14:13:01 +02:00
Asger Feldthaus eec1d88d9c dart2js cps: Introduce some built-in operators in type propagation.
There are also a number of somewhat unrelated changes to get
better type information out of the global type inference.
The dependency on TypedSelector is causing a lot of problems there.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1175973005.
2015-06-15 17:31:48 +02:00
Johnni Winther 6c8b4bb7af Handle most qualified sends.
BUG=
R=herhut@google.com, karlklose@google.com

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

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

Review URL: https://codereview.chromium.org//1182563003.
2015-06-12 15:26:08 +02:00
Karl Klose b01c4bd438 Revert "Handle most qualified sends."
This reverts commit ec40a14019.

TBR=herhut@google.com,johnniwinther@google.com
BUG=

Review URL: https://codereview.chromium.org//1185483004.
2015-06-12 14:03:18 +02:00
Johnni Winther ec40a14019 Handle most qualified sends.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1182563003.
2015-06-12 09:51:30 +02:00
Johnni Winther ee1be89b30 Support foreigns as external.
BUG=

Review URL: https://codereview.chromium.org//1169083004.
2015-06-11 15:27:56 +02:00
Johnni Winther 8a0c73cf4c Move computeType to TypedElement and TypeDeclarationElement.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1172693003.
2015-06-11 15:17:52 +02:00
Johnni Winther 6414489318 Remove computeSignature from FunctionElement.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1165363004.
2015-06-11 15:07:34 +02:00
Stephan Herhut 69d7a01b06 dart2js: Fix minor indentation issues.
BUG=
TBR=karlklose@google.com

Review URL: https://codereview.chromium.org//1173423002.
2015-06-11 14:47:36 +02:00
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