Commit Graph

32 Commits

Author SHA1 Message Date
Stephen Adams 3ec6a72b93 [dart2js] Cleanup triple-shift flags
Bug: 45335
Change-Id: I4fc2f970884439d9e4f0957dd4f756c13511306a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196560
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-04-24 18:55:12 +00:00
Stephen Adams 7754a868dd [dart2js] Remove static state accessors
Change-Id: I58391845d3e28b041b7bb1746e696610d113ea7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195511
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-04-16 03:43:17 +00:00
William Hesse 0cb6607cf1 [sdk] Bump version to 2.14
TEST=CI presubmit with added tryjobs

Change-Id: I6c4f7de9d3fbe6d1031f6f0161e8ffebcea822a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195062
Commit-Queue: William Hesse <whesse@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2021-04-13 12:47:27 +00:00
Johnni Winther 1eda15854d [cfe] Allow experiments only in current sdk version
Experiments that have not be enabled by default should only be allowed
in the current version of the sdk.

Closes #45460

Change-Id: I159f390ac85fe37943920717ce11a4c817d5b4a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/193480
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-03-31 15:20:08 +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
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 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
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
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 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
Ivan Inozemtsev 7194e888ae Revert submission 181620
Reason for revert: b/179155154
Reverted Changes:
I17bd9d9e0:[dart2js] Refactor closure data to use AST nodes i...
I6578b727d:[dart2js] Remove GlobalsLocalsMap from JClosedWorl...

Change-Id: I6cb48937220d2ed3814002254c0717feebe78a94
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182502
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-03 10:52:38 +00:00
Johnni Winther 51726cf38c [dart2js] Remove GlobalsLocalsMap from JClosedWorld
The removes the GlobalsLocalsMap from JClosedWorld and instead includes
it as a part of GlobalInferenceResults.

Change-Id: I6578b727d1046841e5d18e6a7dedaf4dc657e37d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181620
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-02-02 17:10:29 +00:00
Johnni Winther 706632d994 [cfe] Use isPureExpression to ensure temp variables are not created for this expressions
Closes #44475

Change-Id: Ie5a767448e27d2f84b90ebd0ebe2287d897fcd6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176441
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-12-17 17:57:43 +00:00
Stephen Adams f0be731480 [js_runtime] Faster List.of copying a JSArray
Improved inferrer to handle some cases of JS-fragments.
The JS-fragment to copy the array caused the inferrer to be too
pessimistic about list-tracing into List.of.


Change-Id: I0cb4f7610d971d7927d973bd2b0b532d4cef9a7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173883
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2020-12-02 07:53:47 +00:00
Mayank Patke a2778def75 [dart2js] Use wrapped abstract value domain in test mode.
This should cause no change in behavior, but the layer of indirection
keeps us from assuming that typemasks are the underlying implementation
of the abstract value domain.

Change-Id: I2b51b0da489407de86d5638b2eda9541fdd0276e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171780
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2020-11-12 20:11:50 +00:00
Stephen Adams 8c13fa841e [dart2js] Kernel transformer expansion for List.generate
Simple calls to `List.generate` are expanded into a list allocation
and a loop. This generates better code for several reasons:

 - There is no overhead for the function argument (closure allocation,
   closure type, closure class)

 - Global type inference is more precise since each List.generate list
   is tracked separately, and the assignments in the loop give better
   inference to the collection's element type.

To get precise element type inference, there are two new JSArray
constructors. Global type inference starts with the element type being
bottom for these elements, avoiding spurious nulls in the inferred
type.

Change-Id: I5efb90651ae3f9eb2e81af556704960cdf0b75c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168770
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-11-11 04:27:22 +00:00
Stephen Adams f387d24f68 [js_runtime] List.of improvements
`List.of` avoids per-element checks and no longer forwards to
the more expensive `List.from`.

Global type inference infers `List.of` and `List.from` as new
list allocations.

Bug: 40211
Bug: 32937

Change-Id: I54746610a1b0089ec54e43459301720105f872ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170127
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2020-11-05 01:47:17 +00:00
Stephen Adams ee740fae4a [dart2js] Inference of List.generate elements
Change-Id: I9c13eac75df1016229ca560175b72efd77b3a2d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169257
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-10-28 16:33:15 +00:00
Joshua Litt 043bebcd02 [dart2js] Fixes to dart2js unit tests to support nnbd by default.
Change-Id: I440dddd34a62bfe8c0f3fd563888acb680c2b031
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168141
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-10-20 18:40:44 +00:00
Johnni Winther fc158b1616 [dart2js] Evaluate implicit constants in scope visitor
Change-Id: I2351571a665c8ffff8e9d57649fbf42b483e747b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142983
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2020-09-29 20:13:08 +00:00
Johnni Winther 4025dee2f8 [cfe] Ensure that default values on synthesized constructor are included in outlines
Closes #43538

Change-Id: I58f03d6d71e6de4744003cc28519a20c7e9e7f12
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164787
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-09-29 11:09:14 +00:00
Stephen Adams ec4ccb7051 [dart2js] Update inferrer with current List constructors
Use the 'growable:' argument or its absence to pick a better type for
List.of, List.from, List.generate, List.empty and List.filled.

Fixes a bug where it was assumed that List.filled was always fixed length.

Slightly better type analysis on some apps, but nothing that is measurable on benchmarks.

Change-Id: Ibe029a93488412956273fc981f626d33bd295386
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163132
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2020-09-17 20:37:53 +00:00
Stephen Adams dfc411cb90 [dart2js] global type analysis for unreachable closure calls
The return value of a closure call on `null` or bottom should be
bottom.

Change-Id: I4520a8d6b13575172cf5407b0fbcbaa0b6be5e63
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162384
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2020-09-12 00:05:35 +00:00
Christian Altamirano c026589e69 [dart2js] Added interceptor bits to powerset domain
Change-Id: Ia949732ffd431461eb8dc9f14bf398bc85b71dff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160800
Commit-Queue: Christian Altamirano <coam@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2020-08-29 02:14:13 +00:00
Christian Altamirano d52fd7d0d6 [dart2js] Implemented map that stores powerset bits for classes
Added a ClassInfo struct that stores bits for class, strict subclasses and strict subtypes.
This map is initialized empty and lazily computes the bits using the method computeClassInfo.
This function recursively traverses the class hierarchy only when needed, computes the bits on the fly and stores it.
Since the class hierarchy is a DAG, this recursive method terminates.
This map will also be used for some queries, which are now exercised in the new test

Change-Id: I0b8b0b34b5c7d5cc3c1608266c9795033351e650
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160040
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Christian Altamirano <coam@google.com>
2020-08-26 20:44:05 +00:00
Christian Altamirano 51cd4cb3d6 [dart2js] Implemented constant value query for powerset domain
This fixes the issue with the compiler when the powerset flag is on.
Now the powersetBits test works

Change-Id: I8e63b986a7dafb8937b93303cebe304f79bddabf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159800
Commit-Queue: Christian Altamirano <coam@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2020-08-23 23:21:55 +00:00
Christian Altamirano 42dec58c01 [dart2js] Added powerset bits API and implemented most powerset queries
Change-Id: I3d0940df76e66049f3bd545b1a53dbe6036b4df2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158580
Commit-Queue: Christian Altamirano <coam@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2020-08-21 18:10:00 +00:00
Stephen Adams ae462475f9 [dart2js] Try to preserve precision of bools in inferrer.
Use abstract type of constant for BoolConstantTypeInformation
as the AbstractValueDomain may have something more precise than 'bool'
for a true/false constant.

Evaluate short-circuit `&&` and `||` for constant inputs.
This can occur with named and -Dxxx= defined constants.

TODO: we should consider adding a node like a guarded-phi to
select an input, with possible boolean conversions on inputs.



Change-Id: I7f54503db87f6a6d2034ca59c16b4f1ff69ebbb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159323
Reviewed-by: Christian Altamirano <coam@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-08-20 18:26:59 +00:00
Christian Altamirano d983751b77 [dart2js] Refactor a few methods for type masks
Pass the CommonMasks abstract value domain instead of the JClosedWorld to TypeMask methods that need access to *their* abstract value domain. It is wrong to get the abstract value domain from the JClosedWorld because when we try to wrap abstract values, the abstract value domain in the JClosedWorld is the wrapper domain, not the domain being wrapped.

Change-Id: I5bbd0f4c56abe45714dd0a2657f73ef240efae0e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155640
Commit-Queue: Christian Altamirano <coam@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2020-07-28 17:25:40 +00:00
Mayank Patke 3b67681bcc [dart2js] Clean up (pre-)NNBD unit test configurations.
Change-Id: Ife85aafa90b1b0347fabb6e95f3d6c00c5307cd2
Bug: https://github.com/dart-lang/sdk/issues/42063
Fixes: https://github.com/dart-lang/sdk/issues/42063
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152440
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2020-06-25 18:44:32 +00:00
Stephen Adams acf41746f5 [dart2js] More old-rti cleanup
Change-Id: Ia1bb661a255a9e3ea48b79ff33532d0d66e8e80e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151803
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-06-19 17:49:33 +00:00
Joshua Litt 20faaa5d94 [dart2js] Move dart2js unit tests to pkg/compiler/test.
Change-Id: Ib18f554c1076f27a3f7c0df5a36410da41a1f467
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148784
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-05-28 18:51:11 +00:00