Commit Graph

4698 Commits

Author SHA1 Message Date
Kevin Millikin 0a12c2c3d1 dart2js CPS: Inline list.forEach.
Instead of building up a CPS term representing the implementation of
forEach, use the CPS translation on the code for forEach.

R=asgerf@google.com

Review URL: https://codereview.chromium.org//1294353002 .
2015-08-18 17:15:18 +02:00
Asger Feldthaus eb3fc17ea9 dart2js cps: Use direct length and index access on strings.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1293803003 .
2015-08-18 16:08:46 +02:00
Asger Feldthaus ff74930f67 dart2js: Mark startRootIsolate as "used" by the backend.
This fixes a type inference issue where the empty type was inferred for
the parameters to this method.

BUG=
R=herhut@google.com

Review URL: https://codereview.chromium.org//1298173002 .
2015-08-18 15:55:55 +02:00
Johnni Winther fb7ea815c8 Handle C?.m as C.m for Sends
BUG=
R=floitsch@google.com

Review URL: https://codereview.chromium.org//1294103004.
2015-08-18 11:38:48 +02:00
Asger Feldthaus 64825e695d dart2js cps: Set proper receiver type for intercepted methods.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1294083002 .
2015-08-18 11:26:54 +02:00
Asger Feldthaus d3d7de8c12 dart2js cps: Add logical rewriter rules to favor null-aware operators.
These useful patterns arise with null-aware operators:

x ? y : x  ==>  x && y
x ? x : y  ==>  x || y

BUG=
R=kmillikin@google.com

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

Review URL: https://codereview.chromium.org//1291073002 .
2015-08-18 11:09:00 +02:00
Johnni Winther 00df363b7a Split resolution into several libraries.
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org//1286993004.
2015-08-18 10:45:22 +02:00
Johnni Winther 1d356f8072 Refactoring resolution of updates to type literals.
BUG=
R=floitsch@google.com

Review URL: https://codereview.chromium.org//1301583002.
2015-08-17 16:23:37 +02:00
Florian Loitsch 672df7c087 dart2js: Don't zone-register callbacks in async functions for every await.
R=johnniwinther@google.com, lrn@google.com

Review URL: https://codereview.chromium.org//1281523003 .
2015-08-17 15:57:34 +02:00
Florian Loitsch 7e64f3d962 Dart2js async-await. Bind the async-body to the current zone.
Also ensure the wrapping of js-functions happens only once per
async-call.

BUG=
R=floitsch@google.com

Review URL: https://codereview.chromium.org//1163833002 .
2015-08-17 15:56:53 +02:00
Kevin Millikin b495fceef8 dart2js CPS: Fix a bug in commuting binary operations.
The Tree IR statement rewriter assumes both operands of a binary
operation are variable uses.  Either one of them could also be `this`.

BUG=
R=asgerf@google.com

Review URL: https://codereview.chromium.org//1284233003 .
2015-08-17 11:17:44 +02:00
Asger Feldthaus 01844e7bb0 dart2js cps: Compile some loops as 'for' loops.
BUG=
R=kmillikin@google.com

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

Review URL: https://codereview.chromium.org//1287253002 .
2015-08-17 10:52:35 +02:00
Johnni Winther 720e72428c Check for one-to-many source mappings.
BUG=
R=herhut@google.com

Review URL: https://codereview.chromium.org//1287973002.
2015-08-17 09:57:57 +02:00
Florian Loitsch f9d05b6e29 Fix names of map files in the startup emitter.
R=sigmund@google.com

Review URL: https://codereview.chromium.org//1295873002 .
2015-08-14 22:22:46 +02:00
Asger Feldthaus 13a3413ca2 Revert "dart2js cps: Add logical rewriter rules to favor null-aware operators."
This reverts commit 0e46c8dec9.

BUG=

Review URL: https://codereview.chromium.org//1291313003 .
2015-08-14 15:37:20 +02:00
Asger Feldthaus e1f4ae5482 Revert "dart2js cps: Compile some loops as 'for' loops."
This reverts commit 296cb0b5b4.

TBR=kmillikin@google.com

BUG=

Review URL: https://codereview.chromium.org//1291333002 .
2015-08-14 14:34:04 +02:00
Asger Feldthaus 296cb0b5b4 dart2js cps: Compile some loops as 'for' loops.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1287253002 .
2015-08-14 12:09:32 +02:00
Asger Feldthaus 0e46c8dec9 dart2js cps: Add logical rewriter rules to favor null-aware operators.
These useful patterns arise with null-aware operators:

x ? y : x  ==>  x && y
x ? x : y  ==>  x || y

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1291073002 .
2015-08-14 12:07:39 +02:00
Asger Feldthaus c659bda53b dart2js cps: Bugfixes in .push rewrites.
Two consecutive pushes would sometimes be merged in a way that one of
the arguments could fall out of scope.

List.addAll with a literal list as argument would sometimes be rewritten
to a push, even though the list could be modified before the use.

BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1286123005 .
2015-08-14 12:07:11 +02:00
Sigmund Cherem e3fbf44643 dart2js: add function coverage tracking in dart2js output, dumpinfo, and
coverage recording server

R=sra@google.com

Review URL: https://codereview.chromium.org//1288593002 .
2015-08-13 16:47:58 -07:00
Harry Terkelsen 43e6b8b8db dart2js: remove trailing 0 byte when reading .packages
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org//1290643007.
2015-08-13 10:11:58 -07:00
Asger Feldthaus 0210c5c035 dart2js cps: Fix treatment of captured type variables.
CLOSES=24064
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1286113003.
2015-08-13 13:35:50 +02:00
Florian Loitsch f2d08149fd Don't delay values and errors from async/await functions.
Fixes issue 23497.

R=hausner@google.com

Review URL: https://codereview.chromium.org//1287673002 .
2015-08-13 13:00:11 +02:00
Asger Feldthaus 75b6bd1e0f dart2js cps: Type a list literal as extendable, not just mutable.
This would prevent rewriting into .push and .pop.

BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org//1286193003.
2015-08-13 10:48:40 +02:00
Harry Terkelsen 44f890b3c8 dart2js: don't add a trailing slash when reading --packages
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org//1290903002.
2015-08-12 16:28:47 -07:00
Asger Feldthaus da68a812c2 dart2js cps: Rewrite more List operations into JS array operations.
- add and removeLast become push and pop.
- addAll with a literal list becomes push with multiple arguments.
- Concecutive push calls are merged.
- elementAt() recognized as a synonym for [] (on lists).

BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1285173002.
2015-08-12 16:34:07 +02:00
Florian Loitsch a9f2dfde26 dart2js: Better comment for startup-emitter.
R=herhut@google.com

Review URL: https://codereview.chromium.org//1262833003 .
2015-08-12 15:19:40 +02:00
Asger Feldthaus 703e968620 dart2js cps: Improve rewriting of == to identical.
We now rewrite `x == y` if x is known to have a == implementation that
corresponds to identical(). Previously it would only do this when x was
num, string, or bool.

BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1286993003.
2015-08-12 13:13:47 +02:00
Johnni Winther 930bc75c0d Move diagnostic_listener.dart and messages.dart to the diagnostics folder
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1286143003.
2015-08-12 12:05:36 +02:00
Stephan Herhut 4ad2092516 dart2js: Also trace instances of Function as closures.
R=floitsch@google.com
BUG= http://dartbug.com/23873

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

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

Review URL: https://codereview.chromium.org//1284463003 .
2015-08-12 11:38:03 +02:00
Johnni Winther a7c720f61b Remove dart2jslib.dart
dart2jslib.dart is deleted
compiler.dart is a library containing mainly Compiler
other parts of compiler.dart move according to the listing in https://codereview.chromium.org/1280343002/

R=sigmund@google.com

Review URL: https://codereview.chromium.org//1284593003.
2015-08-12 08:42:46 +02:00
Sigmund Cherem cc8457ae4b dart2js: fix typos
TBR=johnniwinther@google.com

Review URL: https://codereview.chromium.org//1285943003 .
2015-08-11 14:14:57 -07:00
Sigmund Cherem cf41336f42 dart2js: dump info about dependencies added by the enqueuer
This is work in progress though, we need to track other dependencies, for now I
added a TODO.

R=het@google.com, johnniwinther@google.com

Review URL: https://codereview.chromium.org//1279093003 .
2015-08-11 12:55:16 -07:00
Sigmund Cherem ca4fbfad5a dart2js: add parent references to some info objects
R=het@google.com, johnniwinther@google.com

Review URL: https://codereview.chromium.org//1287533002 .
2015-08-11 09:53:55 -07:00
Sigmund Cherem ba7bfcd47d dart2js: fixes additional warnings from analyzer
TBR=het@google.com

Review URL: https://codereview.chromium.org//1286733002 .
2015-08-11 09:36:47 -07:00
Sigmund Cherem f44f720637 dart2js: fix warning in test
TBR:het@google.com

Review URL: https://codereview.chromium.org//1270373003 .
2015-08-11 09:13:49 -07:00
Sigmund Cherem fd9b560788 dart2js: add visitors and parsing support to infos
R=het@google.com, johnniwinther@google.com

Review URL: https://codereview.chromium.org//1285743002 .
2015-08-11 09:10:58 -07:00
Asger Feldthaus 684b83ab05 dart2js cps: Change rewriting of equality operators.
Dart == calls now are rewritten to an Identical node (if applicable),
which can then be specialized further into JS == and === nodes.

Previously, == calls would specialize directly to JS == and === nodes,
but some of these optimizations were then missed for the cases where
Identical nodes are introduced directly (e.g. for switch cases).

The rules have also changed a bit to be more effective, and there
are some small improvements to the utility functions.

BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1276843008.
2015-08-11 15:47:49 +02:00
Asger Feldthaus 136ec727ee dart2js: Do not use JSDouble for native behavior return types.
Previously, a JS('double', ...) expression would be seen as having
the exact JSDouble class as return type. This is problematic since that
class is reserved for non-integer doubles, and the result is generally
not known to be non-integer.

For example, the sqrt function returns 'double' but sqrt(0) == 0 which
is an integer.

BUG=
R=floitsch@google.com

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

Review URL: https://codereview.chromium.org//1276353006.
2015-08-11 15:14:50 +02:00
Asger Feldthaus 87ed36e777 Revert "dart2js: Do not use JSDouble for native behavior return types."
This reverts commit b0905eadce.

BUG=

Review URL: https://codereview.chromium.org//1288463002.
2015-08-11 14:46:42 +02:00
Asger Feldthaus b0905eadce dart2js: Do not use JSDouble for native behavior return types.
Previously, a JS('double', ...) expression would be seen as having
the exact JSDouble class as return type. This is problematic since that
class is reserved for non-integer doubles, and the result is generally
not known to be non-integer.

For example, the sqrt function returns 'double' but sqrt(0) == 0 which
is an integer.

BUG=
R=floitsch@google.com

Review URL: https://codereview.chromium.org//1276353006.
2015-08-11 14:27:02 +02:00
Stephan Herhut 47125dd0ad Revert "dart2js: Also trace instances of Function as closures."
This reverts commit 0973b09aa0.

BUG=
TBR=floitsch@google.com

Review URL: https://codereview.chromium.org//1276223004 .
2015-08-11 11:38:17 +02:00
Johnni Winther 1d0bc4b94e Copy files for splitting src/compiler.dart into several libraries
Intended future content:

common/backend_api.dart:
  Backend

common/codegen.dart:
  CodegenRegistry
  CodegenWorkItem

common/registry.dart:
  Registry

common/resolution.dart:
  ResolutionCallbacks
  ResolutionWorkItem

common/tasks.dart:
  CompilerTask
  DeferredAction
  DeferredTask,
  GenericTask

common/work.dart:
  ItemCompilationContext
  WorkItem

diagnostics/code_location.dart:
  AnyLocation
  CodeLocation
  PackageLocation
  SchemeLocation

diagnostics/invariant.dart:
  DEBUG_MODE
  assertDebugMode
  invariant
  REPORT_EXCESS_RESOLUTION

diagnostics/source_span.dart
  SourceSpan

diagnostics/spannable.dart
  Spannable (from util/util.dart)
  NO_LOCATION_SPANNABLE (from util/util.dart)
  CURRENT_ELEMENT_SPANNABLE (from util/util.dart)

scanner/token_map:
  TokenKey
  TokenMap

BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org//1280343002.
2015-08-11 10:57:13 +02:00
Asger Feldthaus 1520e40024 dart2js cps: Do not add identical calls for foreign code conditions.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1283773002.
2015-08-11 10:46:32 +02:00
Stephan Herhut 18c3d2186f dart2js: Ensure each use site of a name uses a new ast node.
R=johnniwinther@google.com
BUG=

Review URL: https://codereview.chromium.org//1274203003 .
2015-08-11 10:37:12 +02:00
Stephan Herhut 0973b09aa0 dart2js: Also trace instances of Function as closures.
R=floitsch@google.com
BUG= http://dartbug.com/23873

Review URL: https://codereview.chromium.org//1284463003 .
2015-08-11 10:35:59 +02:00
Johnni Winther dab1aaae45 Move dart2jslib parts into separate libraries.
BUG=
R=karlklose@google.com, sigmund@google.com

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

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

Review URL: https://codereview.chromium.org//1284673003.
2015-08-11 09:56:49 +02:00
Harry Terkelsen d27ba64af5 Typecheck const classes in the context of the constructor call.
Closes #23182

BUG=https://github.com/dart-lang/sdk/issues/23182
R=johnniwinther@google.com, sigmund@google.com

Review URL: https://codereview.chromium.org//1182663008.
2015-08-10 16:49:44 -07:00
Sigmund Cherem 8ffd1cacf2 dumpinfo: fix type error in checked mode
TBR=sra@google.com

Review URL: https://codereview.chromium.org//1282263004 .
2015-08-10 13:55:47 -07:00
Sigmund Cherem 3ec292772e dart2js: represent dump-info explicitly, so we can easily create tools that process the data
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//1253763004 .
2015-08-10 12:53:42 -07:00