Commit graph

9431 commits

Author SHA1 Message Date
Ben Konyi 1960d21144 [ VM / DartDev ] Updated build rules for DartDev and exposed create_platform_sdk build target
- DartDev will now be rebuilt when changes in DDS are made
- Building the `create_platform_sdk` target will build all non-web
components of the Dart SDK, allowing for shorter build times when not
developing web tooling.

Change-Id: I605df4893e93010ba0c0bab0593fb840f1859c07
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147807
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-05-12 23:37:19 +00:00
Aske Simon Christensen 78df4ac452 Write UTF-8 decoded characters directly into the result strings.
Gives good speedups, especially for short strings. Average speedup for
the TwoByteString cases were measured to:

Length  IA32JIT X64JIT ARMv7JIT ARMv8JIT X64AOT ARMv7AOT ARMv8AOT
10         152%   402%     120%     102%   148%     106%     118%
10k         46%   223%      14%      13%    72%      49%      65%

Closes https://github.com/dart-lang/sdk/issues/41704

Change-Id: I31f716f6582e6fa8e33421e6874e852a3a3362e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146785
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-05-12 17:33:50 +00:00
Aske Simon Christensen 14103a366d [vm] Add _allocate and _setAt methods to _TwoByteString.
Also base these and the corresponding methods in _OneByteString on
functions in dart:_internal, so they can be used in other patches.

Change-Id: Ibced31758db2959c111a01cdaa46df2971ae4a6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146784
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-05-12 17:33:50 +00:00
Srujan Gaddam 0afd7a6907 [dart:html] Unsuppress MediaDevices.getUserMedia
Bug: https://github.com/dart-lang/sdk/issues/35253

This API was suppressed initially due to issues with conversions
between promises and futures. Now that that has been resolved, this
should be unsuppressed. Tests have been refactored to use both
navigator.getUserMedia and navigator.mediaDevices.getUserMedia.

Change-Id: Ia131b303192c7eaa3f08475cf700a53665ab3584
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147640
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2020-05-12 16:59:49 +00:00
Zichang Guo 9a60982089 [dart:io] serialize UnmodifiableListView to Uint8List for file write
Bug: https://github.com/dart-lang/sdk/issues/41029
Change-Id: I5902f01a22787922439f0918b6e845eb004b8984
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139881
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2020-05-12 00:19:01 +00:00
Martin Kustermann 57e54cdd31 [vm/isolate] Prefer .dart_tool/package_config.json over .packages
Flutter has migrated away from using the discontinued
`package:package_resolver`, see [0], which should allow us to prefer the new
`.dart_tool/package_config.json` format now.

[0] https://github.com/flutter/flutter/issues/56289

Closes https://github.com/dart-lang/sdk/issues/41748

Change-Id: I9026af05756d01f4a3e0e0fc97fa77d27bf805b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146840
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-05-11 17:32:07 +00:00
Stephen Adams 1924d64351 [corelib] Fix for BigInt.toDouble() crash
Bug: 41819
Change-Id: Ied24b42728e1da0d713fe971386d4ef6a023333e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147349
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-05-09 00:22:16 +00:00
Regis Crelier eae248cc41 [VM/compiler] Emit a throw NoSuchMethodError for bad arity rather than aborting compilation.
The bad arity maybe detected after an isolate reload or when using strong mode with a mix of opted in and opted out libraries.
The thrown NoSuchMethodError contains enough information to be useful, but does not mirror the complete invocation (e.g. arguments).

This CL does not fix https://github.com/dart-lang/sdk/issues/37517 where the target is missing after a reload (not just bad arity).

The VM implementation of NoSuchMethodError is cleaned up, but the deprecated constructor 'NoSuchMethodError(...)' is not yet removed, since it is still documented.

Change-Id: I0306971c59cb510d21cb1b1acc3545c8817dfea7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146986
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2020-05-08 18:08:26 +00:00
Martin Kustermann 8d1c4c555c [vm/concurrency] Add various tests for lightweight AOT isolates
To enable our tests to spawn a new isolate in a new group, this CL
adds a `{bool newIsolateGroup}` parameter to the internal
`Isolate._spawnFunction` native and moves that native to
`dart:_internal`, thereby allowing runtime/tests/vm/dart/* to access it.

It also adds various tests for lightweight AOT isolates, exercising
GC, communication, spawning, ...

Issue https://github.com/dart-lang/sdk/issues/36097

Change-Id: I3940c30fb43d2475c58e6be78507da74ce64b60d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145941
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-05-06 12:37:52 +00:00
Srujan Gaddam efdb1c5cd6 [dart:html] Use 'null' when html is null
createContextualFragment accepts a non-nullable string, so if html
is null, it's called with 'null'.

Change-Id: If11a4c397c939017f501707130385d967ee05910
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146691
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2020-05-06 02:18:12 +00:00
Clement Skau 2359f4dc68 [VM] Reworked: Remove unnecessary Closure.clone() from sync*.
Removes the Closure.clone() in sync* by adding an additional closure
around the rewritten sync* function body.

This is a re-worked version of the now reverted:
- https://dart-review.googlesource.com/c/sdk/+/136190
- https://dart-review.googlesource.com/c/sdk/+/144948

This CL includes changes from both the above CLs, in addition to:
- A new 'ShadowRewriter' transformer to do deep rewriting of
  shadowed parameters.
  Previous versions only rewrote the immediate sync* function, missing
  references in nested rewritten functions.

Note: This CL is re-landing largely unchanged since the roll-blocking
issues suspected to be caused by this was later attributed to a
different set of changes.
I have independently re-run all failing external tests to verify
them passing for this CL.

Bug: https://github.com/dart-lang/sdk/issues/37753
Change-Id: Id1670a93961180e8558d7c7eca65fe7e9115f07b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145402
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-05-05 12:04:03 +00:00
Lasse Reichstein Holst Nielsen 2ca3555c44 Allow NoSuchMethodError.withInvocation to accept any Invocation.
Currently the VM only accepts an `_InvocationMirror` instance, not a user created `Invocation`.

Fixes #33124

Bug: http://dartbug.com/33124
Change-Id: Ifdc95861cbe632bc317ca8d9fb92cf0d3ae600f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140100
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2020-05-05 08:10:13 +00:00
Zichang Guo 94498c503c [dart:io] Remove unused fields in socket_patch
Change-Id: Id509738f729324127e3ce8cb17848203d6a4e47a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146160
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2020-05-05 07:03:43 +00:00
Ben Konyi 9cfe19d38b [ VM / Service ] Remove _spawnUri RPC from VM service
This code doesn't appear to be used anywhere in the Dart SDK or Flutter.

Fixes https://github.com/dart-lang/sdk/issues/41751

Change-Id: Iad8537f3187caa7b2304ee2ec2aaaa8b6ba2b35c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146480
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-05-05 00:47:37 +00:00
Martin Kustermann a94b8ae45d Reland "[vm] Make VM support .dart_tool/package_config.json"
This relands the following CLs

    [vm] Make VM support .dart_tool/package_config.json
    https://dart-review.googlesource.com/c/sdk/+/145462

    [vm] Make Isolate.resolveUri() work for both `.packages` and `dart_tool/package_config.json`
    https://dart-review.googlesource.com/c/sdk/+/145803

    [vm] Skip (newly enabled) isolate tests on simarm* and hot-reload configs
    https://dart-review.googlesource.com/c/sdk/+/145861

    [vm] Remove ../0 postfix from status file entries (test framework does not recognize those multitests)
    https://dart-review.googlesource.com/c/sdk/+/145940

    [vm] - Fix hang when no package config or .packages exist
    https://dart-review.googlesource.com/c/sdk/+/145661

The only change (extra patchset) is to let VM prefer the old/legacy
".packages" format and only use the newer
".dart_tool/package_config.json" if we failed to find a ".packages".

Closes https://github.com/dart-lang/sdk/issues/41739
Closes https://github.com/dart-lang/sdk/issues/41649

Change-Id: I220f808540e6e521d985ae763968f64dbf57fe67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145942
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-05-04 14:51:14 +00:00
Aske Simon Christensen 07d508b45f Adjust JSON encoding and decoding to the WHATWG standard.
This brings JSON encoding and decoding in line with the UTF-8 changes
described at https://github.com/dart-lang/sdk/issues/41100

The fused UTF-8 / JSON decoder for the VM now uses the new UTF-8 decoder
instead of its own, separate UTF-8 decoder.

The JSON encoder now escapes lone surrogates, so it can encode JSON
string values containing lone surrogates while keeping its output valid
UTF-8.

Change-Id: Ie4d4601cf84012068849e64d4670f2dcd49ea088
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144286
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-05-04 10:48:32 +00:00
Aske Simon Christensen fa2fd41166 UTF-8 decoder using a state machine.
Two-pass decoder: the first pass scans through the input to compute
the length of the resulting string and which decoder to use, and the
second pass does the actual decoding.

The same decoder is used for both one-shot and chunked decoding, and
both with and without allowMalformed. If there is an error in the input
and allowMalformed is true, it starts over with a general decoder that
supports malformed input and allocates space as it goes along.

JS targets go directly to the general decoder, as the two-pass approach
is not beneficial here.

Three pieces of the decoder are designed to be pluggable by patches to
optimize the performance further:
- scan, running the first pass of the conversion.
- decode8, decoding Latin1 data into a OneByteString.
- decode16, decoding arbitrary data into a TwoByteString.

Improves decoding speed, especially for complex input (many multi-byte
characters). Observed speed increases are approximately:
 - dart2js: up to 40%
 - VM JIT:  up to 260%
 - VM AOT:  up to 130%

The constant overhead of calling the UTF-8 decoder is also significantly
reduced for dart2js.

Code size for dart2js is slightly reduced compared to the old decoder.

ASCII inputs currently see a slight speed decrease for VM targets, which
will be fixed in https://dart-review.googlesource.com/c/sdk/+/145460

This is part of the implementation of the breaking change described at
https://github.com/dart-lang/sdk/issues/41100

Closes https://github.com/dart-lang/sdk/issues/28832
Closes https://github.com/dart-lang/sdk/issues/31954

Ideas for further improvements to the decoder are collected in
https://github.com/dart-lang/sdk/issues/41734

Change-Id: I3c5bb84e8d6783231680a9d34d6c38e8a28ab112
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142025
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-05-04 10:48:32 +00:00
Aske Simon Christensen f372084f82 Encode lone surrogates as replacement character.
This implements the encoding part of the breaking change described at
https://github.com/dart-lang/sdk/issues/41100

Change-Id: I22f2ffc24efc783a2199f640690a85c70a85e7d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143818
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-05-04 10:48:32 +00:00
asiva 170d047b20 The rolls of Dart into Flutter have been failing for more than a day now.
We have accumulated almost 69 commits. Please see issue
https://github.com/dart-lang/sdk/issues/41739
for details of why these CLs had to be reverted.

Revert "Reland "[vm] Make VM support .dart_tool/package_config.json""
This reverts commit fa6cc57a32.

Revert "[VM] - Fix hang when no package config or .packages exist"
This reverts commit 31be795457.

Revert "[vm/isolate] Make Isolate.resolveUri() work for both `.packages` and `dart_tool/package_config.json`"
This reverts commit a99f7aef6e.

Revert "[vm] Skip (newly enabled) isolate tests on simarm* and hot-reload configs"
This reverts commit 7082e99c28.

Revert "[vm] Remove ../0 postfix from status file entries (test framework does not recognize those multitests)"
This reverts commit 708468684a.

Change-Id: Id6b951bde4f379fdcfac3cc23e0057a77a7e6db0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146041
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2020-05-01 22:11:55 +00:00
Martin Kustermann a99f7aef6e [vm/isolate] Make Isolate.resolveUri() work for both .packages and dart_tool/package_config.json
Change-Id: I0f923e65f6bb00def2f96704bc51aa751d55ce7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145803
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-05-01 14:13:01 +00:00
asiva 31be795457 [VM] - Fix hang when no package config or .packages exist
When package config or .packages file is missing and a test is
run the VM goes into an infinite loop in _findPackagesConfiguration

Change-Id: Ic920a401cbbac73bcffcac68ab358fb6246ff8c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145661
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2020-04-30 22:03:02 +00:00
Nate Bosch 9b34bee90b Add InternetAddress.tryParse
Closes #40692

Allows a better pattern for parsing user input than catching an
`ArgumentError`.

- Add a new static method to InternetAddress and implement it in all
  patch files.
- Add tests which match the tests for the constructor.

Change-Id: Idc76fc4875578f7a381219c0e7e12d1931d98fd8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136406
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Auto-Submit: Nate Bosch <nbosch@google.com>
2020-04-30 17:19:02 +00:00
Mark Zhou 52f9744c3a [dart2js] Adding support for required named arguments with Function.apply.
Change-Id: I60f7058144924e7c73cff8d885f2ec82fc71857c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144303
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2020-04-30 16:53:32 +00:00
Mark Zhou b4582d25d9 [dart2js] Adding support for required named parameters.
Supercedes previous work here: https://dart-review.googlesource.com/c/sdk/+/128849

Change overview:

* In legacy mode, the isRequired flag for parameters in the kernel IR is treated as false (though this bool is still processed during serialization).

* Adds a Set<String> to the element model to represent required-ness. All named parameters are still stored in a single "bag".

* ParameterStructure objects additionally emit/ingest all required named parameters as well during serialization.

* A bool indicating whether or not a parameter is required is emitted after each named parameter when serializing FunctionTypes.

* JS identifiers for functions with required named parameters now emit '$req' before each required named parameter. E.g., dynamic_Function_String_$named_p0_int_$req_p1_int for dynamic Function({int p0, required int p1}).

* Recipes now indicate required named parameters with '!' instead of ':'. E.g., @(int,{p0:int,p1!int}) if p1 is required and p0 is optional.

* A requiredNamedSeparator was added to the shared recipes to accommodate the above.

* The RTI now represents named function parameters as a repeating list of triplets (name/bool/type). This adds a bit of overhead to our parser but makes subtype checks simpler.

* Does NOT include changes to Function.apply + auxiliary information attached to closures. These will be added in a later patch.

Fixes #39730
Change-Id: I9c9eaac28da0d63bb16bdb439f021f1470539563
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141204
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2020-04-30 16:53:32 +00:00
Stephen Adams ef1528aa78 [js_runtime] Never is a bottom in legacy mode
Opt-in code can have Never types even with legacy subtyping.

Bug: 41675

Change-Id: I6dbdc064dceeedf0774d10faaca336561b41b7d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145561
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2020-04-30 01:41:02 +00:00
Mayank Patke 94c81a137b [dart2js] Remove redundant check for Object when printing bounds.
Change-Id: I7e8190ac9d0095cf1bb225f94184eceba00ba887
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145308
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2020-04-30 00:36:28 +00:00
Martin Kustermann fa6cc57a32 Reland "[vm] Make VM support .dart_tool/package_config.json"
This CL makes the VM add support for .dart_tool/package_config.json via
  * the --packages=<file> command line parameter
  * the `packageConfig: <file>` parameter to `Isolate.spawnUri`

It also allows now `package:*` uris being used in `Isolate.spawnUri`

The CL also removes the unused `packageRoot` parameter from the Dart to
C++ interface as well as in various places in C++.

The CL also aligns the implementations between sdk and sdk_nnbd more.

Issue https://github.com/dart-lang/sdk/issues/41649
Issue https://github.com/dart-lang/sdk/issues/41245
Issue https://github.com/dart-lang/sdk/issues/41246

Change-Id: I0a7aa3040332abafa19bf80bdbd8a8f8594cc6fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145462
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-04-29 19:05:26 +00:00
Zichang Guo 64c9984ecf [dart:io] Fix HTTP parser not decoding header values as Latin-1.
This change reverts an accidental breaking change in 6a5b87f where the
HTTP parser rejects characters in HTTP header values that it wouldn't
send itself.

This change restores the previous behavior of decoding these characters
as Latin-1.

Fixes https://github.com/dart-lang/sdk/issues/41688
Change-Id: I02bae07b5721eb4cbec789ad912c7fe6e2b2b015
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145244
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
2020-04-29 12:58:53 +00:00
Clement Skau 12a5c93d4a Revert "Reland "[VM] Remove unnecessary Closure.clone() from sync*.""
This reverts commit 1bf25798fa.

Reason for revert: Rolling back as it breaks more external targets and is currently blocking rolls.

Original change's description:
> Reland "[VM] Remove unnecessary Closure.clone() from sync*."
> 
> This reverts commit 430c75b5fa.
> 
> Reason for revert: We probably don't care about the dartkb breakages.
> 
> Original change's description:
> > Revert "[VM] Remove unnecessary Closure.clone() from sync*."
> > 
> > This reverts commit ca94ad7112.
> > 
> > Reason for revert: Appears to break dartkb.
> > 
> > Original change's description:
> > > [VM] Remove unnecessary Closure.clone() from sync*.
> > > 
> > > Instead, this CL wraps sync*'s sync_op in an additional function
> > > that captures local copies of the necessary closure state.
> > > Notably this state includes the parameters of the original sync* function
> > > as these also need to be cloned for each instance.
> > > 
> > > 
> > > Note: a large number of .expect files have a small number of changes
> > > due to the additional wrapper function, as well as some extra plumbing.
> > > 
> > > Bug: https://github.com/dart-lang/sdk/issues/37753
> > > Change-Id: If099dbfe9e5d62979626b852386fd0173fc76de5
> > > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136190
> > > Commit-Queue: Clement Skau <cskau@google.com>
> > > Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> > 
> > TBR=vegorov@google.com,cskau@google.com
> > 
> > Change-Id: I89e517196f03622337f909f0fcecbdc77c9dda93
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Bug: https://github.com/dart-lang/sdk/issues/37753
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144920
> > Reviewed-by: Clement Skau <cskau@google.com>
> > Commit-Queue: Clement Skau <cskau@google.com>
> 
> TBR=vegorov@google.com,cskau@google.com
> 
> Change-Id: I78589c83cbb17151ca4ab8f811b4f18f252fb9c1
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: https://github.com/dart-lang/sdk/issues/37753
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144921
> Reviewed-by: Clement Skau <cskau@google.com>
> Commit-Queue: Clement Skau <cskau@google.com>

TBR=vegorov@google.com,cskau@google.com

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

Bug: https://github.com/dart-lang/sdk/issues/37753
Change-Id: I879df17bd282d01468fa010b94a8c89afdb8cd0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145361
Reviewed-by: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2020-04-29 09:52:30 +00:00
Alexander Aprelev 334284a69b Revert "Reland "[vm] Make VM support .dart_tool/package_config.json""
This reverts commit 30085612f4 as it
broke vm-kernel-precomp-nnbd-linux-release-x64 bot.

Seems to be the same failure as the last time it was reverted: https://ci.chromium.org/p/dart/builders/ci.sandbox/vm-kernel-precomp-nnbd-linux-release-x64/537

Change-Id: I35a1897367bcb65f518b58659001280c5d5ed930
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145262
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-04-28 23:23:44 +00:00
Nicholas Shahan 525e02fa5e [ddc] Use Null Safety flag in typeAcceptsNull
- Expose the internal runtime flag for the Null Safety mode.
- Add a guard to protect against accidental configurations
  that set the mode multiple times.

Change-Id: I8d16a3c7bd8590ea6f2fee9b6f8c09009898a64b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144991
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-04-28 21:56:48 +00:00
Nicholas Shahan 3da1591253 [ddc] Fix function type casts in weak mode
Allow null to be cast as function types in weak mode.

Change-Id: I42084250c428b7e6a18ce343305d43603b4e1ec4
Fixes: https://github.com/dart-lang/sdk/issues/41680
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144995
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2020-04-28 21:19:54 +00:00
Martin Kustermann 30085612f4 Reland "[vm] Make VM support .dart_tool/package_config.json"
This CL makes the VM add support for .dart_tool/package_config.json via
  * the --packages=<file> command line parameter
  * the `packageConfig: <file>` parameter to `Isolate.spawnUri`

It also allows now `package:*` uris being used in `Isolate.spawnUri`

The CL also removes the unused `packageRoot` parameter from the Dart to
C++ interface as well as in various places in C++.

The CL also aligns the implementations between sdk and sdk_nnbd more.

Issue https://github.com/dart-lang/sdk/issues/41649
Issue https://github.com/dart-lang/sdk/issues/41245
Issue https://github.com/dart-lang/sdk/issues/41246

Change-Id: Idec0990c731f34efda9c39672067eae9174319f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144826
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-04-28 16:52:02 +00:00
Clement Skau 1bf25798fa Reland "[VM] Remove unnecessary Closure.clone() from sync*."
This reverts commit 430c75b5fa.

Reason for revert: We probably don't care about the dartkb breakages.

Original change's description:
> Revert "[VM] Remove unnecessary Closure.clone() from sync*."
> 
> This reverts commit ca94ad7112.
> 
> Reason for revert: Appears to break dartkb.
> 
> Original change's description:
> > [VM] Remove unnecessary Closure.clone() from sync*.
> > 
> > Instead, this CL wraps sync*'s sync_op in an additional function
> > that captures local copies of the necessary closure state.
> > Notably this state includes the parameters of the original sync* function
> > as these also need to be cloned for each instance.
> > 
> > 
> > Note: a large number of .expect files have a small number of changes
> > due to the additional wrapper function, as well as some extra plumbing.
> > 
> > Bug: https://github.com/dart-lang/sdk/issues/37753
> > Change-Id: If099dbfe9e5d62979626b852386fd0173fc76de5
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136190
> > Commit-Queue: Clement Skau <cskau@google.com>
> > Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
> 
> TBR=vegorov@google.com,cskau@google.com
> 
> Change-Id: I89e517196f03622337f909f0fcecbdc77c9dda93
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: https://github.com/dart-lang/sdk/issues/37753
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144920
> Reviewed-by: Clement Skau <cskau@google.com>
> Commit-Queue: Clement Skau <cskau@google.com>

TBR=vegorov@google.com,cskau@google.com

Change-Id: I78589c83cbb17151ca4ab8f811b4f18f252fb9c1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/37753
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144921
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2020-04-28 06:17:20 +00:00
Mayank Patke 7ac53f1825 [dart2js] Treat Object as a top type in weak mode.
We were only treating Object as a top type if NNBD was disabled. This is
incorrect and we should be treating Object as a top type whenever legacy
subtyping is in effect. In particular, Object acts as a top type in weak
mode.

Change-Id: I76acc25e92fda2b9e2b7872fc72d319161318874
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144689
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2020-04-28 02:27:26 +00:00
Ryan Macnak 3cb7eaa4cb Revert "[vm] Fix test to use Uri.file() instead of Uri.parse()"
This reverts commit 87ce4a504f.

Revert "[vm] Make VM support .dart_tool/package_config.json"

This reverts commit b112aa0d8b.

Reason for revert: Failures on Windows

Change-Id: I3e4f601d7638b25df313773e525c9284737fa729
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144985
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-04-27 21:55:46 +00:00
Martin Kustermann b112aa0d8b [vm] Make VM support .dart_tool/package_config.json
This CL makes the VM add support for .dart_tool/package_config.json via
  * the --packages=<file> command line parameter
  * the `packageConfig: <file>` parameter to `Isolate.spawnUri`

It also allows now `package:*` uris being used in `Isolate.spawnUri`

The CL also removes the unused `packageRoot` parameter from the Dart to
C++ interface as well as in various places in C++.

The CL also aligns the implementations between sdk and sdk_nnbd more.

Issue https://github.com/dart-lang/sdk/issues/41649
Issue https://github.com/dart-lang/sdk/issues/41245
Issue https://github.com/dart-lang/sdk/issues/41246

Change-Id: I642dfb89f82b3f2c1613e443850bf0b4fb91f4a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144766
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-04-27 12:54:38 +00:00
Clement Skau 430c75b5fa Revert "[VM] Remove unnecessary Closure.clone() from sync*."
This reverts commit ca94ad7112.

Reason for revert: Appears to break dartkb.

Original change's description:
> [VM] Remove unnecessary Closure.clone() from sync*.
> 
> Instead, this CL wraps sync*'s sync_op in an additional function
> that captures local copies of the necessary closure state.
> Notably this state includes the parameters of the original sync* function
> as these also need to be cloned for each instance.
> 
> 
> Note: a large number of .expect files have a small number of changes
> due to the additional wrapper function, as well as some extra plumbing.
> 
> Bug: https://github.com/dart-lang/sdk/issues/37753
> Change-Id: If099dbfe9e5d62979626b852386fd0173fc76de5
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136190
> Commit-Queue: Clement Skau <cskau@google.com>
> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>

TBR=vegorov@google.com,cskau@google.com

Change-Id: I89e517196f03622337f909f0fcecbdc77c9dda93
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/37753
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144920
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2020-04-27 07:45:04 +00:00
Clement Skau ca94ad7112 [VM] Remove unnecessary Closure.clone() from sync*.
Instead, this CL wraps sync*'s sync_op in an additional function
that captures local copies of the necessary closure state.
Notably this state includes the parameters of the original sync* function
as these also need to be cloned for each instance.


Note: a large number of .expect files have a small number of changes
due to the additional wrapper function, as well as some extra plumbing.

Bug: https://github.com/dart-lang/sdk/issues/37753
Change-Id: If099dbfe9e5d62979626b852386fd0173fc76de5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136190
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-04-27 07:37:39 +00:00
Ben Konyi 43c2d2c6d2 Reland "[ DartDev ] Generate dartdev.dart.snapshot for runtime builds and place it in the root of the build output directory"
This reverts commit 60823bdaf6.

Change-Id: I10a8421cb1fc5738bfb56d3c4e68d05bb3b4edd9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144680
Reviewed-by: Jaime Wren <jwren@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-04-24 19:59:48 +00:00
Nicholas Shahan 02a34ddfb1 [ddc] Remove type and null checks in dart:_runtime
Only removing checks for common calls within the type system that
we know are always safe.

Added `@notNull` on arguments typed to be non-nullable (in the nnbd
version) to avoid producing the null checks.

Added `Object` type to arguments to match the return type and avoid
casts when returning.

Change-Id: I05de45a8d923497f7340348ef2c0b9f72da5414b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143862
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-04-24 18:29:03 +00:00
Leaf Petersen 721f7b4b3b Null safe dart:async optimizations.
Various optimizations to the null safe dart:async sdk to fix
performance regressions in dart2js.

Change-Id: I32c64b54be196ac18946ade45de6b352a20be832
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144302
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-04-23 18:56:00 +00:00
Srujan Gaddam b0d35855d8 [dart:html] Add nullability to node signature
Closes https://github.com/dart-lang/sdk/issues/41616

When merging interfaces, nullable and non-nullable types
should not be treated as the same. This also fixes some nullability
information that was not included in dart.idl but is part of the
Chromium IDL.

Change-Id: I6e94176d905b63364bc93dc2120d194452cf05f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144464
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2020-04-23 04:56:28 +00:00
Ben Konyi f9816cdc35 [ DDS / Service ] Put the VM service into single client mode when DDS connects
Added a private RPC, _yieldControlToDDS, which DDS invokes once
connected to the VM service. Once this method is called, the following
happens:

- The VM service stops accepting new web socket requests.
- The VM service enters single client mode, where DDS is the single
  client.

DDS can only place the VM service in single client mode when it is the only
VM service client. If other clients are connected, DDS will fail to start and
throw an exception.

The purpose of this change is to simplify state management between the
VM service and DDS. The plan is to delegate the following features to
DDS:

- Service extension management
- Custom client name support
- Isolate resume coordination for multiple clients

Change-Id: I0b3143710d94ee9444a4894e24555f7ed1caf5ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142564
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-04-22 22:03:59 +00:00
Zichang Guo 913cf2583e Revert "[dart:io] Fixes Ping/Pong mechanism not updating readyState when closing"
This reverts commit ac5b24123d.

Reason for revert: Tests are hanging on Windows. https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket.appspot.com/8882288664919412608/+/steps/test_results/0/logs/new_test_failures__logs_/0

Original change's description:
> [dart:io] Fixes Ping/Pong mechanism not updating readyState when closing
> 
> Bug: https://github.com/dart-lang/sdk/issues/33362
> Change-Id: Icf21ad5c9b66c4176ec65e018f9499b24690ed2c
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143890
> Commit-Queue: Zichang Guo <zichangguo@google.com>
> Reviewed-by: Jonas Termansen <sortie@google.com>

TBR=sortie@google.com,asiva@google.com,zichangguo@google.com

Change-Id: I6f32f4a5bf29d949f26381394ce16e103e715c65
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/33362
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144490
Reviewed-by: Zichang Guo <zichangguo@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2020-04-22 21:28:11 +00:00
Zichang Guo ac5b24123d [dart:io] Fixes Ping/Pong mechanism not updating readyState when closing
Bug: https://github.com/dart-lang/sdk/issues/33362
Change-Id: Icf21ad5c9b66c4176ec65e018f9499b24690ed2c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143890
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2020-04-22 20:12:59 +00:00
Alexander Aprelev 17654b70d7 [vm/isolates] Introduce sendAndExit.
sendAndExit allows for fast data passing from worker isolate back to
parent.

```
                                              | linux x64  | spawnIsolate | sendAndExit |
                                              |us per iter | over sync    | over send   |
                                              +------------+--------------+-------------+
IsolateJson.Decode50KBx1(RunTime):               43,175.000   339.83%
IsolateJson.SendAndExit_Decode50KBx1(RunTime):   22,070.000   124.83%        -48.88%
IsolateJson.SyncDecode50KBx1(RunTime):            9,816.284

IsolateJson.Decode50KBx4(RunTime):               77,630.000   104.56%
IsolateJson.SendAndExit_Decode50KBx4(RunTime):   46,307.000   22.02%         -40.35%
IsolateJson.SyncDecode50KBx4(RunTime):           37,949.528

IsolateJson.Decode100KBx1(RunTime):              71,035.000   270.42%
IsolateJson.SendAndExit_Decode100KBx1(RunTime):  43,056.000   124.52%        -39.39%
IsolateJson.SyncDecode100KBx1(RunTime):          19,176.733

IsolateJson.Decode100KBx4(RunTime):             120,915.000   54.66%
IsolateJson.SendAndExit_Decode100KBx4(RunTime):  67,101.000  -14.17%         -44.51%
IsolateJson.SyncDecode100KBx4(RunTime):          78,179.731

IsolateJson.Decode250KBx1(RunTime):             173,574.000  202.52%
IsolateJson.SendAndExit_Decode250KBx1(RunTime): 103,334.000   80.10%         -40.47%
IsolateJson.SyncDecode250KBx1(RunTime):          57,375.314

IsolateJson.Decode250KBx4(RunTime):             292,118.000   20.30%
IsolateJson.SendAndExit_Decode250KBx4(RunTime): 168,444.000  -30.63%         -42.34%
IsolateJson.SyncDecode250KBx4(RunTime):         242,831.000

IsolateJson.Decode1MBx1(RunTime):               631,578.000  166.34%
IsolateJson.SendAndExit_Decode1MBx1(RunTime):   371,127.000   56.50%         -41.24%
IsolateJson.SyncDecode1MBx1(RunTime):           237,135.778

IsolateJson.Decode1MBx4(RunTime):             1,322,789.000   36.16%
IsolateJson.SendAndExit_Decode1MBx4(RunTime):   657,179.000  -32.35%         -50.32%
IsolateJson.SyncDecode1MBx4(RunTime):           971,473.333

```

Bug: https://github.com/dart-lang/sdk/issues/37835
Bug: https://github.com/dart-lang/sdk/issues/36097
Change-Id: I386641e1431ed9f2e34fac36f562607a666ee4a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142823
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-04-22 17:34:09 +00:00
Nicholas Shahan 23cbe39355 [ddc] Remove error handler from number parse helpers
This copies the logic from dart2js and brings the two patches closer
together. There is no need to pass the error handler to the helper
function shared between `parse()` and `tryParse()`.

Update JS foreign function types in parseDouble to match the NNBD
version.

Fixes: https://github.com/dart-lang/sdk/issues/41613

Change-Id: I85d39f8ba6bd76459cf6263099983b8b96d3a669
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144304
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-04-22 16:07:29 +00:00
Srujan Gaddam 01da93f053 [dart:html] Change visualViewport to be nullable
Closes https://github.com/dart-lang/sdk/issues/41612

visualViewport can be nullable on Firefox. This is a workaround
until https://github.com/dart-lang/sdk/issues/41616 is addressed.

Change-Id: I386d8fc8716026191bace912e46a2c56358d079a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144350
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
Auto-Submit: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2020-04-22 02:34:54 +00:00
Nicholas Shahan 1f22cd0573 [dart2js] Cleanup unused local variable
While I was referencing the dart2js implementation to fix a bug in DDC I
noticed an unused local variable here.

Change-Id: I4e6dfd961cbc54ee346f1796eb1b5184d3c01ed7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144347
Auto-Submit: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2020-04-22 01:39:13 +00:00
Tim Sneath d6495ec323 Fix spelling error
Closes https://github.com/dart-lang/sdk/pull/41569
https://github.com/dart-lang/sdk/pull/41569

GitOrigin-RevId: 06ad8b47638d5bbfa6c3d674fbd877fac159086c
Change-Id: I49bb2f61d8a683cff13fcdec0111c18ad89eb74c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144061
Reviewed-by: Kevin Moore <kevmoo@google.com>
2020-04-20 18:33:49 +00:00
Zichang Guo d9b4c87ab4 [dart:io] Fix type error for network profiling
Bug: https://github.com/dart-lang/sdk/issues/41462
Change-Id: I0770a5fa62ea69bbe9eb5495091a2c5e7a88516a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143311
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-04-18 06:28:48 +00:00
Stephen Adams 7ee0e10bd5 [dart2js] specialize legacy primitive as-checks
Each primitive type T has three variant of 'as' check for 'as T' (strong),
'as T*' (weak) and 'as T?' (nullable).


Change-Id: I6ef3c41d73b384d7d16fa0da0c5b9a1e9791d43f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143884
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2020-04-18 01:47:37 +00:00
Ben Konyi 5b19445d9c Reland "[ Service / package:dds ] Add stream support to package:dds and enable DDS for VM service tests"
This reverts commit cccddf3530.

Change-Id: Iabde3542d5be33ffabf50efd9226597aef876ab7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143961
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-04-17 21:12:44 +00:00
Zichang Guo 18bf8c3560 [dart:io] Fix empty Process.run arguments on Windows
Closes https://github.com/dart-lang/sdk/issues/40060
Change-Id: I3d8c15efea3b24a628846b090701ffd245f09651
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143700
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2020-04-17 20:12:54 +00:00
Nicholas Shahan 9ae942b083 [ddc] Use dynamic as default for top type bounds
For the cases of implicit bounds like `<T>` the default value
should be `dynamic` when instantiating and no type parameter is
provided. This change fixes this cases.

For explicit bounds like `<T extends Object?>` or
`<T extends Object*>` the default values should be `Object?` or
`Object*`. This change breaks these cases by defaulting to
`dynamic`.

Filed: https://github.com/dart-lang/sdk/issues/41539

I believe this is the correct trade off right now because the
implicit bounds like `<T>` are more likely to appear compared to
`<T extends Object?>` or `<T extends Object*>`.

Fixes: https://github.com/dart-lang/sdk/issues/41301

Change-Id: I53a22cf9de2d200f628f3ac0f6b0a6b1ab9ba3fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143442
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-04-17 17:51:58 +00:00
Alexander Aprelev cccddf3530 Revert "Reland "[ Service / package:dds ] Add stream support to package:dds and enable DDS for VM service tests""
This reverts commit e5b85792da as it seems to have broken service/pause_on_start_and_exit_with_child_test/service https://ci.chromium.org/p/dart/builders/ci.sandbox/app-kernel-linux-debug-x64/5877

Change-Id: Idb9df51816eebfb58137c449c6461731c77409f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143881
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-04-16 23:37:25 +00:00
Ben Konyi e5b85792da Reland "[ Service / package:dds ] Add stream support to package:dds and enable DDS for VM service tests"
Fixes buildbot failures by running VM service and DDS service tests in
separate test processes.

This reverts commit 1f0c90868c.

Change-Id: I0ad9b2e6ccea4d5468dd4dcdde0e286bcbf820ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142902
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-04-16 17:59:25 +00:00
Nicholas Shahan 110c498e3e [ddc] Throw AssertionError on null bool expression
Partially reverts
https://dart-review.googlesource.com/c/sdk/+/139402
but continues to throw a TypeError when running in strong mode. The
breaking change to boolean conversions was not back-ported so we
are still going to throw an AssertionError in weak mode.

Updated Spec: https://github.com/dart-lang/language/pull/917

Fixes: https://github.com/dart-lang/sdk/issues/41278

Change-Id: Ib50e9ab367f4a0c0f9f10c3e0fa4ec890ff9c2ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143007
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-04-15 22:11:24 +00:00
Alexander Markov d5c38cd354 [vm/nnbd] Use InitStaticField instruction for late static fields
Issue: https://github.com/dart-lang/sdk/issues/41299
Issue: https://github.com/dart-lang/sdk/issues/41417
Issue: https://github.com/dart-lang/sdk/issues/40796
Change-Id: Ibcc0ea55c6262ccafdda6c3fb1b28f357297c1de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143100
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Benchmark: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-04-15 20:04:34 +00:00
Zichang Guo 3ff45a86c2 [dart:io] Throw UnimplementedErrors instead of throwing a String
Closes https://github.com/dart-lang/sdk/issues/40310
Change-Id: I9d0e9fda4d8a4b7ce243787dd7adb41b50422eaa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143481
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2020-04-15 18:03:15 +00:00
Janice Collins 63397ca320 Revert "Add html_common to .gni files."
This reverts commit 75e1f2a16e.

Reason for revert: Fix for dartdoc #1949 makes this no longer strictly necessary.  While this leaves the underlying imports unfixed, I will instead file an issue against the engine.

Original change's description:
> Add html_common to .gni files.
>
> This will enable a fix to an unresolved export that causes Dartdoc
> to complain about all Flutter packages.
>
> Bug: https://github.com/dart-lang/dartdoc/issues/2143
> Change-Id: I634e21066420b100295989cf9bdcd35af91a617b
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143020
> Reviewed-by: Devon Carew <devoncarew@google.com>
> Commit-Queue: Janice Collins <jcollins@google.com>

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

Bug: https://github.com/dart-lang/dartdoc/issues/2143
Change-Id: Ibe25eee8031b348d9260245daca84d9742fbb894
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143402
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Commit-Queue: Janice Collins <jcollins@google.com>
2020-04-14 22:58:07 +00:00
Martin Kustermann e2b6cc93b6 [vm/async] Update async transformation to take NNBD mode into account
The removal of unsafeCast causes flutter galley size regressions:

  - armv7: -0.43%
  - armv8: -0.21%

which we should look into recovering by having better inlining heuristics.

Issue https://github.com/dart-lang/sdk/issues/41373
Closes https://github.com/dart-lang/sdk/issues/41307

Change-Id: I7c0ba4c9598e13f01e807a607c83d50cf03e9abe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142501
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-04-11 08:56:52 +00:00
Zichang Guo 17294842e9 Reland "[dart:io] Making OSError implements Exception"
This is a reland of ae392b8e00

https://github.com/flutter/flutter/pull/53258 will be landed first to unblock the roll.

Original change's description:
> [dart:io] Making OSError implements Exception
>
> Bug: https://github.com/dart-lang/sdk/issues/40934
> Change-Id: Icff457333bd570d81cdf9c3136ee4fe1cadfaae8
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139406
> Reviewed-by: Zach Anderson <zra@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Zichang Guo <zichangguo@google.com>

Bug: https://github.com/dart-lang/sdk/issues/40934
Change-Id: Ibc17c0a5717c2005898ce279d4d16edbdbbf44fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140910
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2020-04-11 01:29:22 +00:00
Nicholas Shahan 8a6d0b57ea [ddc] Unfork DDC dart:_runtime library
Treats the SDK and all application code as a legacy library when
running without enabling the null safety experiment.

- Copy all changes from the SDK fork and applies them to the existing
  SDK (except the null safety syntax used in the library itself.
- Start emitting legacy types.
- Add a work around to avoid ever creating legacy or nullable versions
  of types in the dart:_runtime library or in JS contexts. This should
  be safely removed once the SDK is opted in to null safety.

Fixes: #40266

Change-Id: I6a029b676c3e35980a6bab876a348c35590df92d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142904
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-04-10 17:50:45 +00:00
Stephen Adams 01650fec88 [js_runtime] avoid array write checks in List.filled
Change-Id: Iff2e95fd293b7edbdc419e8593eac945bd270a7b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143002
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-04-09 21:30:52 +00:00
Janice Collins 75e1f2a16e Add html_common to .gni files.
This will enable a fix to an unresolved export that causes Dartdoc
to complain about all Flutter packages.

Bug: https://github.com/dart-lang/dartdoc/issues/2143
Change-Id: I634e21066420b100295989cf9bdcd35af91a617b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143020
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Janice Collins <jcollins@google.com>
2020-04-09 18:32:49 +00:00
David Morgan fb0902a05d Revert "[dart:io] Preserve header case in http header _builds()"
This reverts commit af19f9638d.

Reason for revert: Breaks package:shelf tests.

Original change's description:
> [dart:io] Preserve header case in http header _builds()
> 
> Bug: https://github.com/dart-lang/sdk/issues/33501
> Change-Id: I57d9bba251b76314bf40b81d1b09bd4643dce4d2
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141911
> Commit-Queue: Zichang Guo <zichangguo@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Reviewed-by: Jonas Termansen <sortie@google.com>

TBR=sortie@google.com,asiva@google.com,zichangguo@google.com

Change-Id: I9c0418a256cb53e415ed0d5aeab84c4b0b4a161d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/33501
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142980
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
2020-04-09 10:38:29 +00:00
Zichang Guo af19f9638d [dart:io] Preserve header case in http header _builds()
Bug: https://github.com/dart-lang/sdk/issues/33501
Change-Id: I57d9bba251b76314bf40b81d1b09bd4643dce4d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141911
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2020-04-09 06:37:28 +00:00
Srujan Gaddam 5ed1850933 [dart:html] Add SubmitEvent to Event native annotation
Bug: https://github.com/dart-lang/sdk/issues/40901

Allows SubmitEvent to be treated like an Event.

Change-Id: I86d31b73eda5a0009fbd18aa4e993d0f52165d83
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142882
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Auto-Submit: Srujan Gaddam <srujzs@google.com>
2020-04-08 20:27:34 +00:00
Ben Konyi 1f0c90868c Revert "[ Service / package:dds ] Add stream support to package:dds and enable DDS for VM service tests"
This reverts commit 6b2419ddaf.

Reason for revert: Failures on bots. Reverting.

Original change's description:
> [ Service / package:dds ] Add stream support to package:dds and enable DDS for VM service tests
> 
> This change adds stream forwarding to the Dart Development Service,
> allowing for clients to subscribe to service protocol streams with DDS
> instead of the VM service directly. DDS will maintain a single
> subscription for each stream as long as at least one client is listening
> to that stream. A DDS stream subscription will be closed when the last
> client listening to that stream either disconnects or calls
> streamCancel.
> 
> This change also enables DDS for most of the Observatory services tests,
> excluding thoses which utilize:
> 
> - Service extensions
> - Client naming
> - Client isolate resume synchronization
> 
> Change-Id: I5641e879a7626fcd5e4d28434ed480dd72fc7659
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142083
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Ben Konyi <bkonyi@google.com>

TBR=bkonyi@google.com,rmacnak@google.com,asiva@google.com

Change-Id: I185e63eabca54a3dff49d4f5a8a126795cadfa80
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142820
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-04-08 00:07:38 +00:00
Nicholas Shahan 8064c1c342 [ddc] Add typeRep<T>() to inline an unwrapped type directly
Also add `legacyTypeRep<T>()` that is similar but performs
a shallow conversion to a legacy type.

Using this in compiler/dartdevc_native/ tests gives a better usability
instead of constantly wrapping and unwrapping types. It allows us to
avoid stripping off the legacy from a type when calling `wrapType()`.

Issue: https://github.com/dart-lang/sdk/issues/40266
Change-Id: I07225f18c253222b31203b0b110233a3e018a7d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142547
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-04-08 00:03:38 +00:00
Ben Konyi 6b2419ddaf [ Service / package:dds ] Add stream support to package:dds and enable DDS for VM service tests
This change adds stream forwarding to the Dart Development Service,
allowing for clients to subscribe to service protocol streams with DDS
instead of the VM service directly. DDS will maintain a single
subscription for each stream as long as at least one client is listening
to that stream. A DDS stream subscription will be closed when the last
client listening to that stream either disconnects or calls
streamCancel.

This change also enables DDS for most of the Observatory services tests,
excluding thoses which utilize:

- Service extensions
- Client naming
- Client isolate resume synchronization

Change-Id: I5641e879a7626fcd5e4d28434ed480dd72fc7659
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142083
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-04-07 23:18:45 +00:00
Mehmet Fidanboylu 74a20b7bfd Reland "[dart:_http] Allow the embedder to prohibit HTTP traffic."
This is a reland of 6b44c631ad

Original change's description:
> [dart:_http] Allow the embedder to prohibit HTTP traffic.
> 
> This can be configured by embedders by setting the `_embedderAllowsHttp`
> variable. It can also be overridden by client apps by introducing a
> `Zone` with the variable `#dart.library.io.allow_http` set to `true` or
> `false`.
> 
> The default behavior in SDK is unchanged.
> 
> Bug: https://github.com/dart-lang/sdk/issues/40548
> Change-Id: Ifec0ad2d759de4bbb836644840d8c312e560f285
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138911
> Commit-Queue: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Jonas Termansen <sortie@google.com>

Bug: https://github.com/dart-lang/sdk/issues/40548
Change-Id: I6ced6c1248b3b6687f6c7d998e5206b2b385f00b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142446
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-04-06 17:46:44 +00:00
Aske Simon Christensen a5611cdda2 Revert "[dart:_http] Allow the embedder to prohibit HTTP traffic."
This reverts commit 6b44c631ad.

Reason for revert: Tests timing out on Windows

Original change's description:
> [dart:_http] Allow the embedder to prohibit HTTP traffic.
> 
> This can be configured by embedders by setting the `_embedderAllowsHttp`
> variable. It can also be overridden by client apps by introducing a
> `Zone` with the variable `#dart.library.io.allow_http` set to `true` or
> `false`.
> 
> The default behavior in SDK is unchanged.
> 
> Bug: https://github.com/dart-lang/sdk/issues/40548
> Change-Id: Ifec0ad2d759de4bbb836644840d8c312e560f285
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138911
> Commit-Queue: Martin Kustermann <kustermann@google.com>
> Reviewed-by: Jonas Termansen <sortie@google.com>

TBR=sortie@google.com,lrn@google.com,kustermann@google.com,mehmetf@google.com

Change-Id: I824a1845e82b5facb839109f74bb482e7095e313
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/40548
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142363
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2020-04-03 18:19:17 +00:00
Mehmet Fidanboylu 6b44c631ad [dart:_http] Allow the embedder to prohibit HTTP traffic.
This can be configured by embedders by setting the `_embedderAllowsHttp`
variable. It can also be overridden by client apps by introducing a
`Zone` with the variable `#dart.library.io.allow_http` set to `true` or
`false`.

The default behavior in SDK is unchanged.

Bug: https://github.com/dart-lang/sdk/issues/40548
Change-Id: Ifec0ad2d759de4bbb836644840d8c312e560f285
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138911
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2020-04-03 16:39:26 +00:00
Martin Kustermann c4a7c3488e [vm/async] Make async transformer use typed variables, make async patch use function types
This gets rid of a slow AssertAssignable (function type test)
in _asyncThenWrapperHelper/_awaitHelper, which currently falls back to the slow table
search:

  AssertAssignable
    ^--> TypeTestingStub
          ^--> SlowTypeTestStub
               ^--> Subtype6TestCacheStub

Issue https://github.com/dart-lang/sdk/issues/37668

Change-Id: I3b6517b7e348e39619e8096d6ac2a4b179bb3242
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142022
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2020-04-03 08:28:47 +00:00
Sigmund Cherem 795c0b1b64 [ddc, dart2js] Fix signature of js_util APIs expecting a constructor.
Since JavaScript constructor functions are not valid Dart functions,
they should not be expected to have a Function type.

For context see: https://github.com/dart-lang/sdk/issues/41259

Change-Id: I9092700ad60712f604cec7e5cf0189b23024839a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142321
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2020-04-03 04:54:56 +00:00
Srujan Gaddam 544fc4627f [dart:html] Add insertAll to ChildrenElementList
Bug: https://github.com/dart-lang/sdk/issues/41275

insertAll should be unimplemented. It was previously relying
on a call to ChildrenElementList.length in the List mixin to
throw an UnsupportedError.

Change-Id: Ie8e5b126ea75a538e9db8b939bff0be012814efb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142201
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2020-04-02 20:16:39 +00:00
Srujan Gaddam 0764c70cd9 [dart:html] Remove nullability from CssClassSet funcs
Pre-nnbd, add and toggle were allowed to return null, but with the
change in the Set interface, they must return a non-nullable bool.

Change-Id: I1dfcb43d8c816f46f847d22d6f62507c6a77e4a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141500
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2020-04-02 19:29:09 +00:00
Srujan Gaddam bc65eafd3b [dart:html] Fix nullability for vars with null checks
There are several instances where there are non-nullable
variables with null checks associated with them that should
be converted back to nullable. Attribute functions in Element
are clarified as well.

Change-Id: I23cf020f02f3d4b512e041f0339daafb46fdd7f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140909
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2020-04-02 19:28:59 +00:00
Martin Kustermann cd7ae62a04 [sdk] Hoist loading of _Base64Decoder._inverseAlphabet out of loop
Fixes https://github.com/dart-lang/sdk/issues/41276

Change-Id: I34f6b0619665dbe11bbb56866bcb35bf78262b49
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142020
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-04-02 09:15:54 +00:00
Stephen Adams 1a0df5bc66 [dart2js] Late-binding of 'const String.fromEnvironment'
Defer evaluating 'fromEnvironment' values while building
dart2js_platform.dill.

Future step is to make it work for the Flutter (See https://github.com/flutter/flutter/issues/53284)

Change-Id: Ieef8739364c47540766201332769876cba9f0a35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141467
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-03-31 16:57:40 +00:00
Lasse Reichstein Holst Nielsen b4a591ecc9 Add specialized classes for ZoneFunction<Function> to handle generics.
Type arguments cannot be generic functions, so we add specialized
classes for each generic function type we need to make ZoneFunctions for.

Fixes #41253.

BUG= http://dartbug.com/41253

Change-Id: Idf84f04576465ea9e5ea749ece4a7d843a037e46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141884
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-03-31 14:15:30 +00:00
Teagan Strickland e6e66026d2 [vm] Check the global object pool (if any) when visiting functions.
FFI trampolines are stored in the global object pool and not
reachable either via class or via the closure functions in the
object store.

Fixes https://github.com/dart-lang/sdk/issues/41261

Bug: https://github.com/dart-lang/sdk/issues/41052
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-win-release-x64-try
Change-Id: I3e1551dba80a2fd418946d7449467317463c2c61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141882
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-03-31 13:04:29 +00:00
Jonas Termansen 778eb8f1d0 [dart:_http] Fix HeaderValue.parse if valueSeparator is parameterSeparator.
Closes https://github.com/dart-lang/sdk/issues/31080.

Change-Id: Iba235a339c345d1793935f65e3abe6ffdc157cb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140869
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Jonas Termansen <sortie@google.com>
2020-03-31 12:46:30 +00:00
Teagan Strickland b55342cb3e [vm/aot] Drop some Function objects not needed at runtime.
In particular, don't serialize a function if its code is used by the
dispatch table, but there's no need for the function object itself
at runtime like dynamic lookup or dynamic invocation forwarders.

However, just because the owning function is not needed at runtime,
it may be used during serialization for things like assembly label
creation. Thus, instead of just clearing out the Code's owner field,
we add a new WeakSerializationReference (WSR) object whose target is
the original contents of the owner field. The WSR allows the
serializer to access the original owner, but also signals to the
serializer that the target should not be serialized in AOT snapshots
unless there are additional strong (non-WSR) references.

If no strong references are found, then the references to the WSR
in the snapshot are replaced with a reference to a WSR that only
contains the class ID of the original target. The serializer creates
only one WSR per class ID.

If strong references are found, then the target is still serialized.
In this case, the WSR is dropped entirely and any reference to it is
replaced with a direct reference to the serialized target. Thus, WSRs
only exist in the precompiled runtime for targets with no strong
references.

Changes on the Flutter gallery in release mode:
arm7: total size -1.10%, isolate size -6.08%
arm8: total size -1.16%, isolate size -6.09%

Bug: https://github.com/dart-lang/sdk/issues/41052

Change-Id: I5b435ca71ef85f50fe3484789087471a91aa4fe2
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-precomp-linux-release-simarm-try,vm-kernel-precomp-linux-release-simarm64-try,vm-kernel-precomp-linux-release-simarm_x64-try,vm-kernel-precomp-mac-release-simarm64-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137104
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2020-03-30 18:33:48 +00:00
Stephen Adams d5e8cf7dbd [dart2js] Specialize is- and as- tests for nullable types
- '_as' is now specialized on first use, like '_is'.
- '_is' specialization on `T?` that uses `T._is`
- recognize legacy versions of simple type tests (e.g. is int*)

The T? specialization makes a 2x improvement on some of the ListCopy
benchmarks on 'spec-mode' dart2js because some iterators have a T?
check.

Change-Id: I434a43de9e1322b34c3a5e11199415a75b7ed2c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140944
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2020-03-28 02:15:31 +00:00
Zichang Guo 236dd991e5 [dart:io] Fix parsing the response of the HTTP connect method
According to RFC 7231 4.3.6,
A client MUST ignore any "Content-Length" or "Transfer-Encoding" header
fields received in a successful response to CONNECT.

Bug: https://github.com/dart-lang/sdk/issues/37808
Change-Id: I776f54b93807b4b7f9d9c9b9139728fa0415942a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140564
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2020-03-27 20:03:04 +00:00
Zichang Guo fdf4762c99 Reland "[dart:io] Fix hanging on zero-length datagram"
This is a reland of c326c587c5

The fix is to remove "_availableDatagram" check at the start of receive(). Since receive() can be called without receiver being listening, this check will block the receive().

Original change's description:
> [dart:io] Fix hanging on zero-length datagram
>
> This is observed on Win and Linux.
> Here is a doc to explain the problem: https://docs.google.com/document/d/1ZzyBUMrDHLU6vNryjgSMJfUruOdpmTImtE_s2E0J8IQ/edit?usp=sharing.
>
> Bug: https://github.com/dart-lang/sdk/issues/39910
> Change-Id: Ia961239f45615f14108bcd66043ac33d9a0a4abe
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137425
> Commit-Queue: Zichang Guo <zichangguo@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>

Bug: https://github.com/dart-lang/sdk/issues/39910
Change-Id: Iefc0af96ed4e1b433396bb5fe11276e8a04c00d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140164
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2020-03-27 15:28:23 +00:00
Zichang Guo 9b5aac9495 [dart:io] remove available at _NativeSocket::Read
`Too many HandleMessage events` errors were noticed again on Opal.

Updating `available` at the end of _NativeSocket::Read() potentially leads to another read event, if pipe is populated after nativeRead() finished.
Stop updating the `available`. The eventhanlder will wake up again in the near future to issue read events.

Bug: https://buganizer.corp.google.com/issues/150902962
Change-Id: I86e3618077e6726a2105b8bde202816c50a3d2c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140081
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2020-03-27 03:12:15 +00:00
Nicholas Shahan a6664e093b [ddc] Update types in JSArray operations
- Avoid unnecessary type checks.
- Convert comment syntax to actual generic method syntax.
- Cleanup some type Strings from the JS foreign interface.
- Use var on LHS more consistently.

Performance optimizations can be seen in the ArrayLoop
benchmarks with the highest being ArrayLoop.pseudopoly.forEach
with a 34.15% improvement.

These changes also avoid a large performance regression when
we unfork and the array contains legacy or nullable types.

Change-Id: I88e21a7b0d36d9bb9ba1b0e8ba24326f2b2c8229
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140760
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-03-26 20:12:53 +00:00
Daco Harkes 445d279ff3 [vm] Add Reachability Fence Instruction
The reachability fence keeps a value alive and reachable.

Required for finalizers: https://github.com/dart-lang/sdk/issues/35770

Design: go/dart-ffi-finalizers (See "Premature Cleanup (Single Object)".)

Change-Id: I9742889f0f8d8b15bbcb5dca47f2a4231899dd59
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-mac-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136188
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2020-03-26 18:30:44 +00:00
Alexander Markov 5b131b60d7 [vm/corelib] Specify types explicitly in convert_patch.dart
This refactoring adds explicit types to convert_patch.dart where
they were previously omitted.

It was requested in https://dart-review.googlesource.com/c/sdk/+/140804/2/sdk_nnbd/lib/_internal/vm/lib/convert_patch.dart#522

Change-Id: If78240b4f9f9f4a58ba6b52c7fb6edc880b3de81
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140940
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-03-26 17:25:14 +00:00
Daco Harkes 4cec4fdc18 [vm/ffi] Mark Struct as entrypoint
Required so that we can access its slots in the compiler.

Issue: https://github.com/dart-lang/sdk/issues/36730
Change-Id: Ib14aa73f5cb6b713c682693f95841773b1b4e5d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141121
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2020-03-26 15:12:48 +00:00
Leaf Petersen a55e37289e Deprecate CastError.
CastError is deprecated.  See
 https://github.com/dart-lang/sdk/issues/40763 for details.

Change-Id: If00963e68987a259396c4b5a0cd6d703bc7ac76c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140885
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-03-25 19:41:03 +00:00
David Morgan f6d63899a5 Revert "[dart:io] Making OSError implements Exception"
This reverts commit ae392b8e00.

Reason for revert: Breaks package:flutter_tools, dead code in icon_tree_shaker.dart, which blocks google3 roll.

Original change's description:
> [dart:io] Making OSError implements Exception
> 
> Bug: https://github.com/dart-lang/sdk/issues/40934
> Change-Id: Icff457333bd570d81cdf9c3136ee4fe1cadfaae8
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139406
> Reviewed-by: Zach Anderson <zra@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Commit-Queue: Zichang Guo <zichangguo@google.com>

TBR=zra@google.com,asiva@google.com,zichangguo@google.com

Change-Id: Idc3a41173ba224d0a30fea3ef0f92d1211d9a63c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/40934
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140864
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
2020-03-25 11:54:50 +00:00
Erik Ernst 7d06e198c0 Performing the breaking change of SDK issue 40678
Change-Id: I785b0fb10abfda0dd9fc8670c5641127dd67fed7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140640
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-03-25 11:39:45 +00:00
Lasse R.H. Nielsen 8760283247 New implementation of runZoned.
A combination of `runZoned` and `runZonedGuarded` where only the latter allows an `onError` parameter,
and only that has a nullable return type.

Retains the `onError` parameter on `runZoned` for now because it's too breaking to remove it until packages have been migrated off of it.
It will be removed in a follow-up CL.

Change-Id: If0e86c8d14e13fa089c66f4af975aeacb2616cf6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137302
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2020-03-25 00:24:33 +00:00
Zichang Guo ae392b8e00 [dart:io] Making OSError implements Exception
Bug: https://github.com/dart-lang/sdk/issues/40934
Change-Id: Icff457333bd570d81cdf9c3136ee4fe1cadfaae8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139406
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2020-03-24 22:43:57 +00:00
Srujan Gaddam ed41036d2f [dart:html] Migrate NodeValidator fix to NNBD
Addresses failure in api_dynamic_test, and copies the
vulnerability fix from src to nnbd_src.

Closes https://github.com/dart-lang/sdk/issues/41158

Change-Id: Ic1c6766c066174f4d0504e429ed70f1ce0a487e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140645
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2020-03-24 00:46:55 +00:00
Kevin Moore 6a5d73dfe7 Address a vulnerability in node validator
Related to DOM clobbering of previousSibling

Change-Id: Ib4ed1cdba4217c351804b0689a999b73713f79ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140622
Auto-Submit: Kevin Moore <kevmoo@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-03-23 20:01:58 +00:00
Lasse R.H. Nielsen 8ab3dcf709 Make ArgumentError.check* functions return the valid argument.
This makes these checks useful in situations where you don't want to spend
an extra statement, like `=>` bodies or initializer lists (including
forwarding generative constructors).

Change-Id: Ia55b8741a7c75af631db48ac70e64597d8f96c73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135649
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2020-03-23 18:00:09 +00:00
Zichang Guo ed83a28d3e [dart:io] support Unix domain communications
Support Unix domain sockets communication on Linux, MacOS and Android.

Changes:
1. Add a field for InternetAddressType named unix.
2. Constructor of InternetAddress gains one more optional field: type. InternetAddress(String address, {InternetAddressType type});
3. Add another constructor to InternetAddress which taks raw address/path for ip/unix addresses as an argument. InternetAddress.fromRawAddress(Uint8List rawAddress, {InternetAddressType type});

The operation for unix domain sockets communication is basically the same as normal sockets except an InternetAddress with type unix should be passed.

Change-Id: I6a1135bbdd7f4e4fc745ccf8f95dec5272b6839b
Bug: https://github.com/dart-lang/sdk/issues/21403
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/125932
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-03-23 03:51:40 +00:00
Teagan Strickland a8d735e280 [vm/aot] Add VM entry point annotation to _CompactLinkedHashSet.
Without this, this class might get tree-shaken by the AOT compiler
despite being in the object store (linked_hash_set_class).

Fixes https://github.com/dart-lang/sdk/issues/40083

Change-Id: I8b3025283182280428d482999f2e6598419ee07c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139816
Commit-Queue: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-03-20 14:13:22 +00:00
Leaf Petersen 7aace6fa60 Make StackTrace generally not nullable in migrated NNBD library.
Bug: https://github.com/dart-lang/sdk/issues/40130
Change-Id: I13aba0c2a3fa5b1c3d3995f075ffd38f03aca897
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139880
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2020-03-19 23:31:30 +00:00
Zichang Guo e91e09d1e4 Revert "[dart:io] Fix hanging on zero-length datagram"
This reverts commit c326c587c5.

Reason for revert: Analyzer and Co19 test is broken.

https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket.appspot.com/8885365974080167440/+/steps/test_results/0/logs/new_test_failures__logs_/0

https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket.appspot.com/8885364415750725248/+/steps/test_results/0/logs/new_test_failures__logs_/0

Original change's description:
> [dart:io] Fix hanging on zero-length datagram
> 
> This is observed on Win and Linux.
> Here is a doc to explain the problem: https://docs.google.com/document/d/1ZzyBUMrDHLU6vNryjgSMJfUruOdpmTImtE_s2E0J8IQ/edit?usp=sharing.
> 
> Bug: https://github.com/dart-lang/sdk/issues/39910
> Change-Id: Ia961239f45615f14108bcd66043ac33d9a0a4abe
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137425
> Commit-Queue: Zichang Guo <zichangguo@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>

TBR=sortie@google.com,lrn@google.com,zra@google.com,asiva@google.com,zichangguo@google.com

Change-Id: Id84a7cafbc14d6353fa6af8e294e8b0c751a969f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/39910
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140009
Reviewed-by: Zichang Guo <zichangguo@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2020-03-19 23:05:59 +00:00
Zichang Guo 36496047b4 [dart:io] avoid http smuggling
Vulnerability problems in http.

1. Double Content-Length is allowed currently. Reject if Content-length has been written.

2. An int is use to record the size of chunk size(for chunked encoding). When int overflows, it represent a wrong number.

3. Content-Length and Transfer-Encoding header should not appear together.

4. Add a 8K size limit when parsing "method", "URI","Header field" and "Header value".

Bug: https://b.corp.google.com/issues/150476984, https://github.com/dart-lang/sdk/issues/25390
Change-Id: Id4a81093a86f090cd1047aff8817dcfec3aa3ec9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138266
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-03-19 21:02:38 +00:00
Zichang Guo c326c587c5 [dart:io] Fix hanging on zero-length datagram
This is observed on Win and Linux.
Here is a doc to explain the problem: https://docs.google.com/document/d/1ZzyBUMrDHLU6vNryjgSMJfUruOdpmTImtE_s2E0J8IQ/edit?usp=sharing.

Bug: https://github.com/dart-lang/sdk/issues/39910
Change-Id: Ia961239f45615f14108bcd66043ac33d9a0a4abe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137425
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-03-19 20:23:08 +00:00
Stephen Adams 37d1d69f61 [dart2js] Remove _CastError and Rti._check
CastError is deprecated and _TypeError now implements CastError, so
it is possible to remove the distinction in generated code.

All checks now go via Rti._as(x) to some _asXXXX method.

Change-Id: I4ce6735b6c904bcbc366de92ed149716caf9ae81
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139959
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2020-03-19 18:43:33 +00:00
Zichang Guo d8f5ca49c5 [dart:io] webSocket pingInterval doesn't close the connection
pingInterval api pages says, when pong is not received on time, the connection will be closed. But our implementation didn't follow the description.

Bug: https://github.com/dart-lang/sdk/issues/39469
Change-Id: Ic62b8ab0152997ac60b1b836d6a1587d9ce38131
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138760
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2020-03-18 19:51:19 +00:00
Nicholas Shahan a5704eaca3 [dartdevc] Throw TypeError instead of CastError
Remove all `_check()` calls as they are now identical to `as()`.

Fixes: #41008
Change-Id: I4e4dd1ff50840d3d1cbf0aae9b8cef0621016079
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139490
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-03-18 18:39:26 +00:00
Zichang Guo 6a5b87f92c [dart:io] Stop accessing http header with _add()
Several places adds HttpHeader with _add() instead of public add(). This skips some validation checks.

Bug: https://github.com/dart-lang/sdk/issues/40905
Change-Id: Ifcb16fcd40fb93914540f6bf09f476f621c36e15
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138860
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2020-03-18 18:10:55 +00:00
Mark Zhou 2fc27ffe22 [dartdevc] Making boolean conversion throw a TypeError.
Boolean conversion now throws a TypeError, not CastError. See:
* https://github.com/dart-lang/sdk/issues/40317
* https://github.com/dart-lang/sdk/issues/40763

Presubmit: https://critique.corp.google.com/#review/301195917

Change-Id: I76e8aa4a849eb519e47c80f1b4873032a05ad636
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139402
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2020-03-18 16:14:11 +00:00
Jonas Termansen 96cf889e6b [dart:io] Fix HeaderValue parsing, toString(), and support null values.
This is a breaking change. https://github.com/dart-lang/sdk/issues/40709

This change makes the HeaderValue parsing more strict in two invalid
edge cases, supports parameters with null values as a feature, and fixes
toString() so it always produces tokens or quoted-strings valid per RFC
7230 3.2.6.

The empty parameter value without double quotes (which is not allowed by
the standards) is now parsed as the empty string rather than null. E.g.
HeaderValue.parse("v;a=").parameters now gives {"a": ""} rather than
{"a": null}.

Invalid inputs with unbalanced double quotes are now rejected. E.g.
HeaderValue.parse('v;a="b').parameters will now throw a HttpException
instead of giving {"a": "b"}.

The HeaderValue.toString() method now supports parameters with null
values by omitting the value. E.g.:

  HeaderValue("v", {"a": null, "b": "c"}).toString()

now gives

  v; a; b=c

This behavior can be used to implement some features in the Accept and
Sec-WebSocket-Extensions headers.

Likewise the empty value and values using characters outside of RFC 7230
3.2.6 tokens are now correctly implemented by double quoting such values
with escape sequences. E.g.:

  HeaderValue("v",
      {"a": "A", "b": "(B)", "c": "", "d": "ø", "e": "\\\""}).toString()

now gives

   v;a=A;b="(B)";c="";d="ø";e="\\\""

The NNBD migration required making subtle changes to some dart:io
semantics in order to provide a better API. This change backports one of
these semantic changes to the unmigrated SDK so any issues can be
discovered now instead of blocking the future SDK unfork.

Change-Id: Iafc790e03b6290232cac71fe14f995ce0f0b036b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136620
Commit-Queue: Jonas Termansen <sortie@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-03-18 11:36:36 +00:00
Mayank Patke 80503ef26f [dart2js] Correctly handle T <: Object where T is an interface type.
Change-Id: Ib6e8c80cdf0e2ddb900a146296c24bef009d3a81
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139832
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2020-03-17 21:19:35 +00:00
Martin Kustermann a67aac8c6a Re-land "[vm/tfa] Convert named and optional parameters to required parameters where possible."
When performing protobuf-aware treeshaking, we may generate a kernel
file which will later be used in conjunction with a non-transformed
platform kernel. In this case signature shaking is unsafe.

The original revision is in patchset 1.

This reverts commit b59dad38df.

Change-Id: I1a85e42f245fcdbd821fa1f07b2e9966b8c2d958
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139100
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-03-17 19:54:05 +00:00
Lasse R.H. Nielsen ae19e68377 Backport the NNBD type change for the return of StreamSubscription.cancel.
Change-Id: I4167b63ba8f3bec40c30fb86764bc73fc683af08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135317
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2020-03-17 01:11:11 +00:00
Robert Nystrom a1f87c6962 Reland "Fail synchronously if null is passed as an error to async APIs."
This is a reland of bef363bfb7

Original change's description:
> Fail synchronously if null is passed as an error to async APIs.
> 
> The first patchset is Lasse's original changes.
> 
> Change-Id: Ic5f24bcfc0ef4e82edee68d61e015b095cb5916e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138605
> Reviewed-by: Leaf Petersen <leafp@google.com>

Change-Id: I142831dca5dc4ca266ded08d93cb427ad3fbde74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139683
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2020-03-17 00:39:31 +00:00
Mayank Patke 794d2eba4a [dart2js] Normalize X extends Never in generic functions.
Change-Id: I36ddb6514ab8bfc3af70568502ce83d1f7d84d6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139497
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-03-16 22:03:06 +00:00
Ben Konyi 2cfa00791a [ dart:http ] Update HTTP client request logging to use filterKey TimelineTask constructor
Change-Id: Id99e102c455fade1165f650a4bcc4f7589a7f398
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139685
Reviewed-by: Kenzie Schmoll <kenzieschmoll@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-03-16 19:38:51 +00:00
Ben Konyi 09f756b9a1 [ dart:developer ] Added filterKey optional parameter to TimelineTask constructors.
Providing `filterKey` will result in all timeline events associated with
the TimelineTask including a `filterKey` entry in their arguments map,
set to the value provided in the constructor. This will allow for a
consistent way for tooling to filter asynchronous timeline events.

Fixes https://github.com/dart-lang/sdk/issues/40861

Change-Id: I06d3f9c73f06c2ff0e495f1b6a57fcf357d625a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139312
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Kenzie Schmoll <kenzieschmoll@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-03-16 18:04:58 +00:00
Erik Ernst 330ec173a9 Add bool.hasEnvironment constructor and tests
Change-Id: I65ebfcb48bf46292d5ae611ecb7431e0666f753c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139286
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2020-03-16 11:17:58 +00:00
Sigmund Cherem 344e149a89 [ddc, dart2js] readd dart:mirrors
Technically almost no user of ddc should be able to reach this compile-time error if they are using webdev (it appears a couple users do invoke it directly, though).  Project sass demonstrated that users of dart2js can notice this breaking change.

Given that we are bundling many breaking changes for null-safety on the next release, it seems like making imports to dart:mirrors a compile-time error is not strictly necessary at this time.

One idea is to change this to a compile-time error in our tools when users opt-in their libraries or when they enable strong null-safety mode.

Change-Id: I7f12657eba508e2d071dda60087a21475a303d9f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139494
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2020-03-14 03:04:37 +00:00
Lasse R.H. Nielsen 468f9eb2f9 Backport changes to RuneIterator to non-NNBD SDK.
Change-Id: I02087a794cd731348f00e34eee8b154f80fe4c9a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135316
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2020-03-12 16:47:46 +00:00
Leaf Petersen 5e9be81d5e Make all CastErrors be TypeErrors.
This makes CastError implement TypeError, and changes all test
expectations to look for TypeError.  A followup CL will deprecate
CastError.

Bug: https://github.com/dart-lang/language/issues/787
Bug: https://github.com/dart-lang/sdk/issues/34097
Change-Id: I7102c6260901317572d2df08c4be9c4c48197688
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138670
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-03-11 23:31:06 +00:00
Mayank Patke 0af0cebfa6 [dart2js] Fix printing of Object* bounds.
Change-Id: Ic66ab8a7fbd8d9dba2e662222447c3034347ed6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139000
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2020-03-11 21:41:30 +00:00
Lasse Reichstein Holst Nielsen 9e10ef4458 Fix null-read in RegExpMatch.groupNames.
Fixes VM, DDC and Dart2js.

BUG= http://dartbug.com/39406

Change-Id: If181eaf50905c571614b656a232564e394e1b35d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136635
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Teagan Strickland <sstrickl@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2020-03-11 14:21:39 +00:00
Jonas Termansen 5ae4448779 [dart:io] Provide epoch timestamps in the FileStat notFound object.
This is a breaking change. https://github.com/dart-lang/sdk/issues/40706

The dummy object returned if FileStat.stat() and FileStat.statSync()
fail now contains Unix epoch timestamps instead of null for the
accessed, changed, and modified getters.

These timestamps are always non-null if the API succeeds and the
timestamps are meaningless when the API fails and returns the
FileSystemEntityType.notFound type. This change makes the timestamps
always non-null, which avoids all legitimate accesses needing a needless
null check when Dart becomes null safe. This change is consistent with
the mode and size getters that are initialized to non-null dummy values
when the API fail.

The NNBD migration required making subtle changes to some dart:io
semantics in order to provide a better API. This change backports one of
these semantic changes to the unmigrated SDK so any issues can be
discovered now instead of blocking the future SDK unfork.

Change-Id: Iff6b34d04b60f4c9f4cf8d9dd0679f721d142ba4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136585
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-03-11 13:39:13 +00:00
David Morgan a5bf30c401 Revert "Fail synchronously if null is passed as an error to async APIs."
This reverts commit bef363bfb7.

Reason for revert: Breaks google3 tests, see b/151204525.

Original change's description:
> Fail synchronously if null is passed as an error to async APIs.
> 
> The first patchset is Lasse's original changes.
> 
> Change-Id: Ic5f24bcfc0ef4e82edee68d61e015b095cb5916e
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138605
> Reviewed-by: Leaf Petersen <leafp@google.com>

TBR=leafp@google.com,rnystrom@google.com

Change-Id: Ie17c35e9d23c70a7aecd1ef292962154cf6f007d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138925
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
2020-03-11 10:07:49 +00:00
Zichang Guo be548e724e [dart:io] drain buffer within a single Read
Previous change on _NativeSocket::Read has a consequence of increasing the number of Read().
This change is to make Read() to drain as many bytes as possible to prevent Read event being posted again. But the side effect is that every single read() will become slower.

Bug: https://b.corp.google.com/issues/150902962
Change-Id: I58cc1e39ae598e2f1584da22d07ad1db3106bd39
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138909
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-03-11 03:12:49 +00:00
Robert Nystrom bef363bfb7 Fail synchronously if null is passed as an error to async APIs.
The first patchset is Lasse's original changes.

Change-Id: Ic5f24bcfc0ef4e82edee68d61e015b095cb5916e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138605
Reviewed-by: Leaf Petersen <leafp@google.com>
2020-03-10 23:42:43 +00:00
asiva e33d023fa0 [BUILD] - Format gn files, this is being done to ensure the unfork CL
doesn't show these formatting changes as diffs.

Change-Id: I69ccbf4adabc66d88371cece785a2c1bce60f133
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138962
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-03-10 21:56:11 +00:00
Alexander Markov 7e0139e0c0 [vm/corelib] Improve performance of list copying
With NNBD core libraries:
ListCopy.toList.100(RunTime) 4129 -> 2376 us.

With default core libraries:
ListCopy.toList.100(RunTime) 3006 -> 2140 us.

Issue: https://github.com/dart-lang/sdk/issues/40917
Change-Id: I7a319b6a150eeb5c4765c299dd45638bed2b4406
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138720
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-03-10 15:58:06 +00:00
Kaushlendra Pratap f1369d7896 Updated the invalid Example in num.dart
Closes #35400

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

GitOrigin-RevId: a147cc095cf414431c7c9749a6ea4f53139c02da
Change-Id: I3bbe858e4872be067abc710864fa130ac507ffa2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138792
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2020-03-10 00:00:25 +00:00
Ben Konyi b01cb58320 Revert "Re-land "[vm] Add type to _AsyncAwaitCompleter.start.""
This reverts commit 4049ab54e4.

Reason for revert: Appears to break standalone_2/dwarf_stack_trace_test and other related tests.

https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket.appspot.com/8886276259895791440/+/steps/test_results/0/logs/new_test_failures__logs_/0

Original change's description:
> Re-land "[vm] Add type to _AsyncAwaitCompleter.start."
> 
> We need to relax vm/dart/causal_stacks/async_throws_stack_no_causal_test
> 
> Change-Id: I40c08d432afeac839ce4f49bbf48c3707b23ef7f
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138804
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Samir Jindel <sjindel@google.com>

TBR=kustermann@google.com,sjindel@google.com,cskau@google.com

Change-Id: Ib77bdb5ba9927cf5a9a588570a5d70641e912aed
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138791
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-03-09 22:16:39 +00:00
Samir Jindel 4049ab54e4 Re-land "[vm] Add type to _AsyncAwaitCompleter.start."
We need to relax vm/dart/causal_stacks/async_throws_stack_no_causal_test

Change-Id: I40c08d432afeac839ce4f49bbf48c3707b23ef7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138804
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2020-03-09 19:23:20 +00:00
Mark Zhou 8fb4645cae [dartdevc] Adding nnbd semantics for static and late fields.
Fixes #40375

Change-Id: I53863291a8c6a3cc694d088311a9e09b9b00a790
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138723
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2020-03-09 19:15:49 +00:00
Mayank Patke 81c3208c10 [dart2js] Special case null is T.
Change-Id: Iec5212db2d4493797257753f9eaa63799d047253
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138574
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2020-03-06 21:33:53 +00:00
Lasse R.H. Nielsen 93ff9530aa Document difference between Stream.transform and Stream.map.
Fixes #36351

Bug: http://dartbug.com/36351
Change-Id: I75f98b8fdc3a34578adab96e9993089ea69e84bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98346
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2020-03-06 13:19:34 +00:00
Stephen Adams 8ae984c54a [dart2js] Use a Symbol to access JavaScript Array Rti
Use a JavaScript Symbol() for Array rti property. This makes the
property non-enumerable, avoiding making the property visible via
JS-interop.

The code is feature-tested so that IE11 still works with an enumerable
String property.

Bug: 40535
Change-Id: Ic8b64dac5751989fe4b8d023b0626c3db04676c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137245
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-03-06 01:20:31 +00:00
Nate Bosch 9d76737487 Remove support for --emit-metadata in DDC
This flag is unused and the behavior it enables was only useful along with
`dart:mirrors`.

- Remove the flag and the field on the options object.
- Prune code branches that are no longer reachable.
- Remove or inline some functions that became either empty or trivially small.
- Remove the manual check for a `dart:mirrors` import since this is handled by
  the CFE now.
- Remove references to the flag in tests.
- Remove test files which only existed to enable the flag for other tests.

Change-Id: I21bf594271fb4eeb5b73fcbf07da736e9e8d1f33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138018
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
Auto-Submit: Nate Bosch <nbosch@google.com>
2020-03-05 23:26:13 +00:00
Samir Jindel 1cf9d7a0c5 Revert "[vm] Add type to _AsyncAwaitCompleter.start."
This reverts commit 9983424a3c.

Reason for revert: Breaks vm/dart/causal_stacks/async_throws_stack_no_causal_test

Original change's description:
> [vm] Add type to _AsyncAwaitCompleter.start.
> 
> Without the type, the call to the the parameter f() was being handled
> as a dynamic InstanceCall (smiable), so we had a megamorphic call to one
> of the Closure_XXXX_call methods (there are many copies of this method
> for different signatures) which in turn calls the closure.
> 
> Now that the type is present, we do a direct ClosureCall to the target.
> 
> This gives a measurable improvement to an important internal benchmark.
> 
> Change-Id: Ia9429879f69257465a2537616d8f8595fb1eefa8
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138520
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Samir Jindel <sjindel@google.com>

TBR=kustermann@google.com,sjindel@google.com

Change-Id: I2deeebc24d80a7f444f4f53c5c8959b747fd1b29
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138502
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2020-03-05 17:52:44 +00:00
Samir Jindel 9983424a3c [vm] Add type to _AsyncAwaitCompleter.start.
Without the type, the call to the the parameter f() was being handled
as a dynamic InstanceCall (smiable), so we had a megamorphic call to one
of the Closure_XXXX_call methods (there are many copies of this method
for different signatures) which in turn calls the closure.

Now that the type is present, we do a direct ClosureCall to the target.

This gives a measurable improvement to an important internal benchmark.

Change-Id: Ia9429879f69257465a2537616d8f8595fb1eefa8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138520
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2020-03-05 16:51:44 +00:00
Mark Zhou db63e89fcf [dartdevc] Appending and checking nullability caches earlier for performance.
Because we cache on instances of type objects, all "type"-ish constructs in DDC must be pre-initialized if we want to avoid any hasOwnProperty checks (which are slow).

1) We now consult legacy/nullable caches earlier when wrapping types, as the downstream logic can be much slower than a lookup.

2) We cache on nullble and legacy wrappers themselves as well as just the underlying object (formerly we cached on just the latter) for faster lookups.

3) We attach local caches upfront, maintaining monomorphicity during hot code paths.

This improves regressions for opt-out worst-case tests from (120 us -> 2100 us) to (120 us -> 500 us) and weak mode tests from (120 us -> 1100 us) to (120 us -> 330 us).

Change-Id: I98a26064404e746162ca3feb22b0993c3b39e63c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138330
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-03-05 16:30:54 +00:00
Victor Lima b951498903 [vm/aot] Allow static methods to have unboxed args and return
Static methods and constructors may receive unboxed parameters.
This change adds a bitmap to the RawFunction object indicating
which parameters are unboxed and their types. Also, the stack frame
bitmap was updated to include new bits for those parameters.

The ArgumentsDescriptor object was updated to store not only the number
of arguments, but also their size, since 32-bit platforms would use two
words for each int64 and double value.

In addition, static methods that return non-nullable integers
and doubles may return these values unboxed.

Dart AOT x64:

TypedData.Uint8ClampedListViewVarBench  +11.73%
DeltaBlue                               +9.32%
Meteor (Intel Xeon)                     +4.64%

Flutter release android-armv8:

velocity_tracker_bench                  -2.32% (less is better)

flutter_gallery_readonlydata_size       +0.18%
flutter_gallery_total_size              +0.13%
flutter_gallery_instructions_size       +0.12%

Issue https://github.com/dart-lang/sdk/issues/33549

Change-Id: I97e310f8f30213920af2333fbdedf193d03db5c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135313
Commit-Queue: Victor Agnez Lima <victoragnez@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-03-05 15:17:04 +00:00
Mark Zhou c426b60da4 [dartdevc] Using hasOwnProperty instead of getOwnPropertyDescriptor.value.
getOwnPropertyDescriptor is significantly slower than hasOwnProperty, and we didn't seem to be using any behavior specific to the descriptor besides the value.

Change-Id: I3329177ee78a5ca823e554dd4f7b0bd26e1d5be0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138331
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-03-04 20:26:06 +00:00
Mayank Patke 6f4876849b [dart2js] Add flag to enable printing '*' on legacy types.
Change-Id: Ie0b191e6da39fa6e48601caeeadc492699f07045
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138326
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2020-03-04 20:22:26 +00:00
Mayank Patke 3c2a6c26e2 [dart2js] Erase '*' in runtime type objects.
Change-Id: Ieeb98b79cd03a81cacd10506c977e96306a6330b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137822
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2020-03-04 16:15:05 +00:00
Mayank Patke a0c3b4fedb [dart2js] Fix some types in NNBD SDK.
Change-Id: Ie401c5f6bae54f7394f5c30c7c1b9a28b70126dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137860
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-03-04 16:15:05 +00:00
Daco Harkes 54903e5bf0 [vm/ffi] Rename members in NativeApi to not contain nativeApi
Follow up of: https://dart-review.googlesource.com/c/sdk/+/136962

Change-Id: Icdc8e7f701b0dbc7e476a140e68bcb15b3ac64ae
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138283
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-03-04 15:21:55 +00:00
Régis Crelier 5701c4fd3b [VM/nnbd] Remove propagation of library mode to runtime after spec change.
On 1/27/20, the nnbd specification changed weak and strong mode instance checks
to make them behave uniformly across legacy and opted-in libraries.
Therefore, it is not necessary anymore to propagate the library mode in
generated code to the runtime.

Change-Id: I42d3ddc6e9a921899aeac21be6374c7893a6d27c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138111
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2020-03-03 20:30:32 +00:00
Nicholas Shahan ab30452db5 [dartdevc] Add normalization of FutureOr types
These changes are also being back ported into the existing SDK
with minimal differences that will be gone when we unfork the
dart:_runtime library. In the current back port:
* FutureOr<Null>? is normalized to Future<Null>* instead of
  Future<Null>?.
* There is no runtime normalization of FutureOr<T?>?. This
  should have no effect since nullable types can not yet
  appear.

Fixes: #40611, #40720
Change-Id: Ib3ddffbf3778f0f571cf95f58b6142d3ee0bf59b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136160
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-03-03 16:59:56 +00:00
Zichang Guo 0b819161d7 [dart:io] update return type of native calls
Some cleans up coming from https://dart-review.googlesource.com/c/sdk/+/136322.
Update some inaccurate return types of native calls.
Also update null checks for resourceInfo with nnbd flavor.

Change-Id: I937f204e5cd8331df454c81d58e5893be616862e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137140
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-03-02 18:06:32 +00:00
Srujan Gaddam 5b23373f7e Modify fields in some abstract and native classes
Since we transitioned to natives for dart:html, manually written native
fields should be rewritten. Similarly, if there are fields in abstract
classes that represent interfaces, they should be converted. Fields in
abstract classes that are used in that class are left alone.

Change-Id: I924363639a4430b88b810b7348815bbc3f040e7c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137642
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2020-02-29 01:29:35 +00:00
Srujan Gaddam 9f79dfc37d Address analyzer errors in golden files in dart:html
New analyzer errors are reported for dart:html around nullability.
Non-nullable fields are translated to native getters and setters if part
of a concrete class and normal getters and setters if abstract.

Change-Id: I2fd87803a08872b2a7eae4de0af704f184997c7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137481
Reviewed-by: Stephen Adams <sra@google.com>
2020-02-29 01:29:35 +00:00
Srujan Gaddam 80f84e1942 Change all fields to native getters/setters
Bug: https://github.com/dart-lang/sdk/issues/40772

Attributes are translated to native getters and setters regardless of
NNBD. Some logic was removed for fields that no longer apply due to this
change.

Change-Id: Ia1a05778ff8c6f082506a1c95a3057a7c5f7f896
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136880
Reviewed-by: Stephen Adams <sra@google.com>
2020-02-29 01:29:35 +00:00
Daco Harkes f7192b63cb [vm/ffi] Expose dart_native_api.h symbols via dart:ffi
This enables dynamic linking of the symbols in dart_native_api.h to work around the Windows linking issue and Dart embedders not exposing symbols.

Issue: https://github.com/dart-lang/sdk/issues/40607
Closes: https://github.com/dart-lang/sdk/issues/40564

Change-Id: I6f797cc915b53ec63fa5953529f17c40e52a2aed
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136962
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-02-28 18:44:45 +00:00
Mayank Patke e1f2fea5a4 [dart2js] Use NNBD types in TYPE_REF and add LEGACY_TYPE_REF.
Change-Id: I23c6ce55fabb53bf12bb92fedc9bd1338f06f03d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137734
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2020-02-28 18:24:55 +00:00
Nicholas Shahan 15b6f19008 [dartdevc] Allow mutual subtypes in type argument bounds
Back-porting a breaking change for Null Safety to the existing SDK to
help front load any issues (we expect them to be minimal).
https://github.com/dart-lang/sdk/issues/40633

We are now allowing the type argument bounds in generic function
subtypes to differ if the bounds are mutual subtypes.

Change-Id: I2b093c08f772a1b866dbe1324b605e6143d3a0b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137289
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-02-27 23:35:53 +00:00
Mayank Patke a6ad1915eb [dart2js] Give TYPE_REF a return type.
Change-Id: Iaa49426d7a938ef5b9de6df6a04a0c101d63084a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137684
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2020-02-27 22:03:33 +00:00
Mayank Patke 01064e7b6c [dart2js] Migrate DartTypes to use a wrapper representation for
nullability instead of a field/getter.

Change-Id: I2ca61d1b3a789f2ee4f34a99f66ae237bf9687ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137283
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-02-27 09:08:47 +00:00
Alexander Aprelev 305399c15c [vm/vmservice] Validate getIsolate response before attempting to retrieve pauseEvent from it.
Bug: b/150193047
Change-Id: I6e8f8e27ef2a9894138b1d877597ad3a5f3f9e61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137281
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-02-25 23:19:44 +00:00
Zichang Guo 94009bf980 [dart:io] issue another read in _NativeSocket.read to drain pipe
if NativeSocket.read() has not specified `len`, I will expect caller wants all bytes(this is not documented, correct me if I'm wrong).

Check the available bytes after read(), if there are leftover, issue another read(). This will eventually drain the pipe.

Bug: https://github.com/dart-lang/sdk/issues/40589
Change-Id: I3b0be9ef8258defd1f71f85b3154702401e0f31c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136322
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Zichang Guo <zichangguo@google.com>
2020-02-25 18:40:21 +00:00
David Morgan b59dad38df Revert "[vm/tfa] Convert named and optional parameters to required parameters where possible."
This reverts commit 9ab51b8012.

Reason for revert: Test failure in google3; please see internal b/150195057.

Original change's description:
> [vm/tfa] Convert named and optional parameters to required parameters where possible.
> 
> Flutter Gallery code size (total):
> ARM64: -2.31%
> ARM32: -2.38%
> 
> Change-Id: Ide7764afb06bf6f8387015de612cd4798b301541
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135305
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

TBR=alexmarkov@google.com,sjindel@google.com

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

Change-Id: Ib198c7cf265384c336d9db6776742db23fb4e999
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137102
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: David Morgan <davidmorgan@google.com>
2020-02-25 15:12:01 +00:00
Jaime Wren 52472a4e10 Add dartdev as a pkg/ utility that should have a snapshot generated and added in the Dart SDK
The formatting churn is from being prompted with the required `git cl format` command

Change-Id: Ic2582f720e30f5d9a35fad05709455dad1068ad6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136842
Commit-Queue: Jaime Wren <jwren@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2020-02-25 07:16:10 +00:00
Vijay Menon b5a08c916c [dartdevc/nnbd] fix null checks in primitive casts
These should go through the `cast` operation to fail in strong and pass with warning in weak.

Change-Id: I1863b507835c0c9993357318b9e7038154e47151
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136902
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
2020-02-24 21:42:58 +00:00
Zichang Guo 95b2b8c43b [dart:io] Set isDirectory to false for filesystem delete event
According to the `FileSystemEvent` api page, isDirectory should always be false for delete events.

Bug: https://github.com/dart-lang/sdk/issues/35032
Change-Id: Ic277aa366db09c016979350d7369e004f9a8a152
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136405
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2020-02-24 17:10:55 +00:00
Samir Jindel 9ab51b8012 [vm/tfa] Convert named and optional parameters to required parameters where possible.
Flutter Gallery code size (total):
ARM64: -2.31%
ARM32: -2.38%

Change-Id: Ide7764afb06bf6f8387015de612cd4798b301541
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135305
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-02-24 14:09:27 +00:00
Lasse R.H. Nielsen 98b4635aa9 Make TypeError no longer implement AssertionError.
This means that TypeError no longer inherits a spurious `message` member.
The message of a platform-thrown TypeError is still available as `toString()`.

Fixes #40317

Bug: http://dartbug.com/40317
Change-Id: I77312859ebae3f92c2e56aeea6283b075b71c8d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136129
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2020-02-21 14:02:57 +00:00
Srujan Gaddam a42c072017 Remove unnecessary null check in getPropertyValue
CSSStyleDeclaration.getPropertyValue returns a non-nullable string.
It will also return an empty string if the property is not found. Since
getPropertyValue returns the value of the native getPropertyValue, the
null check should be removed.

Change-Id: I9846553d3f9fcd68cbd15b9c39d2104cab594b7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136413
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2020-02-20 20:49:26 +00:00
Alexander Markov 87f63c3573 [nnbd/vm/corelib] Fixes in VM core libraries for NNBD strong mode
These fixes allow "hello world" to run in NNBD strong mode on the VM.

Change-Id: I3c17b8e1b7ab64086d830298ef8f7601bf1acb68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136706
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-02-20 20:23:25 +00:00
Jonas Termansen 0683e9273d [dart:io] Throw StateError in meaningless getters on detached processes.
This is a breaking change. https://github.com/dart-lang/sdk/issues/40483

The Process class will now throw a StateError if the process is detached
upon accessing the exitCode getter. It now also throws when not
connected to the child process's stdio upon accessing the stdin, stdout,
and stderr getters. Previously these getters would all return null.

The getters in question are meaningless for detached processes and there
is no reason to use them in that case. To provide a better experience
when Dart becomes null-safe, these getters are changed to throw and
never return null, which avoids all legitimate uses of the getters from
needing a null check that will never fail.

The NNBD migration required making subtle changes to some dart:io
semantics in order to provide a better API. This change backports one of
these semantic changes to the unmigrated SDK so any issues can be
discovered now instead of blocking the future SDK unfork.

Change-Id: I776e0dc8bcd517d70332c60dd8ab88db17746aa5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134329
Commit-Queue: Jonas Termansen <sortie@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-02-20 13:18:38 +00:00
Srujan Gaddam 59370f29c5 Fix html methods without returns
Several method bodies did not return a value conditionally or at all.

Change-Id: I01ca87e2e0501597bacb49bcddd10668b59026b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135626
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-02-19 20:43:34 +00:00
Daco Harkes 953377a1fc [vm/ffi] Change internal loads and stores to take no type arguments
Change-Id: Iab7131b5a61282470f339df81b339ceb4fe75962
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136183
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-02-18 12:16:16 +00:00
Daco Harkes 01f4479372 [vm/ffi] Change internal loads and stores to take byteOffesets
Change-Id: Iaff7aa9f158b3b168ccf2d7014a43b08afaa448e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136182
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-02-18 12:16:16 +00:00
Daco Harkes 493779a0e0 [vm/ffi] Size of intptr as getter instead of final field for inlineing
Change-Id: I1bc7ceb06a84e9023c29fdd6255dbfb48c3490fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136181
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-02-18 12:16:16 +00:00
Daco Harkes 3c9f52a499 [vm/ffi] Fix DynamicLibrary extension name
And add changelog entry.

Follow up of: https://dart-review.googlesource.com/c/sdk/+/135463

Closes: https://github.com/dart-lang/sdk/issues/35903
Closes: https://github.com/dart-lang/sdk/issues/40636

Change-Id: I877f735c54e466031715c775d37544617402f9ff
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-kernel-nnbd-linux-release-x64-try,analyzer-linux-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136124
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-02-17 14:55:25 +00:00
Mayank Patke 174c4323ca [dart2js] Fix isLegacyObjectType in RTI.
Looks like this got mixed up due to a bad rebase/merge.

Change-Id: I566acf5a84755cb26fb7b3283a227196cce68d4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136061
Auto-Submit: Mayank Patke <fishythefish@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2020-02-15 00:56:50 +00:00
Zichang Guo d39cdf03f8 Reland [dart:io] Stop forcing lower case on HttpHeaders
This is a breaking change. Request: https://github.com/dart-lang/sdk/issues/33501

HttpHeaders use lowercase by default for all headers, since it is supposed to be case insensitive. Some servers incorrectly treat case as significant, however, and expect headers with capitalization or in uppercase. The current implementation forces headers to be lower cases when adding values. Users cannot even manually modify the headers.

This change removes this restriction here so that users can modify the headers to whatever form they want. The new behavior is backwards compatible except if class was implemented. All headers inside http.dart are written as lower cases, adding values to HttpHeaders is still receiving lower cases input.

The other cl (https://dart-review.googlesource.com/c/http_multi_server/+/121411) migrates multi_headers.dart to be compatible with this change.

Bug: https://github.com/dart-lang/sdk/issues/33501
Change-Id: Ieb9f4061b27ed3bbc6d82e6a408c77d11abb037b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135357
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-02-14 22:23:17 +00:00
Daco Harkes c1467ab5d3 [vm/ffi] Change asFunction and lookFunction to extension methods
This prevents them from being called dynamically.
Moreover, it prevents asFunction from being called on a non-NativeFunction type argument, simplifying the amount of manual checks.

Note that this CL had to change the CFE and analzyer, and their tests (including mock_sdk) as well.

This can potentially be a breaking change, as the extension methods are only visible when `dart:ffi` is imported, while methods on objects are always visible.

Issue: https://github.com/dart-lang/sdk/issues/35903

Change-Id: I1e291f154228d5d9a34b21a022088bf493f6557d
Cq-Include-Trybots: luci.dart.try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-abi-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-mac-debug-x64-try,analyzer-nnbd-linux-release-try,dart2js-nnbd-linux-x64-chrome-try,ddc-nnbd-linux-release-chrome-try,front-end-nnbd-linux-release-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-nnbd-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135463
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-02-14 15:46:37 +00:00
Mayank Patke 989180af3e [dart2js] Add normalization to RTI.
Change-Id: Ieecb90fbc6fdf13a44373d285fc5da450a9876b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134960
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-02-14 01:59:12 +00:00
Mayank Patke 573f470615 [dart2js] Represent nullability as a field.
Change-Id: I12f4c7acfa294b0e92d3f94f7099ffa2aa9cc0a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134792
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-02-14 01:59:12 +00:00
Nate Bosch 43bbf73da3 Update doc comments for dart:js_util
- Format consistently with a header sentence.
- Use `JavaScript` over `JS`, and surround references to the `@JS()`
  annotation with backticks.
- Drop the word "efficiently" since it isn't true of the more commonly
  used API `jsify`.
- Add a note about preferring `@anonymous` interop classes over `jsify`
  with a map.
- Remove mention of `JsObject` since this isn't what gets returned.
- Clarify that Dart objects can't be used from JavaScript, this is
  mentioned at the library level but it worth repeating on `jsify`.

Change-Id: If7582db6440d96f20bb5b4e11bcc0ffe047d9d0a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135525
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Kathy Walrath <kathyw@google.com>
2020-02-13 01:41:41 +00:00
Zichang Guo 91eee195fc [http] loosen status code constraints and rephrase some http exceptions
1. Remove limitation of http response status code check. It used to be [100, 599]. Extends range to [0, 999] to allow users to use customized status code.
2. Rephrase some http exceptions to be more informative.
3. Possibly a bug in isHead setter, where it is only allowed to set to true.

Bug: https://github.com/dart-lang/sdk/issues/38898
Change-Id: I77d8d66eb8333dec1f53742821860b802f74f680
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134763
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2020-02-12 22:21:57 +00:00
Joshua Litt 60295a2cef [dart2js] Migrate async_patch.dart to nnbd.
Change-Id: I11a78e5f085e0121a7bdd34de7ab92bddca44f60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135480
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2020-02-12 20:09:47 +00:00
Zichang Guo e0621b65b2 [nnbd] Stop writing chunked into headers
There are some tests failed after switching to NNBD. This is supposed to fix HttpException: Connection closed while receiving data.

It reduced the number of failure from 300 to 70.

The root cause is that HttpHeaders write {Transfer-Encoding: chunked} into _header field once user set it to true. However, when user tried to flip the bit,
remove() function didn't remove the content. This leads to an additional property in header. Parser alarmed when parsing it.

This is inconsistency on how others handle chunked transfer encoding. Looking at add(), set() and remove() implementation, all of them will only set _chunkedTransferEncoding instead of actually touching _header.

Bug: https://github.com/dart-lang/sdk/issues/40534
Change-Id: I80d76f3a6da01022fdb8e755e0def8a630ca376a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135353
Commit-Queue: Zichang Guo <zichangguo@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-02-12 19:36:47 +00:00
Srujan Gaddam e2ff83724b Fix nullability for some templates
Addresses discrepancies between IDL and template files for some
operations. There's probably more I'm missing since this was
from a cursory check through all the templates.

Change-Id: Id79710b343f4a5fe0b5529f64c341d4f63d69b9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135222
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2020-02-11 20:28:54 +00:00
Nicholas Shahan 855309a1dd [dartdevc] Delete patch files for mirrors library
Cleanup special handling for annotations required by pageloader/mirrors
use case that is now fully unsupported.

Should not be submitted until the removal of the libraries has landed
in flutter web.
https://github.com/flutter/engine/compare/master...vsmenon:vsm-mirrors

Change-Id: I00dbdc8e185a9c3e0585d030f670c1d5a4c77395
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134889
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-02-11 17:02:11 +00:00
Alexander Markov 61b2d6a9a7 [nnbd/corelib] Restore null check in DateTime._withValue constructor
The null check in DateTime._withValue is needed to be backwards
compatible with legacy code which might still call DateTime
constructors with isUtc == null.

Fixes co19_2/LibTest/core/DateTime/DateTime.fromMillisecondsSinceEpoch_A02_t01
failing test after unforking SDK.

Change-Id: I5394a25d0c6a5be41cad984f98e1cf56f400106e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134869
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-02-11 15:38:51 +00:00
Lasse Reichstein Holst Nielsen 76b18c455e Make DoubleLinkedQueue.firstEntry/lastEntry nullable again.
It was migrated to null-safety by throwing, but that's an unnecessary breaking change.

Change-Id: I92c21d7518bf7c291b333b33a04eb4b21b7cc210
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134725
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2020-02-11 06:59:11 +00:00
Nicholas Shahan 905a154f59 Remove import of dart:mirrors from dart:html
This probably should have been part of
https://dart-review.googlesource.com/c/sdk/+/134405 and I suspect it
caused no failures because the import was unused.

Change-Id: I418448ddef5d50267a89ae183f215fded56a425e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134863
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-02-11 01:04:55 +00:00
Srujan Gaddam 5e74472449 Handle optionals in DOM scripts for NNBD
Optionals were being ignored for some methods and for optionals that
have a default of Undefined or None, they should be marked nullable in
Dart syntax regardless of whether they are in the IDL.

Change-Id: Icc71300dc7d8e06fef640a5ca8d502b093c0580c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134765
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-02-10 22:26:35 +00:00
Srujan Gaddam 8c0d72db1d Fix how composedPath is called
Bug: b/149075352

Event.path should call composedPath if the result of the inline is
True. As it is, it only calls it if the result is null, which is
erroneous.

Change-Id: Idacc9ccddafc4374aca10de84265bf82cfbd0ab9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134887
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-02-07 23:25:22 +00:00
Ryan Macnak a73b0ceda2 [vm, lib] Teach mirrors about the Never type and member signatures.
Bug: https://github.com/dart-lang/sdk/issues/12478
Bug: https://github.com/dart-lang/sdk/issues/40497
Bug: https://github.com/dart-lang/sdk/issues/40510
Change-Id: I841d7e239b8235555ec26fbcb74ca41b5de60f58
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134806
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-02-07 20:57:46 +00:00
Nicholas Shahan 35cd61819a Remove dart:mirrors library from dart2js and ddc SDKs
A followup change will delete the patches that are no longer needed once
these changes have been "mirrored" :P to the libraries files in the
flutter repos.

Change-Id: I7d255838b97922198248b29311facd4956001e25
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134405
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-02-07 17:34:54 +00:00
Srujan Gaddam dae60008ab DOM script changes to handle nnbd
-Adds field for type nullability for IDL operations
-Adds field for conversions to reflect input and output type nullability
--based on implementation
-Corrects generic object types to include nullability
-Changes 'any' types to dynamics
-Adds nullability to types in various operations
-Converts finals and non-initialized non-nullable fields to getters and
setters
--TODO: convert these to native instead of JS inline
-Modifies nullability for annotations and removes annotations from
setters

Change-Id: Iab19830fd1d7f37b170a4da8672f922c3f9b0863
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132967
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-02-07 01:05:14 +00:00
Srujan Gaddam 3776313e65 Change dart:html templates to generate null-safe code
Introduces NULLASSERT token and NNBD condition to allow code to
conditionally compile with NNBD.

Change-Id: Ib71e439f32c793e69b66c328cd7c9900358d886e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134045
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-02-06 23:18:24 +00:00
Sigmund Cherem eb54b5bb9b Formatting changes to dart:_native_type_data to make dart2js and ddc more similar.
Mostly changes to the comment syntax, removing optional `new`, and using the
same kind of quotes on strings.

Change-Id: Ia6d7f38523312f67cfa30cd30cef994759d40ef1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134480
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2020-02-05 19:34:59 +00:00
Sigmund Cherem 20745941ad [ddc,dart2js] make dart:typed_data the same in dart2js and ddc and opt-in to null safety.
Change-Id: If325a2ea11afef1d784fd01830999d5a4c9d4daf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134049
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2020-02-05 19:29:10 +00:00