Commit Graph

4698 Commits

Author SHA1 Message Date
Johnni Winther 507bc962d7 Split TypedSelector into Selector and TypeMask.
BUG=
R=herhut@google.com, karlklose@google.com

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

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

Review URL: https://codereview.chromium.org//1182913003.
2015-06-25 10:13:11 +02:00
Stephan Herhut dd41983945 dart2js: Use an abstract Name class for names in the generated JavaScript ast.
BUG=
R=asgerf@google.com, floitsch@google.com, sigurdm@google.com, sra@google.com

Review URL: https://codereview.chromium.org//1198293002.
2015-06-25 09:39:57 +02:00
Harry Terkelsen 8c315d41ac Update invalid package name example
BUG=
R=pquitslund@google.com

Review URL: https://codereview.chromium.org//1203923007.
2015-06-24 16:29:37 -07:00
Kevin Millikin b9192ab9e2 dart2js CPS: Support try/catch/finally.
Support try/catch/finally by pretending it is macro-expanded into
try/catch and try/finally:

    try S0 catch (ex, st) S1 finally S2
    ==>
    try { try S0 catch (ex, st) S1 } finally S2

The duplicated code for try/catch and try/finally is abstracted into a
function parameterized over translations for all the parts that
differed.

R=asgerf@google.com

Review URL: https://codereview.chromium.org//1207703002.
2015-06-24 17:13:15 +02:00
Asger Feldthaus 371b5c16a8 dart2js cps: Merge JsIrBuilder and IrBuilder.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1201463003.
2015-06-24 14:32:12 +02:00
Lasse R.H. Nielsen d3013cfd35 Fix typos of "function".
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//1210483002.
2015-06-24 12:36:34 +02:00
Kevin Millikin 089ed2965b Implement try/finally by inlining the finally code.
Try/finally is implemented by inlining.  There is a try/catch to catch
exceptions in the try block.  The catch body contains the finally code
followed by a rethrow.  The code for finally is translated again after the
normal exit of the try block.  Break, continue, and return exits in the try
block have the finally code inlined just before the exit is taken.

Try/catch/finally is not yet supported, it requires some changes to the
assigned variables analysis.

R=asgerf@google.com

Review URL: https://codereview.chromium.org//1201983002.
2015-06-24 10:12:42 +02:00
Asger Feldthaus c5bb081ed6 dart2js cps: Get typed selectors for compound operators.
This dramatically improves type inference. Previously, i++ would
completely destroy all type information known for i.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1197673003.
2015-06-23 17:04:19 +02:00
Asger Feldthaus 05497633df dart2js cps: Make Identical a built-in and add Interceptor to Tree IR.
Identical is now a built-in operator instead of a separate primitive.

Interceptor is now its own expression in the Tree IR instead of a static
invocation. This matches the CPS IR (where it is a primitive), and
should fix a problem it was causing for frequency-based naming.

The JS-specific subclass of the Tree IR builder no longer depended on
the backend, emitter, namer, glue, compiler, or anything so it has
been merged into the superclass.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1204733002.
2015-06-23 16:03:57 +02:00
Asger Feldthaus 04c5c61a10 dart2js cps: Refactor and optimize string concatenations.
The ConcatenateStrings IR node has been removed. It was a leftover from
dart2dart.

Expressions inside string interpolations are now stringified explicitly
and we concatenate strings with a pure StringConcat operator.

ConstantExpressions have also been removed from the IR. They were also
an artifact from dart2dart and were complicating the optimizer.

BUG=
R=kmillikin@google.com

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

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

Review URL: https://codereview.chromium.org//1195573003.
2015-06-23 13:17:59 +02:00
Asger Feldthaus 56158b54a1 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

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

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

Review URL: https://codereview.chromium.org//1200823002.
2015-06-23 10:55:02 +02:00
Stephan Herhut 1057e73019 dart2js: Avoid Object.create for bookeeping data structures during startup.
BUG=
R=floitsch@google.com

Review URL: https://codereview.chromium.org//1193423002.
2015-06-23 10:38:16 +02:00
Stephen Adams afe5b32e48 Fix for issue 23432.
Get the correct receiver in noSuchMethod stubs.

noSuchMethod stubs for selectors with Interceptor calling convention should pass the receiver to noSuchMethod (not 'this').  The actual receiver is selected by Object.noSuchMethod and Interceptor.noSuchMethod.

R=floitsch@google.com

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

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

Review URL: https://codereview.chromium.org//1181063005.
2015-06-22 17:02:21 -07:00
Stephen Adams 21a322fd99 Revert "Fix for issue 23432."
Reverted while investigating failed tests.

TBR=sigmund@google.com

Review URL: https://codereview.chromium.org//1203523003.
2015-06-22 13:46:29 -07:00
Stephen Adams c8d7cd8ef4 Fix for issue 23432.
Get the correct receiver in noSuchMethod stubs.

noSuchMethod stubs for selectors with Interceptor calling convention should pass the receiver to noSuchMethod (not 'this').  The actual receiver is selected by Object.noSuchMethod and Interceptor.noSuchMethod.

R=floitsch@google.com

Review URL: https://codereview.chromium.org//1181063005.
2015-06-22 13:16:05 -07:00
Asger Feldthaus 382319fe70 Revert "dart2cps: Fix bug in constructors."
This reverts commit 4a1e6c7966.

TBR=floitsch@google.com

BUG=

Review URL: https://codereview.chromium.org//1195393005.
2015-06-22 19:35:24 +02:00
Asger Feldthaus 988b65336b Revert "dart2js cps: Refactor and optimize string concatenations."
This reverts commit ac75893964.

TBR=kmillikin@google.com

BUG=

Review URL: https://codereview.chromium.org//1201753004.
2015-06-22 19:34:11 +02:00
Asger Feldthaus ac75893964 dart2js cps: Refactor and optimize string concatenations.
The ConcatenateStrings IR node has been removed. It was a leftover from
dart2dart.

Expressions inside string interpolations are now stringified explicitly
and we concatenate strings with a pure StringConcat operator.

ConstantExpressions have also been removed from the IR. They were also
an artifact from dart2dart and were complicating the optimizer.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1195573003.
2015-06-22 18:08:44 +02:00
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