Commit Graph

4698 Commits

Author SHA1 Message Date
Srujan Gaddam 825f56c6aa Revert "[pkg:js] Add errors for JS interop using @Native classes"
This reverts commit bc43d06479.

Reason for revert: Breakage in https://github.com/flutter/flutter/issues/73176

Original change's description:
> [pkg:js] Add errors for JS interop using @Native classes
>
> Closes https://github.com/dart-lang/sdk/issues/44211
>
> - Preprocesses and hashes Native classes defined in the sdk.
> - Adds an error if you use a JS class with the same underlying name
> as a Native class.
> - Adds tests with different namespaces to test for the error.
>
> Change-Id: I649e8b2346de8cc6d11205941a37152ce42104b9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175423
> Reviewed-by: Sigmund Cherem <sigmund@google.com>

TBR=sigmund@google.com,srujzs@google.com,rileyporter@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I4b492015468d41335fc5c9d4952560d303841695
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178260
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2021-01-08 18:55:02 +00:00
Johnni Winther dd5b455a0c [dart2js] Handle super access in mixin declarations
This crashed because the canonical name for the replace procedure
was unbound before all references to it had been loaded, causing
subsequent reads of the canonical name to create reference without
a target.

This broke the flutter web smoke tests.

Change-Id: I6249cfda85ff76b5e2dd31bb0cf8d6312ad50c1d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177861
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-01-07 13:45:18 +00:00
Stephen Adams b4ca18015c [dart2js] Canonicalize empty list to const in FunctionType
This one was somehow missed with the others.

Change-Id: I5d06cedc4d00c3fa5f2390d211389382f64e2fc2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177761
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-01-06 23:21:51 +00:00
Stephen Adams 0ab7c7ec51 [dart2js] InterfaceType tweak
Avoid duplicate empty lists.

Change-Id: Ibad5f4263a5cef8f7086473d9eebc13612323ebb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177040
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-12-30 19:52:10 +00:00
Stephen Adams 969ff148d0 [dart2js] Don't store empty variable map in KernelToLocalsMap
Reduces dart2js heap for link phase of modular compile by ~100MB.

Change-Id: I2037c2010efe055b2564394f091206069a54de5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177220
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-12-30 17:38:40 +00:00
Johnni Winther b4d4316de0 [cfe] Rename stub kinds
ForwardingStub -> AbstractForwardingStub
ForwardingSuperStub -> ConcreteForwardingStub
MixinStub -> AbstractMixinStub
MixinSuperStub -> ConcreteMixinStub

TEST=refactoring

Change-Id: Ice76a41ce8e1071f553ed8fd3ecbb29c97377161
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177129
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-12-29 16:54:55 +00:00
Stephen Adams 9e87100f54 [dart2js] Deserialized JsScopeInfos don't get modified
This means we can replace empty Maps and Sets with constant ones.
This reduces the heap for the link phase of a modular compile by 2.8%

Change-Id: If0b78d4f76f40e8b4628fabbf5fa2b9fa07db8be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177181
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-12-29 12:58:15 +00:00
Johnni Winther 60702d4158 [cfe] Make field assignability immutable
Changes fields to be either mutable or immutable by construction.
This ensure that we don't create setter references for fields that
cannot be assigned to and is a prerequisite for replacing @fields/
@fields= canonical names with @getters/@setters.

TEST=existing expectation tests and verification

Change-Id: I70b9a504ee6f221b7c334ac02620feb0d5f7ae01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176665
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-12-28 16:11:14 +00:00
Johnni Winther 52db62dd65 [cfe] Use MixinSuperStub
This CL adds stub for each concrete mixed in member into mixin
applications. The body of the stub calls the original member via
a super call.

This addition means that resolution of super access now use the
stub and not the original declaration as the target, which means
that it will be correct even when mixed in members are cloned. For
this reason, dart2js no longer needs to perform its own super
member resolution.

When a super call targets a mixin super stub (after cloning) it
can be optimized away by redirecting the call to the `stubTarget`
of the call. This optimization is performed in dart2js.

Since dart2js now uses the correct super target, its runtime
mixin application needs to avoid overriding members already
declared in the mixin application. These members are the
forwarding super stubs which ensure that correct runtime types
when members with covariant parameters are implemented.


Change-Id: Iab71ffcc400aa6a683987bc20b9553a263ebc8e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176526
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-12-25 23:32:17 +00:00
Srujan Gaddam bc43d06479 [pkg:js] Add errors for JS interop using @Native classes
Closes https://github.com/dart-lang/sdk/issues/44211

- Preprocesses and hashes Native classes defined in the sdk.
- Adds an error if you use a JS class with the same underlying name
as a Native class.
- Adds tests with different namespaces to test for the error.

Change-Id: I649e8b2346de8cc6d11205941a37152ce42104b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175423
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-12-24 00:00:46 +00:00
Sigmund Cherem 49f80bbe4c [dart2js]: consolidate native allow list in a single place
Change-Id: If20412797233b2384bf083213aef292dde163db5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176982
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2020-12-23 22:52:46 +00:00
Stephen Adams 65110c3448 [dart2js] Use LinkedHashMap in namer
Memory footprint of a LinkedHashMap is smaller for large maps.

Change-Id: I2230943514eeebd97a690419755d7b310471ea51
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176980
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-12-23 20:48:11 +00:00
Stephen Adams b9a771a66a [dart2js] Use fixed Lists in CodegenResult
0.5% heap reduction in link phase.

Change-Id: I2ed52dfc65e56375222297583d4e3bd97bd98b8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176860
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-12-22 18:16:11 +00:00
Stephen Adams 6acb187d4a [dart2js] Release codegen shard buffers
Change-Id: Iebf3a85920f141cff1595529b55b7cbac240434a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176601
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-12-21 19:44:49 +00:00
Stephen Adams 8a37dcf3d4 [dart2js] Reduce number of ParameterStructures
There are 3271 unique ParameterStructures in a big app.
This change reduces the number of instances from 242681 to 13262.

I'm not sure it is worth a full canonicalizaton, for comparison, there
are ~350k Selectors, fully canonicalized.

Change-Id: Iff99fab2e31adb4c5d829ffc3078de8b3e834389
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176324
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-12-16 21:35:22 +00:00
Johnni Winther e64839cd3f [dart2js] Remove code for creating constructors in unnamed mixin applications
This is now handled by the CFE

Change-Id: I78ae8897408cd7e78998ee9bedba87102f2b4fd8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175481
Auto-Submit: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2020-12-14 19:16:18 +00:00
Johnni Winther 5dbb6e245b [kernel,cfe,ddc] Add new method invocation node to package:kernel
This adds
* InstanceInvocation, DynamicInvocation, FunctionInvocation, and
   LocalFunctionInvocation, EqualsCall, and EqualsNull as a future
   replacement for MethodInvocation.
* InstanceGet, DynamicGet, InstanceTearOff, and FunctionTearOff as a
   future replacement for PropertyGet
* InstanceSet and DynamicSet as a future replacement of PropertySet
* StaticTearOff as an addition to StaticGet

TEST=pkg/front_end/test/binary_md_vm_tags_and_version_test.dart

This CL combines
* https://dart-review.googlesource.com/c/sdk/+/171729
* https://dart-review.googlesource.com/c/sdk/+/172649
* https://dart-review.googlesource.com/c/sdk/+/172650
* https://dart-review.googlesource.com/c/sdk/+/172651

using the initial encoding fo EqualsCall and EqualsNull

Change-Id: I98e020b5f2b405a812663bdcd2c05aba8efa74c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175480
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-12-14 10:55:48 +00:00
Stephen Adams cc3c70159d [dart2js] Convert first argument to main
- When `main` has arguments, use a callMain shim to convert first
  argument passed to `main` to a `List<String>`.

- Make js_runtime/preambles/{d8,jsshell}.js pass command line arguments to
  Dart `main`.

Change-Id: I8c04bbe49366e756cfe84d1c705767e0366ee74c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158373
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-12-11 01:29:28 +00:00
Stephen Adams f0bd30b0ff [dart2js] disambiguate non-minified top-level closure names
In a big app there are a few hundred closures with names like 'closure321'.
These come from the initializer expressions of top-level variables.
Add the field name to these so the are a little more stable.

This is just for unminified closure class names and has no effect on
minified names.

Change-Id: I3fef4a950ef372cd9b53f984540f6197dd2a2f64
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175581
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-12-10 00:36:00 +00:00
Joshua Litt 7d64e39572 [dart2js] Add flag to specify maximum number of deferred code fragments.
Change-Id: Ifd85eb01c0be9de9ebbb157df616ef8765a4d5b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158366
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2020-12-08 21:21:40 +00:00
Joshua Litt 86e598808f [dart2js] Support reading closed world during codegen.
Change-Id: I6dd82cb7744b7053eac2afc2ef5206d176c2da26
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175320
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2020-12-08 17:49:54 +00:00
Lasse Reichstein Holst Nielsen f0ed48196e Undo conversion from List() to [] and List(n) to List.filled(n, null) in comments.
Change-Id: I80b5e335f63e14a80db697e2ac3cbcf4c8d51d6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175253
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2020-12-07 22:10:18 +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
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
Joshua Litt 3a73870244 [dart2js] Add coverage of read/write closed world flags.
Change-Id: I398232c5ed437600669c04910f5a62b6cd225f63
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173400
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2020-11-23 22:07:07 +00:00
Sam Rawlins 462170a86c Remove unused imports with shared prefixes
The analyzer will start reporting these when
https://github.com/dart-lang/sdk/issues/38784 is fixed.

Change-Id: Id7488449e90104eeac65d64095c1ee5a5bfbb469
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172902
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-11-19 18:02:54 +00:00
Johnni Winther 887ab360e5 Revert "[kernel] Ensure that visitors don't implicitly returns null"
This reverts commit 4a3f121341.

The changes broke flutter/engine

TEST=It's a revert!

Change-Id: I1e65e6cfab03795a21a64a96fe3ed72e6ba8ecd9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172760
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-11-18 14:51:30 +00:00
Johnni Winther 4a3f121341 [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: I9f9b318982148d844be9826a5f8c88374a9fc402
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172180
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-11-18 11:54:30 +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
Stephen Adams 82637793bf [dart2js] List.generate tweaks
- Use 'isBoundsSafe' property of `[]=` to avoid a bounds check.
- Accept closures with a block containing a single return statement.

Change-Id: I97db02dae14d926345487e863fdb4a1513ab773b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171804
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2020-11-13 19:04:00 +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 9200e866f2 [dart2js] Remove SsaCheckInserter
Index bounds checks are now added as part of lowering `[]`, `[]=` and
`removeLast()` rather that being added later in a separate pass.

To know when to add checks, new trust/check annotations have been
added:

    @pragma('dart2js:index-bounds:trust')
    @pragma('dart2js:index-bounds:check')

These default according to the `--trust-primitives` command-line
option.

In order to consult the annotations, the enclosing context of the
method call is tracked. This allows annotations to be applied correctly
when several methods with different annotations are inlined.

Change-Id: I22e1acf90b85ad0d100766b85a50095ced9815e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171632
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2020-11-12 19:42:50 +00:00
Johnni Winther 7b89827956 [cfe] Support bit mask for enabling specific late lowerings
TEST=pkg/front_end/testcases/late_lowering/late_lowering_bitmasks.dart

Closes #43993

Change-Id: I47d238dd7cf0ea22983a38bed86e415330070596
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171580
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-11-11 14:06:30 +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 c15faeab88 [dart2js] Use 'isInvariant' property of method calls
The 'isInvariant' property of ir.MethodInvocation nodes allows dart2js
to lower JSArray.add to Array.push in more cases. It is set in the
expansion of List literals.

Change-Id: I6c08ec449e6f7e2b2d839e9faeeff2c338f29e5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171080
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2020-11-10 18:54:04 +00:00
Joshua Litt cfccd80ef7 [dart2js] Break out closed world computation from global inference step.
Change-Id: Id743ad11344e94ebc56f732d5580c33ae8e45e46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169123
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-11-09 21:35:14 +00:00
Dmitry Stefantsov d54e2bb568 [cfe,ddc,dart2js,vm] Add NullType
This CL is the sum of the following 5 CLs:
* https://dart-review.googlesource.com/c/sdk/+/170342/
* https://dart-review.googlesource.com/c/sdk/+/170344/
* https://dart-review.googlesource.com/c/sdk/+/170345/
* https://dart-review.googlesource.com/c/sdk/+/170346/
* https://dart-review.googlesource.com/c/sdk/+/170347/

The reason for landing the 5 CLs as one CL is to prevent potential
troubles with bisecting over the branch because the change is fully
functional only with all 5 CLs.

Closes #40122.

TEST=Verified by changes in .expect files in pkg/vm/.
Bug: https://github.com/dart-lang/sdk/issues/40122
Change-Id: Ib8197802fdc69694387ae47ac990c58b3aaab7a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170689
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-11-06 12:43:52 +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
Johnni Winther d70796bae8 [kernel] Add caching ability to StaticTypeContext
Dart2js is changed to use the caching scheme in preparation for dart2js
to use the static types computed by the CFE instead its own custom
static type computation.

Change-Id: I1d45eda2f67ce4b23d669ec49e476ee357b37fc1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166845
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-10-30 17:55:21 +00:00
Srujan Gaddam 2fd4b4f562 [dart2js, ddc] Emit native null checks in sound mode only
Bug: https://github.com/dart-lang/sdk/issues/42536
Bug: https://github.com/dart-lang/sdk/issues/42535

Since ddc would require a potentially breaking change to emit these
checks in unsound mode without opt-in and it's currently not possible
to emit these checks only in opt-in with dart2js, both are changed
to only emit checks in sound mode. In ddc, calling convention is
changed conditionally on sound mode as well to avoid emitting
unnecessary code in unsound mode.

Change-Id: I42f7bb5a53550f4ee5412fbbbfb6ca533c393e96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169247
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2020-10-28 21:35:45 +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
Srujan Gaddam ed009afc4c [package:js] Add static errors for invalid extends
Bug: https://github.com/dart-lang/sdk/issues/37896

dart2js disallows JS interop classes from extending Dart classes,
and ddc does not work as expected. Dart classes that extends JS
interop classes can't be declared in ddc and throw an error on
usage in dart2js. This CL adds static errors for both cases.

Change-Id: I72001d2e8bec046c0e1ab4c06fed8fcf84ade259
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164840
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2020-10-28 16:04:15 +00:00
Jens Johansen ae5fc78992 [kernel] Remove 'addMember'
Most of the time one already knows at the call site if it's a Field,
a Procedure etc --- so use that instead.

For now I'll leave the corresponding getters that are basically
documented as "don't use" ("[...] for convenience, not efficiency.
Consider manually iterating the members [...]").

Change-Id: Ib732759432c62963e6645f85f6df301c4281df9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168826
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-10-27 11:36:58 +00:00
Riley Porter 520fd2059a [dart2js] Remove unused JS interop check enum.
Change-Id: If8b3fce59277aac42cdb453a1f270d5600581a5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168990
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>
2020-10-23 23:15:42 +00:00
Srujan Gaddam 1c1fef8d68 [dart2js] Add negatable flag for native null assertions
Allows build systems to turn off native null assertions if the
default value ever changes.

Change-Id: I7265b2328e4e8834d8bbe19159fcac7ea916b451
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168763
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-10-23 00:07:21 +00:00
Srujan Gaddam d201c33f69 [ddc, dartj2s] Exclude null checks on non-web native members
Modifies ddc and dart2js logic to only include null-checks on native
members inside the web libraries. Modifies tests to account for this
change.

Change-Id: If9c164fb90b761d3c4611d87ffeb02c2fa884457
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168585
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-10-23 00:07:21 +00:00
Johnni Winther b42f954364 [cfe] Use experiment release version when non-nullable is enabled explicitly
Even when non-nullable is enabled by default, enabling the experiment
explicitly should result in the experiment release version (and not
the experiment enabled version) to be used for opting in.

For this change, the semantics of parseExperimentalFlags was change
to _not_ normalize the flags to a full mapping including default values.
For this reason all uses of such maps are renamed to
'explicitExperimentalFlags'.

Closes #43879

Change-Id: I0d0262e68ec1403549abcfd305ae3a4404fe93e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168654
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-22 06:17:39 +00:00
Stephen Adams ba6a17ab29 [dart2js] Make --benchmarking-x imply --csp
This is a temporary assignment of the meaning of `--benchmarking-x`.

Change-Id: I453aca3fa2782498664aad05f0d637af5e91bd34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168402
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-10-21 17:54:13 +00:00
Stephen Adams d5e790b2b1 [dart2js] Add golden function codegen tests
As with other 'id_equivalence' tests, the information can be generated
via the '-g' flag.

Bug: 43778
Change-Id: I316d539f7575e349dc55ecb564de7b65f0f21575
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167480
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2020-10-14 22:32:38 +00:00
Stephen Adams ee5a1534d3 [dart2js] Fix for List length forwarding
Change-Id: I8bffac06c835aa73eb041661518944d1be9d8385
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167723
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-10-14 22:19:48 +00:00