Commit Graph

4835 Commits

Author SHA1 Message Date
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 f95dd37d1a dart2js: add simple script to compute dependency queries. Currently only
one query is supported "some_path", which gives you a way to determine how a
function is included in the program. For example, running:

  dart code_deps.dart angular2_hello.js.info.json some_path main Compiler

would produce this output:

  source: examples.src.hello_world.index...main
  target: angular2.src.core.compiler.compiler...Compiler.Compiler
  result:
    0. examples.src.hello_world.index...main
    1. examples.src.gestures.index.ng_deps.dart...initReflector
    2. angular2.bootstrap_static.ng_deps.dart...initReflector
    3. angular2.application_static.ng_deps.dart...initReflector
    4. angular2.src.core.application_common.ng_deps.dart...initReflector
    5. angular2.src.core.compiler.compiler.ng_deps.dart...initReflector
    6. angular2.src.core.compiler.compiler...Compiler.Compiler

The tool accepts regular expressions to match the name of the elements.
The graph and util library will be used for other scripts as well.

R=het@google.com

Review URL: https://codereview.chromium.org//1284843002 .
2015-08-11 17:12:45 -07:00
Sigmund Cherem 571c1d5b6e dart2js: add an example script that shows the distribution of code among
libraries.

For example, running this on the dump-info of angular2 'hello
world' would produce:

  path             8807   1.21%
  stack_trace     11501   1.59%
  intl            14135   1.95%
  Loose files    142311  19.62%
  angular2       224171  30.90%
  Core libs      225120  31.03%
  All packages   258614  35.65%
  TOTAL          626045  86.30%

Note that the grouping of libraries, say by package, and summary information is
configurable.

R=het@google.com

Review URL: https://codereview.chromium.org//1287543002 .
2015-08-11 14:59:59 -07: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
Sigmund Cherem eb824b8fac add dart2js.dart in the bin directory.
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//1277003006 .
2015-08-11 08:27:17 -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
William Hesse 5af4843432 Revert "Move dart2jslib parts into separate libraries."
This reverts commit 4474acf36b.

BUG=

Review URL: https://codereview.chromium.org//1278503004 .
2015-08-10 16:57:07 +02:00
Johnni Winther 4474acf36b Move dart2jslib parts into separate libraries.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1284673003.
2015-08-10 16:19:02 +02:00
Asger Feldthaus f30ae48d1b dart2js cps: Introduce '<<' operator in type propagation.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1278013003.
2015-08-10 14:55:13 +02:00
Johnni Winther 25e2dabcf0 Handle more unqualified SendSets
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1278353003.
2015-08-10 13:02:34 +02:00
Johnni Winther 147698997f Refactor and clean up AccessSemantics
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1282773002.
2015-08-10 12:46:47 +02:00
Florian Loitsch f973abf915 dart2js: Use deferredFragments getter.
R=herhut@google.com

Review URL: https://codereview.chromium.org//1256323006 .
2015-08-10 12:42:53 +02:00
Johnni Winther 62fd661ec5 Reorganize constants/* libraries.
Based on https://codereview.chromium.org/1275343002/

R=karlklose@google.com

Review URL: https://codereview.chromium.org//1282463002.
2015-08-07 13:57:27 +02:00
Johnni Winther 211cffc662 Copy expressions.dart to constructors.dart
(missed by a bad merge)

BUG=

Review URL: https://codereview.chromium.org//1276253002.
2015-08-07 13:55:18 +02:00
Johnni Winther 54066b298d Copy expressions.dart to constructors.dart and evaluation.dart
Based on https://codereview.chromium.org/1279613003

In preparation for https://codereview.chromium.org/1282463002

R=karlklose@google.com

Review URL: https://codereview.chromium.org//1275343002.
2015-08-07 13:47:02 +02:00
Johnni Winther 696b8d49d1 Rename constructors.dart to constant_constructors.dart
In preparation for https://codereview.chromium.org/1282463002

R=karlklose@google.com

Review URL: https://codereview.chromium.org//1279613003.
2015-08-07 13:44:50 +02:00
Johnni Winther 66aa8c1624 Rename warnings.dart to messages.dart.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1277143002.
2015-08-07 12:08:51 +02:00
Johnni Winther b777457785 Begin refactoring of visitSendSet for unqualified updates.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1279863005.
2015-08-07 12:01:49 +02:00
Karl Klose bafb8fb191 dart2js cps: Support async/await by rewriting the JavaScript AST.
BUG=
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//1253333002 .
2015-08-07 11:27:40 +02:00
Kevin Millikin 0186a932f0 dart2js CPS: Fix an incorrect assertion.
When computing captured variables in constructors, there was an assert
that an assignment in one of the initializers must be a parameter
assignment (since those are the only locals in scope for the
initializers).

However, the initializers can contain closures, which can have
assignments to their own local variables so the assert was not
correct.

BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1278463005 .
2015-08-07 10:37:45 +02:00
Johnni Winther 29cdb17f39 Refactor visitSendSet for super compounds and assignment.
BUG=
R=karlklose@google.com

Review URL: https://codereview.chromium.org//1274073003.
2015-08-06 14:38:05 +02:00
Ryan Macnak b6c979f20b Hoist InstanceMirror.delegate to ObjectMirror.
BUG=http://dartbug.com/14827
R=gbracha@google.com

Review URL: https://codereview.chromium.org//1273983002 .
2015-08-05 17:09:59 -07:00
Florian Loitsch 6377f18587 dart2js: use correct Compiler class.
Review URL: https://codereview.chromium.org//1272613003 .
2015-08-05 14:24:36 +02:00
Florian Loitsch 49daca25d0 dart2js: Set the name to null for parameter stubs of static functions.
R=sigmund@google.com

Review URL: https://codereview.chromium.org//1252543002 .
2015-08-05 13:48:52 +02:00
Florian Loitsch 7e9fcbf5d6 dart2js: Add a header to the output of the startup emitter.
R=sigmund@google.com

Review URL: https://codereview.chromium.org//1271953003 .
2015-08-05 13:47:39 +02:00