Commit graph

32 commits

Author SHA1 Message Date
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
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
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
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
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
sigurdm@google.com
25e11e6b29 Fix renaming of exception variables on left-hand-sides.
Also fix compound assignments.

BUG=
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44558 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-18 14:04:41 +00:00
sigurdm@google.com
d95886b484 Make sure to bind a method to its receiver if it is stored in a temporary.
Otherwise `this` is not bound when the temprary is invoked.

BUG=
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44449 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-13 08:21:48 +00:00
johnniwinther@google.com
143b5d31fc Pass SourceInformation through the CPS IR.
BUG=
R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44126 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-02 11:44:37 +00:00
sigurdm@google.com
e66642c6b0 Avoid printing braces for one-statement blocks in js-printer.
BUG=
R=floitsch@google.com

Committed: https://code.google.com/p/dart/source/detail?r=43956

Reverted: https://codereview.chromium.org/954493002/

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44016 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-25 08:38:13 +00:00
sra@google.com
fe756ad5cd Move js_ast library to its own package under pkg
IT IS NECESSARY TO REBUILD AFTER SYNCING TO THIS CL.
Rebuilding creates a needed symlink in out/... for the new js_ast package.

R=floitsch@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44012 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-25 01:27:01 +00:00