Commit Graph

2325 Commits

Author SHA1 Message Date
Asger Feldthaus 1b9a7e0be5 dart2js cps: Avoid comparing boolean values to boolean constants.
E.g. (x === true) can be replaced with x if x is a boolean.

Box2D has some code where this happens.

BUG=
R=kmillikin@google.com, sra@google.com

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

Review URL: https://codereview.chromium.org/1588813002 .
2016-01-14 13:01:31 -08:00
Harry Terkelsen ba83822ca3 dart2js: clean up status file
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1589073002 .
2016-01-14 11:19:16 -08:00
Stephen Adams 5d728e9b6e Add new cps_ir test omitted from last cl
BUG=

Review URL: https://codereview.chromium.org/1589503003 .
2016-01-13 20:19:16 -08:00
Stephen Adams a56036b0a3 Do TypePropagation again after inlining
R=asgerf@google.com

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

Reverted.

Review URL: https://codereview.chromium.org/1560963002 .
2016-01-13 20:03:47 -08:00
Stephen Adams 9db58343b3 dart2js cps: for(;;) is shorter than while(true)
R=asgerf@google.com

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

Reverted.

Review URL: https://codereview.chromium.org/1584693003 .
2016-01-13 12:57:13 -08:00
Florian Loitsch e775fa0932 Add support for 'dart.library.X' environment variables in dart2js.
R=johnniwinther@google.com, sigurdm@google.com

Committed: https://github.com/dart-lang/sdk/commit/369899c8ffca28f28a1af3cc323d1111c1a4a48a
Reverted: https://github.com/dart-lang/sdk/commit/b80994d6ad63ac30b400590cf51815e862c0e8a1

Review URL: https://codereview.chromium.org/1404183002 .
2016-01-13 16:34:46 +01:00
Harry Terkelsen d4ce7f145d dart2js cps: update status files for passing tests
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1581813004 .
2016-01-12 17:20:32 -08:00
Asger Feldthaus c85916dedc dart2js cps: Hoist unsafe expressions from loop entry.
Primitives that potentially throw cannot normally be hoisted, but we can
sometimes hoist them anyway if they are at the loop entry.

We now hoist GetLength, GetField, GetIndex, NullCheck, and BoundsCheck.

BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1578963002 .
2016-01-12 15:18:31 -08:00
Asger Feldthaus e6cc028c6f dart2js cps: Preserve parameter hints during eta and beta reductions.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1582643002 .
2016-01-12 15:12:51 -08:00
Sigmund Cherem c3b7e13c4c cpsir unittests: move all unittests into individual files and test runners.
Notes: most test code was copied from the original test files. The expectations
in patchset #1 are what we had in the files, expectations in patchset #2 are the
updated expectations.

Here is how the files under tests/compiler/dart2js/cps_ir/ are organized:
  - up_to_date_test.dart: test that checks that your files are up to date, and
    gives you the option to update them.
    - passing "update" as an argument will update all *_test.dart files in
      this folder and "update_all.dart".

  - some_name_N_test.dart: a unit test
    - takes cps_ir/input/some_name_N.dart as input, compiles it, and compares
      the output to cps_ir/expected/some_name_N.js
    - it accepts "update" as a command line argument to update the expectations in place

  - update_all.dart: updates expectations on all tests.

  - runner.dart: imported from all individual tests, basically an adaptation of
    the logic from js_backend_cps_ir.dart.

Test failures indicate how to update them, normally you will run 2 commands:
    up_to_date_test.dart update // to update the list of tests
    update_all.dart             // to update the expectations.

R=asgerf@google.com, kmillikin@google.com

Review URL: https://codereview.chromium.org/1576093003 .
2016-01-12 10:00:47 -08:00
Florian Loitsch b80994d6ad Revert "Add support for 'dart.library.X' environment variables in dart2js."
This reverts commit 369899c8ff.

Review URL: https://codereview.chromium.org/1573243004 .
2016-01-12 14:41:00 +01:00
Florian Loitsch 369899c8ff Add support for 'dart.library.X' environment variables in dart2js.
R=johnniwinther@google.com, sigurdm@google.com

Review URL: https://codereview.chromium.org/1404183002 .
2016-01-12 13:58:46 +01:00
Sigmund Cherem 480193ec3a cpsir: mark unit test as slow
BUG=

Review URL: https://codereview.chromium.org/1577993002 .
2016-01-11 13:00:14 -08:00
Sigmund Cherem 0f626270ad cps_ir: add refinement on "success" arguments for a set of whitelisted methods
and operators.

R=asgerf@google.com

Review URL: https://codereview.chromium.org/1571953002 .
2016-01-11 10:48:14 -08:00
Johnni Winther 2ddf46bb85 Add EnumSet.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1568213003.
2016-01-11 11:29:44 +01:00
Asger Feldthaus e87b055c4e dart2js cps: Update status file.
BUG=

Review URL: https://codereview.chromium.org/1566423004 .
2016-01-08 15:26:55 -08:00
Johnni Winther c6f0d75d81 Specialize message for parts as entry point
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1564803002.
2016-01-07 09:50:49 +01:00
Asger Feldthaus d2a6980c1c dart2js cps: Generate increment and compound operators.
Expressions like `i = i + E` now become `i += E` or `++i` if E=1.

The same applies for field and index access.

BUG=
R=sigmund@google.com, sra@google.com

Review URL: https://codereview.chromium.org/1562893002 .
2016-01-06 16:56:33 -08:00
Asger Feldthaus bb129a2d07 dart2js cps: Disable units tests that check the exact compiler output.
These were sort of useful, but are way too expensive to maintain and
have broken the build bots way more often than they have uncovered bugs.

If we want to monitor the concrete compiler output we should build real
tools for that.  They are not unit tests.

BUG=

Review URL: https://codereview.chromium.org/1562263002 .
2016-01-06 16:47:48 -08:00
Asger Feldthaus eadb59e4c1 dart2js cps: Eliminate unary string concatenation.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org/1563983002 .
2016-01-06 16:18:00 -08:00
Kevin Millikin 47461f8d2c dart2js Rebase a compiler test whose output has changed.
We are not currently inlining some list printing methods that contain
try/catch.

TBR=sra@google.com
BUG=

Review URL: https://codereview.chromium.org/1563883004 .
2016-01-07 00:01:11 +01:00
Stephen Adams 55e8ae0e10 Copier should copy InvokeMethod calling convention
R=asgerf@google.com

Review URL: https://codereview.chromium.org/1564713002 .
2016-01-06 13:07:11 -08:00
Sigmund Cherem e2623f1aea cpsir: add support for deferred code
R=asgerf@google.com

Review URL: https://codereview.chromium.org/1558353002 .
2016-01-06 10:24:52 -08:00
Johnni Winther bdcce60ff4 Fix analyze_test_test white-listing.
BUG=

Review URL: https://codereview.chromium.org/1564733003.
2016-01-06 13:40:10 +01:00
Johnni Winther 306537be79 Add test of unittests.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1562023002.
2016-01-06 13:19:41 +01:00
Kevin Millikin b5aac5b951 dart2js: Update test status files for the CPS backend.
After inlining, test expectations have changed.  A few tests have
starting unexpectedly passing --- this could be because inlining
implements the correct semantics, or the could be passing for the
wrong reason.  In any case, the underlying bug in the compiler has not
been fixed.

I will look into all these issues after the Christmas holidays.

BUG=

Review URL: https://codereview.chromium.org/1546943002 .
2015-12-23 12:25:59 +01:00
Kevin Millikin 044b283a3c dart2js: Initial implementation of inlining.
Perform a depth-first postorder traversal of the call graph of known
functions.  Make an inlining decision based on the vector of argument
types at the call site, and cache inlining decisions.  For positive
inlining decisions, cache the optimized function body specialized to
the receiver and argument types at the call site.

Future work:
  * Real inlining heuristics.
  * Propagate result types of inlined calls.
  * Specialized for constant arguments when it makes sense.
  * Performance improvements.

R=asgerf@google.com, sra@google.com

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

Review URL: https://codereview.chromium.org/1537663002 .
2015-12-23 10:12:19 +01:00
Stephen Adams 2d43e29cdc Mark sourcemaps/source_mapping_operators_test as failing
TBR=johnniwinther@google.com

Review URL: https://codereview.chromium.org/1540403002 .
2015-12-21 14:32:25 -08:00
Ivan Posva 7e6d5a579d - Fix more bad uses of Platform.packageRoot.
- Simplify previous fixes.

BUG=
R=lrn@google.com

Review URL: https://codereview.chromium.org/1536043002 .
2015-12-18 08:34:07 -08:00
Asger Feldthaus db00be6476 dart2js cps: Clone small constants to use site.
BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org/1526333002 .
2015-12-18 16:31:09 +01:00
Ivan Posva c9d23b0418 - Fix or simplify use of Platform.packageRoot.
BUG=

Review URL: https://codereview.chromium.org/1537833002 .
2015-12-17 13:54:19 -08:00
Ivan Posva a3f816e75b - Fix usage of Platform.packageRoot.
BUG=

Review URL: https://codereview.chromium.org/1533693003 .
2015-12-17 13:08:19 -08:00
Ivan Posva d7ed4afbae - Fix usage of Platform.packageRoot.
BUG=

Review URL: https://codereview.chromium.org/1529173004 .
2015-12-17 09:30:17 -08:00
Johnni Winther 5d53b30151 Handle malformed elements in onElementResolved.
R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1525423002.
2015-12-16 15:04:25 +01:00
Asger Feldthaus 488ffd8aac dart2js cps: Use oneshot interceptors and 'instanceof' expressions.
BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org/1525163002 .
2015-12-16 14:13:51 +01:00
Johnni Winther 212ba4afbe Support optional package name arguments to --show-package-warnings
In response to dartbug.com/18661 and dartbug.com/21651.

Dart2js doesn't know pubspec.yaml or the directory structure but pub does. Next step is to pass arguments from pub.

BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1513263002.
2015-12-15 10:52:19 +01:00
Johnni Winther 6bb8cd8943 Introduce benign errors.
Closes #25204

R=sigmund@google.com

Review URL: https://codereview.chromium.org/1525593002.
2015-12-15 10:17:00 +01:00
Asger Feldthaus f53ce36c3d dart2js cps: Add instruction for bounds checks.
The new instruction is expanded into low-level operations
in a new pass Finalize. The Finalize pass is mandatory.

The BoundsCheck returns the indexable object being checked
so it can be used to restrict code motion.

BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org/1512303002 .
2015-12-14 14:41:49 +01:00
Florian Loitsch ca1c5ebe6b Enable conditional imports in unparser test.
Review URL: https://codereview.chromium.org/1517873004 .
2015-12-11 06:44:06 +01:00
Florian Loitsch af4983c6b2 dart2js: add support for configuration-specific imports.
R=johnniwinther@google.com, rnystrom@google.com

Committed: https://github.com/dart-lang/sdk/commit/64edfaf21af3153f32e1229dd97c9b3d40cbfb2b
Reverted: https://github.com/dart-lang/sdk/commit/f38b810d334900317ee6c919b45ebd0c673fdb02

Review URL: https://codereview.chromium.org/1388523002 .
2015-12-11 06:17:15 +01:00
Florian Loitsch f38b810d33 Revert "dart2js: add support for configuration-specific imports."
This reverts commit 64edfaf21a.

Review URL: https://codereview.chromium.org/1517013003 .
2015-12-11 00:49:38 +01:00
Florian Loitsch 64edfaf21a dart2js: add support for configuration-specific imports.
R=johnniwinther@google.com, rnystrom@google.com

Review URL: https://codereview.chromium.org/1388523002 .
2015-12-11 00:25:01 +01:00
Stephen Adams 51b3b98bb9 Upgrade more confuse() functions
Verified generated code has no material changes.

TBR=floitsch@google.com

Review URL: https://codereview.chromium.org/1519563004 .
2015-12-10 12:49:20 -08:00
Stephen Adams dfc9ad2630 Test for consistent errors for optimized forms of '-'.
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1516723002 .
2015-12-10 11:32:22 -08:00
Stephen Adams ae0da7de9c Canonical output ordering for constants.
Fix for: http://dartbug.com/24920

R=sigmund@google.com

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

Reverted.

Review URL: https://codereview.chromium.org/1491413008 .
2015-12-10 10:32:20 -08:00
Johnni Winther 8e467be6b0 Add missing compile-time errors for async/await.
Closes #22324
Closes #23716

R=sigurdm@google.com

Review URL: https://codereview.chromium.org/1504403005.
2015-12-10 11:24:09 +01:00
Stephen Adams cfb97d053e Revert "Canonical output ordering for constants."
TBR=sigmund@google.com

Review URL: https://codereview.chromium.org/1511383002 .
2015-12-09 17:23:29 -08:00
Stephen Adams d15e5d5192 Canonical output ordering for constants.
Fix for: http://dartbug.com/24920

R=sigmund@google.com

Review URL: https://codereview.chromium.org/1491413008 .
2015-12-09 17:05:51 -08:00
Alan Knight 44d82ebc43 Fix Chrome 47 test suppressions and invalid @DontInline directive
BUG=

Review URL: https://codereview.chromium.org/1509323003 .
2015-12-09 10:32:26 -08:00
Johnni Winther 7716ef5da1 Report compile-time error on disallowed metadata values.
Closes #14548

R=karlklose@google.com

Review URL: https://codereview.chromium.org/1510863004.
2015-12-09 15:48:38 +01:00