Commit graph

55 commits

Author SHA1 Message Date
Johnni Winther 41c50d9ac9 Support serialization of deferred imports
+ add tests for various fixes
+ add canonicalization support in serialization

Change-Id: Ib6a8bfd6073dbd93c1ba4fd9d2feff77ac43b178
Reviewed-on: https://dart-review.googlesource.com/c/81402
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-10-26 09:36:18 +00:00
Kevin Moore 4d5c5ecdbf Update synced version of pkg:test
Also updated the package references in a number of pubspecs to
more closely align with the package versions that are in the SDK

Change-Id: I061951587befa4211ac7455cf1179911eb07efc0
Reviewed-on: https://dart-review.googlesource.com/c/79920
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2018-10-16 16:12:38 +00:00
G?nter Z?chbauer 2da0b9f4f1 fix some typos
Closes #34738
https://github.com/dart-lang/sdk/pull/34738

GitOrigin-RevId: d211bbacfe65355cf7304c990ffb6c79d7a229cf
Change-Id: If690e6d378e543b300e1f6a353ceae73e39c29db
Reviewed-on: https://dart-review.googlesource.com/c/78900
Reviewed-by: Alexander Thomas <athom@google.com>
2018-10-10 19:15:30 +00:00
Stephen Adams f96362ccfd [dart2js] Smaller code by caching values
- Move more that one assignment into var-list
- Move 'this' to a local variable
- Move repeated large 'fast' constants to local variable

Currently under flag --experiment-code-1


Change-Id: I091cab47f498b4ec3759b9ed358bcc0f2e73fdb1
Reviewed-on: https://dart-review.googlesource.com/c/77025
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-10-08 17:40:19 +00:00
Johnni Winther 263931bd33 Small cleanups to avoid warnings in IntelliJ
Change-Id: I02214d21a910def67184e49765af3020848389d9
Reviewed-on: https://dart-review.googlesource.com/71941
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-08-30 06:47:38 +00:00
Emily Fortuna 2911f1f107 More dart2js strong mode cleanup.
Change-Id: Id54951ebac50e465a31914c78d1ce859e8599229
Reviewed-on: https://dart-review.googlesource.com/57484
Commit-Queue: Emily Fortuna <efortuna@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-30 22:26:01 +00:00
Emily Fortuna 7b33203f8e Fixes to make hackernews run strong mode clean
Change-Id: I3ca5fcd0a4d8daf3aaca3cc39ba034a608f5f760
Reviewed-on: https://dart-review.googlesource.com/56707
Commit-Queue: Emily Fortuna <efortuna@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-05-29 18:58:36 +00:00
Emily Fortuna 00a5197542 More changes to make dart2js dart 2 strong mode clean.
Change-Id: I796ac4b71ca9b91ec43ac72a02127ed87872f954
Reviewed-on: https://dart-review.googlesource.com/56460
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-05-24 20:50:51 +00:00
Johnni Winther 8504808ce3 Remove Dart 2 errors in package:js_ast
Change-Id: I1684a662bb777e2175cb0f1a6590136ab3ba5cc2
Reviewed-on: https://dart-review.googlesource.com/48580
Reviewed-by: Stephen Adams <sra@google.com>
2018-03-30 11:21:21 +00:00
Stephen Adams 8e8287f4e0 Add classes for instantiations
Change-Id: Iee9df3ad673012776cd1867448ff12ba692a863f
Reviewed-on: https://dart-review.googlesource.com/41564
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-03-03 00:50:59 +00:00
Gary Roumanis 0456f6c95a migrate pkg/js_ast to package:test
Change-Id: I9cf43c37e425b8c6e48a6c24edce888137dc3560
Reviewed-on: https://dart-review.googlesource.com/35463
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Gary Roumanis <grouma@google.com>
2018-01-17 23:35:24 +00:00
Johnni Winther 2a06996361 Fix printer_callback_test
Change-Id: Ib2f71309ae0b5eee1a3c2df757d7f2c3fe77e144
Reviewed-on: https://dart-review.googlesource.com/31121
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2017-12-21 14:30:49 +00:00
Johnni Winther a521c7f255 First step debugging tests.
Change-Id: I8a947999778f851ed38c1a9fb518af00664f19ec
Reviewed-on: https://dart-review.googlesource.com/30740
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-12-21 14:03:51 +00:00
Stephen Adams 72736aff0d Avoid introducing js.Parameters in constructor body
Use the Parameter name in the template so that it is converted into a
VariableUse.

This change fixes some double-counting in the function parameter /
local variable minifier which made the --fast-startup constructors
'miss' using some minified names.

I believe the 'missed' names is a regression.

Saves 50k (0.4%) on one large app.

Change-Id: Ib7597f5c474ef285b082697e368667dbac23931b
Reviewed-on: https://dart-review.googlesource.com/30720
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2017-12-20 06:09:25 +00:00
Kevin Moore 11a1cd5ccc Remove version from unpublished packages
Helps with tooling – and helps avoid accidental publishing

Change-Id: I0aaa029ba737adf9a7eda565a9e620d423427fb0
Reviewed-on: https://dart-review.googlesource.com/30465
Reviewed-by: Jake Macdonald <jakemac@google.com>
2017-12-19 18:26:05 +00:00
Peter von der Ahé 32673d01c5 Add missing type variables to interface
Change-Id: I6c3d07d7b1adf145da54d24081e5238ce3a07624
Reviewed-on: https://dart-review.googlesource.com/28303
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2017-12-12 12:22:37 +00:00
Johnni Winther 9bfef29e21 Add source information to throw/try/await in async and yield in sync*
Change-Id: I8559aaf40c3cb12892113b7373608dc0eed3cb45
Reviewed-on: https://dart-review.googlesource.com/23680
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-11-28 09:56:09 +00:00
Leaf Petersen 4270b99d75 Fix dynamic as bottom uses in front end and dart2js.
Re-enable the dynamic as bottom hint in analysis_options.yaml and fix
the code to be hint clean again.

Fixes #30589
Fixes #30590

Bug:
Change-Id: Idb7910b3ab1c6d931a3ead3eed885d8bd172e621
Reviewed-on: https://dart-review.googlesource.com/17062
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2017-10-30 19:54:26 +00:00
Stephen Adams 26d220445c dart2js-kernel: Handle type variables with names like '#U0'
R=sigmund@google.com

Bug:
Change-Id: I91972d7b0324e0ba7f4969529e203da40923ad55
Reviewed-on: https://dart-review.googlesource.com/5580
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-09-13 23:18:21 +00:00
Johnni Winther 09c5828204 Add EquivalenceVisitor to tools in js_ast
R=sra@google.com

Review-Url: https://codereview.chromium.org/2967843002 .
2017-07-06 10:39:28 +02:00
Johnni Winther 436eefbb33 Add NodeVisitor1 to js_ast
R=sra@google.com

Review-Url: https://codereview.chromium.org/2969873002 .
2017-07-06 10:24:53 +02:00
Erik Corry 029b1cb948 Spelling fixes e to i.
R=kevmoo@google.com
BUG=

Review-Url: https://codereview.chromium.org/2957593002 .
2017-06-24 13:41:39 +02:00
Stephen Adams d15da7d900 dart2js: Capture typedef arguments once
The type Map<T, Foo<Set<T>>> contains one type variable referenced twice,
so there are two inputs into the HTypeInfoExpression instruction.

If Foo is a typedef, T can be reused, e.g.

    typedef E Foo<E>(E a, E b);

As the typedef is expanded (to Function(Set<T>, Set<T>) => Set<T>) it
should not consume additional types from the to-level input.  We
prevent this by capturing the types and using the captured type
expressions inside the typedef expansion.

TODO: We should make the type subexpression Foo<...> be a second
HTypeInfoExpression, with Set<T> as its input (a third
HTypeInfoExpression). This would share all the Set<T> subexpressions
instead of duplicating them. This would require HTypeInfoExpression
inputs to correspond to type variables AND typedefs.

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

Review-Url: https://codereview.chromium.org/2812393003 .
2017-04-13 12:45:32 -07:00
Jacob Richman 11950984e4 Run dartfmt on js_ast
BUG=
R=sra@google.com

Review-Url: https://codereview.chromium.org/2748103010 .
2017-03-15 21:22:40 -07:00
Asger Feldthaus ba582b48b3 dart2js: Distinguish precedence levels for left-hand side and call.
This fixes an issue where `new (f())()` was emitted as `new f()()`.

This in turn fixes some JS interop issues in the CPS backend.

CLOSES #25708

BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1681863003 .
2016-02-09 17:15:00 +01:00
Johnni Winther 1a4ba676ad Add Dart code to diff_view
+ update annotations to make nodes without information more visible
+ add annotation for unused source information
+ use source information from subnodes in variable declarations, assignments and expression statements (a fix triggered by showing unused information)
+ support source information for initial variable declarations
+ new source info is now comparable to the old; need to check source locations before  switch to the new

R=sigmund@google.com

Review URL: https://codereview.chromium.org/1678043003.
2016-02-09 11:25:26 +01:00
Johnni Winther e333e631f3 Base JavaScript code position computation on JavaScript tracer.
Trace computation added in position_information.dart
Diff view tool added in diff_view.dart that utilizes the new computation and show coverage stats.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/1617083002.
2016-01-25 11:17:24 +01:00
Stephen Adams db2d6b798f dart2js: format 'static' sections better.
Unminified: each property goes on a new line.
minified: ignore the isOneLiner directive until a function is seen.

This makes unminified static functions easier to read, and makes minified swarm 0.3% smaller (but almost no different after gzip).

R=sigmund@google.com

Review URL: https://codereview.chromium.org/1548793002 .
2015-12-22 14:45:23 -08:00
Stephen Adams dcf576a428 js_ast: Better escaping of strings in preparation for utf8 file encoding
- Choose between single and double quotes to reduce number of escapes.
- With "uft8: true", leave most characters for the file encoding.
- LINE SEPARATOR and PAGE SEPARATOR must always be \uXXXX encoded.
- Unpaired surrogates must be encoded as \uXXXX.
- Use \xXX rather than \u00XX where possible.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/1520033002 .
2015-12-14 11:33:12 -08:00
Florian Loitsch 74d2846cb5 Don't use ".catch" in dart2js generated code.
"catch" as a property name is legal in most VMs nowadays, but a few implementations still don't like it.

R=sra@google.com

Review URL: https://codereview.chromium.org/1490463003 .
2015-12-01 01:54:37 +01:00
Stephen Adams 2d60a9cf45 js_ast: Avoid precedence issue with negative numbers as receivers at calls
This change makes LiteralNumber and DeferredNumber have a precedence based on the value so that the sign always binds to the number.

An alternative is to change constant generation to built the negation of a positive constant, but this approach does not work for deferred numbers since the sign is unknown at AST generation time.

R=sigmund@google.com

Review URL: https://codereview.chromium.org/1438633002 .
2015-11-10 19:02:05 -08: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
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 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 9a633402a7 dart2js: Support natives in the startup emitter.
R=sigmund@google.com

Review URL: https://codereview.chromium.org//1234623002 .
2015-08-03 17:45:23 +02:00
Stephan Herhut 70edfeeb18 Fix warning in test of js_ast package.
BUG=
TBR=floitsch@google.com

Review URL: https://codereview.chromium.org//1219533007.
2015-07-03 13:28:27 +02:00
Stephan Herhut 9fa33e4e72 dart2js: Implement frequency based naming.
BUG=
R=sra@google.com

Review URL: https://codereview.chromium.org//1212613009.
2015-07-03 13:06:35 +02:00
Johnni Winther 4ed63b6790 Fix multiline problem in printer_callback_test.
BUG=
R=herhut@google.com

Review URL: https://codereview.chromium.org//1224513003.
2015-07-02 13:20:08 +02:00
Johnni Winther 048a4651fe Create and test source mapping for invocations.
BUG=
R=floitsch@google.com

Review URL: https://codereview.chromium.org//1196433002.
2015-07-02 10:38:19 +02:00
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
Stephan Herhut dd41983945 dart2js: Use an abstract Name class for names in the generated JavaScript ast.
BUG=
R=asgerf@google.com, floitsch@google.com, sigurdm@google.com, sra@google.com

Review URL: https://codereview.chromium.org//1198293002.
2015-06-25 09:39:57 +02:00
Stephan Herhut e0e96624b9 dart2js: Use frequency of occurence to sort metadata indices.
BUG=
R=johnniwinther@google.com, karlklose@google.com, sigurdm@google.com, sra@google.com

Review URL: https://codereview.chromium.org//1153243003.
2015-06-11 10:13:32 +02:00
Stephan Herhut 03917ffe4d dart2js: Construct the entire output as a single AST before printing.
BUG=
R=floitsch@google.com, sra@google.com

Review URL: https://codereview.chromium.org//1140703006
2015-05-20 12:31:31 +02:00
herhut@google.com 76694b7cdd dart2js: Use JavaScript asts instead of CodeBuffers when assembling output units.
BUG=
R=johnniwinther@google.com

Review URL: https://codereview.chromium.org//1129333003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45635 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-08 08:57:50 +00:00
floitsch@google.com eb20073478 dart2js: add compiler builtins to the core-runtime.
WIP.

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

Committed: https://code.google.com/p/dart/source/detail?r=45176
Reverted: https://code.google.com/p/dart/source/detail?r=45177

Review URL: https://codereview.chromium.org//954253002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45347 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-22 13:44:39 +00:00
johnniwinther@google.com af8a0dcdca Add SourceInformationFactory.
BUG=
R=floitsch@google.com

Review URL: https://codereview.chromium.org//1100723002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45312 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-21 12:07:51 +00:00
floitsch@google.com a004ca0767 Revert "dart2js: add compiler builtins to the core-runtime."
This reverts commit r45176.

Review URL: https://codereview.chromium.org//1091613003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45177 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-15 19:30:09 +00:00
floitsch@google.com dfbe06beba dart2js: add compiler builtins to the core-runtime.
WIP.

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

Review URL: https://codereview.chromium.org//954253002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45176 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-15 19:17:57 +00:00
johnniwinther@google.com 19efd2cc96 Improve precision of JS printer callbacks (2nd try)
BUG=
R=floitsch@google.com, sra@google.com

Review URL: https://codereview.chromium.org//1081313003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45164 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-15 12:09:15 +00:00
sra@google.com 9b730d6447 Compute default throwing behavior from JavaScript.
This change removes the heuristic that 'general effects imply may-throw behavior', replacing it with explicit throwing behavior.

A new JavaScript AST visitor provides the default throwing behavior.

R=floitsch@google.com

Review URL: https://codereview.chromium.org//1074043003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45070 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-10 16:00:02 +00:00