commit | 787446213c72b18dc016bc98018bb90335c6a215 | [log] [tgz] |
---|---|---|
author | Tess Strickland <sstrickl@google.com> | Mon Aug 17 08:58:08 2020 +0000 |
committer | commit-bot@chromium.org <commit-bot@chromium.org> | Mon Aug 17 08:58:08 2020 +0000 |
tree | e1af499e9021f3947de37a191ff3d3f48831fb7a | |
parent | 07a440901e874d026e92e2774c69e37292a5217f [diff] |
[vm/compiler] Move argument shape (not type) checks out of closures. This CL performs the following checks in the invoke field dispatcher for dynamic closure calls when lazy dispatchers are enabled: * The provided function type arguments vector (if any) has the correct length. * No function type arguments should be provided if the closure has delayed type arguments. * All required arguments (positional in all modes, named in appropriate null safety modes) have been provided by the caller. * If there are optional positional arguments, an appropriate number has been provided. * If there are optional named arguments, their names are valid. Since the runtime already handles checking the argument shapes when lazy dispatchers are disabled, these checks are now completely removed from closure bodies in all cases. Thus, the only remaining checks in closure bodies are the type checks performed by AssertSubtype and AssertAssignable when lazy dispatchers are enabled. Changes in the Flutter Gallery: * ARM7, release: -3.61% instructions, -2.19% total * ARM7, sizeopt: -3.62% instructions, -2.55% total * ARM8, release: -3.66% instructions, -1.98% total * ARM8, sizeopt: -3.65% instructions, -2.37% total Most of these changes are already exercised by existing tests such as (but not limited to): * corelib{,_2}/dynamic_nosuchmethod_test * language{,_2}/call/call_test * language{,_2}/closure/tearoff_dynamic_test * language{,_2}/generic/function_bounds_test * language{,_2}/parameter/named_with_conversions_test * language{,_2}/vm/no_such_args_error_message_vm_test I've added one test to specifically check the interaction between dynamic calls and required named parameters. There is some coverage in other NNBD tests, but those are not directly focused on testing this specifically. Other changes: * Adds initial cached ranges for certain BinarySmiOp and ShiftIntegerOp instructions when the RHS is a constant, to avoid false negatives for deoptimization and throw checks prior to range analysis. * Adds new slots for various Function fields. * Adds the ability to define unboxed native slots, which are always unboxed after retrieval even in unoptimized code. In the first iteration, the backend only handles loads from Uint32 unboxed native slots. Part of https://github.com/dart-lang/sdk/issues/42793. * Removed the special handling for loading from non-nullable int fields in AOT compilation. Instead, their treatment is unified with the treatment of the new unboxed native fields, since the source field is always unboxed and the result of the load is also always unboxed, as code involving them is always optimized. Bug: https://github.com/dart-lang/sdk/issues/40813 Change-Id: Ia02aa3e872c1fefd906fd67b55021ea1797556e4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155604 Commit-Queue: Tess Strickland <sstrickl@google.com> Reviewed-by: Alexander Markov <alexmarkov@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, getting started, and more.
Browse pub.dev for more packages and libraries contributed by the community and the Dart team.
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.