Commit graph

80 commits

Author SHA1 Message Date
Stephen Adams 2f66afbfb4 [js_ast] dart format --fix
Formatted with `--fix`, followed by some small manual changes:

- Reflowed some comments to 80 columns.
- Replaced Map/Set constructor calls with {} literals.
- Removed type argument when on both sides of initialization.

Change-Id: I3f5d29dd7e144f96a02efa95db8b40bf63484442
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210940
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2021-08-25 03:08:21 +00:00
Mark Zhou 6fef1894cd [dart2js] Realigning source entry boundaries for methods.
Also fixes some minor typos from the initial implementation change.

Change-Id: I6c17ff94009298f6ab4e1d9fbdb88db633ae8aca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/203285
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2021-06-14 18:34:33 +00:00
Mark Zhou b72588aa3e [dart2js] Extending pkg/js_ast to support arrow functions and methods.
* Adds a couple of arrow function and method tests
* Does not add support for method interpolation (like in DDC).

Change-Id: I73ccbbf2907611dae6f1720f7933e3469d4eb9b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198883
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-06-03 00:15:04 +00:00
Stephen Adams acf463616e Redo again "[dart2js/js_ast] Escape strings in the printer"
Patchset 1 is original change.

Change-Id: I19832574012af4a81f6d32c8ea46b196b6f306a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201101
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2021-06-02 02:05:05 +00:00
Stephen Adams 8a1ebec02e [js_ast] Use Set literals
- Increase SDK requirements to allow Set literals
- Fix analyzer errors in test

TBR=fishythefish@google.com

Change-Id: I02fa18b6fc280cf74d6f7da7d2d24ff7dca806f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201082
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-05-22 17:41:09 +00:00
Stephen Adams 43b9fca8df Revert "Redo "[dart2js/js_ast] Escape strings in the printer""
This reverts commit 7817468526.

TBR=fishythefish@google.com

Change-Id: I6d1b4864ea483073f636718ac650d13e1f782d0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201080
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-05-21 22:49:08 +00:00
Stephen Adams 7817468526 Redo "[dart2js/js_ast] Escape strings in the printer"
Fix analyzer diagnostics in js_ast.

- remove unused import
- bump SDK requirements to allow Set literal
- remove unused compareTo method

TBR=fishythefish@google.com

Change-Id: Iabf8d9aeea1d6ceeda1bf85ff7e80914c67c9d63
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200780
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-05-20 05:55:37 +00:00
Stephen Adams 8564caf29a Revert "[dart2js/js_ast] Escape strings in the printer"
Revert while I fix the cbuild errors.

This reverts commit dc92f126e2.

TBR=fishythefish@google.com

Change-Id: I4e3afa19d62bdeecc344bf1a413a2fd3e3a7aca2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200760
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-05-19 23:51:22 +00:00
Stephen Adams dc92f126e2 [dart2js/js_ast] Escape strings in the printer
The old way was for the JavaScript string literals to be pre-escaped.
This was cumbersome since each place that creates a JavaScript string
literal needs to make a decision about whether escaping is needed and
the kind of escaping (UTF8 or ASCII).

This change moves the responsibility for escaping into the js_ast printer.
The escaped text exists only while printing, which reduces the heap in a
large modular compile link scenario by 220MB, since the unescaped string
is in memory anyway.

There were three kinds of escaping - ASCII, UTF8, and 'legacy', if not
specified. This has been reduced to ASCII (default) and UTF8, chosen by
a printer option.


Change-Id: Ic57d8fb70a213d3518244f1a152cd33e54103259
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200400
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2021-05-19 21:32:52 +00:00
Stephen Adams 5a9bfa1195 [dart2js] Remove metadata collection that was used for reflection
Change-Id: If4953135a84583a12fcf1c4b1f0d03cd1ae51f14
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/200321
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-05-19 03:57:35 +00:00
Stephen Adams 823b429d86 [dart2js] js_ast.Name does not need to be Comparable
- js_ast.Name is no longer Comparable
- _NameReference is used on demand rather than for every occurrence.
  This saves 50MB in the big link scenario.
- remove unused asVariableUse() method


Change-Id: I37f55044d394b7e047ca88c527641471bc94c641
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/198981
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2021-05-11 01:53:33 +00:00
Joshua Litt 32e3f78ba4 [js_ast] add DeferredStatement to js ast.
Change-Id: I921eb7638039435711974d4fc40a3b9471a03f7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195172
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-04-15 20:16:27 +00:00
Franklin Yow 03101c0c2b Update LICENSE
Changes to comply to internal review

Closes https://github.com/dart-lang/sdk/pull/45568
https://github.com/dart-lang/sdk/pull/45568

TEST=CL contains no code changes.

No-Try: true
GitOrigin-RevId: 65796784e5fdfddaa021b5c55ad435b1db419700
Change-Id: I085a948f16dc9a0de128ed0bd456ae69adf6c124
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193888
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
2021-04-07 10:28:38 +00:00
Stephen Adams a4956e8f99 [dart2js/js_ast] cleanup: Simplify LiteralExpression
LiteralExpression used to be the mechanism for 'interpolating' the
`JS` pseudo-function, but that long ago was reimplemented via the
js_ast template feature.

There are a few vestigial uses of LiteralExpression, but as none of
them use the `inputs`, this field is removed.

Change-Id: I4cd7c64766a7d6d9dd2c196c134bbfcb536fd2f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178400
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-01-12 01:28:10 +00:00
Lasse R.H. Nielsen 6e29700e16 Update List constructor documentation, deprecate constructor.
Emphasize that the operation is going away,
and mark constructor as deprecated.

TEST= Refactoring+deprecation only, covered by existing tests.

Change-Id: I82aa044cd2cf7bf347b624371399f44bda8f4a07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173261
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2020-12-07 16:20:28 +00:00
Joshua Litt b3d0a3c985 [dart2js] Add a SizeEstimator for js ast.
Change-Id: Id9d6c6ef26b38f5d28e14d51e60f6d3f5418fc33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169800
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2020-11-16 20:18:06 +00:00
Devon Carew d26469f715 update the pubspec.yaml files to reflect actual package usage
Change-Id: I7a46c42dff3506cd5d09d3d793c072258e09a6e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159143
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-08-20 16:08:59 +00:00
Michael Thomsen f0c87e9f21 Clean up no-publish comments in pubspecs
Change-Id: I6cc1ab404de75cd02183b862842198c85b6d9256
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152005
Reviewed-by: Alexander Thomas <athom@google.com>
2020-06-23 10:34:09 +00:00
Stephen Adams a7d95d4755 [dart2js] Defer ground type recipes until assembly
Change-Id: I9f2ba6c0feec1600b3dbbf3828a4954b35608f9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/120621
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2019-10-11 20:12:06 +00:00
Johnni Winther 178cfe6111 Avoid warnings in pkg/js_ast
Change-Id: I883230beeed33878115940982ade5cd6844d26ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/108812
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2019-07-12 15:51:23 +00:00
Stephen Adams c7524cc296 [js_ast] Don't rewrite compound assignments
Bug: 37337
Change-Id: Ibda0d9233d480cc64732e9e17182b55cde77baf2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/107181
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2019-06-24 19:35:07 +00:00
Johnni Winther 09b46aa084 Support in-memory CodegenResult serialization/deserialization
The serialization/deserialization is performed in test-mode.

Change-Id: I90f31a6a88dbdf2c38beb9b5409ce3c52557e227
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102740
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-05-20 08:57:39 +00:00
Johnni Winther 670ac1aca8 Prepare js_ast for more advanced use of DeferredExpression
Change-Id: I008dc7ce21437475c2fa1d5505b42f9d4a4aa166
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/102363
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-05-20 07:46:58 +00:00
Kevin Moore 17a7f513c3 Fix up pubspec for pkg:compiler
Removed unused dependencies
Correctly reference repo packages via dependency_overrides
Fix pubspecs for pkg: js_ast, js_runtime, sdk_library_metadata

Change-Id: I2077814f733c299dca7afe3f5ab4b380c2c886e4
Reviewed-on: https://dart-review.googlesource.com/c/85660
Commit-Queue: Kevin Moore <kevmoo@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-11-29 23:33:39 +00:00
Stephen Adams 8422bf1a80 dart2js experiment: force parens around part file function
Apparently V8 will keep the parse tree and this might reduce startup latency in evaluating the deferred parts.

Change-Id: If8662c7efcc855a9e87779baeeb460108283e681
Reviewed-on: https://dart-review.googlesource.com/c/84882
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2018-11-20 02:56:21 +00:00
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