Reland "[vm] More efficient 'await' of not Future and completed _Future" This is a reland of commit 6b3d1752fad1a2980e8c51ef6033d98061362a04 Fixes b/235734143 TEST=runtime/tests/vm/dart/await_in_custom_zone_test.dart Original change's description: > [vm] More efficient 'await' of not Future and completed _Future > > When awaiting a value which is not a Future or a completed > built-in _Future, 'await' implementation can bypass heavyweight > _Future/_FutureListener machinery and schedule micro-tasks directly. > > Benchmarks: > JIT, x64: > AsyncLiveVars.* +46-54% (bigger is better) > Calls.AwaitAsyncCall -46% (less is better) > Calls.AwaitAsyncCallInstanceTargetPolymorphic -46% > Calls.AwaitAsyncCallClosureTargetPolymorphic -45% > Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -45% > Calls.AwaitFutureOrCall -60% > Calls.AwaitFutureOrCallInstanceTargetPolymorphic -60% > Calls.AwaitFutureOrCallClosureTargetPolymorphic -59% > > JIT, ia32: > AsyncLiveVars.* +43-52% (bigger is better) > Calls.AwaitAsyncCall -42% (less is better) > Calls.AwaitAsyncCallInstanceTargetPolymorphic -42% > Calls.AwaitAsyncCallClosureTargetPolymorphic -41% > Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -39% > Calls.AwaitFutureOrCall -55% > Calls.AwaitFutureOrCallInstanceTargetPolymorphic -54% > Calls.AwaitFutureOrCallClosureTargetPolymorphic -53% > > JIT, arm: > AsyncLiveVars.* +64-71% (bigger is better) > Calls.AwaitAsyncCallInstanceTargetPolymorphic -51% (less is better) > Calls.AwaitAsyncCallClosureTargetPolymorphic -47% > Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -48% > Calls.AwaitFutureOrCall -64% > Calls.AwaitFutureOrCallInstanceTargetPolymorphic -64% > Calls.AwaitFutureOrCallClosureTargetPolymorphic -59% > > JIT, arm64: > AsyncLiveVars.* +65-78% (bigger is better) > Calls.AwaitAsyncCall -51% (less is better) > Calls.AwaitAsyncCallInstanceTargetPolymorphic -51% > Calls.AwaitAsyncCallClosureTargetPolymorphic -50% > Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -49% > Calls.AwaitFutureOrCall -69% > Calls.AwaitFutureOrCallInstanceTargetPolymorphic -68% > Calls.AwaitFutureOrCallClosureTargetPolymorphic -67% > > AOT, x64: > AsyncLiveVars.* +55-61% (bigger is better) > Calls.AwaitAsyncCall -47% (less is better) > Calls.AwaitAsyncCallInstanceTargetPolymorphic -46% > Calls.AwaitAsyncCallClosureTargetPolymorphic -47% > Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -46% > Calls.AwaitFutureOrCall -59% > Calls.AwaitFutureOrCallInstanceTargetPolymorphic -59% > Calls.AwaitFutureOrCallClosureTargetPolymorphic -58% > > AOT, arm: > AsyncLiveVars.* 54-66% (bigger is better) > Calls.AwaitAsyncCall -46-51% (less is better) > Calls.AwaitAsyncCallInstanceTargetPolymorphic -46-50% > Calls.AwaitAsyncCallClosureTargetPolymorphic -46-52% > Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -45-50% > Calls.AwaitFutureOrCall -63-68% > Calls.AwaitFutureOrCallInstanceTargetPolymorphic -63-66% > Calls.AwaitFutureOrCallClosureTargetPolymorphic -63-67% > > AOT, arm64: > AsyncLiveVars.* +53-66% (bigger is better) > Calls.AwaitAsyncCall -50-51% (less is better) > Calls.AwaitAsyncCallInstanceTargetPolymorphic -50% > Calls.AwaitAsyncCallClosureTargetPolymorphic -50-51% > Calls.AwaitFutureOrCallInstanceTargetPolymorphicManyAwaits -49-50% > Calls.AwaitFutureOrCall -66-68% > Calls.AwaitFutureOrCallInstanceTargetPolymorphic -66-68% > Calls.AwaitFutureOrCallClosureTargetPolymorphic -63-67% > > TEST=ci > Issue: https://github.com/dart-lang/sdk/issues/48378 > > Change-Id: I65e3702fcd816ee3fee876ff442b9887c035b1ec > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243102 > Reviewed-by: Lasse Nielsen <lrn@google.com> > Commit-Queue: Alexander Markov <alexmarkov@google.com> Change-Id: I245984ace1c768fdcba58dfdd6aa46e52126be4e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/248442 Commit-Queue: Alexander Markov <alexmarkov@google.com> Reviewed-by: Lasse Nielsen <lrn@google.com> Reviewed-by: Slava Egorov <vegorov@google.com>
Dart is:
Optimized for UI: Develop with a programming language specialized around the needs of user interface creation.
Productive: Make changes iteratively: use hot reload to see the result instantly in your running app.
Fast on all platforms: Compile to ARM & x64 machine code for mobile, desktop, and backend. Or compile to JavaScript for the web.
Dart's flexible compiler technology lets you run Dart code in different ways, depending on your target platform and goals:
Dart Native: For programs targeting devices (mobile, desktop, server, and more), Dart Native includes both a Dart VM with JIT (just-in-time) compilation and an AOT (ahead-of-time) compiler for producing machine code.
Dart Web: For programs targeting the web, Dart Web includes both a development time compiler (dartdevc) and a production time compiler (dart2js).
Dart is free and open source.
See LICENSE and PATENT_GRANT.
Visit dart.dev to learn more about the language, tools, and to find codelabs.
Browse pub.dev for more packages and libraries contributed by the community and the Dart team.
Our API reference documentation is published at api.dart.dev, based on the stable release. (We also publish docs from our beta and dev channels, as well as from the primary development branch).
If you want to build Dart yourself, here is a guide to getting the source, preparing your machine to build the SDK, and building.
There are more documents on our wiki.
The easiest way to contribute to Dart is to file issues.
You can also contribute patches, as described in Contributing.