Commit Graph

5559 Commits

Author SHA1 Message Date
Stephan Herhut 225be75498 Fix some tests and exclude others from CRLF rewriting.
R=whesse@google.com
BUG=

Review URL: https://codereview.chromium.org//1212823002.
2015-06-26 14:40:01 +02:00
Matthias Hausner e5f339b861 Yield in non-generator function is compile-time error
BUG=23710
R=srdjan@google.com

Review URL: https://codereview.chromium.org//1204103002.
2015-06-25 10:40:25 -07:00
Asger Feldthaus fceb7f00dc dart2js cps: Handle checks against mutable and extendable lists.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1206873003.
2015-06-25 15:03:00 +02:00
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
Srdjan Mitrovic fbc9f6b9d8 Fix (optimizer) crashes in conditional nodes when result is not needed.
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//1211593004.
2015-06-24 11:30:50 -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
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 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
Matthias Hausner 84be183a32 Library prefixes used to be invisible. The newest spec treats them as objects, but it's a compile-time error to do most anything with them.
This change brings the VM in compliance with the current spec.

BUG=23612
R=iposva@google.com

Review URL: https://codereview.chromium.org//1201523002.
2015-06-22 13:01:29 -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 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
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
Srdjan Mitrovic 9270fc7f3d Fix status file
BUG=

Review URL: https://codereview.chromium.org//1197993002.
2015-06-20 00:10:54 -07:00
Srdjan Mitrovic b498492194 Fix bingint crash, disable a test
BUG=
R=regis@google.com

Review URL: https://codereview.chromium.org//1194963004.
2015-06-19 15:18:06 -07:00
Karl Klose f8bb30a113 Restore accidentially deleted test expectations.
TBR=kmillikin@google.com

Review URL: https://codereview.chromium.org//1192383002.
2015-06-19 15:07:00 +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
Paul Berry a2a93750f6 Fix Dartium/drt buildbots for recent conditional operator and prefix tests.
TBR=hausner@google.com

Review URL: https://codereview.chromium.org//1191883003.
2015-06-18 16:13:59 -07:00
Matthias Hausner 0535e37619 Implement ?? ??= and ?. operators
BUG=23455
R=srdjan@google.com

Review URL: https://codereview.chromium.org//1180903002.
2015-06-18 11:05:16 -07:00
Paul Berry 9c90a66d0d Update analyzer to reflect new rules for prefixes.
As of commit 67b99e4b33, it is now
consistently a compile error for a prefix not to be followed by '.'.
(Previously, there were two exceptions in which a prefix not followed
by '.' was treated as though it was preceded by "this.")

This CL updates analyzer to be consistent with the new spec langauge,
and modifies the tests in tests/language accordingly.

Dart2js and the VM do not yet produce the correct compile-time error
in all circumstances.  See issues #23611 and #23612.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//1186033004.
2015-06-18 10:03:07 -07: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
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
Paul Berry 76bbccf28f Add tests for e?.v++, e?.v--, ++e?.v, and --e?.v.
The tests for e?.v++ and e?.v-- validate the spec text added in
58708e3 (as clarified by 1ab7736).

The tests for ++e?.v and --e?.v weren't mandated by any spec change,
but since these expressions weren't previously tested, it seemed
reasonable to add tests for them.

All tests pass under the current implementation of "?." in analyzer
and dart2js.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//1177043010.
2015-06-17 11:17:40 -07:00
Karl Klose a842f6dff2 Update dart2js-cps_ir test expectations.
TBR=johnniwinther@google.com

Review URL: https://codereview.chromium.org//1188183006.
2015-06-17 09:41:50 +02:00
Karl Klose 7f8fe44067 Update dart2js-cps_ir test expectations.
TBR=kmillikin@google.com

Review URL: https://codereview.chromium.org//1181063004.
2015-06-16 15:47:35 +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
Karl Klose bb45376735 Update dart2js-cps_ir status files.
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1191433002.
2015-06-15 12:50:58 +02:00
Ryan Macnak bac8bc4b18 Fix accessing dart:_ libraries via exports.
R=hausner@google.com

Review URL: https://codereview.chromium.org//1185733003.
2015-06-12 16:50:27 -07:00
Karl Klose e4b56654ff Update dart2js-cps_ir test expectations with better annotations.
R=asgerf@google.com

Review URL: https://codereview.chromium.org//1181613003.
2015-06-11 10:56:56 +02:00
Paul Berry 2f610a3ff5 Report a compile-time error if a const field is multiply initialized.
This CL makes analyzer consistent with the VM and the spec, by
producing a compile-time error for code such as:

    class C {
      final x = 1;
      const C() : x = 2;
    }
    main() {
      const C();
    }

Note that Dart2js also produces an error in this circumstance, but its
error is too general (the error should only be produced if the const
constructor is invoked using "const"; if the const constructor is
invoked using "new", or is not invoked at all, it should only be a
warning).  See #23618.

R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//1175073002.
2015-06-10 14:02:43 -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
Karl Klose 6a85394310 Mark tests as failing on dart2js-cps_ir.
R=kmillikin@google.com
TBR=kmillikin@google.com

Review URL: https://codereview.chromium.org//1172793006.
2015-06-10 10:11:40 +02:00
Paul Berry 97ed10eba0 Exclude "drt" from expected failures due to issue #23612.
On the "dartium-full" buildbots we use the "drt" runtime, which has
the same behavior as the "dartium" runtime.  So we need to exclude
this runtime for the same reason as we had to exclude "dartium" in
commit 046123935a.

TBR=scheglov@google.com

Review URL: https://codereview.chromium.org//1171833005.
2015-06-09 18:58:12 -07:00
Paul Berry 046123935a Exclude Dartium from expected failures due to issue #23612.
These tests are marked as MissingCompileTimeError, and indeed Dartium
gives a runtime error rather than a compile-time error.  But the test
framework doesn't seem to be able to tell the difference, so it
incorrectly flags the test as passing.

TBR=scheglov@google.com
BUG=https://github.com/dart-lang/sdk/issues/23612

Review URL: https://codereview.chromium.org//1169813007.
2015-06-09 14:53:08 -07:00
Paul Berry fc83ce5ba9 Fix analyzer's handling of import prefixes not followed by '.'.
If 'p' is an import prefix, then 'p = ...' is treated as synonymous
with 'this.p = ...', and 'p()' is treated as synonymous with
'this.p()'.  In all other circumstances where 'p' is not followed by
'.', the spec calls for a compile time error.

Previous to this CL, 'p' not followed by '.' was being treated as
synonymous with 'this.p' under all circumstances.  This CL brings
analyzer in line with the spec, and updates the tests in
tests/language accordingly.

The VM and Dart2js currently fail to implement the compile-time error
properly.  See issues #23611 and #23612.

Fixes issue #23461.

R=scheglov@google.com

Review URL: https://codereview.chromium.org//1173523002.
2015-06-09 13:38:53 -07:00
Karl Klose 6cffe227fe Update dart2js-cps_ir test expectations after bac7481d3d.
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//1171773004.
2015-06-09 15:12:18 +02: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
Sigurd 28be4b3243 Revert "Reenable async-tests on macos chrome - they are not failing anymore."
This reverts commit 3d5f2b45bf.

Seems my script checked for the wrong thing.

BUG=

Review URL: https://codereview.chromium.org//1158853005
2015-06-08 12:52:59 +02:00
Sigurd 3d5f2b45bf Reenable async-tests on macos chrome - they are not failing anymore.
It seems that the new chrome does not trigger the bug.

BUG= https://github.com/dart-lang/sdk/issues/22695
R=whesse@google.com

Review URL: https://codereview.chromium.org//1149633010
2015-06-08 11:04:42 +02:00
Karl Klose 22976789b5 Mark new test as failing on dart2js-cps_ir.
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1163943006
2015-06-04 09:06:05 +02:00
Srdjan Mitrovic c0824e7725 Fix 23563: double unary- operator unstable for NANs
BUG=
R=koda@google.com

Review URL: https://codereview.chromium.org//1160453003
2015-06-03 11:00:28 -07:00
Regis Crelier 4bf6db0c25 Adjust context level when required before executing inlined finally clauses.
Add regression test.

BUG=23537
R=srdjan@google.com

Review URL: https://codereview.chromium.org//1154823003
2015-06-03 10:31:48 -07:00
Srdjan Mitrovic defec9c960 --check_function_fingerprints is available only in dart_no_snapshot, i.e., it was not tested. Make it default true, catch failure at build time then
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//1166813002
2015-06-02 16:36:54 -07:00
Karl Klose 95a46fb177 Adjust cps_ir test expectations.
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//1167673009
2015-06-02 11:26:26 +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