Commit Graph

4790 Commits

Author SHA1 Message Date
Joshua Litt fd4eefc22d [dart2js] Move determination of fragments to emitter phase.
Change-Id: I0aaf02a8900445fc76b87de17e21b6488ca2fe46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191240
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2021-03-23 21:55:53 +00:00
Stephen Adams 20bdf38514 [dart2js] Fix variable allocator live-range bug
The controlling condition of a control-flow operator (?:, &&, ||)
needs to have the same live range as the other operands.

Change-Id: Iee999a1b400ef35ccbb761fcd7266952c9a95be9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192605
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-03-23 15:38:36 +00:00
Stephen Adams 93313bf12d [dart2js] Fix stack overflow on optimizing '%'
The back-edge test failed to take into account that a block can have a
back-edge to itself.

Fixed: 45413
Change-Id: Ib623e6baa2c1de6df131fc67462978a042df5a4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192606
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-03-23 15:37:46 +00:00
Johnni Winther 92e237c835 [cfe,dartdevc,dart2js] Use InstanceGetterInvocation for getter/field invocation
The web compilers don't support getter/field invocation encoded as a
FunctionInvocation on an InstanceGet because it doesn't work for
getter/field invocation of js-interop properties, since the InstanceGet
wouldn't result in a Dart function but just JavaScript function.

To support this in the new method invocation encoding, a special
expression, InstanceGetterInvocation, is used to encode getter/field
invocations in dart2js and ddc.

Change-Id: I21da8e8686f66ae4ce4d44245073b9e424f975b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192181
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-03-23 09:49:06 +00:00
Jens Johansen 22551d35c2 [CFE/dart2js] Don't set exit code to 1 in unit tests running analyzer
The testing system - sometimes (see http://dartbug.com/45408) - exits
and turns the bot purple when the exit-code from a test is (e.g.) 1.

This CL removes some instances of having an exit code of 1.

Change-Id: Ic831d151346a28dabe9180e80a8e462af227bf41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192381
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-03-23 08:36:56 +00:00
Joshua Litt 6f6afa4dba [dart2js] Add component detection to deferred fragment merge.
This is to avoid merging unrelated code into language files.

Change-Id: Ief514d0761fbb471a0460c78db35c0a07bf78f6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191800
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-03-22 18:57:24 +00:00
Joshua Litt 51ca2145bb [dart2js] Fix finalization bug in namer_names.dart
Change-Id: I8ad37e67bfee2b8fb022fcffedee74c4c6b19b6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192043
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2021-03-22 18:26:15 +00:00
Johnni Winther d59c8bc4fd [cfe,dart2js] Handle LocalFunctionInvocation in ListFactorySpecializer
The CloneVisitorNotMembers contains a mapping from variables to their
corresponding clones. The ListFactorySpecializer special cased access
to this mapping to support conditional cloning. When dart2js switchted
to used the new method invocation encoding, this left the
LocalFunctionInvocation unhandled, leading to null check error when
local functions where invoked in the closure passed to List.generate.

This CL makes this mapping private and adds getter/setter methods for
lookup and registration. The ListFactorySpecializer now instead overrides
the getter to support conditional cloning instead of handling each use
case.

Bug: b/183083319
Change-Id: I2fd3b79137c51a424f17127b502e6a945c6796a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191901
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-03-18 14:34:33 +00:00
Joshua Litt c5c80648b9 [dart2js] Land accurate compute merging dependency algorithm.
Change-Id: If47a670631c4c4d63b0fd834a01dc30275b416d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191241
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2021-03-17 17:27:44 +00:00
Johnni Winther 12f510fbd1 [dart2js] Use new method invocation encoding
Change-Id: Iab73f25a19fe8718cb68327fef5878d25b735030
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188523
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2021-03-17 17:26:25 +00:00
Sam Rawlins 18bc70b898 Remove unnecessary imports from compiler/test
Bug: https://github.com/dart-lang/sdk/issues/44569
Change-Id: Iacb5553755af38e931431cb5aa4e3495cd34539f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190602
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-03-16 19:44:10 +00:00
Sam Rawlins 766791bb7d Remove unnecessary imports from compiler/lib
Bug: https://github.com/dart-lang/sdk/issues/44569
Change-Id: Iaec46afafca5dece288d4d36640a164eb2458a66
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190601
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-03-16 19:36:39 +00:00
Dmitry Stefantsov 8ddc7465a8 [cfe] Move ExtensionType into pkg/kernel/lib/ast.dart
Change-Id: I2e8231dad00accafb09d1ec88416242d3d5815a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190483
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-03-12 19:02:27 +00:00
Mayank Patke 3c5767ccd3 [dart2js] Ensure RTI need/checks account for instantiations.
If a type variable T is used in an `is` or `as` expression (e.g.
`42 is T` or `42 as T`) or is part of a subtype check, then any types
which may be substituted for T via instantiation must also be treated as
participating in a type check.

This CL ensures that the RTI need computation includes type arguments
for those substituted types and that those types are included in the
list of implicit checks.

Additionally, in order for this to work, this CL fixes a bug in which
the impact transformer was failing to register generic instantiations
occurring in (partial) constants.

Fixes: https://github.com/dart-lang/sdk/issues/45046
Change-Id: I98ae0eca0adcbbb26cdd664318da0da578b289b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190460
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2021-03-12 04:47:59 +00:00
Johnni Winther ab694d352d [dart2js] Handle promotion in inference of locals known to be null
In the inferrer code like `local == null` would use the type information
for the operands to determine whether the call was `o == null` or
`null == o`. This had the side effect that if the left operand was a
local variable known to have value `null` the case would be treated as
`null == o` and the local would not be promoted to non-null on the false
branch.

Change-Id: I5fa08f8c891578f4c8e337e6cf5882fc2383063f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189210
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2021-03-11 10:39:41 +00:00
Stephen Adams 6398fe7b10 [dart2js] Optimizer cleanup: remove unused rtiSubstitution reference
Change-Id: If22af98e68ca0bd79a7cf69423b77c2a6166daaf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190420
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-03-10 19:07:33 +00:00
Sam Rawlins f887834783 compiler: Remove unused system import
Change-Id: I98fc091a7f2a701f3f325543aeecd451120a6ae7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189660
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-03-09 22:08:32 +00:00
Stephen Adams 39aa454e7b [dart2js] Implement int.>>> optimizations
Change-Id: I7d54bc523bb81c5ae8d6fed4ec2e6df473206788
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187340
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2021-03-09 02:20:06 +00:00
Joshua Litt 20475fe5da [dart2js] Add script to start generating better tests for deferred_loading.
Change-Id: Iffe5b7010ad0ada09a9c99246bef6386f255586c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188841
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-03-08 22:54:03 +00:00
Riley Porter 226ecb0e5c Expanded DebugPrinter for StaticInvocation nodes.
Example AST nodes printed for
`print(getProperty(getProperty(o, "list"), "0"));`
https://paste.googleplex.com/4720701811458048

Change-Id: Ieceee38628e10854d40c7b469887b2cc572365dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189380
Reviewed-by: Riley Porter <rileyporter@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>
2021-03-08 20:28:23 +00:00
Johnni Winther 01b0947a6d [kernel] Update kernel encodings
* Add InstanceGetterInvocation for getter/field invocation in web
  backends
* Add localFunction getter to LocalFunctionInvocation
* Remove isNot from EqualsCall and EqualsNull - the encoding didn't
  carry its weight.
* Remove uses of Name.name
* Remove BottomType code from VM

TEST=existing

Change-Id: I99d05d35b9ef193d092cc151c99ad472dbd60834
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188725
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-03-08 11:29:51 +00:00
Riley Porter bfaf674479 Optimize js_util getProperty calls to lowered call to native JS.
No change in the generated JavaScript for dart2js based on both a small
foo.dart sample file and tests/lib/js/js_util/properties_test.dart

All changes in generated JavaScript for DDC are smaller and clearer:
  - foo.dart: https://paste.googleplex.com/4738045023617024
  - properties_test.dart: https://paste.googleplex.com/5107699705446400

Bug: #44533
Change-Id: I670f0226fbef90d05a95c51d918831bea58d6aa3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/187840
Commit-Queue: Riley Porter <rileyporter@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2021-03-06 01:16:24 +00:00
Johnni Winther cdfbac278b [dart2js] Support AssertInitializer in dart2js
Closes #37881

Change-Id: I2606a3cf9bcbc047c58d075585aec01e10e0ea90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189200
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-03-05 09:14:37 +00:00
Johnni Winther fc67a8c955 [dart2js] Handle new method invocation encoding in ssa builder
Change-Id: I382fd8d113ed41c5d01db570fcda0d7f8231b4d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188460
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2021-03-04 17:06:29 +00:00
Johnni Winther f1fb79f73c [dart2js] Handle new method invocation encoding in inferrer
Change-Id: I74b191dcad4c83359688657e9434ff27ea550766
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188280
Reviewed-by: Mayank Patke <fishythefish@google.com>
2021-03-04 17:06:29 +00:00
Johnni Winther af4757dd0b [kernel] Migrate ast_from_binary.dart
TEST=existing tests

Change-Id: Ie6b3baa9233e2f02179d0eaf31224e628436495e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188282
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-03-02 12:11:12 +00:00
Joshua Litt dcd5735345 [dart2js] Create cycle-free trivial merge algorithm.
Change-Id: I20c8a5741121ceecee0520adffdc2f51d6f1c291
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188360
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-03-02 00:10:50 +00:00
Johnni Winther 6a43d6e32d [dart2js] Support new method invocation in ScopeModelBuilder, InlineWeeder and _TreeNodeIndexerVisitor
Change-Id: I64ecfaa8d5746c2b0189eb7f46cfa22bbf3bc914
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186285
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2021-02-26 12:25:47 +00:00
Stephen Adams 25ca4c490f [dart2js] Use StringInterner to share strings from binary files
Reduces heap in large link scenario by 850MB.

Change-Id: I9dd8c82868b4cc45e6389007348d8b6086c28ee1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186745
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-24 20:48:34 +00:00
Dmitry Stefantsov c191551fac [cfe] Remove BottomType
TEST=Covered by existing tests.

Change-Id: Ied8be1874164e68e0a3a48e1b2f9a33310071381
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183009
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-24 13:21:55 +00:00
Jens Johansen a200aa509c [dart2js] Return (almost) const [] when reading empty List<ir.DartType>
When running dart2js in its "linker scenario" on a large internal app
this saves something along the lines of 70MB of memory.

Note: Does not actually return a const object as that might introduce
polymorphism. See CL review for discussion/explanation.

Change-Id: I9f939a57d994139f0c08caab0871361c5ecd437a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185828
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-02-24 07:53:57 +00:00
Johnni Winther 9a74bcef97 [dart2js] Support new method invocation encoding in static type visitor
This is the first part of using the new encodings of MethodInvocation,
PropertyGet and PropertySet in dart2js. In this CL the new visitors
are implemented in static_type.dart. This change is done by refactoring
the existing implementation into helpers and new registration methods
that can be used by both the old and the new encoding but lends itself
to take advance of the new encoding. The new encoding is not enabled
until all of dart2js has been migrated to the new encoding. The
refactoring is intentionally not changing the outcome of the
static_type.dart to make it easier to detect accidental regressions
introduced by the migration.

Change-Id: I93d2033969c33d4c7a5957ad7a6c0b1cdf47fe6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184220
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2021-02-22 10:12:08 +00:00
Jens Johansen 433d59b917 [kernel] Add option to dill loader for not using growable lists; use in dart2js
Most lists created when loading a dill file are growable.
That's not always needed, though, and a non-growable list is more compact than
a growable one.

When running dart2js in its "linker scenario" on a large internal app
this saves something along the lines of 90MB of memory.

Change-Id: I113a73ed150efb56a5172ac7e1daf1d28f4bc188
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185825
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-02-22 09:31:08 +00:00
Johnni Winther bfee879e19 [dart2js] Add tests for bug in dart2js type promotion
Dart2js type promotion wrongfully uses the type promotion result of
the last argument of an invocation as the result of the invocation
itself.

Change-Id: I188514fdac4edbea24dffbd858c0f8be6cd6ccf0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185781
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-02-22 08:56:18 +00:00
Joshua Litt 4dabdbd028 [dart2js] Create flag to dump the graph shape.
Change-Id: I4b9658985e9dcd1d30172aca1363db515463f601
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185260
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-02-18 23:58:20 +00:00
Johnni Winther 8467186ca0 [kernel] Initial migration of package kernel wave 1
This CL completes the migration of the first wave of
interdependent libraries in package:kernel, including ast.dart.

In order to ensure non-nullability on AST properties, the Transformer
has been split in 2 variants: Transformer which doesn't support
removal of nodes and RemovingTransformer which supports removal where
allowed by the context using 'removal sentinels'.

Start reviewing Transformer and RemovingTransformer in visitors.dart
since many of the changes are caused by the changes here.

Included in the migration are the mixin_deduplication.dart and
unreachable_code_elimination.dart since these needed porting to
the RemovingTransformer which was aided by opting in the libraries
which only depended on ast.dart.

TEST=existing

Change-Id: I9e63b985bd24896c25edd4ee51e37770187bcc17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184786
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-18 16:01:17 +00:00
Jens Johansen f169abcee0 [CFE] Make standard filesystem more synchronous by default; add async versions
This CL:
 * Makes the standard filesystem more synchronous by default.
   This makes reading files for normal compiles faster.
 * Adds a more asynchronous version of `exists` and `readAsBytes`.
   This potentially allows for reading files faster when in a context
   where the files can actually be read in parallel. The client have
   to make the choise though.
 * Skips `Uri.base.resolveUri` when the uri has a scheme. This makes it
   slightly faster in my tests, but does not remove any `.` and `..`.
   Having those when having a scheme seems sort of weird though.
   If this turns out to be a problem we can add it back.
 * Re-orders what the standard filesystem checks in `exists` to assume files
   which seems more likely to happen. This - for files - means less checks
   and should make checking for existance faster. (This was noticed by Siggi).

Using the same measurement procedure as in
https://dart-review.googlesource.com/c/sdk/+/85442
timing how long fasta spends on *reading* files when compiling dart2js
(when compiling via the VM) I get a good speedup.

Note that the measurements are in microseconds:

Before this CL (run like `out/ReleaseX64/dart pkg/compiler/bin/dart2js.dart 2>&1 | grep "Read file (total)" | tail -n 1` 10 times):
Read file (total): 94678
Read file (total): 94232
Read file (total): 91726
Read file (total): 77472
Read file (total): 95582
Read file (total): 88113
Read file (total): 89245
Read file (total): 91575
Read file (total): 96291
Read file (total): 95730

With this CL (run like `out/ReleaseX64/dart pkg/compiler/bin/dart2js.dart 2>&1 | grep "Read file (total)" | tail -n 1` 10 times):
Read file (total): 68379
Read file (total): 69320
Read file (total): 72930
Read file (total): 69692
Read file (total): 68685
Read file (total): 73548
Read file (total): 64649
Read file (total): 71951
Read file (total): 73486
Read file (total): 70621

Difference at 95.0% confidence
        -21138.3 +/- 4193
        -23.111% +/- 4.5843%
        (Student's t, pooled s = 4462.56)


Furthermore, using an internal benchmark (discussed in an email thread)
I get these numbers (note that the measurements are in milliseconds):

before:
4453
4249
4187
4190
4216

after:
2310
2379
2449
2467
2407

Difference at 95.0% confidence
        -1856.6 +/- 131.443
        -43.5924% +/- 3.08625%
        (Student's t, pooled s = 90.1257)

Using the asynchronous versions of exists and readAsBytes and checking for
existance and reading in parallel on the same internal benchmark it gets to
1137
1185
1067
1089
1189


For completion, comparing to using "raw" `File` (again using the internal benchmark):

sequential standard
2377
2419
2485
2373
2431

sequential io_sync
2279
2182
2237
2312
2324

io_sync faster:
        -150.2 +/- 76.3122
        -6.21432% +/- 3.15731%
        (Student's t, pooled s = 52.3245)

sequential standardasync
4865
4915
4753
5185
4760

sequential io_async
4746
4834
4989
4840
4891

No difference proven at 95.0% confidence

parallel standard
2526
2563
2652
2616
2685

parallel io_sync
2335
2184
2244
2341
2401

io_async faster
Difference at 95.0% confidence
        -307.4 +/- 111.037
        -11.785% +/- 4.25691%
        (Student's t, pooled s = 76.1341)

parallel standardasync
1137
1185
1067
1089
1189

parallel io_async
1105
1088
1145
1048
1113

No difference proven at 95.0% confidence

TEST=Existing tests.

Change-Id: I8ba56ab0768df8672bcdb693782d3f1eec86b683
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185101
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Gary Roumanis <grouma@google.com>
2021-02-17 10:28:00 +00:00
Lasse R.H. Nielsen d352bc28b8 Remove (most) uses of the "non-nullable" experiment flag.
Since the flag is now enabled by default, there should be no mention of it.
There are still some uses in front_end/testcases that are not just removable
(it also uses `no-non-nullable`). There migth be more uses that are not
as easily found as grepping for `--enable-experiment

Removes two VM tests where fixing them meant they were just duplicating
the corresponding non *_2/ tests.
Fixes #44941

TEST= Large number of tests chaged.=(no-)?non-nullable`.

Change-Id: Ief755981ccde9a5482fcdf408c2929c74433a710
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183688
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-02-12 17:16:54 +00:00
Johnni Winther ee0c0bcd57 Reland "[kernel] Ensure that visitors don't implicitly returns null"
This is in preparation to migrate package:kernel to null safety.
For the visitor interfaces to support non-nullable return types, the
implementations must avoid using `null` as return value in its base case.

TEST=Refactoring

Change-Id: Ie8fa5d41b99850d9e4abb59634c72920c64128d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183691
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-02-10 07:51:52 +00:00
Stephen Adams cb06d6c86a [dart2js] Rename JSDouble to JSNumNotInt
JSDouble was really "double *excluding integral values*".
This was confusing, with JSDouble sometimes used assuming it was all doubles.
Rename JSDouble to JSNumNotInt to avoid future errors like #44818

Change-Id: I96bf33d5531b94aaf33b582e584702f47ed50395
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183201
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-02-09 17:51:07 +00:00
Johnni Winther b60e0aa5a1 Revert "[kernel] Ensure that visitors don't implicitly returns null"
This reverts commit ce81216885.

Reason for revert: Flutter dependency

Original change's description:
> [kernel] Ensure that visitors don't implicitly returns `null`
>
> This is in preparation to migrate package:kernel to null safety.
> For the visitor interfaces to support non-nullable return types, the
> implementations must avoid using `null` as return value in its base case.
>
> TEST=Refactoring
>
> Change-Id: Ie5e4153f8d3779d94957bb13b3d2d2a942040ff2
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179760
> Commit-Queue: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Jens Johansen <jensj@google.com>

TBR=jensj@google.com,johnniwinther@google.com

Change-Id: I61b838d3371e6b1de2427716d056324c120be499
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183689
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-02-09 12:41:12 +00:00
Johnni Winther ce81216885 [kernel] Ensure that visitors don't implicitly returns null
This is in preparation to migrate package:kernel to null safety.
For the visitor interfaces to support non-nullable return types, the
implementations must avoid using `null` as return value in its base case.

TEST=Refactoring

Change-Id: Ie5e4153f8d3779d94957bb13b3d2d2a942040ff2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179760
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-09 09:46:46 +00:00
Mayank Patke c0dd78ccd7 [dart2js] Ensure type arguments are propagated to call methods that
need them.

Change-Id: I8ccf9d782675c790376dac95bf7f35a174544791
Fixes: https://github.com/dart-lang/sdk/issues/41449
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182640
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-02-08 23:23:34 +00:00
Stephen Adams 08f90cad84 [dart2js] Use 'num(ber)' wherever possible instead of 'double'
JSDouble represents doubles that are not integers. It is usually wrong
to use JSDouble, so use JSNumber instead where we mean 'all double
values'.

This fixes #44818 by not mistakenly pretending that division cannot
have an integral result.

Will follow up with a CL to rename JSDouble.

Fixed: 44818
Change-Id: Ic324df2ee1f2c7434bc0b064c0dbd7b6800ad93b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183360
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-02-08 22:06:54 +00:00
Dmitry Stefantsov 63737581f8 [cfe] Encourage the use of the const NeverType objects
TEST=Covered by existing test base.
Change-Id: Ie858bd5a765d71fa4095eab3373a6ecdb063b260
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183006
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-08 10:36:40 +00:00
Johnni Winther 531a3a4ffd Reland [dart2js] Remove GlobalsLocalsMap from JClosedWorld
The removes the GlobalsLocalsMap from JClosedWorld and instead includes
it as a part of GlobalInferenceResults.

Previously landed in https://dart-review.googlesource.com/c/sdk/+/181620
but reverted.

Change-Id: I384b21bf285009c82ca9ec8740443cda0a6fa493
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183001
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-02-06 08:11:16 +00:00
Johnni Winther 6849d737a6 Reland: [dart2js] Refactor closure data to use AST nodes instead of locals
This CL avoids creating locals using KernelToLocalsMap when computing
closure data for the J-model. Instead the closure data uses
ir.VariableDeclaration, JTypeVariable, and internal locals (ThisLocal
and BoxLocal) internally, and the accessor function require passes
a KernelToLocalsMap to convert the internal model to a Locals upon use.
The converted Locals are cached internal for performance only.

This prepares for splitting the GlobalLocalsMap and KernelToLocalsMap
from the JClosedWorld.

Previously landed in https://dart-review.googlesource.com/c/sdk/+/180820
but reverted.

Change-Id: Ic6a2ab63de7cb31c89dd50ca2af3f205a792fd74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183000
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-02-06 08:11:16 +00:00
Ben Konyi 848121e6d4 Reland "[ CLI ] Improved consistency of -D and --define across tools and commands"
- Added support for --define to the VM and dart2js
- Added support for -D and --define for `dart run` and `dart compile js`

Remaining improvements:
- Add support for providing multiple comma separated values for `dart
  run`, `dart`, and `dart2js`

Related issue: https://github.com/dart-lang/sdk/issues/44562

TEST=Updated CLI tests and added new dart2js tests.

This reverts commit e49937769f.

Change-Id: I5f9275b829665eb5e8695403d67f230e752ab0e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183180
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-02-05 23:53:28 +00:00
Johnni Winther b66bab009c [dart2js] Ensure that the class member environment for [node] is computed for live members
This CL ensures that the member environment for the enclosing class
of a live member is computed.

Static members and mixed in members a member can be become live
through static access and mixin application, respectively, which does
not require lookup into the class members.

Since the J-model class environment is computed from the K-model
environment, not ensuring the computation of the class members, can
result in a live member being present in the J-model but unavailable
when queried as a member of its enclosing class.

Closes #44754

Change-Id: I5a735f4605737947cca082450803c35887b0b7a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181801
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-02-05 09:27:52 +00:00
Sigmund Cherem 912005267d [web] rename suite dart2js -> web.
Change-Id: I46be49b2effec3e38a3dc44cd45cfe736f77fa78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182680
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-02-04 23:11:32 +00:00