Make a private field typed to avoid an unnecessary dynamic call in the error handler for a stream. Also remove an unused private member found in passing.
Change-Id: I29ebba5a3818a4c24df436e504d159731fd6531e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241243
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Leaf Petersen <leafp@google.com>
This reverts commit 438c1ed2ba.
Reason for revert: b/231617607 and b/230945329.
Will reland after b/230945329 is addressed.
Original change's description:
> [vm] Only call `.hashCode` once when adding to `Map` and `Set`
>
> The methods to add to hash maps and hash sets are recursive: if the
> index needs to be rehashed then the same method is called again after
> rehashing.
>
> This CL nests the actual implementation in a private method that takes
> the full hashCode as an extra argument.
>
> No significant code size or run time changes are reported on our
> benchmarks. (Our benchmarks do not contain purposefully slow hashCodes.)
>
> Note that hashCode can be called again later if rehashing of the index
> is required on adding subsequent elements.
>
> Bug: https://github.com/dart-lang/sdk/issues/48948
> Change-Id: Ia3ccff9e592d675b4922ac78c4aa7ee0287ecb50
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243623
> Reviewed-by: Martin Kustermann <kustermann@google.com>
> Commit-Queue: Daco Harkes <dacoharkes@google.com>
TBR=kustermann@google.com,dacoharkes@google.com
Change-Id: I214251b65ea89e7f729564a125e226f2e6d580c0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/48948
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243900
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
The methods to add to hash maps and hash sets are recursive: if the
index needs to be rehashed then the same method is called again after
rehashing.
This CL nests the actual implementation in a private method that takes
the full hashCode as an extra argument.
No significant code size or run time changes are reported on our
benchmarks. (Our benchmarks do not contain purposefully slow hashCodes.)
Note that hashCode can be called again later if rehashing of the index
is required on adding subsequent elements.
Bug: https://github.com/dart-lang/sdk/issues/48948
Change-Id: Ia3ccff9e592d675b4922ac78c4aa7ee0287ecb50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243623
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
This will be used to analyze the unpatched SDK. The file contains only
the major and minor part of the version number. The patch version will
always be 0. This is sufficient for the analyzer to construct a language
version.
Change-Id: Ief71ce617b279f7c688e9068c425bc31394cbf5f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243660
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
This null char is inserted by _toNullTerminatedUtf8Array, and right
below that function is _toStringFromUtf8Array, which does the opposite.
But _toStringFromUtf8Array is currently dead code, so it looks like the
intent was always to use _toStringFromUtf8Array for this, and the fact
that utf8.decode was being used instead is just a mistake.
Bug: https://github.com/dart-lang/sdk/issues/34885
Change-Id: I1404c7783b055902b256176aa61971c0d6969f5e
Fixes: https://github.com/dart-lang/sdk/issues/34885
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243103
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
This will allow to remove the `.packages` file from the bots. See
for reference Jonas change here: https://dart-review.googlesource.com/c/sdk/+/240842
Change-Id: Ic4ec8d6192533756e0c7642240eea918e790f67f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243360
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
This situation was flagged as invalid by the kernel verifier.
Change-Id: I549e6fbb838e301f2a4c0f6203028ee03caa5c41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243261
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Users are getting confused by `allocate` and `call` in the `Allocator`s.
This CL clarifies the behavior by extending the documentation.
Unfortunately, we cannot expose the actual implementation of `call`. All
calls to `sizeOf<T>()` must have `T` as compile-time constants. So,
instead of `call` having a body in Dart, all call-sites get the behavior
inlined (`x.call<Int32>(3)` is transformed to
`x.allocate<Int32>(sizeOf<Int32>() * 3)`).
Change-Id: Ife169095d1648e9a353f3a4b75c9aff954bc04a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242800
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Add an example to `WeakReference` and `NativeFinalizer`. `Finalizer`
already contained an example.
Cross-link between `Finalizer` and `NativeFinalizer`.
Make the examples pass all the checks and enable syntax highlight in
VS Code again (https://github.com/dart-lang/sdk/issues/48926).
Change-Id: I54cc213fa3bbe7bf8f872ccfee9770fb36b96ab4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242873
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
The new implementation moves away from desugaring of async
functions on kernel AST, state machine generated in the flow graph and
capturing all local variables in the context.
Instead, async/await is implemented using a few stubs
(InitSuspendableFunction, Suspend, Resume, Return and
AsyncExceptionHandler). The stubs are implemented in a
platform-independent way using (macro-)assembler helpers.
When suspending a function, its frame is copied into a SuspendState
object, and when resuming a function it is copied back onto the stack.
No extra code is generated for accessing local variables.
Callback closures are created lazily on the first await.
Design doc: go/compact-async-await.
Part 1 (kernel): https://dart-review.googlesource.com/c/sdk/+/241842
TEST=ci
Issue: https://github.com/dart-lang/sdk/issues/48378
Change-Id: Ibad757035b7cc438ebdff80b460728b1d3eff1f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242000
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Some JS functionality is only exposed through operators, such as
implicit type conversions and BigInt arithmetic. Other than requiring
some minor additions for the exponentiation (`**`) operator, supporting
these through `dart:js_util` is trivial.
Change-Id: I010674303e4f99b42d43b73095de69b8ddcdeb47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242680
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
This fixes an issue where VM would run the async* generator after a
`yield` / `yield*` even though the subscription may be paused or
cancelled.
Furthermore this fixes an issue where `StackTrace.current` used
in async* generator crashes VM and/or produces truncated stack
trace.
This fixes the following existing tests that were failing before:
* co19/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_t08
* co19/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_t09
* co19/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_t10
* language/async_star/async_star_cancel_test
* language/async_star/pause_test
New in reland: Allow the generator to to cause cancelling it's own consumer.
This addresses the issue of original revert
-> see https://github.com/flutter/flutter/issues/101514
Issue https://github.com/flutter/flutter/issues/100441
Issue https://github.com/dart-lang/sdk/issues/48695
Issue https://github.com/dart-lang/sdk/issues/34775
TEST=vm/dart{,_2}/causal_stacks/flutter_regress_100441_test
Change-Id: I091b7159d59ea15fc31162b4b6b17260d523d7cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242400
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
This avoids json encoding that was otherwise happening even in product mode. JSON encoding shows up CPU profiling as taking significant time, particularly on low end devices.
TEST=runtime/observatory/tests/service/developer_extension_test.dart
Bug: https://github.com/dart-lang/sdk/issues/48860
Change-Id: I2cf4d949e85c0b23de01ec2033b04527d40c76fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242081
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Dan Field <dnfield@google.com>
The `toString` used the sign of `hours` to get a leading `-`
when the duration is negative. However, a negative duration of
less than one hour would therefore miss out on the sign,
because `-0` is not an integer.
Now handles sign explicitly.
Fixes#48841.
Change-Id: I0ab6d451faf1c76b838fc35a692f07c5b035d2a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241748
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
This fixes https://github.com/dart-lang/sdk/issues/48848
When the base URI is just a filename, then base was empty, and we accidentally
added a / in the first position. This made the deferred URI absolute by
mistake.
Change-Id: I4d6a773f6ef8bfefbbf61417bfe7c005aa5e63ea
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241990
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Adds an experimental `@trustTypes` annotation which can be used during
migration to static interop to preserve the older semantics for JS interop.
Change-Id: Ic00a6c968b15f8c8f5d0840b82db5a6670eaf0eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241362
Reviewed-by: Riley Porter <rileyporter@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
Having first-class Wasm function references makes it possible to call
JS function objects directly from Dart, and to call some Dart functions
(static functions with no optional parameters and no type parameters)
from JS as function objects.
Change-Id: I1c788338d418c8857493ec76560d74fdd17d5dd2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241001
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Apaprently the landing of the previous DartDoc introduced an error
in the DartDoc process.
Removing the entire comment doesn't change that, so I'm not sure
where the actual error is.
Anyway, this fixes the links that weren't working,
and it adds a missing `Since` annotation at the same time.
Change-Id: I92ac23a32ccc9ddbaf9a708b21fe3521c4103513
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241011
Commit-Queue: Lasse Nielsen <lrn@google.com>
Auto-Submit: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
It's been described as "thoroughly incomprehensible".
Hopefully the incomprehensivity is now mostly superficial.
Change-Id: Id46fa20934ad340db8f485f138fb895b9dee176a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/241003
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
This reverts commit 837ee17b43.
Reason for revert: Please see https://github.com/flutter/flutter/issues/101514
Original change's description:
> [vm] Fix some async* semantics issues: Only run generator if there's active subscription (not paused/cancelled)
>
> This fixes an issue where VM would run the async* generator after a
> `yield` / `yield*` even though the subscription may be paused or
> cancelled.
>
> Furthermore this fixes an issue where `StackTrace.current` used
> in async* generator crashes VM and/or produces truncated stack
> trace.
>
> This fixes the following existing tests that were failing before:
>
> * co19/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_t08
> * co19/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_t09
> * co19/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_t10
> * language/async_star/async_star_cancel_test
> * language/async_star/pause_test
>
> Issue https://github.com/flutter/flutter/issues/100441
> Issue https://github.com/dart-lang/sdk/issues/48695
> Issue https://github.com/dart-lang/sdk/issues/34775
>
> TEST=vm/dart{,_2}/causal_stacks/flutter_regress_100441_test
>
> Change-Id: I73f7d0b70937a3e3766b992740fa6fe6e6d57cec
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239421
> Reviewed-by: Lasse Nielsen <lrn@google.com>
> Commit-Queue: Martin Kustermann <kustermann@google.com>
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: Ic3d9c0508310a33a2aaee67860c0bb2ec83bab4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240506
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
This fixes an issue where VM would run the async* generator after a
`yield` / `yield*` even though the subscription may be paused or
cancelled.
Furthermore this fixes an issue where `StackTrace.current` used
in async* generator crashes VM and/or produces truncated stack
trace.
This fixes the following existing tests that were failing before:
* co19/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_t08
* co19/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_t09
* co19/Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_t10
* language/async_star/async_star_cancel_test
* language/async_star/pause_test
Issue https://github.com/flutter/flutter/issues/100441
Issue https://github.com/dart-lang/sdk/issues/48695
Issue https://github.com/dart-lang/sdk/issues/34775
TEST=vm/dart{,_2}/causal_stacks/flutter_regress_100441_test
Change-Id: I73f7d0b70937a3e3766b992740fa6fe6e6d57cec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/239421
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>