Commit Graph

4835 Commits

Author SHA1 Message Date
Stephen Adams 0bd5cc5f70 dart2js: fix for https://github.com/dart-lang/sdk/issues/24412
The regression on some benchmarks was caused by
UnknownJavaScriptObject becoming alive.  Changing the test to 'is' reverts the regression.

Also make the cps_ir register UnknownJavaScriptObject when generating try-catch as that might snag a JavaScript error.

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

Review URL: https://codereview.chromium.org//1366673003 .
2015-09-23 17:27:16 -07:00
Stephen Adams 8852bf9e14 dart2js: fix nondeterministic output of type metadata.
Use consistent hashcode for deferred index into metadata.
Slightly nicer names for type constants in non-minified mode.

C.Type_k8F -->  C.Type_String_k8F

BUG= http://dartbug.com/24391
R=het@google.com

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

Review URL: https://codereview.chromium.org//1358363002 .
2015-09-23 17:08:27 -07:00
Stephen Adams db811d2e20 Revert "dart2js: fix nondeterministic output of type metadata."
BUG=

Review URL: https://codereview.chromium.org//1367723005 .
2015-09-23 16:09:43 -07:00
Stephen Adams 4cb72d2baf dart2js: fix nondeterministic output of type metadata.
Use consistent hashcode for deferred index into metadata.
Slightly nicer names for type constants in non-minified mode.

C.Type_k8F -->  C.Type_String_k8F

BUG= http://dartbug.com/24391
R=het@google.com

Review URL: https://codereview.chromium.org//1358363002 .
2015-09-23 15:52:55 -07:00
Sigurd 1c3dd67408 Avoid warning when using return; from sync* and async* functions.
Fixes https://github.com/dart-lang/sdk/issues/24406

R=johnniwinther@google.com

Committed: https://github.com/dart-lang/sdk/commit/75f80a204b98ebd65a5da1f2c1db6c6388d67887
Reverted: https://github.com/dart-lang/sdk/commit/8163c4a14199314b6fad626de61d031a35b4d2c1

Review URL: https://codereview.chromium.org//1367433002 .
2015-09-23 13:50:56 +02:00
Sigurd 8163c4a141 Revert "Avoid warning when using return; from sync* and async* functions."
This reverts commit 75f80a204b.

BUG=

Review URL: https://codereview.chromium.org//1361813003 .
2015-09-23 12:21:52 +02:00
Florian Loitsch f36b8aa4e4 dart2js: Make sure that super classes have their inheritance chain set up correctly.
This bug was only happening for the --fast-startup.
For most browsers we simply change the '__proto__' and the order wouldn't be important. However, for the other browsers we have to do it in order.

R=sigmund@google.com

Review URL: https://codereview.chromium.org//1347423003 .
2015-09-23 11:48:18 +02:00
Sigurd 75f80a204b Avoid warning when using return; from sync* and async* functions.
Fixes https://github.com/dart-lang/sdk/issues/24406

R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//1367433002 .
2015-09-23 11:07:31 +02:00
Karl Klose e28e578731 dart2js cps: Support sync* and yield.
R=asgerf@google.com, kmillikin@google.com

Review URL: https://codereview.chromium.org//1353843002 .
2015-09-23 11:01:34 +02:00
Florian Loitsch 5461f0f5cd dart2js: Don't return null from void functions.
R=sigmund@google.com

Review URL: https://codereview.chromium.org//1348573004 .
2015-09-22 11:10:33 +02:00
Asger Feldthaus e97d32be50 Revert "dart2js cps: Change type tests to null tests when applicable."
This reverts commit 29dedfa97e.

This triggers an assertion failure.

BUG=

Review URL: https://codereview.chromium.org//1358843002 .
2015-09-21 14:17:54 +02:00
Asger Feldthaus 29dedfa97e dart2js cps: Change type tests to null tests when applicable.
When null is the only value that might fail a type test we can
rewrite it to just compare against null.

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

Review URL: https://codereview.chromium.org//1306773005 .
2015-09-21 13:33:16 +02:00
Asger Feldthaus 8c6b990305 dart2js cps: Set receiver-nullability in analysis pass.
Setting receiverIsNotNull, objectIsNotNull in the analysis pass
simplifies the transformation pass since predicates like
'isSafeForElimination' depend on them.

This would prevent constant folding of array lengths since
GetLength was not marked as safe for elimination at the
time it was considered for constant folding.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1348233002 .
2015-09-21 12:43:26 +02:00
Asger Feldthaus ccb3af54ab dart2js cps: Set result of 'await' to dynamic instead of empty.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1349723002 .
2015-09-21 11:37:39 +02:00
Stephen Adams 19f2296576 Nicer error for JS() form with mismatched arguments.
R=sigmund@google.com

Review URL: https://codereview.chromium.org//1353243002 .
2015-09-18 18:51:47 -07:00
Stephen Adams d0c00d2b61 Throw Error on unreachable code rather than throwing a String.
Still under a 'flag'.
Enable with:

  DART_VM_OPTIONS=-Dunreachable-throw=true  <compile>

These tests fail with an [empty] input to createRuntimeType.

DART_VM_OPTIONS=-Dunreachable-throw=true  tools/test.py -mrelease -cdart2js -rd8 dart2js_extra/deferred/deferred_mirrors1_test
DART_VM_OPTIONS=-Dunreachable-throw=true  tools/test.py -mrelease -cdart2js -rd8 dart2js_extra/mirrors_used_warning2_test
R=sigmund@google.com

Review URL: https://codereview.chromium.org//1355873003 .
2015-09-18 16:54:50 -07:00
Kevin Millikin 454278872a dart2js CPS: Fix a bug in the generic Tree transformer.
When I was experimenting with inlining, I triggered a violation of the Tree
integrity checker after variable merging, because variable uses in the
typeInformation were not rewritten.

R=asgerf@google.com
BUG=

Review URL: https://codereview.chromium.org//1356903002 .
2015-09-18 16:59:33 +02:00
Kevin Millikin 19d7f93dad dart2js CPS: Small cleanup of the compilation pipeline.
Apply all the optimization passes uniformly.  Rename CpsIR to CpsIr
and TreeIR to TreeIr.

R=asgerf@google.com, karlklose@google.com
BUG=

Review URL: https://codereview.chromium.org//1344173005 .
2015-09-18 14:13:18 +02:00
Kevin Millikin b97a6bc0c9 dart2js CPS: Clean up the S-Expression builder.
* Type annotations were not correct anymore, since we refactored type
  propagation.

* Continuations were not decorated.  This meant that they weren't marked
  with '**' when they caused an integrity violation.

* There was a bug in the arity of calls to _currentIsolate that manifested
  when trying to build the argument list string.

* Formatting needed some small cleanups.

R=karlklose@google.com
BUG=

Review URL: https://codereview.chromium.org//1345983007 .
2015-09-18 11:31:35 +02:00
Stephan Herhut 75b48722bc Abandon type inference on closures that (potentially) flow into Function.apply.
Type inference uses the closure tracer to decide whether it has sufficient global
information to compute an actual type on a closure. If tracing fails, it will
abandon type inference for that closure. However, we no longer fail tracing just
because a closure flows into Function.apply, as this still means that we have
seen all use sites. Unfortunately, type inference does not understand that
Function.apply is actually a call site (and we lack other information to make
this knowledge worthwhile). So it concludes that the closure is never called.
With this fix, it now correctly abandons inference again.

The second issue was that we only take default values into account when looking
at a call site (so that we only use them if they are actually used). This can be
decided statically unless we loose track or there is a call to Function.apply.
I have added an extra edge to the use-graph so that there now always is a use
edge from a default to the parameter. While this is conservative, it will only
affect tracing and thus only the types of traced entities that are used as
default should be impacted.

BUG= http://dartbug.com/24297
R=sigmund@google.com, sra@google.com

Review URL: https://codereview.chromium.org//1355563002 .
2015-09-18 10:13:34 +02:00
Stephen Adams a2239c2dee dart2js ssa: Inlining heuristics ignore assert() statement size.
assert() Ast nodes are not counted towards inlinee size in production mode.

R=sigmund@google.com

Review URL: https://codereview.chromium.org//1345413002 .
2015-09-17 09:44:32 -07:00
Johnni Winther b1ecbf10d4 Revert "Enqueue superclasses instead of supertypes."
This reverts commit a118955a2b.

BUG=

Review URL: https://codereview.chromium.org//1354603002.
2015-09-17 14:02:46 +02:00
Johnni Winther a118955a2b Enqueue superclasses instead of supertypes.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1352533002.
2015-09-17 13:28:31 +02:00
Johnni Winther ecb1e33a7f Report hint on unmatched show and hide combinators.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1346133002.
2015-09-17 12:33:17 +02:00
Johnni Winther 573c1c68e4 Rename ReceiverMask and ReceiverMaskSet and update comments.
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org//1342933006.
2015-09-17 10:41:04 +02:00
Stephen Adams 0b9e80edbf Add optional message to assert in Dart2js - continued
This CL takes https://chromiumcodereview.appspot.com/1325843003/ and makes some changes:

 - distinguish enableUserAssertions from enableTypeAssertions
 - better type inference for disabled assertions

R=lrn@google.com

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

Review URL: https://codereview.chromium.org//1342213003 .
2015-09-16 16:47:40 -07:00
Stephen Adams 37be70525b Revert "Add optional message to assert in Dart2js - continued"
To be re-applied with .status changes.

TBR=sigmund@google.com

Review URL: https://codereview.chromium.org//1346093003 .
2015-09-16 16:37:10 -07:00
Stephen Adams d5b2b393f3 Add optional message to assert in Dart2js - continued
This CL takes https://chromiumcodereview.appspot.com/1325843003/ and makes some changes:

 - distinguish enableUserAssertions from enableTypeAssertions
 - better type inference for disabled assertions

R=lrn@google.com

Review URL: https://codereview.chromium.org//1342213003 .
2015-09-16 15:16:02 -07:00
Johnni Winther 7ef93ef03a Make the universe parts into small libraries.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1348063002.
2015-09-16 15:09:14 +02:00
Asger Feldthaus 4055f6fca3 dart2js cps: Use more precise type inference for direct index access.
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1340093002 .
2015-09-16 11:00:51 +02:00
Asger Feldthaus 19cb08fa05 dart2js cps: Remove code after calls that cannot return.
This should resolve an outstanding issue with unreachable code being
transformed. A subterm in the unreachable code would get specialized
and then reanalyzed while some of the definitions in scope have no type.

This changes a lot of test case results. Some test results
have changed in very surprising ways, but I would argue
these are separate bugs that we should hunt down.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1335273003 .
2015-09-15 17:46:48 +02:00
Karl Klose 4ce8a23f0a dart2js: Register helpers for updating send to type variable.
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//1344733003 .
2015-09-15 15:31:52 +02:00
Johnni Winther 06ad66481c Move Selector and CallStructure into parts.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1346593002.
2015-09-15 14:21:05 +02:00
Johnni Winther b0e941ac98 Prepare for moving Selector and CallStructure into their own libraries.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1342503004.
2015-09-15 14:14:30 +02:00
Asger Feldthaus 79c0cb039f dart2js cps: Store the TypeMask for each primitive in a field.
This should make it easier to use type information in other passes.

Some passes have been adapted to update the type field, even though it
is still only used in type propagation.

Refinement nodes are still removed pretty early since most passes are
not prepared to deal with them.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1305863010 .
2015-09-15 13:05:35 +02:00
Asger Feldthaus e48d774006 dart2js cps: Set a flag on InvokeMethod when the receiver is intercepted
This should make it clear where the "actual receiver" of a method call
can be found after dummy receiver optimization.

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

Review URL: https://codereview.chromium.org//1335933004 .
2015-09-15 12:13:06 +02:00
Johnni Winther 14336baa3a Handle deferred import without prefix.
BUG=

Review URL: https://codereview.chromium.org//1332223005.
2015-09-15 11:34:05 +02:00
Johnni Winther b98cd40055 Add ImportElement and ExportElement
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1335983004.
2015-09-15 10:06:10 +02:00
Stephen Adams f9459ad4ac dart2js ssa: Avoid tracking too much in load elimination
R=floitsch@google.com

Review URL: https://codereview.chromium.org//1343783002 .
2015-09-14 12:49:57 -07:00
Sigurd dc6b09a6d7 Makes the $ variable local to the deferred enclosing function.
This fixes https://github.com/dart-lang/sdk/issues/24328
BUG=
R=floitsch@google.com

Review URL: https://codereview.chromium.org//1337923006 .
2015-09-14 15:35:52 +02:00
Johnni Winther afc7f9acae Avoid creating ConstructedConstantExpression for deferred constant.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org//1336303002.
2015-09-14 15:28:26 +02:00
Johnni Winther bae758fa61 Show import chains for unsupported dart:* library imports.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org//1338783002.
2015-09-14 15:19:06 +02:00
Johnni Winther 83b2c7f68a Type check await for.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org//1338803002.
2015-09-14 11:37:33 +02:00
Johnni Winther bda5146f40 Compute Compiler.proxyConstant on demand.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1334203002.
2015-09-11 14:47:49 +02:00
Johnni Winther 7407a72115 Add related types check to analyze_dart2js_test
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org//1338683002.
2015-09-11 14:38:04 +02:00
Johnni Winther 8bcbccc067 Use memory compiler in compiler_helper.dart.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org//1322973007.
2015-09-11 12:49:34 +02:00
Johnni Winther d655374736 Add warnings and hints to for-in.
BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org//1334673002.
2015-09-11 12:38:34 +02:00
Stephen Adams 1aa97c36b5 dart2js ssa: Open coding of removeLast should use -1 as index
This makes the error consistent between unoptimized and optimizer code.

R=sigmund@google.com

Review URL: https://codereview.chromium.org//1315523012 .
2015-09-10 15:38:49 -07:00
Asger Feldthaus 7d7d70a0e4 dart2js cps: Check strictness flag in redundant join eliminator.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1316163004 .
2015-09-10 09:54:43 +02:00
Johnni Winther 0dc96c4c2c Wrap Import uses in deferred_load.dart
This prepares for the addition of ImportElement for imports.

BUG=
R=sigurdm@google.com

Review URL: https://codereview.chromium.org//1313753004.
2015-09-10 09:53:49 +02:00